You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 23:13:29 UTC

[01/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 ee9613b65 -> 2025f359c


Fixed CLOUDSTACK-6648

vm_ha cases were failing because of improper zone
and test data passed. Fixed them now.

Signed-off-by: santhosh <sa...@gmail.com>
Signed-off-by: Koushik Das <ko...@apache.org>
(cherry picked from commit 900415b1d847ab4f2ccca75452adc1db009bb261)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0e188e7b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0e188e7b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0e188e7b

Branch: refs/heads/4.4
Commit: 0e188e7bec8ecc6feed5e12ab6367b6d81b43a89
Parents: 2ed6b9d
Author: santhosh <sa...@gmail.com>
Authored: Tue May 13 15:12:14 2014 +1000
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:39 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_vm_ha.py    | 45 ++++------------------------
 tools/marvin/marvin/config/test_data.py | 21 +++++++++----
 2 files changed, 21 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e188e7b/test/integration/smoke/test_vm_ha.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_ha.py b/test/integration/smoke/test_vm_ha.py
index e5d9666..1fc6960 100644
--- a/test/integration/smoke/test_vm_ha.py
+++ b/test/integration/smoke/test_vm_ha.py
@@ -35,51 +35,18 @@ from marvin.lib.common import get_zone, get_domain, get_template
 
 from nose.plugins.attrib import attr
 
-class TestData(object):
-    """Test data object that is required to create resources
-    """
-    def __init__(self):
-        self.testdata = {
-            #data to create an account
-            "account": {
-                "email": "test@test.com",
-                "firstname": "Test",
-                "lastname": "User",
-                "username": "test",
-                "password": "password",
-            },
-            #data reqd for virtual machine creation
-            "virtual_machine" : {
-                "name" : "testvm",
-                "displayname" : "Test VM",
-            },
-            #small service offering
-            "service_offering": {
-                "hasmall": {
-                    "name": "HA Small Instance",
-                    "displaytext": "HA Small Instance",
-                    "cpunumber": 1,
-                    "cpuspeed": 100,
-                    "memory": 256,
-                    "hosttags": "ha",                    
-                    "offerha": True,
-                },
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-        }
-
-
 class TestDeployVMHA(cloudstackTestCase):
     """Test VM HA
     """
 
     def setUp(self):
-        self.testdata = TestData().testdata
+        self.testdata = self.testClient.getParsedTestDataConfig()
         self.apiclient = self.testClient.getApiClient()
 
         # Get Zone, Domain and Default Built-in template
-        self.domain = get_domain(self.apiclient, self.testdata)
-        self.zone = get_zone(self.apiclient, self.testdata)
+        self.domain = get_domain(self.apiclient)
+        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+
         self.testdata["mode"] = self.zone.networktype
         self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
 
@@ -95,7 +62,7 @@ class TestDeployVMHA(cloudstackTestCase):
         self.assertTrue(isinstance(self.hosts, list) and len(self.hosts) >= 2, msg = "Atleast 2 hosts required in cluster for VM HA test")
         #update host tags
         for host in self.hosts:
-            Host.update(self.apiclient, id=host.id, hosttags=self.testdata["service_offering"]["hasmall"]["hosttags"])
+            Host.update(self.apiclient, id=host.id, hosttags=self.testdata["service_offerings"]["hasmall"]["hosttags"])
 
         #create a user account
         self.account = Account.create(
@@ -106,7 +73,7 @@ class TestDeployVMHA(cloudstackTestCase):
         #create a service offering
         self.service_offering = ServiceOffering.create(
             self.apiclient,
-            self.testdata["service_offering"]["hasmall"]
+            self.testdata["service_offerings"]["hasmall"]
         )
         #deploy ha vm
         self.virtual_machine = VirtualMachine.create(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0e188e7b/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 927a35c..9df3f2f 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -109,7 +109,16 @@ test_data = {
             "cpunumber": 1,
             "cpuspeed": 100,
             "memory": 512,
-        }
+        },
+        "hasmall": {
+            "name": "HA Small Instance",
+                    "displaytext": "HA Small Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,
+                    "memory": 256,
+                    "hosttags": "ha",
+                    "offerha": True,
+        },
     },
     "disk_offering": {
         "name": "Disk offering",
@@ -278,14 +287,14 @@ test_data = {
         }
     },
     "shared_network_offering_all_services": {
-            "name":"shaared network offering with services enabled",
+            "name": "shaared network offering with services enabled",
             "displaytext": "Shard network offering",
             "guestiptype": "Shared",
             "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
-            "specifyVlan" : "False",
-            "specifyIpRanges" : "False",
+            "specifyVlan": "False",
+            "specifyIpRanges": "False",
             "traffictype": "GUEST",
-            "serviceProviderList" : {
+            "serviceProviderList": {
                 "Dhcp": "VirtualRouter",
                 "Dns": "VirtualRouter",
                 "UserData": "VirtualRouter",
@@ -531,7 +540,7 @@ test_data = {
             "Lb": "VirtualRouter",
             "UserData": "VirtualRouter",
             "StaticNat": "VirtualRouter"
-            }
+        }
     },
     "fwrule": {
         "startport": 22,


[46/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7137: Resolving cleanup issue in test_escalations_securitygroups.py

(cherry picked from commit 8d8190ea4e00edb0f7ce9665535adcc7a5b5097d)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1ca9abd6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1ca9abd6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1ca9abd6

Branch: refs/heads/4.4
Commit: 1ca9abd6dc8013dd1dc4e4f9ca1eabb71785cc37
Parents: f055ec5
Author: Ashutosh K <as...@clogeny.com>
Authored: Mon Jul 21 03:15:07 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:57 2014 +0200

----------------------------------------------------------------------
 .../test_escalations_securitygroups.py          | 38 ++++----------------
 1 file changed, 7 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1ca9abd6/test/integration/component/test_escalations_securitygroups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_securitygroups.py b/test/integration/component/test_escalations_securitygroups.py
index 8934088..076477e 100644
--- a/test/integration/component/test_escalations_securitygroups.py
+++ b/test/integration/component/test_escalations_securitygroups.py
@@ -17,40 +17,15 @@
 
 #Import Local Modules
 from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor,
-                             VpcOffering,
-                             VPC,
-                             NetworkACL)
+from marvin.lib.base import (SecurityGroup,
+                             Account)
 from marvin.lib.common import (get_zone,
                                get_domain,
-                               get_template,
-                               list_os_types)
+                               get_template)
 from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+                              cleanup_resources)
+from marvin.codes import (PASS, EMPTY_LIST)
 from nose.plugins.attrib import attr
-import time
 
 class TestSecurityGroups(cloudstackTestCase):
 
@@ -245,6 +220,7 @@ class TestSecurityGroups(cloudstackTestCase):
         SecurityGroup.delete(
                              securitygroup_created,
                              self.userapiclient)
+        self.cleanup.remove(securitygroup_created)
         # Listing all the security groups in page 2 again
         list_securitygroups_page2 = SecurityGroup.list(
                                                        self.userapiclient,
@@ -585,4 +561,4 @@ class TestSecurityGroups(cloudstackTestCase):
                           status[2],
                           "Security Groups Egress rule is not revoked"
                           )
-        return
\ No newline at end of file
+        return


[43/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
Added a simulator based test for VM sync

(cherry picked from commit a83212afdc5558582d2aa60727bb28648472d95d)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e1cfd8de
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e1cfd8de
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e1cfd8de

Branch: refs/heads/4.4
Commit: e1cfd8dedf03a7b10ad4dd5246e6dcded444cef3
Parents: 999daec
Author: Koushik Das <ko...@apache.org>
Authored: Mon Jul 7 12:53:05 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:55 2014 +0200

----------------------------------------------------------------------
 .../api/commands/ConfigureSimulatorCmd.java     |   5 +-
 .../cloud/simulator/MockConfigurationVO.java    |   2 +-
 test/integration/smoke/test_vm_sync.py          | 151 +++++++++++++++++++
 tools/marvin/marvin/config/test_data.py         |  22 ++-
 tools/marvin/marvin/lib/base.py                 |   4 +-
 5 files changed, 173 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1cfd8de/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
index 9498a93..b891c6c 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
@@ -69,12 +69,15 @@ public class ConfigureSimulatorCmd extends BaseCmd {
     @Parameter(name=ApiConstants.COUNT, type=CommandType.INTEGER, description="number of times the mock is active")
     private Integer count;
 
-    @Parameter(name="jsonresponse", type=CommandType.STRING, description="agent command response to be returned")
+    @Parameter(name="jsonresponse", type=CommandType.STRING, description="agent command response to be returned", length=4096)
     private String jsonResponse;
 
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
         ResourceAllocationException {
+        if (hostId != null && jsonResponse != null) {
+            jsonResponse = jsonResponse.replace("\"hostId\":0", "\"hostId\":" + hostId);
+        }
         Long id = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command, values, count, jsonResponse);
         if (id == null) {
             throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure simulator");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1cfd8de/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
index 1beff76..6edec12 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java
@@ -60,7 +60,7 @@ public class MockConfigurationVO implements InternalIdentity {
     @Column(name="count")
     private Integer count;
 
-    @Column(name="json_response")
+    @Column(name="json_response", length=4096)
     private String jsonResponse;
 
     @Column(name="removed")

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1cfd8de/test/integration/smoke/test_vm_sync.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_sync.py b/test/integration/smoke/test_vm_sync.py
new file mode 100644
index 0000000..6d56945
--- /dev/null
+++ b/test/integration/smoke/test_vm_sync.py
@@ -0,0 +1,151 @@
+# 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.
+
+#Test from the Marvin - Testing in Python wiki
+
+import time
+
+#All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase
+
+#Import Integration Libraries
+
+#base - contains all resources as entities and defines create, delete, list operations on them
+from marvin.lib.base import Account, VirtualMachine, Cluster, Host, ServiceOffering, Configurations, SimulatorMock
+
+#utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources
+
+#common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, get_template
+
+from nose.plugins.attrib import attr
+
+class TestDeployVMSync(cloudstackTestCase):
+    """Test VM Sync
+    """
+
+    def setUp(self):
+        self.testdata = self.testClient.getParsedTestDataConfig()
+        self.apiclient = self.testClient.getApiClient()
+
+        # Get Zone, Domain and Default Built-in template
+        self.domain = get_domain(self.apiclient)
+        self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+
+        self.testdata["mode"] = self.zone.networktype
+        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+
+        hosts = Host.list(self.apiclient, type='Routing')
+        self.assertTrue(isinstance(hosts, list) and len(hosts) > 0, msg = "No hosts found")
+        self.host = hosts[0]
+        #update host tags
+        Host.update(self.apiclient, id=self.host.id, hosttags=self.testdata["service_offerings"]["taggedsmall"]["hosttags"])
+
+        #create a user account
+        self.account = Account.create(
+            self.apiclient,
+            self.testdata["account"],
+            domainid=self.domain.id
+        )
+        #create a service offering
+        self.service_offering = ServiceOffering.create(
+            self.apiclient,
+            self.testdata["service_offerings"]["taggedsmall"]
+        )
+        #deploy vms
+        self.vm1 = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["small"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id
+        )
+        self.vm2 = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["small"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id
+        )
+        self.vm3 = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["small"],
+            accountid=self.account.name,
+            zoneid=self.zone.id,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id
+        )
+        list_vms = VirtualMachine.list(self.apiclient, ids=[self.vm1.id, self.vm2.id, self.vm3.id], listAll=True)
+        self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 3, msg = "List VM response is empty")
+        clusters = Cluster.list(self.apiclient, id=self.host.clusterid)
+        self.assertTrue(isinstance(clusters, list) and len(clusters) > 0, msg = "Cluster not found")
+
+        json_response = '{"com.cloud.agent.api.PingRoutingWithNwGroupsCommand":{"newGroupStates":{},"newStates":{},"_hostVmStateReport":{"%s":{"state":"PowerOn","host":"%s"},"%s":{"state":"PowerOff","host":"%s"}},"_gatewayAccessible":true,"_vnetAccessible":true,"hostType":"Routing","hostId":0,"contextMap":{},"wait":0}}'
+        json_response = json_response%(self.vm1.instancename, self.host.name, self.vm2.instancename, self.host.name)
+
+        #create a mock to simulate vm1 as power-on, vm2 as power-off and vm3 as missing
+        self.mock_ping = SimulatorMock.create(
+            apiclient=self.apiclient,
+            command="PingRoutingWithNwGroupsCommand",
+            zoneid=self.zone.id,
+            podid=clusters[0].podid,
+            clusterid=clusters[0].id,
+            hostid=self.host.id,
+            value='',
+            jsonresponse=json_response,
+            method='POST')
+
+        #build cleanup list
+        self.cleanup = [
+            self.service_offering,
+            self.account,
+            self.mock_ping
+        ]
+
+    @attr(tags = ['advanced'], required_hardware="false", BugId="CLOUDSTACK-6873")
+    def test_vm_sync(self):
+        """Test VM Sync
+
+        # Validate the following:
+        # vm1 should be running, vm2 should be stopped as power report says PowerOff, vm3 should be stopped as missing from power report
+        """
+
+        #wait for vmsync to happen
+        ping_interval = Configurations.list(self.apiclient, name="ping.interval")
+        total_duration = int(float(ping_interval[0].value) * 3.2)
+        time.sleep(total_duration)
+
+        list_vms = VirtualMachine.list(self.apiclient, ids=[self.vm1.id, self.vm2.id, self.vm3.id], listAll=True)
+        self.assertTrue(isinstance(list_vms, list) and len(list_vms) == 3, msg = "List VM response is empty")
+        for vm in list_vms:        
+            if vm.id == self.vm1.id:
+                self.assertTrue(vm.state == "Running", msg = "VM {0} is expected to be in running state".format(vm.name))
+            elif vm.id == self.vm2.id or vm.id == self.vm3.id:
+                self.assertTrue(vm.state == "Stopped", msg = "VM {0} is expected to be in stopped state".format(vm.name))
+
+    def tearDown(self):
+        try:
+            Host.update(self.apiclient, id=self.host.id, hosttags="")
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            self.debug("Warning! Exception in tearDown: %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1cfd8de/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 61c1338..3cd4b6c 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -91,7 +91,7 @@ test_data = {
         "memory": 128,
 
         "tiny": {
-                "name": "Tiny Instance",
+            "name": "Tiny Instance",
             "displaytext": "Tiny Instance",
             "cpunumber": 1,
             "cpuspeed": 100,
@@ -120,12 +120,20 @@ test_data = {
         },
         "hasmall": {
             "name": "HA Small Instance",
-                    "displaytext": "HA Small Instance",
-                    "cpunumber": 1,
-                    "cpuspeed": 100,
-                    "memory": 256,
-                    "hosttags": "ha",
-                    "offerha": True,
+            "displaytext": "HA Small Instance",
+            "cpunumber": 1,
+            "cpuspeed": 100,
+            "memory": 256,
+            "hosttags": "ha",
+            "offerha": True,
+        },
+        "taggedsmall": {
+            "name": "Tagged Small Instance",
+            "displaytext": "Tagged Small Instance",
+            "cpunumber": 1,
+            "cpuspeed": 100,
+            "memory": 256,
+            "hosttags": "vmsync",
         },
     },
     "disk_offering": {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1cfd8de/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index b216bca..ff75176 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -4656,7 +4656,7 @@ class SimulatorMock:
     @classmethod
     def create(cls, apiclient, command, zoneid=None, podid=None,
                clusterid=None, hostid=None, value="result:fail",
-               count=None, jsonresponse=None):
+               count=None, jsonresponse=None, method="GET"):
         """Creates simulator mock"""
 
         cmd = configureSimulator.configureSimulatorCmd()
@@ -4669,7 +4669,7 @@ class SimulatorMock:
         cmd.count = count
         cmd.jsonresponse = jsonresponse
         try:
-            simulatormock = apiclient.configureSimulator(cmd)
+            simulatormock = apiclient.configureSimulator(cmd, method=method)
             if simulatormock is not None:
                 return SimulatorMock(simulatormock.__dict__)
         except Exception as e:


[22/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6282: Modified IPAddress tests to fix the failures. Modified Instances, snapshots, templates tests to handle KVM Hypervisor

(cherry picked from commit 89c35abb4db0f362f9159ea39a6eb70ad4351921)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/63feb451
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/63feb451
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/63feb451

Branch: refs/heads/4.4
Commit: 63feb4519abb275210110102de5d20237bbac4c2
Parents: b518d61
Author: VinayV <vi...@citrix.com>
Authored: Thu Jun 12 14:49:35 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:47 2014 +0200

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     |  122 +-
 .../component/test_escalations_ipaddresses.py   | 1886 +++++++++---------
 .../component/test_escalations_snapshots.py     |   60 +-
 .../component/test_escalations_templates.py     |   97 +-
 tools/marvin/marvin/config/test_data.py         |    7 +
 tools/marvin/marvin/lib/base.py                 |    2 +-
 6 files changed, 1116 insertions(+), 1058 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63feb451/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 9e040db..4900ff6 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -15,52 +15,30 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor,
-                             VpcOffering,
-                             VPC,
-                             NetworkACL)
-from marvin.lib.common import (get_zone,
-                               get_domain,
-                               get_template,
-                               list_os_types)
-from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
 from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
 
 class TestListInstances(cloudstackTestCase):
 
     @classmethod
     def setUpClass(cls):
         try:
-            cls._cleanup = []        
+            cls._cleanup = []
             cls.testClient = super(TestListInstances, cls).getClsTestClient()
             cls.api_client = cls.testClient.getApiClient()
             cls.services = cls.testClient.getParsedTestDataConfig()
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
             cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -101,7 +79,7 @@ class TestListInstances(cloudstackTestCase):
             cls.user = cls.account.user[0]
             cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
             # Updating resource Limits
-            for i in range(0,12):
+            for i in range(0, 12):
                 Resources.updateLimit(
                                       cls.api_client,
                                       account=cls.account.name,
@@ -124,7 +102,7 @@ class TestListInstances(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created resources
+        # Clean up, terminate the created resources
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -194,7 +172,7 @@ class TestListInstances(cloudstackTestCase):
                           list_instances_before,
                           "Virtual Machine already exists for newly created user"
                           )
-        # If number of instances are less than (pagesize + 1), then creating them    
+        # If number of instances are less than (pagesize + 1), then creating them
         for i in range(0, (self.services["pagesize"] + 1)):
             vm_created = VirtualMachine.create(
                                                self.userapiclient,
@@ -216,7 +194,7 @@ class TestListInstances(cloudstackTestCase):
                              "Newly created VM name and the test data VM name are not matching"
                              )
 
-        # Listing all the instances again after creating VM's        
+        # Listing all the instances again after creating VM's
         list_instances_after = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
         status = validateList(list_instances_after)
         self.assertEquals(
@@ -301,7 +279,7 @@ class TestListInstances(cloudstackTestCase):
                         "VM was not deleted"
                         )
         return
- 
+
     @attr(tags=["advanced", "basic", "selfservice"])
     def test_02_list_Running_vm(self):
         """  
@@ -363,7 +341,7 @@ class TestListInstances(cloudstackTestCase):
                           )
         running_vm = list_running_vms_after[0]
 
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -456,7 +434,7 @@ class TestListInstances(cloudstackTestCase):
                           "Stopped VM list count is not matching"
                           )
         stopped_vm = list_stopped_vms_after[0]
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -564,7 +542,7 @@ class TestListInstances(cloudstackTestCase):
                           "Destroyed VM list count is not matching"
                           )
         destroyed_vm = list_destroyed_vms_admin[0]
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -666,7 +644,7 @@ class TestListInstances(cloudstackTestCase):
                           "Listing of VM by Id failed"
                           )
         listed_vm = list_vm_byid[0]
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -782,7 +760,7 @@ class TestListInstances(cloudstackTestCase):
                           "VM list by full name count is not matching"
                           )
         # Verifying that the details of the listed VM are same as the VM created above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vms[0].id,
                          "name":vms[0].name,
@@ -916,7 +894,7 @@ class TestListInstances(cloudstackTestCase):
                           "Count of VM list by name and state is not matching"
                           )
         # Verifying that the details of the listed VM are same as the VM created above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -1068,7 +1046,7 @@ class TestListInstances(cloudstackTestCase):
                               )
             listed_vm = list_vms_after[0]
             # Verifying that the details of the Listed VM are same as the VM deployed above
-            #Creating expected and actual values dictionaries
+            # Creating expected and actual values dictionaries
             expected_dict = {
                                "id":vm_created.id,
                                "name":vm_created.name,
@@ -1235,7 +1213,7 @@ class TestListInstances(cloudstackTestCase):
                               )
             listed_vm = list_vms[0]
             # Verifying that the details of the Listed VM are same as the VM deployed above
-            #Creating expected and actual values dictionaries
+            # Creating expected and actual values dictionaries
             expected_dict = {
                              "id":vm_created.id,
                              "name":vm_created.name,
@@ -1388,7 +1366,7 @@ class TestListInstances(cloudstackTestCase):
                           )
         listed_vm = list_vms[0]
         # Verifying that the details of the Listed VM are same as the VM deployed above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -1456,7 +1434,7 @@ class TestListInstances(cloudstackTestCase):
                           )
         listed_vm = list_vms[0]
         # Verifying that the details of the Listed VM are same as the VM deployed above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":vm_created.id,
                          "name":vm_created.name,
@@ -1899,7 +1877,7 @@ class TestInstances(cloudstackTestCase):
             cls.testClient = super(TestInstances, cls).getClsTestClient()
             cls.api_client = cls.testClient.getApiClient()
             cls.services = cls.testClient.getParsedTestDataConfig()
-
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
             cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -1941,7 +1919,7 @@ class TestInstances(cloudstackTestCase):
             cls.user = cls.account.user[0]
             cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
             # Updating resource Limits
-            for i in range(0,12):
+            for i in range(0, 12):
                 Resources.updateLimit(
                                       cls.api_client,
                                       account=cls.account.name,
@@ -1963,7 +1941,7 @@ class TestInstances(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created resources
+        # Clean up, terminate the created resources
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -2024,6 +2002,8 @@ class TestInstances(cloudstackTestCase):
         Step10: Detaching the ISO attached in step8
         Step11: Verifying that detached ISO details are not associated with VM
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
                                               self.userapiclient,
@@ -2154,6 +2134,8 @@ class TestInstances(cloudstackTestCase):
         Step12: Listing all the VM snapshots in Page 2 with page size
         Step13: Verifying that size of the list is 0
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
                                               self.userapiclient,
@@ -2309,6 +2291,8 @@ class TestInstances(cloudstackTestCase):
         Step10: Verifying that only 1 VM snapshot is having current flag set as true.
         Step11: Verifying that the VM Snapshot with current flag set to true is the reverted snapshot in Step 8
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
         # Listing all the VM's for a User
         list_vms_before = VirtualMachine.list(
                                               self.userapiclient,
@@ -2624,6 +2608,32 @@ class TestInstances(cloudstackTestCase):
                           list_volumes_page2,
                           "Volumes listed in page 2"
                           )
+        # Listing all the volumes for a VM again in page 1
+        list_volumes_page1 = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         virtualmachineid=vm_created.id,
+                                         page=1,
+                                         pagesize=self.services["pagesize"]
+                                         )
+        status = validateList(list_volumes_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Volumes not listed in page1"
+                          )
+        # Verifying that list size is equal to page size
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_volumes_page1),
+                          "VM's volume count is not matching in page 1"
+                          )
+        # Detaching all the volumes attached from VM
+        for i in range(0, len(list_volumes_page1)):
+            vm_created.detach_volume(
+                                     self.userapiclient,
+                                     list_volumes_page1[i]
+                                     )
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -2641,6 +2651,8 @@ class TestInstances(cloudstackTestCase):
         Step5: Perform change service (scale up) the Running VM deployed in step1
         Step6: Verifying that VM's service offerings is changed
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("ScaleVM is not supported on KVM. Hence, skipping the test")
         # Checking if Dynamic scaling of VM is supported or not
         list_config = Configurations.list(
                                           self.apiClient,
@@ -3445,4 +3457,4 @@ class TestInstances(cloudstackTestCase):
                           vm_securitygroups_flag,
                           "Security Groups in VM are not same as created"
                           )
-        return
\ No newline at end of file
+        return


[32/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6914: Disabling few failing BVTs

(cherry picked from commit c7d00d52b2b7e375008f3fabbd1ec96c1e6e7238)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1430a6c5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1430a6c5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1430a6c5

Branch: refs/heads/4.4
Commit: 1430a6c5c3e739bbe02b7d9636ff909e75b41907
Parents: aca8ae0
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Tue Jun 24 13:11:42 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:51 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_deploy_vm_root_resize.py | 2 +-
 test/integration/smoke/test_network.py               | 2 +-
 test/integration/smoke/test_vm_life_cycle.py         | 4 ++--
 test/integration/smoke/test_volumes.py               | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1430a6c5/test/integration/smoke/test_deploy_vm_root_resize.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index 0f0ddcc..269b321 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -233,7 +233,7 @@ class TestDeployVM(cloudstackTestCase):
         else:
             self.debug("test 01 does not support hypervisor type " + self.hypervisor);
 
-    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true")
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true", BugId="CLOUDSTACK-6985")
     def test_02_deploy_vm_root_resize(self):
         """Test proper failure to deploy virtual machine with rootdisksize less than template size
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1430a6c5/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index cfe9c18..0ae777e 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -773,7 +773,7 @@ class TestReleaseIP(cloudstackTestCase):
     def tearDown(self):
         cleanup_resources(self.apiclient, self.cleanup)
 
-    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false", BugId="CLOUDSTACK-6984")
     def test_releaseIP(self):
         """Test for release public IP address"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1430a6c5/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index ce7cac7..9ab7848 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -304,7 +304,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false", BugId="CLOUDSTACK-6984")
     def test_01_stop_vm(self):
         """Test Stop Virtual Machine
         """
@@ -593,7 +593,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         self.assertEqual(list_vm_response,None,"Check Expunged virtual machine is in listVirtualMachines response")
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true", BugId="CLOUDSTACK-6985")
     def test_10_attachAndDetach_iso(self):
         """Test for attach and detach ISO to virtual machine"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1430a6c5/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 79cc5b2..238cb5f 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -596,7 +596,7 @@ class TestVolumes(cloudstackTestCase):
         return 
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true", BugId="CLOUDSTACK-6985")
     def test_08_resize_volume(self):
         """Test resize a volume"""
         # Verify the size is the new size is what we wanted it to be.


[45/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7020:Fixed test script issue

(cherry picked from commit b7d445873c36d523571896ea1c51a49f65024445)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/01e78330
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/01e78330
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/01e78330

Branch: refs/heads/4.4
Commit: 01e783301711199efa3fd7dfbdfa453e8f564473
Parents: 2ca71f4
Author: Ashutosh K <as...@clogeny.com>
Authored: Wed Jul 16 22:08:29 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:56 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_usage.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01e78330/test/integration/component/test_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py
index b10f14d..fe80da7 100644
--- a/test/integration/component/test_usage.py
+++ b/test/integration/component/test_usage.py
@@ -661,6 +661,7 @@ class TestTemplateUsage(cloudstackTestCase):
                             cls.services["ostype"]
                             )
         cls.services["server"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
         try:
             cls.account = Account.create(
                             cls.api_client,


[35/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
Re-enabling fixed test case test_primary_storage.py

(cherry picked from commit 5749abc23af90f6563d42647044031e7428b9eed)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8e374c5d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8e374c5d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8e374c5d

Branch: refs/heads/4.4
Commit: 8e374c5d6f06eebdea47cedbd401e8484988f63b
Parents: be87c5c
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Wed Jun 25 18:05:26 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:52 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_primary_storage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e374c5d/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index f5a666e..0312ad6 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -51,7 +51,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], BugId="CLOUDSTACK-6770", required_hardware="false")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_01_primary_storage_nfs(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """
@@ -144,7 +144,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             return
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], BugId="CLOUDSTACK-6770", required_hardware="false")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_01_primary_storage_iscsi(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """


[31/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6984: Resolving simulator issues

(cherry picked from commit 8de18f144c680287c762a4b5db1b6e1d596f5723)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c98064b9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c98064b9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c98064b9

Branch: refs/heads/4.4
Commit: c98064b98dc17981a77246bf0019b92a499fb210
Parents: 1430a6c
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Jun 24 07:28:50 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:51 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_network.py       | 30 ++++++++++++-----------
 test/integration/smoke/test_vm_life_cycle.py |  2 +-
 tools/marvin/marvin/lib/base.py              |  2 +-
 3 files changed, 18 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c98064b9/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 0ae777e..988a162 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -744,7 +744,8 @@ class TestReleaseIP(cloudstackTestCase):
         ip_addrs = list_publicIP(
                                     self.apiclient,
                                     account=self.account.name,
-                                    domainid=self.account.domainid
+                                    domainid=self.account.domainid,
+                                    issourcenat=False
                                   )
         try:
             self.ip_addr = ip_addrs[0]
@@ -773,7 +774,7 @@ class TestReleaseIP(cloudstackTestCase):
     def tearDown(self):
         cleanup_resources(self.apiclient, self.cleanup)
 
-    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false", BugId="CLOUDSTACK-6984")
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_releaseIP(self):
         """Test for release public IP address"""
 
@@ -781,21 +782,22 @@ class TestReleaseIP(cloudstackTestCase):
 
         self.ip_address.delete(self.apiclient)
 
-        # Sleep to ensure that deleted state is reflected in other calls
-        time.sleep(self.services["sleep"])
+        retriesCount = 10
+        isIpAddressDisassociated = False
 
-        # ListPublicIpAddresses should not list deleted Public IP address
-        list_pub_ip_addr_resp = list_publicIP(
+        while retriesCount > 0:
+            listResponse = 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"
-                   )
+                                    )
+            if listResponse is None:
+                isIpAddressDisassociated = True
+                break
+            retriesCount -= 1
+            time.sleep(60)
+        # End while
+
+        self.assertTrue(isIpAddressDisassociated, "Failed to disassociate IP address")
 
         # ListPortForwardingRules should not list
         # associated rules with Public IP address

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c98064b9/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 9ab7848..e346157 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -304,7 +304,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false", BugId="CLOUDSTACK-6984")
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_01_stop_vm(self):
         """Test Stop Virtual Machine
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c98064b9/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index d45b7cc..1ed8c72 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -592,7 +592,7 @@ class VirtualMachine:
                 validationresult = validateList(vms)
                 if validationresult[0] == FAIL:
                     raise Exception("VM list validation failed: %s" % validationresult[2])
-                elif str(vms[0].state).lower() == str(state).lower():
+                elif str(vms[0].state).lower().decode("string_escape") == str(state).lower():
                     returnValue = [PASS, None]
                     break
             except Exception as e:


[02/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
While listing Public IP listall should always be true

(cherry picked from commit 0c40adfc4a9620ed29604f7aedbde0e1a077a68f)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2ed6b9d4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2ed6b9d4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2ed6b9d4

Branch: refs/heads/4.4
Commit: 2ed6b9d4390978af54649253894659e445222876
Parents: 00d18b7
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri May 9 22:26:51 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:39 2014 +0200

----------------------------------------------------------------------
 tools/marvin/marvin/lib/base.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ed6b9d4/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 424c627..00f49d8 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1405,8 +1405,7 @@ class PublicIPAddress:
 
         cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
         [setattr(cmd, k, v) for k, v in kwargs.items()]
-        if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
-            cmd.listall=True
+        cmd.listall=True
         return(apiclient.listPublicIpAddresses(cmd))
 
 


[08/50] [abbrv] CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_isos.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_isos.py b/test/integration/component/test_escalations_isos.py
new file mode 100644
index 0000000..387a681
--- /dev/null
+++ b/test/integration/component/test_escalations_isos.py
@@ -0,0 +1,783 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (createVolume,
+                                  createTemplate)
+from marvin.lib.base import (Volume,
+                             Iso,
+                             VirtualMachine,
+                             Template,
+                             Snapshot,
+                             SecurityGroup,
+                             Account,
+                             Zone,
+                             Network,
+                             NetworkOffering,
+                             DiskOffering,
+                             ServiceOffering,
+                             VmSnapshot,
+                             SnapshotPolicy,
+                             SSHKeyPair,
+                             Resources,
+                             Configurations,
+                             VpnCustomerGateway,
+                             Hypervisor,
+                             VpcOffering,
+                             VPC,
+                             NetworkACL)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_os_types)
+from marvin.lib.utils import (validateList,
+                              cleanup_resources,
+                              random_gen)
+from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+from nose.plugins.attrib import attr
+import time
+
+class TestIsos(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestIsos, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
+            cls.services['mode'] = cls.zone.networktype
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created resources
+        cleanup_resources(self.apiClient, self.cleanup)
+        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)
+
+        return
+
+    def __verify_values(self, expected_vals, actual_vals):
+        """
+        @Desc: Function to verify expected and actual values
+        @Steps:
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_01_list_isos_pagination(self):
+        """
+        @Desc: Test to List ISO's pagination
+        @steps:
+        Step1: Listing all the ISO's for a user
+        Step2: Verifying that no ISO's are listed
+        Step3: Creating (page size + 1) number of ISO's
+        Step4: Listing all the ISO's again for a user
+        Step5: Verifying that list size is (page size + 1)
+        Step6: Listing all the ISO's in page1
+        Step7: Verifying that list size is (page size)
+        Step8: Listing all the ISO's in page2
+        Step9: Verifying that list size is 1
+        Step10: Listing the ISO's by Id
+        Step11: Verifying if the ISO is downloaded and ready.
+                If yes the continuing
+                If not waiting and checking for iso to be ready till timeout
+        Step12: Deleting the ISO present in page 2
+        Step13: Listing all the ISO's in page2
+        Step14: Verifying that no ISO's are listed
+        """
+        # Listing all the ISO's for a User
+        list_iso_before = Iso.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   isofilter=self.services["templatefilter"]
+                                   )
+        # Verifying that no ISOs are listed
+        self.assertIsNone(
+                          list_iso_before,
+                          "ISOs listed for newly created User"
+                          )
+        self.services["iso"]["zoneid"] = self.zone.id
+        # Creating pagesize + 1 number of ISO's
+        for i in range(0, (self.services["pagesize"] + 1)):
+            iso_created = Iso.create(
+                                     self.userapiclient,
+                                     self.services["iso"]
+                                     )
+            self.assertIsNotNone(
+                                 iso_created,
+                                 "ISO creation failed"
+                                 )
+            if(i < self.services["pagesize"]):
+                self.cleanup.append(iso_created)
+
+        # Listing all the ISO's for a User
+        list_iso_after = Iso.list(
+                                  self.userapiclient,
+                                  listall=self.services["listall"],
+                                  isofilter=self.services["templatefilter"]
+                                  )
+        status = validateList(list_iso_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "ISO's creation failed"
+                          )
+        # Verifying that list size is pagesize + 1
+        self.assertEquals(
+                          self.services["pagesize"] + 1,
+                          len(list_iso_after),
+                          "Failed to create pagesize + 1 number of ISO's"
+                          )
+        # Listing all the ISO's in page 1
+        list_iso_page1 = Iso.list(
+                                  self.userapiclient,
+                                  listall=self.services["listall"],
+                                  isofilter=self.services["templatefilter"],
+                                  page=1,
+                                  pagesize=self.services["pagesize"]
+                                  )
+        status = validateList(list_iso_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list ISO's in page 1"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_iso_page1),
+                          "Size of ISO's in page 1 is not matching"
+                          )
+        # Listing all the Templates in page 2
+        list_iso_page2 = Iso.list(
+                                  self.userapiclient,
+                                  listall=self.services["listall"],
+                                  isofilter=self.services["templatefilter"],
+                                  page=2,
+                                  pagesize=self.services["pagesize"]
+                                  )
+        status = validateList(list_iso_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list ISo's in page 2"
+                          )
+        # Verifying the list size to be equal to 1
+        self.assertEquals(
+                          1,
+                          len(list_iso_page2),
+                          "Size of ISO's in page 2 is not matching"
+                          )
+        # Verifying the state of the ISO to be ready. If not waiting for state to become ready
+        iso_ready = False
+        count = 0
+        while iso_ready is False:
+            list_iso = Iso.list(
+                                self.userapiclient,
+                                listall=self.services["listall"],
+                                isofilter=self.services["templatefilter"],
+                                id=iso_created.id
+                                )
+            status = validateList(list_iso)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list ISO by Id"
+                              )
+            if list_iso[0].isready is True:
+                iso_ready = True
+            elif (str(list_iso[0].status) == "Error"):
+                self.fail("Created ISO is in Errored state")
+                break
+            elif count > 10:
+                self.fail("Timed out before ISO came into ready state")
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                count = count + 1
+
+        # Deleting the ISO present in page 2
+        Iso.delete(
+                   iso_created,
+                   self.userapiclient
+                   )
+        # Listing all the ISO's in page 2 again
+        list_iso_page2 = Iso.list(
+                                  self.userapiclient,
+                                  listall=self.services["listall"],
+                                  isofilter=self.services["templatefilter"],
+                                  page=2,
+                                  pagesize=self.services["pagesize"]
+                                  )
+        # Verifying that there are no ISO's listed
+        self.assertIsNone(
+                          list_iso_page2,
+                          "ISO's not deleted from page 2"
+                          )
+        del self.services["iso"]["zoneid"]
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_02_download_iso(self):
+        """
+        @Desc: Test to Download ISO
+        @steps:
+        Step1: Listing all the ISO's for a user
+        Step2: Verifying that no ISO's are listed
+        Step3: Creating an ISO
+        Step4: Listing all the ISO's again for a user
+        Step5: Verifying that list size is 1
+        Step6: Verifying if the ISO is in ready state.
+                If yes the continuing
+                If not waiting and checking for template to be ready till timeout
+        Step7: Downloading the ISO (Extract)
+        Step8: Verifying the details of downloaded ISO
+        """
+        # Listing all the ISO's for a User
+        list_iso_before = Iso.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   isofilter=self.services["templatefilter"]
+                                   )
+        # Verifying that no ISOs are listed
+        self.assertIsNone(
+                          list_iso_before,
+                          "ISOs listed for newly created User"
+                          )
+        self.services["iso"]["zoneid"] = self.zone.id
+        self.services["iso"]["isextractable"] = True
+        # Creating an ISO's
+        iso_created = Iso.create(
+                                 self.userapiclient,
+                                 self.services["iso"]
+                                 )
+        self.assertIsNotNone(
+                             iso_created,
+                             "ISO creation failed"
+                             )
+        self.cleanup.append(iso_created)
+        # Listing all the ISO's for a User
+        list_iso_after = Iso.list(
+                                  self.userapiclient,
+                                  listall=self.services["listall"],
+                                  isofilter=self.services["templatefilter"]
+                                  )
+        status = validateList(list_iso_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "ISO's creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_iso_after),
+                          "Failed to create an ISO's"
+                          )
+        # Verifying the state of the ISO to be ready. If not waiting for state to become ready
+        iso_ready = False
+        count = 0
+        while iso_ready is False:
+            list_iso = Iso.list(
+                                self.userapiclient,
+                                listall=self.services["listall"],
+                                isofilter=self.services["templatefilter"],
+                                id=iso_created.id
+                                )
+            status = validateList(list_iso)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list ISO by Id"
+                              )
+            if list_iso[0].isready is True:
+                iso_ready = True
+            elif (str(list_iso[0].status) == "Error"):
+                self.fail("Created ISO is in Errored state")
+                break
+            elif count > 10:
+                self.fail("Timed out before ISO came into ready state")
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                count = count + 1
+
+        # Downloading the ISO
+        download_iso = Iso.extract(
+                                   self.userapiclient,
+                                   iso_created.id,
+                                   mode="HTTP_DOWNLOAD",
+                                   zoneid=self.zone.id
+                                   )
+        self.assertIsNotNone(
+                             download_iso,
+                             "Download ISO failed"
+                             )
+         # Verifying the details of downloaded ISO
+        self.assertEquals(
+                          "DOWNLOAD_URL_CREATED",
+                          download_iso.state,
+                          "Download URL not created for ISO"
+                          )
+        self.assertIsNotNone(
+                             download_iso.url,
+                             "Download URL not created for ISO"
+                             )
+        self.assertEquals(
+                          iso_created.id,
+                          download_iso.id,
+                          "Download ISO details are not same as ISO created"
+                          )
+        del self.services["iso"]["zoneid"]
+        del self.services["iso"]["isextractable"]
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_03_edit_iso_details(self):
+        """
+        @Desc: Test to Edit ISO name, displaytext, OSType
+        @steps:
+        Step1: Listing all the ISO's for a user
+        Step2: Verifying that no ISO's are listed
+        Step3: Creating an ISO
+        Step4: Listing all the ISO's again for a user
+        Step5: Verifying that list size is 1
+        Step6: Verifying if the ISO is in ready state.
+                If yes the continuing
+                If not waiting and checking for template to be ready till timeout
+        Step7: Editing the ISO's name, displaytext
+        Step8: Verifying that ISO name and displaytext are edited
+        Step9: Editing the ISO name, displaytext, ostypeid
+        Step10: Verifying that ISO name, displaytext and ostypeid are edited
+        """
+        # Listing all the ISO's for a User
+        list_iso_before = Iso.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   isofilter=self.services["templatefilter"]
+                                   )
+        # Verifying that no ISOs are listed
+        self.assertIsNone(
+                          list_iso_before,
+                          "ISOs listed for newly created User"
+                          )
+        self.services["iso"]["zoneid"] = self.zone.id
+        # Creating an ISO's
+        iso_created = Iso.create(
+                                 self.userapiclient,
+                                 self.services["iso"]
+                                 )
+        self.assertIsNotNone(
+                             iso_created,
+                             "ISO creation failed"
+                             )
+        self.cleanup.append(iso_created)
+        # Listing all the ISO's for a User
+        list_iso_after = Iso.list(
+                                  self.userapiclient,
+                                  listall=self.services["listall"],
+                                  isofilter=self.services["templatefilter"]
+                                  )
+        status = validateList(list_iso_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "ISO's creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_iso_after),
+                          "Failed to create an ISO's"
+                          )
+        # Verifying the state of the ISO to be ready. If not waiting for state to become ready
+        iso_ready = False
+        count = 0
+        while iso_ready is False:
+            list_iso = Iso.list(
+                                self.userapiclient,
+                                listall=self.services["listall"],
+                                isofilter=self.services["templatefilter"],
+                                id=iso_created.id
+                                )
+            status = validateList(list_iso)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list ISO by Id"
+                              )
+            if list_iso[0].isready is True:
+                iso_ready = True
+            elif (str(list_iso[0].status) == "Error"):
+                self.fail("Created ISO is in Errored state")
+                break
+            elif count > 10:
+                self.fail("Timed out before ISO came into ready state")
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                count = count + 1
+
+        # Editing the ISO name, displaytext
+        edited_iso = Iso.update(
+                                iso_created,
+                                self.userapiclient,
+                                name="NewISOName",
+                                displaytext="NewISODisplayText"
+                                )
+        self.assertIsNotNone(
+                             edited_iso,
+                             "Editing ISO failed"
+                             )
+         # Verifying the details of edited template
+        expected_dict = {
+                         "id":iso_created.id,
+                         "name":"NewISOName",
+                         "displaytest":"NewISODisplayText",
+                         "account":iso_created.account,
+                         "domainid":iso_created.domainid,
+                         "isfeatured":iso_created.isfeatured,
+                         "ostypeid":iso_created.ostypeid,
+                         "ispublic":iso_created.ispublic,
+                         }
+        actual_dict = {
+                       "id":edited_iso.id,
+                       "name":edited_iso.name,
+                       "displaytest":edited_iso.displaytext,
+                       "account":edited_iso.account,
+                       "domainid":edited_iso.domainid,
+                       "isfeatured":edited_iso.isfeatured,
+                       "ostypeid":edited_iso.ostypeid,
+                       "ispublic":edited_iso.ispublic,
+                       }
+        edit_iso_status = self.__verify_values(
+                                               expected_dict,
+                                               actual_dict
+                                               )
+        self.assertEqual(
+                         True,
+                         edit_iso_status,
+                         "Edited ISO details are not as expected"
+                         )
+        # Editing the ISO name, displaytext, ostypeid
+        ostype_list = list_os_types(self.userapiclient)
+        status = validateList(ostype_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list OS Types"
+                          )
+        for i in range(0, len(ostype_list)):
+            if ostype_list[i].id != iso_created.ostypeid:
+                newostypeid = ostype_list[i].id
+                break
+
+        edited_iso = Iso.update(
+                                iso_created,
+                                self.userapiclient,
+                                name=iso_created.name,
+                                displaytext=iso_created.displaytext,
+                                ostypeid=newostypeid
+                                )
+        self.assertIsNotNone(
+                             edited_iso,
+                             "Editing ISO failed"
+                             )
+        # Verifying the details of edited template
+        expected_dict = {
+                         "id":iso_created.id,
+                         "name":iso_created.name,
+                         "displaytest":iso_created.displaytext,
+                         "account":iso_created.account,
+                         "domainid":iso_created.domainid,
+                         "isfeatured":iso_created.isfeatured,
+                         "ostypeid":newostypeid,
+                         "ispublic":iso_created.ispublic,
+                         }
+        actual_dict = {
+                       "id":edited_iso.id,
+                       "name":edited_iso.name,
+                       "displaytest":edited_iso.displaytext,
+                       "account":edited_iso.account,
+                       "domainid":edited_iso.domainid,
+                       "isfeatured":edited_iso.isfeatured,
+                       "ostypeid":edited_iso.ostypeid,
+                       "ispublic":edited_iso.ispublic,
+                       }
+        edit_iso_status = self.__verify_values(
+                                               expected_dict,
+                                               actual_dict
+                                               )
+        self.assertEqual(
+                         True,
+                         edit_iso_status,
+                         "Edited ISO details are not as expected"
+                         )
+        del self.services["iso"]["zoneid"]
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_04_copy_iso(self):
+        """
+        @Desc: Test to copy ISO from one zone to another
+        @steps:
+        Step1: Listing Zones available for a user
+        Step2: Verifying if the zones listed are greater than 1.
+               If Yes continuing.
+               If not halting the test.
+        Step3: Listing all the ISO's for a user in zone1
+        Step4: Verifying that no ISO's are listed
+        Step5: Listing all the ISO's for a user in zone2
+        Step6: Verifying that no ISO's are listed
+        Step7: Creating an ISO in zone 1
+        Step8: Listing all the ISO's again for a user in zone1
+        Step9: Verifying that list size is 1
+        Step10: Listing all the ISO's for a user in zone2
+        Step11: Verifying that no ISO's are listed
+        Step12: Copying the ISO created in step7 from zone1 to zone2
+        Step13: Listing all the ISO's for a user in zone2
+        Step14: Verifying that list size is 1
+        Step15: Listing all the ISO's for a user in zone1
+        Step16: Verifying that list size is 1
+        """
+        # Listing Zones available for a user
+        zones_list = Zone.list(
+                               self.userapiclient,
+                               available=True
+                               )
+        status = validateList(zones_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list Zones"
+                          )
+        if not len(zones_list) > 1:
+            self.fail("Enough zones doesnot exists to copy iso")
+        else:
+            # Listing all the ISO's for a User in Zone 1
+            list_isos_zone1 = Iso.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       isofilter=self.services["templatefilter"],
+                                       zoneid=zones_list[0].id
+                                       )
+            # Verifying that no ISO's are listed
+            self.assertIsNone(
+                              list_isos_zone1,
+                              "ISO's listed for newly created User in Zone1"
+                              )
+            # Listing all the ISO's for a User in Zone 2
+            list_isos_zone2 = Iso.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       isofilter=self.services["templatefilter"],
+                                       zoneid=zones_list[1].id
+                                       )
+            # Verifying that no ISO's are listed
+            self.assertIsNone(
+                              list_isos_zone2,
+                              "ISO's listed for newly created User in Zone2"
+                              )
+            self.services["iso"]["zoneid"] = zones_list[0].id
+            # Creating an ISO in Zone 1
+            iso_created = Iso.create(
+                                     self.userapiclient,
+                                     self.services["iso"]
+                                     )
+            self.assertIsNotNone(
+                                 iso_created,
+                                 "ISO creation failed"
+                                 )
+            self.cleanup.append(iso_created)
+            # Listing all the ISO's for a User in Zone 1
+            list_isos_zone1 = Iso.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       isofilter=self.services["templatefilter"],
+                                       zoneid=zones_list[0].id
+                                       )
+            status = validateList(list_isos_zone1)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "ISO creation failed in Zone1"
+                              )
+            # Verifying that list size is 1
+            self.assertEquals(
+                              1,
+                              len(list_isos_zone1),
+                              "Failed to create a Template"
+                              )
+            # Listing all the ISO's for a User in Zone 2
+            list_isos_zone2 = Iso.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       isofilter=self.services["templatefilter"],
+                                       zoneid=zones_list[1].id
+                                       )
+            # Verifying that no ISO's are listed
+            self.assertIsNone(
+                              list_isos_zone2,
+                              "ISO's listed for newly created User in Zone2"
+                              )
+            # Verifying the state of the ISO to be ready. If not waiting for state to become ready
+            iso_ready = False
+            count = 0
+            while iso_ready is False:
+                list_iso = Iso.list(
+                                    self.userapiclient,
+                                    listall=self.services["listall"],
+                                    isofilter=self.services["templatefilter"],
+                                    id=iso_created.id
+                                    )
+                status = validateList(list_iso)
+                self.assertEquals(
+                                  PASS,
+                                  status[0],
+                                  "Failed to list ISO by Id"
+                                  )
+                if list_iso[0].isready is True:
+                    iso_ready = True
+                elif (str(list_iso[0].status) == "Error"):
+                    self.fail("Created ISO is in Errored state")
+                    break
+                elif count > 10:
+                    self.fail("Timed out before ISO came into ready state")
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    count = count + 1
+
+            # Copying the ISO from Zone1 to Zone2
+            copied_iso = Iso.copy(
+                                  self.userapiclient,
+                                  iso_created.id,
+                                  sourcezoneid=iso_created.zoneid,
+                                  destzoneid=zones_list[1].id
+                                  )
+            self.assertIsNotNone(
+                                 copied_iso,
+                                 "Copying ISO from Zone1 to Zone2 failed"
+                                 )
+            # Listing all the ISO's for a User in Zone 1
+            list_isos_zone1 = Iso.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       isofilter=self.services["templatefilter"],
+                                       zoneid=zones_list[0].id
+                                       )
+            status = validateList(list_isos_zone1)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "ISO creation failed in Zone1"
+                              )
+            # Verifying that list size is 1
+            self.assertEquals(
+                              1,
+                              len(list_isos_zone1),
+                              "Failed to create a Template"
+                              )
+            # Listing all the ISO's for a User in Zone 2
+            list_isos_zone2 = Iso.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       isofilter=self.services["templatefilter"],
+                                       zoneid=zones_list[1].id
+                                       )
+            status = validateList(list_isos_zone2)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "ISO failed to copy into Zone2"
+                              )
+            # Verifying that list size is 1
+            self.assertEquals(
+                              1,
+                              len(list_isos_zone2),
+                              "ISO failed to copy into Zone2"
+                              )
+            self.assertNotEquals(
+                                 "Connection refused",
+                                 list_isos_zone2[0].status,
+                                 "Failed to copy ISO"
+                                 )
+            self.assertEquals(
+                              True,
+                              list_isos_zone2[0].isready,
+                              "Failed to copy ISO"
+                              )
+        del self.services["iso"]["zoneid"]
+        return
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_securitygroups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_securitygroups.py b/test/integration/component/test_escalations_securitygroups.py
new file mode 100644
index 0000000..8934088
--- /dev/null
+++ b/test/integration/component/test_escalations_securitygroups.py
@@ -0,0 +1,588 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (createVolume,
+                                  createTemplate)
+from marvin.lib.base import (Volume,
+                             Iso,
+                             VirtualMachine,
+                             Template,
+                             Snapshot,
+                             SecurityGroup,
+                             Account,
+                             Zone,
+                             Network,
+                             NetworkOffering,
+                             DiskOffering,
+                             ServiceOffering,
+                             VmSnapshot,
+                             SnapshotPolicy,
+                             SSHKeyPair,
+                             Resources,
+                             Configurations,
+                             VpnCustomerGateway,
+                             Hypervisor,
+                             VpcOffering,
+                             VPC,
+                             NetworkACL)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_os_types)
+from marvin.lib.utils import (validateList,
+                              cleanup_resources,
+                              random_gen)
+from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+from nose.plugins.attrib import attr
+import time
+
+class TestSecurityGroups(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestSecurityGroups, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            cls.services['mode'] = cls.zone.networktype
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created resources
+        cleanup_resources(self.apiClient, self.cleanup)
+        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)
+
+        return
+
+    def __verify_values(self, expected_vals, actual_vals):
+        """
+        @Desc: Function to verify expected and actual values
+        @Steps:
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["basic", "provisioning"])
+    def test_01_list_securitygroups_pagination(self):
+        """
+        @Desc: Test to List Security Groups pagination
+        @steps:
+        Step1: Listing all the Security Groups for a user
+        Step2: Verifying that list size is 1
+        Step3: Creating (page size) number of Security Groups
+        Step4: Listing all the Security Groups again for a user
+        Step5: Verifying that list size is (page size + 1)
+        Step6: Listing all the Security Groups in page1
+        Step7: Verifying that list size is (page size)
+        Step8: Listing all the Security Groups in page2
+        Step9: Verifying that list size is 1
+        Step10: Deleting the Security Group present in page 2
+        Step11: Listing all the Security Groups in page2
+        Step12: Verifying that no security groups are listed
+        """
+        # Listing all the Security Groups for a User
+        list_securitygroups_before = SecurityGroup.list(
+                                                        self.userapiclient,
+                                                        listall=self.services["listall"]
+                                                        )
+        # Verifying that default security group is created
+        status = validateList(list_securitygroups_before)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Default Security Groups creation failed"
+                          )
+        # Verifying the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_before),
+                          "Count of Security Groups list is not matching"
+                          )
+        # Creating pagesize number of security groups
+        for i in range(0, (self.services["pagesize"])):
+            securitygroup_created = SecurityGroup.create(
+                                                         self.userapiclient,
+                                                         self.services["security_group"],
+                                                         account=self.account.name,
+                                                         domainid=self.domain.id,
+                                                         description=self.services["security_group"]["name"]
+                                                         )
+            self.assertIsNotNone(
+                                 securitygroup_created,
+                                 "Security Group creation failed"
+                                 )
+            if (i < self.services["pagesize"]):
+                self.cleanup.append(securitygroup_created)
+
+        # Listing all the security groups for user again
+        list_securitygroups_after = SecurityGroup.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        status = validateList(list_securitygroups_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Security Groups creation failed"
+                          )
+        # Verifying that list size is pagesize + 1
+        self.assertEquals(
+                          self.services["pagesize"] + 1,
+                          len(list_securitygroups_after),
+                          "Failed to create pagesize + 1 number of Security Groups"
+                          )
+        # Listing all the security groups in page 1
+        list_securitygroups_page1 = SecurityGroup.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"],
+                                                       page=1,
+                                                       pagesize=self.services["pagesize"]
+                                                       )
+        status = validateList(list_securitygroups_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list security groups in page 1"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_securitygroups_page1),
+                          "Size of security groups in page 1 is not matching"
+                          )
+        # Listing all the security groups in page 2
+        list_securitygroups_page2 = SecurityGroup.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"],
+                                                       page=2,
+                                                       pagesize=self.services["pagesize"]
+                                                       )
+        status = validateList(list_securitygroups_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list security groups in page 2"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_page2),
+                          "Size of security groups in page 2 is not matching"
+                          )
+        # Deleting the security group present in page 2
+        SecurityGroup.delete(
+                             securitygroup_created,
+                             self.userapiclient)
+        # Listing all the security groups in page 2 again
+        list_securitygroups_page2 = SecurityGroup.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"],
+                                                       page=2,
+                                                       pagesize=self.services["pagesize"]
+                                                       )
+        # Verifying that there are no security groups listed
+        self.assertIsNone(
+                          list_securitygroups_page2,
+                          "Security Groups not deleted from page 2"
+                          )
+        return
+
+    @attr(tags=["basic", "provisioning"])
+    def test_02_securitygroups_authorize_revoke_ingress(self):
+        """
+        @Desc: Test to Authorize and Revoke Ingress for Security Group
+        @steps:
+        Step1: Listing all the Security Groups for a user
+        Step2: Verifying that list size is 1
+        Step3: Creating a Security Groups
+        Step4: Listing all the Security Groups again for a user
+        Step5: Verifying that list size is 2
+        Step6: Authorizing Ingress for the security group created in step3
+        Step7: Listing the security groups by passing id of security group created in step3
+        Step8: Verifying that list size is 1
+        Step9: Verifying that Ingress is authorized to the security group
+        Step10: Verifying the details of the Ingress rule are as expected
+        Step11: Revoking Ingress for the security group created in step3
+        Step12: Listing the security groups by passing id of security group created in step3
+        Step13: Verifying that list size is 1
+        Step14: Verifying that Ingress is revoked from the security group
+        """
+        # Listing all the Security Groups for a User
+        list_securitygroups_before = SecurityGroup.list(
+                                                        self.userapiclient,
+                                                        listall=self.services["listall"]
+                                                        )
+        # Verifying that default security group is created
+        status = validateList(list_securitygroups_before)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Default Security Groups creation failed"
+                          )
+        # Verifying the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_before),
+                          "Count of Security Groups list is not matching"
+                          )
+        # Creating a security group
+        securitygroup_created = SecurityGroup.create(
+                                                     self.userapiclient,
+                                                     self.services["security_group"],
+                                                     account=self.account.name,
+                                                     domainid=self.domain.id,
+                                                     description=self.services["security_group"]["name"]
+                                                     )
+        self.assertIsNotNone(
+                             securitygroup_created,
+                             "Security Group creation failed"
+                             )
+        self.cleanup.append(securitygroup_created)
+
+        # Listing all the security groups for user again
+        list_securitygroups_after = SecurityGroup.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        status = validateList(list_securitygroups_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Security Groups creation failed"
+                          )
+        # Verifying that list size is 2
+        self.assertEquals(
+                          2,
+                          len(list_securitygroups_after),
+                          "Failed to create Security Group"
+                          )
+        # Authorizing Ingress for the security group created in step3
+        securitygroup_created.authorize(
+                                        self.userapiclient,
+                                        self.services["ingress_rule"],
+                                        self.account.name,
+                                        self.domain.id,
+                                        )
+        # Listing the security group by Id
+        list_securitygroups_byid = SecurityGroup.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      id=securitygroup_created.id,
+                                                      domainid=self.domain.id
+                                                      )
+        # Verifying that security group is listed
+        status = validateList(list_securitygroups_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of Security Groups by id failed"
+                          )
+        # Verifying size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_byid),
+                          "Count of the listing security group by id is not matching"
+                          )
+        securitygroup_ingress = list_securitygroups_byid[0].ingressrule
+        # Validating the Ingress rule
+        status = validateList(securitygroup_ingress)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Security Groups Ingress rule authorization failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(securitygroup_ingress),
+                          "Security Group Ingress rules count is not matching"
+                          )
+        # Verifying the details of the Ingress rule are as expected
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "cidr":self.services["ingress_rule"]["cidrlist"],
+                         "protocol":self.services["ingress_rule"]["protocol"],
+                         "startport":self.services["ingress_rule"]["startport"],
+                         "endport":self.services["ingress_rule"]["endport"],
+                         }
+        actual_dict = {
+                       "cidr":str(securitygroup_ingress[0].cidr),
+                       "protocol":str(securitygroup_ingress[0].protocol.upper()),
+                       "startport":str(securitygroup_ingress[0].startport),
+                       "endport":str(securitygroup_ingress[0].endport),
+                       }
+        ingress_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         ingress_status,
+                         "Listed Security group Ingress rule details are not as expected"
+                         )
+        # Revoking the Ingress rule from Security Group
+        securitygroup_created.revoke(self.userapiclient, securitygroup_ingress[0].ruleid)
+        # Listing the security group by Id
+        list_securitygroups_byid = SecurityGroup.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      id=securitygroup_created.id,
+                                                      domainid=self.domain.id
+                                                      )
+        # Verifying that security group is listed
+        status = validateList(list_securitygroups_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of Security Groups by id failed"
+                          )
+        # Verifying size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_byid),
+                          "Count of the listing security group by id is not matching"
+                          )
+        securitygroup_ingress = list_securitygroups_byid[0].ingressrule
+        # Verifying that Ingress rule is empty(revoked)
+        status = validateList(securitygroup_ingress)
+        self.assertEquals(
+                          EMPTY_LIST,
+                          status[2],
+                          "Security Groups Ingress rule is not revoked"
+                          )
+        return
+
+    @attr(tags=["basic", "provisioning"])
+    def test_03_securitygroups_authorize_revoke_egress(self):
+        """
+        @Desc: Test to Authorize and Revoke Egress for Security Group
+        @steps:
+        Step1: Listing all the Security Groups for a user
+        Step2: Verifying that list size is 1
+        Step3: Creating a Security Groups
+        Step4: Listing all the Security Groups again for a user
+        Step5: Verifying that list size is 2
+        Step6: Authorizing Egress for the security group created in step3
+        Step7: Listing the security groups by passing id of security group created in step3
+        Step8: Verifying that list size is 1
+        Step9: Verifying that Egress is authorized to the security group
+        Step10: Verifying the details of the Egress rule are as expected
+        Step11: Revoking Egress for the security group created in step3
+        Step12: Listing the security groups by passing id of security group created in step3
+        Step13: Verifying that list size is 1
+        Step14: Verifying that Egress is revoked from the security group
+        """
+        # Listing all the Security Groups for a User
+        list_securitygroups_before = SecurityGroup.list(
+                                                        self.userapiclient,
+                                                        listall=self.services["listall"]
+                                                        )
+        # Verifying that default security group is created
+        status = validateList(list_securitygroups_before)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Default Security Groups creation failed"
+                          )
+        # Verifying the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_before),
+                          "Count of Security Groups list is not matching"
+                          )
+        # Creating a security group
+        securitygroup_created = SecurityGroup.create(
+                                                     self.userapiclient,
+                                                     self.services["security_group"],
+                                                     account=self.account.name,
+                                                     domainid=self.domain.id,
+                                                     description=self.services["security_group"]["name"]
+                                                     )
+        self.assertIsNotNone(
+                             securitygroup_created,
+                             "Security Group creation failed"
+                             )
+        self.cleanup.append(securitygroup_created)
+
+        # Listing all the security groups for user again
+        list_securitygroups_after = SecurityGroup.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        status = validateList(list_securitygroups_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Security Groups creation failed"
+                          )
+        # Verifying that list size is 2
+        self.assertEquals(
+                          2,
+                          len(list_securitygroups_after),
+                          "Failed to create Security Group"
+                          )
+        # Authorizing Egress for the security group created in step3
+        securitygroup_created.authorizeEgress(
+                                              self.userapiclient,
+                                              self.services["ingress_rule"],
+                                              self.account.name,
+                                              self.domain.id,
+                                              )
+        # Listing the security group by Id
+        list_securitygroups_byid = SecurityGroup.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      id=securitygroup_created.id,
+                                                      domainid=self.domain.id
+                                                      )
+        # Verifying that security group is listed
+        status = validateList(list_securitygroups_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of Security Groups by id failed"
+                          )
+        # Verifying size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_byid),
+                          "Count of the listing security group by id is not matching"
+                          )
+        securitygroup_egress = list_securitygroups_byid[0].egressrule
+        # Validating the Ingress rule
+        status = validateList(securitygroup_egress)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Security Groups Egress rule authorization failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(securitygroup_egress),
+                          "Security Group Egress rules count is not matching"
+                          )
+        # Verifying the details of the Egress rule are as expected
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "cidr":self.services["ingress_rule"]["cidrlist"],
+                         "protocol":self.services["ingress_rule"]["protocol"],
+                         "startport":self.services["ingress_rule"]["startport"],
+                         "endport":self.services["ingress_rule"]["endport"],
+                         }
+        actual_dict = {
+                       "cidr":str(securitygroup_egress[0].cidr),
+                       "protocol":str(securitygroup_egress[0].protocol.upper()),
+                       "startport":str(securitygroup_egress[0].startport),
+                       "endport":str(securitygroup_egress[0].endport),
+                       }
+        ingress_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         ingress_status,
+                         "Listed Security group Egress rule details are not as expected"
+                         )
+        # Revoking the Egress rule from Security Group
+        securitygroup_created.revokeEgress(self.userapiclient, securitygroup_egress[0].ruleid)
+        # Listing the security group by Id
+        list_securitygroups_byid = SecurityGroup.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      id=securitygroup_created.id,
+                                                      domainid=self.domain.id
+                                                      )
+        # Verifying that security group is listed
+        status = validateList(list_securitygroups_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of Security Groups by id failed"
+                          )
+        # Verifying size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_securitygroups_byid),
+                          "Count of the listing security group by id is not matching"
+                          )
+        securitygroup_egress = list_securitygroups_byid[0].egressrule
+        # Verifying that Ingress rule is empty(revoked)
+        status = validateList(securitygroup_egress)
+        self.assertEquals(
+                          EMPTY_LIST,
+                          status[2],
+                          "Security Groups Egress rule is not revoked"
+                          )
+        return
\ No newline at end of file


[37/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6984: Re-enable the testcase

(cherry picked from commit 039878b49a821cd1fd52e0ead0f528c3e9371a0c)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/29287c98
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/29287c98
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/29287c98

Branch: refs/heads/4.4
Commit: 29287c989deb782c68ae6979e2c140dfd0b3fca3
Parents: 32a9ab6
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Wed Jun 25 23:29:28 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:53 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_deploy_vm_root_resize.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29287c98/test/integration/smoke/test_deploy_vm_root_resize.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index 269b321..0f0ddcc 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -233,7 +233,7 @@ class TestDeployVM(cloudstackTestCase):
         else:
             self.debug("test 01 does not support hypervisor type " + self.hypervisor);
 
-    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true", BugId="CLOUDSTACK-6985")
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true")
     def test_02_deploy_vm_root_resize(self):
         """Test proper failure to deploy virtual machine with rootdisksize less than template size
         """


[47/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7013: Fixing test script issue in test_add_remove_network.py

(cherry picked from commit f99a96f38a1f2433cb01bd7af25890789716e070)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6b66fe92
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6b66fe92
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6b66fe92

Branch: refs/heads/4.4
Commit: 6b66fe92ca89633ec64397cedb0d1572d0089c93
Parents: 01e7833
Author: Ashutosh K <as...@clogeny.com>
Authored: Wed Jul 16 23:30:43 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:57 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_add_remove_network.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6b66fe92/test/integration/component/test_add_remove_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py
index dbba59b..2bd6ec2 100644
--- a/test/integration/component/test_add_remove_network.py
+++ b/test/integration/component/test_add_remove_network.py
@@ -1391,7 +1391,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
         cls._cleanup = []
 
         cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
-        cls.append(cls.account)
+        cls._cleanup.append(cls.account)
 
         cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
         cls._cleanup.append(cls.service_offering)


[18/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6780: Resolved cleanup issue in portable ip test cases

(cherry picked from commit 0190c936689fc252e51b7c412283c128b5386b24)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92a9703c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92a9703c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92a9703c

Branch: refs/heads/4.4
Commit: 92a9703c55b7f8718cbd9ae7403d3bed556ba0ef
Parents: ed77cf8
Author: Ashutosh K <as...@clogeny.com>
Authored: Tue May 27 07:02:04 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:46 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92a9703c/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 847bb4a..77a5ab6 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -1103,21 +1103,27 @@ class TestDisassociatePublicIp(cloudstackTestCase):
             self.fail("Failed to create portable ip: %s" % e)
 
         try:
-            self.user_account = Account.create(
+            self.otherAccount = Account.create(
                             self.apiclient,
                             self.services["account"],
                             domainid=self.domain.id
                             )
+            self.cleanup.append(self.otherAccount)
 
-            self.api_client_user = self.testClient.getUserApiClient(
-                                            UserName=self.user_account.name,
-                                            DomainName=self.user_account.domain
+            self.apiclientOtherAccount = self.testClient.getUserApiClient(
+                                            UserName=self.otherAccount.name,
+                                            DomainName=self.otherAccount.domain
                                             )
 
+            # Trying to disassociate portable ip using
+            # api client of other account than the one
+            # used to create portable ip
             with self.assertRaises(Exception):
-                portableip.delete(self.api_client_user)
-        except Exception as e:
+                portableip.delete(self.apiclientOtherAccount)
+
+            # Disassociate IP using api client of account used to create it
             portableip.delete(self.apiclient)
+        except Exception as e:
             self.fail("Exception while disassociating portable ip: %s" % e)
         return
 


[10/50] [abbrv] CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_instances.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
new file mode 100644
index 0000000..9e040db
--- /dev/null
+++ b/test/integration/component/test_escalations_instances.py
@@ -0,0 +1,3448 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (createVolume,
+                                  createTemplate)
+from marvin.lib.base import (Volume,
+                             Iso,
+                             VirtualMachine,
+                             Template,
+                             Snapshot,
+                             SecurityGroup,
+                             Account,
+                             Zone,
+                             Network,
+                             NetworkOffering,
+                             DiskOffering,
+                             ServiceOffering,
+                             VmSnapshot,
+                             SnapshotPolicy,
+                             SSHKeyPair,
+                             Resources,
+                             Configurations,
+                             VpnCustomerGateway,
+                             Hypervisor,
+                             VpcOffering,
+                             VPC,
+                             NetworkACL)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_os_types)
+from marvin.lib.utils import (validateList,
+                              cleanup_resources,
+                              random_gen)
+from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+from nose.plugins.attrib import attr
+import time
+
+class TestListInstances(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []        
+            cls.testClient = super(TestListInstances, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                        cls.api_client,
+                                        cls.zone.id,
+                                        cls.services["ostype"]
+                                        )
+            if cls.zone.localstorageenabled:
+                cls.storagetype = 'local'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.services["disk_offering"]["storagetype"] = 'local'
+            else:
+                cls.storagetype = 'shared'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.services["disk_offering"]["storagetype"] = 'shared'
+
+            cls.services['mode'] = cls.zone.networktype
+            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+            cls.services["virtual_machine"]["template"] = cls.template.id
+            cls.services["custom_volume"]["zoneid"] = cls.zone.id
+            # Creating Disk offering, Service Offering and Account
+            cls.disk_offering = DiskOffering.create(
+                                                    cls.api_client,
+                                                    cls.services["disk_offering"]
+                                                    )
+            cls.service_offering = ServiceOffering.create(
+                                                          cls.api_client,
+                                                          cls.services["service_offerings"]["tiny"]
+                                                          )
+            cls.account = Account.create(
+                                         cls.api_client,
+                                         cls.services["account"],
+                                         domainid=cls.domain.id
+                                         )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            # Updating resource Limits
+            for i in range(0,12):
+                Resources.updateLimit(
+                                      cls.api_client,
+                                      account=cls.account.name,
+                                      domainid=cls.domain.id,
+                                      max=-1,
+                                      resourcetype=i
+                                      )
+
+            cls._cleanup.append(cls.account)
+            cls._cleanup.append(cls.service_offering)
+            cls._cleanup.append(cls.disk_offering)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created resources
+        cleanup_resources(self.apiClient, self.cleanup)
+        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)
+
+        return
+
+    def __verify_values(self, expected_vals, actual_vals):
+        """  
+        @Desc: Function to verify expected and actual values
+        @Steps:
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_01_list_instances_pagination(self):
+        """  
+        @Desc: Test List Instances pagination
+        @Steps:
+        Step1: Listing all the Instances for a user
+        Step2: Verifying listed Instances for account created at class level
+        Step3: If number of volumes is less than (page size + 1), then creating them
+        Step4: Listing all the volumes again after creation of volumes
+        Step5: Verifying the length of the volumes is (page size + 1)
+        Step6: Listing all the volumes in page1
+        Step7: Verifying that the length of the volumes in page 1 is (page size)
+        Step8: Listing all the volumes in page2
+        Step9: Verifying that the length of the volumes in page 2 is 1
+        Step10: Deleting the volume present in page 2
+        Step11: Listing for the volumes on page 2
+        Step12: Verifying that there are no volumes present in page 2
+        """
+        # Listing all the instances for a user
+        list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+
+        # Verifying listed instances for account created at class level
+        self.assertIsNone(
+                          list_instances_before,
+                          "Virtual Machine already exists for newly created user"
+                          )
+        # If number of instances are less than (pagesize + 1), then creating them    
+        for i in range(0, (self.services["pagesize"] + 1)):
+            vm_created = VirtualMachine.create(
+                                               self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               serviceofferingid=self.service_offering.id,
+                                               )
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "VM creation failed"
+                                 )
+            if(i < (self.services["pagesize"])):
+                self.cleanup.append(vm_created)
+
+            self.assertEqual(
+                             self.services["virtual_machine"]["displayname"],
+                             vm_created.displayname,
+                             "Newly created VM name and the test data VM name are not matching"
+                             )
+
+        # Listing all the instances again after creating VM's        
+        list_instances_after = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+        status = validateList(list_instances_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of instances after creation failed"
+                          )
+        # Verifying the length of the instances is (page size + 1)
+        self.assertEqual(
+                         len(list_instances_after),
+                         (self.services["pagesize"] + 1),
+                         "Number of instances created is not matching as expected"
+                         )
+
+        # Listing all the volumes in page1
+        list_instances_page1 = VirtualMachine.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   page=1,
+                                                   pagesize=self.services["pagesize"],
+                                                   domainid=self.account.domainid
+                                                   )
+        status = validateList(list_instances_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of instances in page1 failed"
+                          )
+        # Verifying that the length of the instances in page 1 is (page size)
+        self.assertEqual(
+                         self.services["pagesize"],
+                         len(list_instances_page1),
+                         "List VM response is not matching with the page size length for page 1"
+                         )
+
+        # Listing all the VM's in page2
+        list_instances_page2 = VirtualMachine.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   page=2,
+                                                   pagesize=self.services["pagesize"],
+                                                   domainid=self.account.domainid
+                                                   )
+        status = validateList(list_instances_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of instances in page2 failed"
+                          )
+        # Verifying that the length of the VM's in page 2 is 1
+        self.assertEqual(
+                         1,
+                         len(list_instances_page2),
+                         "List VM response is not matching with the page size length for page 2"
+                         )
+        instance_page2 = list_instances_page2[0]
+
+        # Verifying that the VM on page 2 is not present in page1
+        for i in range(0, len(list_instances_page1)):
+            instance_page1 = list_instances_page1[i]
+            self.assertNotEquals(
+                                 instance_page2.id,
+                                 instance_page1.id,
+                                 "VM listed in page 2 is also listed in page 1"
+                                 )
+
+        # Deleting a single VM
+        VirtualMachine.delete(vm_created, self.userapiclient)
+
+        # Listing the VM's in page 2
+        list_instance_response = VirtualMachine.list(
+                                                     self.userapiclient,
+                                                     listall=self.services["listall"],
+                                                     page=2,
+                                                     pagesize=self.services["pagesize"],
+                                                     domainid=self.account.domainid
+                                                     )
+        # verifying that VM does not exists on page 2
+        self.assertEqual(
+                        list_instance_response,
+                        None,
+                        "VM was not deleted"
+                        )
+        return
+ 
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_02_list_Running_vm(self):
+        """  
+        @Desc: Test List Running VM's
+        @Steps:
+        Step1: Listing all the Running VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a VM
+        Step4: Listing all the Running VMs for a user again
+        Step5: Verifying that the size of the list is increased by 1
+        Step6: Verifying that the details of the Running VM listed are same as the VM deployed in Step3
+        """
+        # Listing all the Running VM's for a User
+        list_running_vms_before = VirtualMachine.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      page=1,
+                                                      pagesize=self.services["pagesize"],
+                                                      domainid=self.account.domainid,
+                                                      state="Running"
+                                                      )
+        self.assertIsNone(
+                          list_running_vms_before,
+                          "Virtual Machine already exists for newly created user"
+                          )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Listing all the Running VM's for a User
+        list_running_vms_after = VirtualMachine.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      page=1,
+                                                      pagesize=self.services["pagesize"],
+                                                      domainid=self.account.domainid,
+                                                      state="Running"
+                                                      )
+        status = validateList(list_running_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Newly created VM is not in Running state"
+                          )
+        # Verifying list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_running_vms_after),
+                          "Running VM list count is not matching"
+                          )
+        running_vm = list_running_vms_after[0]
+
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":"Running",
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                         }
+        actual_dict = {
+                       "id":running_vm.id,
+                       "name":running_vm.name,
+                       "displayname":running_vm.displayname,
+                       "state":running_vm.state,
+                       "zoneid":running_vm.zoneid,
+                       "account":running_vm.account,
+                       "template":running_vm.templateid
+                       }
+        running_vm_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         running_vm_status,
+                         "Listed Running VM details are not as expected"
+                         )
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_03_list_Stopped_vm(self):
+        """  
+        @Desc: Test List Stopped VM's
+        @Steps:
+        Step1: Listing all the Stopped VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a VM
+        Step4: Stopping the VM deployed in step3
+        Step5: Listing all the Stopped VMs for a user again
+        Step6: Verifying that the size of the list is increased by 1
+        Step7: Verifying that the details of the Stopped VM listed are same as the VM stopped in Step4
+        """
+        # Listing all the Stopped VM's for a User
+        list_stopped_vms_before = VirtualMachine.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      page=1,
+                                                      pagesize=self.services["pagesize"],
+                                                      domainid=self.account.domainid,
+                                                      state="Stopped"
+                                                      )
+        self.assertIsNone(
+                           list_stopped_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Stopping the VM
+        VirtualMachine.stop(vm_created, self.userapiclient)
+        # Listing all the Stopped VM's for a User
+        list_stopped_vms_after = VirtualMachine.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      page=1,
+                                                      pagesize=self.services["pagesize"],
+                                                      domainid=self.account.domainid,
+                                                      state="Stopped"
+                                                      )
+        status = validateList(list_stopped_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Stopped VM is not in Stopped state"
+                          )
+        # Verifying list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_stopped_vms_after),
+                          "Stopped VM list count is not matching"
+                          )
+        stopped_vm = list_stopped_vms_after[0]
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":"Stopped",
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                         }
+        actual_dict = {
+                       "id":stopped_vm.id,
+                       "name":stopped_vm.name,
+                       "displayname":stopped_vm.displayname,
+                       "state":stopped_vm.state,
+                       "zoneid":stopped_vm.zoneid,
+                       "account":stopped_vm.account,
+                       "template":stopped_vm.templateid
+                       }
+        stopped_vm_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         stopped_vm_status,
+                         "Listed Stopped VM details are not as expected"
+                         )
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_04_list_Destroyed_vm(self):
+        """
+        @Desc: Test List Destroyed VM's
+        @Steps:
+        Step1: Listing all the Destroyed VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a VM
+        Step4: Destroyed the VM deployed in step3
+        Step5: Listing all the Destroyed VMs for a user again
+        Step6: Verifying that destroyed VM is not listed for User
+        Step7: Listing all the destroyed VMs as admin
+        Step8: Verifying that the size of the list is 1
+        Step9: Verifying that the details of the Destroyed VM listed are same as the VM destroyed in Step4
+        """
+        # Listing all the Destroyed VM's for a User
+        list_destroyed_vms_before = VirtualMachine.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      page=1,
+                                                      pagesize=self.services["pagesize"],
+                                                      domainid=self.account.domainid,
+                                                      state="Destroyed"
+                                                      )
+        self.assertIsNone(
+                           list_destroyed_vms_before,
+                           "Virtual Machine in Destroyed state already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        # Destroying the VM
+        VirtualMachine.delete(vm_created, self.userapiclient)
+        # Listing all the Destroyed VM's for a User
+        list_destroyed_vms_after = VirtualMachine.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"],
+                                                      page=1,
+                                                      pagesize=self.services["pagesize"],
+                                                      domainid=self.account.domainid,
+                                                      state="Destroyed"
+                                                      )
+        self.assertIsNone(
+                          list_destroyed_vms_after,
+                          "Destroyed VM is not in destroyed state"
+                          )
+        # Listing destroyed VMs as admin user
+        list_destroyed_vms_admin = VirtualMachine.list(
+                                                       self.apiClient,
+                                                       listall=self.services["listall"],
+                                                       page=1,
+                                                       pagesize=self.services["pagesize"],
+                                                       domainid=self.account.domainid,
+                                                       state="Destroyed",
+                                                       id=vm_created.id
+                                                       )
+        status = validateList(list_destroyed_vms_admin)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Destroyed VM is not in Destroyed state"
+                          )
+        # Verifying that the length of the destroyed VMs list should be 1
+        self.assertEquals(
+                          1,
+                          len(list_destroyed_vms_admin),
+                          "Destroyed VM list count is not matching"
+                          )
+        destroyed_vm = list_destroyed_vms_admin[0]
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":"Destroyed",
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                         }
+        actual_dict = {
+                       "id":destroyed_vm.id,
+                       "name":destroyed_vm.name,
+                       "displayname":destroyed_vm.displayname,
+                       "state":destroyed_vm.state,
+                       "zoneid":destroyed_vm.zoneid,
+                       "account":destroyed_vm.account,
+                       "template":destroyed_vm.templateid
+                       }
+        destroyed_vm_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         destroyed_vm_status,
+                         "Listed Destroyed VM details are not as expected"
+                         )
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_05_list_vm_by_id(self):
+        """
+        @Desc: Test List VM by Id
+        @Steps:
+        Step1: Listing all the VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a VM
+        Step4: Listing all the VMs for a user again
+        Step5: Verifying that the size of the list is increased by 1
+        Step6: List a VM by specifying the Id if the VM deployed in Step3
+        Step7: Verifying that the details of the Listed VM are same as the VM deployed in Step3
+        """
+        # Listing all the VM's for a User
+        list_vms_before = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              account=self.account.name
+                                              )
+        self.assertIsNone(
+                           list_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Listing all the VM's for a User
+        list_vms_after = VirtualMachine.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"],
+                                             domainid=self.account.domainid,
+                                             account=self.account.name
+                                             )
+        status = validateList(list_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of VM after creation failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(list_vms_after),
+                          "VM list count is not matching"
+                          )
+        # Listing a VM by Id
+        list_vm_byid = VirtualMachine.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"],
+                                           id=vm_created.id
+                                           )
+        status = validateList(list_vm_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of VM by Id failed"
+                          )
+        listed_vm = list_vm_byid[0]
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":vm_created.state,
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                         }
+        actual_dict = {
+                       "id":listed_vm.id,
+                       "name":listed_vm.name,
+                       "displayname":listed_vm.displayname,
+                       "state":listed_vm.state,
+                       "zoneid":listed_vm.zoneid,
+                       "account":listed_vm.account,
+                       "template":listed_vm.templateid
+                       }
+        list_vm_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         list_vm_status,
+                         "Listed VM by Id details are not as expected"
+                         )
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_06_list_vm_by_name(self):
+        """
+        @Desc: Test List VM's by Name
+        @Steps:
+        Step1: Listing all the VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a 2 VM's
+        Step4: Listing all the VMs for a user again
+        Step5: Verifying that list size is increased by 2
+        Step6: Listing the VM by specifying complete name of VM-1 created in step3
+        Step7: Verifying that the size of the list is 1
+        Step8: Verifying that the details of the listed VM are same as the VM-1 created in step3
+        Step9: Listing the VM by specifying the partial name of VM
+        Step10: Verifying that the size of the list is 2
+        """
+        # Listing all the VM's for a User
+        list_vms_before = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              )
+        self.assertIsNone(
+                           list_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        vms = {}
+        for i in range(0, 2):
+            # Deploying a VM
+            vm_created = VirtualMachine.create(
+                                               self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               serviceofferingid=self.service_offering.id,
+                                               )
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "VM creation failed"
+                                 )
+            self.cleanup.append(vm_created)
+            vms.update({i: vm_created})
+
+        # Listing all the VM's for a User
+        list_vms_after = VirtualMachine.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"],
+                                             domainid=self.account.domainid,
+                                             )
+        status = validateList(list_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM's creation failed"
+                          )
+        self.assertEquals(
+                          2,
+                          len(list_vms_after),
+                          "VM's list count is not matching"
+                          )
+        # Listing the VM by complete name
+        list_vm_byfullname = VirtualMachine.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 page=1,
+                                                 pagesize=self.services["pagesize"],
+                                                 domainid=self.account.domainid,
+                                                 name=vms[0].name
+                                                 )
+        status = validateList(list_vm_byfullname)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list VM by Name"
+                          )
+        # Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_vm_byfullname),
+                          "VM list by full name count is not matching"
+                          )
+        # Verifying that the details of the listed VM are same as the VM created above
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vms[0].id,
+                         "name":vms[0].name,
+                         "displayname":vms[0].displayname,
+                         "state":vms[0].state,
+                         "zoneid":vms[0].zoneid,
+                         "account":vms[0].account,
+                         "template":vms[0].templateid
+                         }
+        actual_dict = {
+                       "id":list_vm_byfullname[0].id,
+                       "name":list_vm_byfullname[0].name,
+                       "displayname":list_vm_byfullname[0].displayname,
+                       "state":list_vm_byfullname[0].state,
+                       "zoneid":list_vm_byfullname[0].zoneid,
+                       "account":list_vm_byfullname[0].account,
+                       "template":list_vm_byfullname[0].templateid
+                       }
+        list_vm_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         list_vm_status,
+                         "Listed VM details are not as expected"
+                         )
+        # Listing the VM by partial name
+        list_vm_bypartialname = VirtualMachine.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 domainid=self.account.domainid,
+                                                 name=vms[0].name[:1]
+                                                 )
+        status = validateList(list_vm_bypartialname)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list VM by Name"
+                          )
+        # Verifying that the size of the list is 2
+        self.assertEquals(
+                          2,
+                          len(list_vm_bypartialname),
+                          "VM list by full name count is not matching"
+                          )
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_07_list_vm_by_name_state(self):
+        """  
+        @Desc: Test List VM's by Name and State
+        @Steps:
+        Step1: Listing all the VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a VM
+        Step4: Listing all the VMs for a user again
+        Step5: Verifying that list size is increased by 1
+        Step6: Listing the VM by specifying name of VM created in step3 and state as Running (matching name and state)
+        Step7: Verifying that the size of the list is 1
+        Step8: Verifying that the details of the listed VM are same as the VM created in step3
+        Step9: Listing the VM by specifying name of VM created in step3 and state as Stopped (non matching state)
+        Step10: Verifying that the size of the list is 0
+        Step11: Listing the VM by specifying non matching name and state as Running (non matching name)
+        Step12: Verifying that the size of the list is 0
+        """
+        # Listing all the VM's for a User
+        list_vms_before = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              )
+        self.assertIsNone(
+                           list_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Listing all the VM's for a User
+        list_vms_after = VirtualMachine.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"],
+                                             domainid=self.account.domainid,
+                                             )
+        status = validateList(list_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM's creation failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(list_vms_after),
+                          "VM's list count is not matching"
+                          )
+        # Listing the VM by matching Name and State
+        list_running_vm = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              name=vm_created.name,
+                                              state="Running"
+                                              )
+        status = validateList(list_running_vm)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "List VM by name and state failed"
+                          )
+        # Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_running_vm),
+                          "Count of VM list by name and state is not matching"
+                          )
+        # Verifying that the details of the listed VM are same as the VM created above
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":"Running",
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                         }
+        actual_dict = {
+                       "id":list_running_vm[0].id,
+                       "name":list_running_vm[0].name,
+                       "displayname":list_running_vm[0].displayname,
+                       "state":list_running_vm[0].state,
+                       "zoneid":list_running_vm[0].zoneid,
+                       "account":list_running_vm[0].account,
+                       "template":list_running_vm[0].templateid
+                       }
+        list_vm_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         list_vm_status,
+                         "Listed VM details are not as expected"
+                         )
+        # Listing the VM by matching name and non matching state
+        list_running_vm = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              name=vm_created.name,
+                                              state="Stopped"
+                                              )
+        self.assertIsNone(
+                          list_running_vm,
+                          "Listed VM with non matching state"
+                          )
+        # Listing the VM by non matching name and matching state
+        list_running_vm = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              name="name",
+                                              state="Running"
+                                              )
+        self.assertIsNone(
+                          list_running_vm,
+                          "Listed VM with non matching name"
+                          )
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_08_list_vm_by_zone(self):
+        """  
+        @Desc: Test List VM by Zone. 
+        This test case is applicable for a setup having multiple zones.
+        @Steps:
+        Step1: Listing all the zones
+        Step2: Checking if there are multiple zones in the setup.
+               Continuing below steps only if there are multiple zones
+        Step3: Listing template for zone
+        Step4: Listing all the VMs for a user
+        Step5: Verifying that the size of the list is 0
+        Step6: Deploying a VM
+        Step7: Listing all the VMs for a user again for matching zone
+        Step8: Verifying that the size of the list is 1
+        Step9: Verifying that the details of the Listed VM are same as the VM deployed in Step6
+        Step10: Listing all the VMs for a user again for non-matching zone
+        Step11: Verifying that the size of the list is 0
+        """
+        # Listing all the zones available
+        zones_list = Zone.list(self.apiClient)
+        status = validateList(zones_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "zones not available in the given setup"
+                          )
+        current_zone = self.services["virtual_machine"]["zoneid"]
+        current_template = self.services["virtual_machine"]["template"]
+        # Checking if there are multiple zones in the setup.
+        if not len(zones_list) > 1:
+            self.debug("Setup is not having multiple zones")
+        else:
+            # Getting the template available under the zone
+            template = get_template(
+                                    self.apiClient,
+                                    zones_list[0].id,
+                                    self.services["ostype"]
+                                    )
+            self.assertIsNotNone(
+                                 template,
+                                 "Template not found for zone"
+                                 )
+            self.services["virtual_machine"]["zoneid"] = zones_list[0].id
+            self.services["virtual_machine"]["template"] = template.id
+            # Listing all the VM's for a User
+            list_vms_before = VirtualMachine.list(
+                                                  self.userapiclient,
+                                                  listall=self.services["listall"],
+                                                  page=1,
+                                                  pagesize=self.services["pagesize"],
+                                                  domainid=self.account.domainid,
+                                                  zoneid=zones_list[0].id
+                                                  )
+            self.assertIsNone(
+                               list_vms_before,
+                               "Virtual Machine already exists for newly created user"
+                               )
+            # Deploying a VM
+            vm_created = VirtualMachine.create(
+                                               self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               serviceofferingid=self.service_offering.id,
+                                               )
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "VM creation failed"
+                                 )
+            self.cleanup.append(vm_created)
+            # Listing all the VMs for a user again for matching zone
+            list_vms_after = VirtualMachine.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 page=1,
+                                                 pagesize=self.services["pagesize"],
+                                                 domainid=self.account.domainid,
+                                                 zoneid=zones_list[0].id
+                                                 )
+            status = validateList(list_vms_after)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "VM creation failed"
+                              )
+            # Verifying that the size of the list is 1
+            self.assertEquals(
+                              1,
+                              len(list_vms_after),
+                              "VM list count is not matching"
+                              )
+            listed_vm = list_vms_after[0]
+            # Verifying that the details of the Listed VM are same as the VM deployed above
+            #Creating expected and actual values dictionaries
+            expected_dict = {
+                               "id":vm_created.id,
+                               "name":vm_created.name,
+                               "displayname":vm_created.displayname,
+                               "state":vm_created.state,
+                               "zoneid":vm_created.zoneid,
+                               "account":vm_created.account,
+                               "template":vm_created.templateid
+                               }
+            actual_dict = {
+                               "id":listed_vm.id,
+                               "name":listed_vm.name,
+                               "displayname":listed_vm.displayname,
+                               "state":listed_vm.state,
+                               "zoneid":listed_vm.zoneid,
+                               "account":listed_vm.account,
+                               "template":listed_vm.templateid
+                               }
+            list_vm_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+            self.assertEqual(
+                             True,
+                             list_vm_status,
+                             "Listed VM by Id details are not as expected"
+                             )
+            # Listing all the VMs for a user again for non-matching zone
+            list_vms = VirtualMachine.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"],
+                                           page=1,
+                                           pagesize=self.services["pagesize"],
+                                           domainid=self.account.domainid,
+                                           zoneid=zones_list[1].id
+                                           )
+            self.assertIsNone(
+                              list_vms,
+                              "VM's listed for non matching zone"
+                              )
+            self.services["virtual_machine"]["zoneid"] = current_zone
+            self.services["virtual_machine"]["template"] = current_template
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_09_list_vm_by_zone_name(self):
+        """  
+        @Desc: Test List VM by Zone. 
+        This test case is applicable for a setup having multiple zones.
+        @Steps:
+        Step1: Listing all the zones
+        Step2: Checking if there are multiple zones in the setup.
+               Continuing below steps only if there are multiple zones
+        Step3: Listing template for zone
+        Step4: Listing all the VMs for a user
+        Step5: Verifying that the size of the list is 0
+        Step6: Deploying a VM
+        Step7: Listing all the VMs for a user again
+        Step8: Verifying that list size is increased by 1
+        Step9: Listing the VM by specifying name of VM created in step6 and matching zone (matching name and zone)
+        Step10: Verifying that the size of the list is 1
+        Step11: Verifying that the details of the listed VM are same as the VM created in step3
+        Step12: Listing the VM by specifying name of VM created in step6 and non matching zone (non matching zone)
+        Step13: Verifying that the size of the list is 0
+        Step14: Listing the VM by specifying non matching name and matching zone (non matching name)
+        Step15: Verifying that the size of the list is 0
+        """
+        # Listing all the zones available
+        zones_list = Zone.list(self.apiClient)
+        status = validateList(zones_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "zones not available in the given setup"
+                          )
+        current_zone = self.services["virtual_machine"]["zoneid"]
+        current_template = self.services["virtual_machine"]["template"]
+        # Checking if there are multiple zones in the setup.
+        if not len(zones_list) > 1:
+            self.debug("Setup is not having multiple Zones")
+        else:
+            # Getting the template available under the zone
+            template = get_template(
+                                    self.apiClient,
+                                    zones_list[0].id,
+                                    self.services["ostype"]
+                                    )
+            self.assertIsNotNone(
+                                 template,
+                                 "Template not found for zone"
+                                 )
+            self.services["virtual_machine"]["zoneid"] = zones_list[0].id
+            self.services["virtual_machine"]["template"] = template.id
+            # Listing all the VM's for a User
+            list_vms_before = VirtualMachine.list(
+                                                  self.userapiclient,
+                                                  listall=self.services["listall"],
+                                                  page=1,
+                                                  pagesize=self.services["pagesize"],
+                                                  domainid=self.account.domainid,
+                                                  zoneid=zones_list[0].id,
+                                                  account=self.account.name
+                                                  )
+            self.assertIsNone(
+                               list_vms_before,
+                               "Virtual Machine already exists for newly created user"
+                               )
+            # Deploying a VM
+            vm_created = VirtualMachine.create(
+                                               self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               serviceofferingid=self.service_offering.id,
+                                               )
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "VM creation failed"
+                                 )
+            self.cleanup.append(vm_created)
+            # Listing all the VMs for a user again for matching zone
+            list_vms_after = VirtualMachine.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 page=1,
+                                                 pagesize=self.services["pagesize"],
+                                                 domainid=self.account.domainid,
+                                                 zoneid=zones_list[0].id,
+                                                 account=self.account.name
+                                                 )
+            status = validateList(list_vms_after)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "VM creation failed"
+                              )
+            # Verifying that the size of the list is 1
+            self.assertEquals(
+                              1,
+                              len(list_vms_after),
+                              "VM list count is not matching"
+                              )
+            # Listing the VM by specifying name of VM created in above and matching zone
+            list_vms = VirtualMachine.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"],
+                                           page=1,
+                                           pagesize=self.services["pagesize"],
+                                           domainid=self.account.domainid,
+                                           zoneid=zones_list[0].id,
+                                           name=vm_created.name
+                                           )
+            status = validateList(list_vms)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Listing VM's by name and zone failed"
+                              )
+            # Verifying Verifying that the size of the list is 1
+            self.assertEquals(
+                              1,
+                              len(list_vms),
+                              "Count of listed VM's by name and zone is not as expected"
+                              )
+            listed_vm = list_vms[0]
+            # Verifying that the details of the Listed VM are same as the VM deployed above
+            #Creating expected and actual values dictionaries
+            expected_dict = {
+                             "id":vm_created.id,
+                             "name":vm_created.name,
+                             "displayname":vm_created.displayname,
+                             "state":vm_created.state,
+                             "zoneid":vm_created.zoneid,
+                             "account":vm_created.account,
+                             "template":vm_created.templateid
+                               }
+            actual_dict = {
+                               "id":listed_vm.id,
+                               "name":listed_vm.name,
+                               "displayname":listed_vm.displayname,
+                               "state":listed_vm.state,
+                               "zoneid":listed_vm.zoneid,
+                               "account":listed_vm.account,
+                               "template":listed_vm.templateid
+                               }
+            list_vm_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+            self.assertEqual(
+                             True,
+                             list_vm_status,
+                             "Listed VM by Id details are not as expected"
+                             )
+            # Listing the VM by specifying name of VM created in step3 and non matching zone
+            list_vms = VirtualMachine.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"],
+                                           page=1,
+                                           pagesize=self.services["pagesize"],
+                                           domainid=self.account.domainid,
+                                           zoneid=zones_list[1].id,
+                                           name=vm_created.name
+                                           )
+            self.assertIsNone(
+                              list_vms,
+                              "VM's listed for non matching zone"
+                              )
+            # Listing the VM by specifying non matching name of VM and matching zone
+            list_vms = VirtualMachine.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"],
+                                           page=1,
+                                           pagesize=self.services["pagesize"],
+                                           domainid=self.account.domainid,
+                                           zoneid=zones_list[0].id,
+                                           name="name"
+                                           )
+            self.assertIsNone(
+                              list_vms,
+                              "VM's listed for non matching zone"
+                              )
+            self.services["virtual_machine"]["zoneid"] = current_zone
+            self.services["virtual_machine"]["template"] = current_template
+        return
+
+    @attr(tags=["advanced", "basic", "selfservice"])
+    def test_10_list_vm_by_zone_name_state(self):
+        """  
+        @Desc: Test List VM by Zone. 
+        @Steps:
+        Step1: Listing all the VMs for a user
+        Step2: Verifying that the size of the list is 0
+        Step3: Deploying a VM
+        Step4: Listing all the VMs for a user again
+        Step5: Verifying that list size is increased by 1
+        Step6: Listing the VM by specifying name of VM created in step3 and matching zone and state as Running
+        Step7: Verifying that the size of the list is 1
+        Step8: Verifying that the details of the listed VM are same as the VM created in step3
+        Step9: Listing the VM by specifying name of VM created in step3 and matching zone and state as Stopped
+        Step10: Verifying that the size of the list is 0
+        Step11: Listing the VM by name, Zone and account
+        Step12: Verifying that the size of the list is 1
+        Step13: Verifying that the details of the listed VM are same as the VM created in step3
+        """
+        # Listing all the VM's for a User
+        list_vms_before = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"],
+                                              domainid=self.account.domainid,
+                                              zoneid=self.zone.id,
+                                              account=self.account.name
+                                              )
+        self.assertIsNone(
+                           list_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Listing all the VMs for a user again for matching zone
+        list_vms_after = VirtualMachine.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"],
+                                             domainid=self.account.domainid,
+                                             zoneid=self.zone.id,
+                                             account=self.account.name
+                                             )
+        status = validateList(list_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM creation failed"
+                          )
+        # Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_vms_after),
+                          "VM list count is not matching"
+                          )
+        # Listing the VM by specifying name of VM created in step3 and matching zone and state as Running
+        list_vms = VirtualMachine.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       page=1,
+                                       pagesize=self.services["pagesize"],
+                                       domainid=self.account.domainid,
+                                       zoneid=self.zone.id,
+                                       name=vm_created.name,
+                                       state="Running"
+                                       )
+        status = validateList(list_vms)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing VM's by name and zone failed"
+                          )
+        # Verifying Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_vms),
+                          "Count of listed VM's by name, zone and state is not as expected"
+                          )
+        listed_vm = list_vms[0]
+        # Verifying that the details of the Listed VM are same as the VM deployed above
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":vm_created.state,
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                       }
+        actual_dict = {
+                       "id":listed_vm.id,
+                       "name":listed_vm.name,
+                       "displayname":listed_vm.displayname,
+                       "state":listed_vm.state,
+                       "zoneid":listed_vm.zoneid,
+                       "account":listed_vm.account,
+                       "template":listed_vm.templateid
+                       }
+        list_vm_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         list_vm_status,
+                         "Listed VM by Id details are not as expected"
+                         )
+        # Listing the VM by specifying name of VM created in step3, zone and State as Stopped
+        list_vms = VirtualMachine.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       page=1,
+                                       pagesize=self.services["pagesize"],
+                                       domainid=self.account.domainid,
+                                       zoneid=self.zone.id,
+                                       name=vm_created.name,
+                                       state="Stopped"
+                                       )
+        self.assertIsNone(
+                          list_vms,
+                          "VM's listed for non matching zone"
+                          )
+        # Listing the VM by name, zone and account
+        list_vms = VirtualMachine.list(
+                                       self.userapiclient,
+                                       listall=self.services["listall"],
+                                       page=1,
+                                       pagesize=self.services["pagesize"],
+                                       domainid=self.account.domainid,
+                                       zoneid=self.zone.id,
+                                       name=vm_created.name,
+                                       account=self.account.name
+                                       )
+        status = validateList(list_vms)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing VM's by name, account and zone failed"
+                          )
+        # Verifying Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_vms),
+                          "Count of listed VM's by name, zone and account is not as expected"
+                          )
+        listed_vm = list_vms[0]
+        # Verifying that the details of the Listed VM are same as the VM deployed above
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":vm_created.id,
+                         "name":vm_created.name,
+                         "displayname":vm_created.displayname,
+                         "state":vm_created.state,
+                         "zoneid":vm_created.zoneid,
+                         "account":vm_created.account,
+                         "template":vm_created.templateid
+                         }
+        actual_dict = {
+                       "id":listed_vm.id,
+                       "name":listed_vm.name,
+                       "displayname":listed_vm.displayname,
+                       "state":listed_vm.state,
+                       "zoneid":listed_vm.zoneid,
+                       "account":listed_vm.account,
+                       "template":listed_vm.templateid
+                       }
+        list_vm_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         list_vm_status,
+                         "Listed VM by Id details are not as expected"
+                         )
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_11_register_reset_vm_sshkey(self):
+        """  
+        @Desc: Test to verify registering and reset of SSH Key for VM
+        @Steps:
+        Step1: Deploying a VM
+        Step2: Stopping the VM deployed in step1
+        Step3: Listing all the SSH Key pairs
+        Step4: Registering a SSH Key pair
+        Step5: Listing all the SSh Key pairs again
+        Step6: Verifying that the key pairs list is increased by 1
+        Step7: Resetting the VM SSH Key to the key pair registered in step4
+        Step8: Verifying that the registered SSH Key pair is set to the VM
+        """
+        # Listing all the VM's for a User
+        list_vms_before = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              )
+        self.assertIsNone(
+                           list_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Listing all the VMs for a user again
+        list_vms_after = VirtualMachine.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             )
+        status = validateList(list_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM creation failed"
+                          )
+        # Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_vms_after),
+                          "VM list count is not matching"
+                          )
+        # Stopping the VM deployed above
+        vm_created.stop(
+                        self.userapiclient,
+                        forced=True
+                        )
+        # Listing all the SSH Key pairs
+        list_keypairs_before = SSHKeyPair.list(
+                                               self.userapiclient
+                                               )
+        list_keypairs_before_size = 0
+        if list_keypairs_before is not None:
+            list_keypairs_before_size = len(list_keypairs_before)
+
+        # Registering new Key pair
+        new_keypair = SSHKeyPair.register(
+                                          self.userapiclient,
+                                          name="keypair1",
+                                          publickey="ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2"
+                                          )
+        self.assertIsNotNone(
+                             new_keypair,
+                             "New Key pair generation failed"
+                             )
+        self.assertEquals(
+                          "keypair1",
+                          new_keypair.name,
+                          "Key Pair not created with given name"
+                          )
+        # Listing all the SSH Key pairs again
+        list_keypairs_after = SSHKeyPair.list(
+                                              self.userapiclient
+                                              )
+        status = validateList(list_keypairs_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of Key pairs failed"
+                          )
+        # Verifying that list size is increased by 1
+        self.assertEquals(
+                          list_keypairs_before_size + 1,
+                          len(list_keypairs_after),
+                          "List count is not matching"
+                          )
+        # Resetting the VM SSH key to the Key pair created above
+        vm_created.resetSshKey(
+                               self.userapiclient,
+                               keypair=new_keypair.name
+                               )
+        # Listing VM details again
+        list_vm = VirtualMachine.list(
+                                      self.userapiclient,
+                                      id=vm_created.id
+                                     )
+        status = validateList(list_vm)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of VM failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(list_vm),
+                          "VMs list is not as expected"
+                          )
+        # Verifying that VM's SSH keypair is set to newly created keypair
+        self.assertEquals(
+                          new_keypair.name,
+                          list_vm[0].keypair,
+                          "VM is not set to newly created SSH Key pair"
+                          )
+        return
+
+    @attr(tags=["advanced", "provisioning"])
+    def test_12_vm_nics(self):
+        """
+        @Desc: Test to verify Nics for a VM
+        @Steps:
+        Step1: Deploying a VM
+        Step2: Listing all the Networks
+        Step3: Verifying that the list size is 1
+        Step4: Creating 1 network
+        Step5: Listing all the networks again
+        Step6: Verifying that the list size is 2
+        Step7: Verifying that VM deployed in step1 has only 1 nic
+                and it is same as network listed in step3
+        Step8: Adding the networks created in step4 to VM deployed in step1
+        Step9: Verifying that VM deployed in step1 has 2 nics
+        Step10: Verifying that isdefault is set to true for only 1 nic
+        Step11: Verifying that isdefault is set to true for the Network created when deployed a VM
+        Step12: Making the nic created in step4 as default nic
+        Step13: Verifying that isdefault is set to true for only 1 nic
+        Step14: Verifying that the isdefault is set to true for the nic created in step4
+        Step15: Removing the non-default nic from VM
+        Step16: Verifying that VM deployed in step1 has only 1 nic
+        """
+        # Listing all the VM's for a User
+        list_vms_before = VirtualMachine.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              )
+        self.assertIsNone(
+                           list_vms_before,
+                           "Virtual Machine already exists for newly created user"
+                           )
+        # Deploying a VM
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "VM creation failed"
+                             )
+        self.cleanup.append(vm_created)
+        # Listing all the VMs for a user again
+        list_vms_after = VirtualMachine.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             )
+        status = validateList(list_vms_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM creation failed"
+                          )
+        # Verifying that the size of the list is 1
+        self.assertEquals(
+                          1,
+                          len(list_vms_after),
+                          "VM list count is not matching"
+                          )
+        # Listing all the networks before
+        list_network_before = Network.list(
+                                           self.userapiclient,
+                                           isdefault="true",
+                                           zoneid=self.zone.id,
+                                           account=self.account.name,
+                                           domainid=self.domain.id
+                                           )
+        status = validateList(list_network_before)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Default Network not created when deploying a VM"
+                          )
+        # Verifying that only 1 network is created while deploying a VM
+        self.assertEquals(
+                          1,
+                          len(list_network_before),
+                          "More than 1 default network exists"
+                          )
+        network1 = list_network_before[0]
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat",
+                                                      zoneid=self.zone.id
+                                                      )
+        self.assertIsNotNone(
+                             network_offerings_list,
+                             "Isolated Network Offerings with sourceNat enabled are not found"
+                             )
+        # Creating one more network
+        network2 = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network2,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network2)
+        # Listing all the networks again
+        list_network_after = Network.list(
+                                          self.userapiclient,
+                                          zoneid=self.zone.id,
+                                          account=self.account.name,
+                                          domainid=self.domain.id
+                                          )
+        status = validateList(list_network_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "List of Networks failed"
+                  

<TRUNCATED>

[48/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7024: Resolved cleanup issue in test script

(cherry picked from commit ec49669f1cf525b207889ae13a8a2b01a0271933)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f055ec52
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f055ec52
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f055ec52

Branch: refs/heads/4.4
Commit: f055ec52d9d751df86e42aeb6a2aace2ceea4567
Parents: 6b66fe9
Author: Ashutosh K <as...@clogeny.com>
Authored: Fri Jul 18 01:14:42 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:57 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_project_usage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f055ec52/test/integration/component/test_project_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py
index 5e0dda5..e8ed1b1 100644
--- a/test/integration/component/test_project_usage.py
+++ b/test/integration/component/test_project_usage.py
@@ -720,7 +720,7 @@ class TestTemplateUsage(cloudstackTestCase):
                                  account=cls.account.name,
                                  domainid=cls.account.domainid
                                  )
-            cls._cleanup.append(cls.account)
+            cls._cleanup.insert(-1, cls.project)
             cls.service_offering = ServiceOffering.create(
                                             cls.api_client,
                                             cls.services["service_offering"])


[49/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7178: Correcting imports in test_escalations* test cases

(cherry picked from commit 4e45b296891f71fc7991dc507dc7ae9cec6f5496)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2025f359
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2025f359
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2025f359

Branch: refs/heads/4.4
Commit: 2025f359c4fbff6b24132d39e8cf587315a2a981
Parents: 5898745
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Jul 24 01:03:45 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:58 2014 +0200

----------------------------------------------------------------------
 .../component/test_escalations_ipaddresses.py   | 38 +++++++++++++-------
 .../component/test_escalations_snapshots.py     | 26 +++++++-------
 2 files changed, 40 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2025f359/test/integration/component/test_escalations_ipaddresses.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
index 0b31d2e..411dae0 100644
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -16,18 +16,32 @@
 # under the License.
 
 # Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackException import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-from marvin.lib.utils import checkVolumeSize
-from marvin.codes import SUCCESS
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (PublicIPAddress,
+                             NetworkOffering,
+                             Autoscale,
+                             Network,
+                             NetworkServiceProvider,
+                             Template,
+                             VirtualMachine,
+                             VPC,
+                             VpcOffering,
+                             StaticNATRule,
+                             FireWallRule,
+                             NATRule,
+                             Vpn,
+                             VpnUser,
+                             LoadBalancerRule,
+                             Account,
+                             ServiceOffering,
+                             PhysicalNetwork,
+                             User)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template)
+from marvin.lib.utils import validateList, cleanup_resources
+from marvin.codes import PASS
 from nose.plugins.attrib import attr
-from time import sleep
-from ctypes.wintypes import BOOLEAN
 
 class TestIpAddresses(cloudstackTestCase):
 
@@ -1730,7 +1744,7 @@ class TestIpAddresses(cloudstackTestCase):
                          "Load Balancer Sticky Policy creation Failed"
                          )
         # Deleting the Sticky Policy
-        deleted = LoadBalancerRule.deleteSticky(
+        LoadBalancerRule.deleteSticky(
                                                 lb_rule,
                                                 self.userapiclient,
                                                 id=sticky_policy.stickinesspolicy[0].id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2025f359/test/integration/component/test_escalations_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
index 0aa36c3..9bb3b50 100644
--- a/test/integration/component/test_escalations_snapshots.py
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -16,18 +16,20 @@
 # under the License.
 
 # Import Local Modules
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackException import *
-from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-from marvin.lib.utils import checkVolumeSize
-from marvin.codes import SUCCESS
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (VmSnapshot,
+                             Snapshot,
+                             DiskOffering,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Account,
+                             Volume)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template)
+from marvin.lib.utils import validateList, cleanup_resources
+from marvin.codes import PASS
 from nose.plugins.attrib import attr
-from time import sleep
-from ctypes.wintypes import BOOLEAN
 
 class TestSnapshots(cloudstackTestCase):
 
@@ -626,4 +628,4 @@ class TestSnapshots(cloudstackTestCase):
                          vm_snapshot_status,
                          "Listed VM Snapshot details are not as expected"
                          )
-        return
\ No newline at end of file
+        return


[38/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
This test suite contains test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork() for Admin, domain admin and regular users.

(cherry picked from commit a18a4ea9e8b5c6a9c4935570af5d2eb9a2c1b753)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/491eb1bb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/491eb1bb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/491eb1bb

Branch: refs/heads/4.4
Commit: 491eb1bb73a048f5e2e3ec370a891d4a677f613e
Parents: 29287c9
Author: Sangeetha <sa...@citrix.com>
Authored: Thu Jun 26 13:40:53 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:53 2014 +0200

----------------------------------------------------------------------
 .../component/test_acl_isolatednetwork.py       | 1151 ++++++++++++++++++
 tools/marvin/marvin/cloudstackException.py      |   24 +
 tools/marvin/marvin/codes.py                    |    5 +
 tools/marvin/marvin/config/test_data.py         |  156 ++-
 4 files changed, 1334 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/491eb1bb/test/integration/component/test_acl_isolatednetwork.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_acl_isolatednetwork.py b/test/integration/component/test_acl_isolatednetwork.py
new file mode 100644
index 0000000..59119f1
--- /dev/null
+++ b/test/integration/component/test_acl_isolatednetwork.py
@@ -0,0 +1,1151 @@
+# 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.
+""" 
+Test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork() for Admin, domain admin and regular users 
+"""
+
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.cloudstackException import CloudstackAclException
+from marvin.lib.common import *
+from marvin.codes import (RUNNING,
+                          ALLOCATED)
+from nose.plugins.attrib import attr
+#Import System modules
+import time
+
+_multiprocess_shared_ = True
+
+class TestIsolatedNetwork(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+    	"""
+        Create the following domain tree and accounts that are reqiured for executing Test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork():
+        Under ROOT - create 2 domaind D1 and D2
+        Under D1 - Create 2 subdomain D11 and D12
+        Under D11 - Create subdimain D111
+
+        Under each of the domain create 1 admin user and couple of regular users.
+
+        As each of these users , create an isolated network.
+
+    	"""
+
+        cls.testclient = super(TestIsolatedNetwork, cls).getClsTestClient()
+        cls.apiclient = cls.testclient.getApiClient()
+        #cls.acldata = Services().services
+	cls.testdata = cls.testClient.getParsedTestDataConfig()
+	cls.acldata = cls.testdata["acl"]
+        cls.domain_1 = None
+        cls.domain_2 = None
+        cls.cleanup = []
+	
+
+	try:
+    	
+            # backup default apikey and secretkey
+            cls.default_apikey = cls.apiclient.connection.apiKey
+            cls.default_secretkey = cls.apiclient.connection.securityKey
+    	
+            # Create domains 
+            cls.domain_1 = Domain.create(
+                                       cls.apiclient,
+                                       cls.acldata["domain1"]
+                                       )
+            cls.domain_11 = Domain.create(
+                                       cls.apiclient,
+                                       cls.acldata["domain11"],
+    				   parentdomainid=cls.domain_1.id
+                                       )
+            cls.domain_111 = Domain.create(
+                                       cls.apiclient,
+                                       cls.acldata["domain111"],
+    				   parentdomainid=cls.domain_11.id,
+                                       )
+            cls.domain_12 = Domain.create(
+                                       cls.apiclient,
+                                       cls.acldata["domain12"],
+    				   parentdomainid=cls.domain_1.id
+                                       )
+            cls.domain_2 = Domain.create(
+                                       cls.apiclient,
+                                       cls.acldata["domain2"]
+                                       )
+            # Create  1 admin account and 2 user accounts for doamin_1
+            cls.account_d1 = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD1"],
+                                admin=True,
+                                domainid=cls.domain_1.id
+                                )
+    
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
+            cls.user_d1_apikey = user.apikey
+            cls.user_d1_secretkey = user.secretkey
+            
+            cls.account_d1a = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD1A"],
+                                admin=False,
+                                domainid=cls.domain_1.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
+            cls.user_d1a_apikey = user.apikey
+            cls.user_d1a_secretkey = user.secretkey
+            
+    
+            cls.account_d1b = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD1B"],
+                                admin=False,
+                                domainid=cls.domain_1.id
+                                )
+    
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
+            cls.user_d1b_apikey = user.apikey
+            cls.user_d1b_secretkey = user.secretkey
+      
+            # Create  1 admin and 2 user accounts for doamin_11
+            cls.account_d11 = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD11"],
+                                admin=True,
+                                domainid=cls.domain_11.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
+            cls.user_d11_apikey = user.apikey
+            cls.user_d11_secretkey = user.secretkey
+    
+            cls.account_d11a = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD11A"],
+                                admin=False,
+                                domainid=cls.domain_11.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
+            cls.user_d11a_apikey = user.apikey
+            cls.user_d11a_secretkey = user.secretkey
+    
+            cls.account_d11b = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD11B"],
+                                admin=False,
+                                domainid=cls.domain_11.id
+                                )  
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
+            cls.user_d11b_apikey = user.apikey
+            cls.user_d11b_secretkey = user.secretkey
+    
+            # Create  2 user accounts and 1 admin account for doamin_111
+    
+            cls.account_d111 = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD111"],
+                                admin=True,
+                                domainid=cls.domain_111.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
+            cls.user_d111_apikey = user.apikey
+            cls.user_d111_secretkey = user.secretkey
+          
+            cls.account_d111a = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD111A"],
+                                admin=False,
+                                domainid=cls.domain_111.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
+            cls.user_d111a_apikey = user.apikey
+            cls.user_d111a_secretkey = user.secretkey
+          
+            cls.account_d111b = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD111B"],
+                                admin=False,
+                                domainid=cls.domain_111.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
+            cls.user_d111b_apikey = user.apikey
+            cls.user_d111b_secretkey = user.secretkey
+          
+            # Create  2 user accounts for doamin_12
+            cls.account_d12a = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD12A"],
+                                admin=False,
+                                domainid=cls.domain_12.id
+                                )        
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
+            cls.user_d12a_apikey = user.apikey
+            cls.user_d12a_secretkey = user.secretkey
+    
+            cls.account_d12b = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD12B"],
+                                admin=False,
+                                domainid=cls.domain_12.id
+                                )  
+          
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
+            cls.user_d12b_apikey = user.apikey
+            cls.user_d12b_secretkey = user.secretkey
+          
+            # Create 1 user account for domain_2
+    
+            cls.account_d2a = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountD2"],
+                                admin=False,
+                                domainid=cls.domain_2.id
+                                )
+            
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
+            cls.user_d2a_apikey = user.apikey
+            cls.user_d2a_secretkey = user.secretkey
+                             
+                    
+            # Create 1 user account and admin account in "ROOT" domain
+    
+            cls.account_roota = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountROOTA"],
+                                admin=False,
+                                )
+            
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
+            cls.user_roota_apikey = user.apikey
+            cls.user_roota_secretkey = user.secretkey
+    
+            cls.account_root = Account.create(
+                                cls.apiclient,
+                                cls.acldata["accountROOT"],
+                                admin=True,
+                                )
+            
+    	    user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
+            cls.user_root_apikey = user.apikey
+            cls.user_root_secretkey = user.secretkey
+    
+            # create service offering
+            cls.service_offering = ServiceOffering.create(
+                                    cls.apiclient,
+                                    cls.acldata["service_offering"]["small"]
+                                    )
+            
+            cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
+            cls.acldata['mode'] = cls.zone.networktype
+            cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
+    
+    	    cls.apiclient.connection.apiKey = cls.default_apikey
+            cls.apiclient.connection.securityKey = cls.default_secretkey
+    
+            list_isolated_network_offerings_response = NetworkOffering.list(
+                                                             cls.apiclient,
+                                                             name="DefaultIsolatedNetworkOfferingWithSourceNatService"
+                                                             )
+    	    cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
+    
+    	    ## Create Network objects for deployVirtualMachine and restartNetwork API related test cases
+      
+    	    cls.apiclient.connection.apiKey = cls.user_root_apikey
+            cls.apiclient.connection.securityKey = cls.user_root_secretkey 
+    	    cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_root.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d1_apikey
+            cls.apiclient.connection.securityKey = cls.user_d1_secretkey 
+    	    cls.network_d1 =  cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d1.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d1a_apikey
+            cls.apiclient.connection.securityKey = cls.user_d1a_secretkey 
+    	    cls.network_d1a =  cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d1a.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d1b_apikey
+            cls.apiclient.connection.securityKey = cls.user_d1b_secretkey 
+    	    cls.network_d1b =  cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d1b.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d11a_apikey
+            cls.apiclient.connection.securityKey = cls.user_d11a_secretkey 
+    	    cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d11a.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d11b_apikey
+            cls.apiclient.connection.securityKey = cls.user_d11b_secretkey 
+    	    cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d11b.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d12a_apikey
+            cls.apiclient.connection.securityKey = cls.user_d12a_secretkey 
+    	    cls.network_d12a =  cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d12a.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_roota_apikey
+            cls.apiclient.connection.securityKey = cls.user_roota_secretkey 
+    	    cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_roota.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d111a_apikey
+            cls.apiclient.connection.securityKey = cls.user_d111a_secretkey 
+    	    cls.network_d111a =  cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d111a.id)
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d111b_apikey
+            cls.apiclient.connection.securityKey = cls.user_d111b_secretkey 
+    	    cls.network_d111b =  cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d111b.id)
+    
+    
+    	    cls.apiclient.connection.apiKey = cls.user_d2a_apikey
+            cls.apiclient.connection.securityKey = cls.user_d2a_secretkey 
+    	    cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
+    	    cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d2a.id)
+    
+            cls.cleanup = [
+    			cls.account_root,
+                            cls.account_roota,
+                            cls.service_offering,
+                            ]
+        except Exception as e:
+                cls.domain_1.delete(cls.apiclient,cleanup="true")
+                cls.domain_2.delete(cls.apiclient,cleanup="true")
+                cleanup_resources(cls.apiclient, cls.cleanup)
+                raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.apiclient = super(TestIsolatedNetwork, cls).getClsTestClient().getApiClient()
+        cls.apiclient.connection.apiKey = cls.default_apikey
+        cls.apiclient.connection.securityKey = cls.default_secretkey
+        cls.domain_1.delete(cls.apiclient,cleanup="true")
+        cls.domain_2.delete(cls.apiclient,cleanup="true")
+        cleanup_resources(cls.apiclient, cls.cleanup)
+        return
+
+    def setUp(cls):
+        cls.apiclient = cls.testClient.getApiClient()
+        cls.dbclient = cls.testClient.getDbConnection()
+
+    def tearDown(cls):
+        # restore back default apikey and secretkey
+        cls.apiclient.connection.apiKey = cls.default_apikey
+        cls.apiclient.connection.securityKey = cls.default_secretkey
+        return
+
+## Test cases relating to createNetwork as admin user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_01_createNetwork_admin(self):
+
+	"""
+        # Validate that Admin should be able to create network for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	self.acldata["network"]["name"] = "root"
+	self.acldata["network"]["displayname"] = "root"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "Admin User is not able to create a network for himself")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_02_createNetwork_admin_foruserinsamedomain(self):
+
+	"""
+        # Validate that Admin should be able to create network for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	self.acldata["network"]["name"] = "root_roota"
+	self.acldata["network"]["displayname"] = "root_roota"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_roota.name,
+            		 domainid=self.account_roota.domainid
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "Admin User is not able to create a network for other users in his domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_03_createNetwork_admin_foruserinotherdomain(self):
+
+	"""
+        # Validate that Admin should be able to create network for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	self.acldata["network"]["name"] = "root_d11a"
+	self.acldata["network"]["displayname"] = "root_d11a"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_d11a.name,
+            		 domainid=self.account_d11a.domainid
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "Admin User is not able to create a network for for other users in other domain")
+
+## Test cases relating to createNetwork as domain admin user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_04_createNetwork_domaindmin(self):
+
+	"""
+        # Validate that Domain admin should be able to create network for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	self.acldata["network"]["name"] = "d1"
+	self.acldata["network"]["displayname"] = "d1"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "Domain admin User is not able to create a network for himself")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_05_createNetwork_domaindmin_foruserinsamedomain(self):
+
+	"""
+        # Validate that Domain admin should be able to create network for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	self.acldata["network"]["name"] = "d1-d1a"
+	self.acldata["network"]["displayname"] = "d1-d1a"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_d1a.name,
+            		 domainid=self.account_d1a.domainid
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "Domain admin User is not able to create a network for other users in his domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_06_createNetwork_domaindmin_foruserinsubdomain(self):
+
+	"""
+        # Validate that Domain admin should be able to create network for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	self.acldata["network"]["name"] = "d1_d11a"
+	self.acldata["network"]["displayname"] = "d1_d11a"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_d11a.name,
+            		 domainid=self.account_d11a.domainid
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "Domain admin User is not able to create a network for other users in his sub domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_07_createNetwork_domaindmin_forcrossdomainuser(self):
+
+	"""
+        # Validate that Domain admin should not be able to create network for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	self.acldata["network"]["name"] = "d1_d2a"
+	self.acldata["network"]["displayname"] = "d1_d2a"
+	try:
+        	network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_d2a.name,
+            		 domainid=self.account_d2a.domainid
+                         )
+        	self.fail("Domain admin is allowed to create network for users not in his domain ")
+        except Exception as e:
+                self.debug ("When Domain admin tries to create network for users in his sub domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+        	    self.fail("Error message validation failed when Domain admin tries to create network for users not in his domain ")
+
+## Test cases relating to createNetwork as regular user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_08_createNetwork_user(self):
+
+	"""
+        # Validate that Regular should be able to create network for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	self.acldata["network"]["name"] = "d1a"
+	self.acldata["network"]["displayname"] = "d1a"
+
+        network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id
+                         )
+
+ 	self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+                    True,
+                    "User is not able to create a network for himself")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_09_createNetwork_user_foruserinsamedomain(self):
+
+	"""
+        # Validate that  Regular user should NOT be able to create network for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	self.acldata["network"]["name"] = "d1a_d1b"
+	self.acldata["network"]["displayname"] = "d1a_d1b"
+	
+	try:
+        	network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_d1b.name,
+            		 domainid=self.account_d1b.domainid
+                         )
+        	self.fail("User is allowed to create network for other users in his domain ")
+        except Exception as e:
+                self.debug ("When user tries to create network for users in his domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_LIST_NETWORK_ACCOUNT):
+        	    self.fail("Error message validation failed when when User tries to create network for other users in his domain ")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_10_createNetwork_user_foruserinotherdomain(self):
+
+	"""
+        # Validate that Domain admin should be NOT be able to create network for users in other domains
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	self.acldata["network"]["name"] = "d1a_d11a"
+	self.acldata["network"]["displayname"] = "d1a_d11a"
+
+	try:
+        	network = Network.create(
+                         self.apiclient,
+                         self.acldata["network"],
+                         networkofferingid=self.isolated_network_offering_id,
+                         zoneid=self.zone.id,
+            		 accountid=self.account_d11a.name,
+            		 domainid=self.account_d11a.domainid
+                         )
+        	self.fail("User is allowed to create network for users not in his domain ")
+        except Exception as e:
+                self.debug ("When user tries to create network for users in other domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_LIST_NETWORK_ACCOUNT):
+        	    self.fail("Error message validation failed when User tries to create network for users not in his domain ")
+
+
+## Test cases relating to Deploying VM in a network as admin user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_11_deployvm_admin(self):
+
+	"""
+        # Validate that Admin should be able to deploy VM in the networks he owns
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	vmData = {"name":"root-root","dispayname":"root-root"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_root.id
+        )
+
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower(),
+                    True,
+                    "Admin User is not able to deploy VM in his own network")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_12_deployvm_admin_foruserinsamedomain(self):
+
+	"""
+        # Validate that Admin should be able to deploy Vm  for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	vmData={"name":"roota-root","displayname":"roota-root"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_roota.id,
+	    accountid=self.account_roota.name,
+            domainid=self.account_roota.domainid
+        )
+
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_roota.name and vm.domainid == self.account_roota.domainid,
+                    True,
+                    "Admin User is not able to deploy VM for users in his domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_13_deployvm_admin_foruserinotherdomain(self):
+
+	"""
+        # Validate that Admin should be able to deploy VM for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	vmData={"name":"d2a-root","displayname":"d2a-root"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_d2a.id,
+	    accountid=self.account_d2a.name,
+            domainid=self.account_d2a.domainid
+            )
+
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_d2a.name and vm.domainid == self.account_d2a.domainid,
+                    True,
+                    "Admin User is not able to deploy VM for users users in other domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_13_1_deployvm_admin_foruserinotherdomain_crossnetwork(self):
+
+	"""
+        # Validate that Admin should not be able deploy VM for a user in a network that does not belong to the user
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+	vmData={"name":"d11a-root-invalidnetwork","displayname":"d11a-root-invalidnetwork"}
+	try:
+		vm  = VirtualMachine.create(
+            	self.apiclient,
+	    	vmData,
+            	zoneid=self.zone.id,
+            	serviceofferingid=self.service_offering.id,
+            	templateid=self.template.id,	
+	    	networkids=self.network_d11b.id,
+	    	accountid=self.account_d11a.name,
+            	domainid=self.account_d11a.domainid
+       		)
+        	self.fail("Admin is allowed to deploy VM for a user in a network that does not belong to the user ")
+        except Exception as e:
+                self.debug ("When admin tries to deploy vm for users in network that does not belong to the user %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK): 
+        	    self.fail("Admin tries to deploy VM for a user in a network that does not belong to the user ")
+
+## Test cases relating to deploying VM as domain admin user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_14_deployvm_domaindmin(self):
+
+	"""
+        # Validate that Domain admin should be able to deploy vm for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	vmData={"name":"d1-d1","displayname":"d1-d1"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_d1.id,
+        )
+
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower(),
+                    True,
+                    "Domain admin User is not able to deploy VM for himself")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_15_deployvm_domaindmin_foruserinsamedomain(self):
+
+	"""
+        # Validate that Domain admin should be able to deploy vm for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	vmData={"name":"d1a-d1","displayname":"d1a-d1"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_d1a.id,
+	    accountid=self.account_d1a.name,
+            domainid=self.account_d1a.domainid
+        )
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
+                    True,
+                    "Domain admin User is not able to deploy VM for other users in his domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_16_deployvm_domaindmin_foruserinsubdomain(self):
+
+	"""
+        # Validate that Domain admin should be able to deploy vm for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	vmData={"name":"d11a-d1","displayname":"d111a-d1"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_d11a.id,
+	    accountid=self.account_d11a.name,
+            domainid=self.account_d11a.domainid
+        )
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+                    True,
+                    "Domain admin User is not able to deploy vm for himself")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_17_deployvm_domaindmin_forcrossdomainuser(self):
+
+	"""
+        # Validate that Domain admin should not be able allowed to deploy vm for users not in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	vmData={"name":"d2a-d1","displayname":"d2a-d1"}
+
+	try:
+		vm  = VirtualMachine.create(
+            	self.apiclient,
+	        vmData,
+            	zoneid=self.zone.id,
+            	serviceofferingid=self.service_offering.id,
+           	templateid=self.template.id,	
+	    	networkids=self.network_d2a.id,
+	   	accountid=self.account_d2a.name,
+           	domainid=self.account_d2a.domainid
+        	)
+        	self.fail("Domain admin is allowed to deploy vm for users not in hos domain ")
+        except Exception as e:
+                self.debug ("When Domain admin tries to deploy vm for users in his sub domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+        	    self.fail("Error message validation failed when Domain admin tries to deploy vm for users not in hos domain ")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_17_1_deployvm_domainadmin_foruserinotherdomain_crossnetwork(self):
+
+	"""
+        # Validate that Domain admin should not be able deploy VM for a user in a network that does not belong to the user
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+	vmData={"name":"d1-d11a-invalidnetwork","displayname":"d1-d11a-invalidnetwork"}
+	try:
+		vm  = VirtualMachine.create(
+            	self.apiclient,
+	    	vmData,
+            	zoneid=self.zone.id,
+            	serviceofferingid=self.service_offering.id,
+            	templateid=self.template.id,	
+	    	networkids=self.network_d11b.id,
+	    	accountid=self.account_d11a.name,
+            	domainid=self.account_d11a.domainid
+       		)
+        	self.fail("Domain admin is allowed to deploy vm for users in a network that does not belong to him ")
+        except Exception as e:
+                self.debug ("When domain admin tries to deploy vm for users in network that does not belong to the user %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK): 
+        	    self.fail("Error message validation failed when Domain admin tries to deploy vm for users in a network that does not belong to him ")
+
+## Test cases relating to deploying VM as regular user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_18_deployvm_user(self):
+
+	"""
+        # Validate that Regular should be able to deploy vm for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	vmData={"name":"d1a-d1a","displayname":"d1a-d1a"}
+
+	vm  = VirtualMachine.create(
+            self.apiclient,
+	    vmData,
+            zoneid=self.zone.id,
+            serviceofferingid=self.service_offering.id,
+            templateid=self.template.id,	
+	    networkids=self.network_d1a.id,
+        )
+ 	self.assertEqual(vm.state.lower() == RUNNING.lower(),
+                    True,
+                    "User is not able to deploy vm for himself")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_19_deployvm_user_foruserinsamedomain(self):
+
+	"""
+        # Validate that Regular user should NOT be able to deploy vm for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	vmData={"name":"d1b-d1a","displayname":"d1b-d1a"}
+
+	try:
+		vm  = VirtualMachine.create(
+            		self.apiclient,
+	    		vmData,
+            		zoneid=self.zone.id,
+            		serviceofferingid=self.service_offering.id,
+            		templateid=self.template.id,	
+	    		networkids=self.network_d1b.id,
+	    		accountid=self.account_d1b.name,
+            		domainid=self.account_d1b.domainid
+        	)
+        	self.fail("Regular user is allowed to deploy vm for other users in his domain ")
+        except Exception as e:
+                self.debug ("When user tries to deploy vm for users in his domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+        	    self.fail("Error message validation failed when Regular user tries to deploy vm for other users in his domain ")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_20_deployvm_user_foruserincrossdomain(self):
+
+	"""
+        # Validate that Regular user should NOT be able to deploy vm for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	vmData={"name":"d2a-d1a","displayname":"d2a-d1a"}
+
+	try:
+		vm  = VirtualMachine.create(
+            		self.apiclient,
+	    		vmData,
+            		zoneid=self.zone.id,
+            		serviceofferingid=self.service_offering.id,
+            		templateid=self.template.id,	
+	    		networkids=self.network_d2a.id,
+	    		accountid=self.account_d2a.name,
+            		domainid=self.account_d2a.domainid
+        	)
+        	self.fail("Regular user is allowed to deploy vm for users not in his domain ")
+        except Exception as e:
+                self.debug ("When user tries to deploy vm for users n different domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+        	    self.fail("Error message validation failed when Regular user tries to deploy vm for users not in his domain ")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_20_1_deployvm_user_incrossnetwork(self):
+
+	"""
+        #Validate that User should not be able deploy VM in a network that does not belong to him
+	"""
+	self.apiclient.connection.apiKey = self.user_d11a_apikey
+        self.apiclient.connection.securityKey = self.user_d11a_secretkey
+	vmData={"name":"d11a-invalidnetwork","displayname":"d11a-invalidnetwork"}
+	try:
+		vm  = VirtualMachine.create(
+            	self.apiclient,
+	    	vmData,
+            	zoneid=self.zone.id,
+            	serviceofferingid=self.service_offering.id,
+            	templateid=self.template.id,	
+	    	networkids=self.network_d11b.id,
+       		)
+        	self.fail("User is allowed to deploy VM  in a network that does not belong to him ")
+        except Exception as e:
+                self.debug ("When user tries to deploy vm in a  network that does not belong to him %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK): 
+        	    self.fail("Error message validation failed when User is allowed to deploy VM  in a network that does not belong to him ")
+
+## Test cases relating to restart Network as admin user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_21_restartNetwork_admin(self):
+
+	"""
+        #Validate that Admin should be able to restart network for networks he owns
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+
+        restartResponse = self.network_root.restart(self.apiclient)
+
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "Admin User is not able to restart network he owns")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_22_restartNetwork_admin_foruserinsamedomain(self):
+
+	"""
+        # Validate that Admin should be able to restart network for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+
+        restartResponse = self.network_roota.restart(self.apiclient)
+
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "Admin User is not able to restart network owned by users his domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_23_restartNetwork_admin_foruserinotherdomain(self):
+
+	"""
+        # Validate that Admin should be able to restart network for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_root_apikey
+        self.apiclient.connection.securityKey = self.user_root_secretkey
+
+        restartResponse = self.network_d11a.restart(self.apiclient)
+
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "Admin User is not able to restart network owned other users in other domain")
+
+## Test cases relating to restart Network as domain admin user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_24_restartNetwork_domaindmin(self):
+
+	"""
+        # Validate that Domain admin should be able to restart network for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+
+        restartResponse = self.network_d1.restart(self.apiclient)
+
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "Domain admin User is not able to restart network for himself")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_25_restartNetwork_domaindmin_foruserinsamedomain(self):
+
+	"""
+        # Validate that Domain admin should be able to restart network for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+
+        restartResponse = self.network_d1a.restart(self.apiclient)
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "Domain admin User is not able to restart network for other users in his domain")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_26_restartNetwork_domaindmin_foruserinsubdomain(self):
+
+	"""
+        # Validate that Domain admin should be able to restart network for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+
+        restartResponse = self.network_d11a.restart(self.apiclient)
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "Domain admin User is not able to restart network he owns")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_27_restartNetwork_domaindmin_forcrossdomainuser(self):
+
+	"""
+        # Validate that Domain admin should be able to restart network for users in his sub domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1_apikey
+        self.apiclient.connection.securityKey = self.user_d1_secretkey
+
+	try:
+        	restartResponse = self.network_d2a.restart(self.apiclient)
+        	self.fail("Domain admin is allowed to restart network for users not in his domain ")
+        except Exception as e:
+                self.debug ("When Domain admin tries to restart network for users in his sub domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+        	    self.fail("Error message validation failed when Domain admin tries to restart network for users not in his domain ")
+
+## Test cases relating restart network as regular user
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_28_restartNetwork_user(self):
+
+	"""
+        #Validate that  Regular should be able to restart network for himslef
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+
+        restartResponse = self.network_d1a.restart(self.apiclient)
+ 	self.assertEqual(restartResponse.success,
+                    True,
+                    "User is not able to restart network he owns")
+
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_29_restartNetwork_user_foruserinsamedomain(self):
+
+	"""
+        #Validate that Regular user should NOT be able to restart network for users in his domain
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+
+	try:
+       		restartResponse = self.network_d1b.restart(self.apiclient)
+        	self.fail("Regular user is allowed to restart network for users in his domain ")
+        except Exception as e:
+                self.debug ("When user tries to restart network for users in his domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+        	    self.fail("Error message validation failed when Regular user tries to restart network for users in his domain ")
+
+    @attr(tags=[ "advanced"],required_hardware="false")
+    def test_30_restartNetwork_user_foruserinotherdomain(self):
+
+	"""
+        #Validate that Domain admin should be NOT be able to restart network for users in other domains
+	"""
+	self.apiclient.connection.apiKey = self.user_d1a_apikey
+        self.apiclient.connection.securityKey = self.user_d1a_secretkey
+	
+	try:
+
+        	restartResponse = self.network_d11a.restart(self.apiclient)
+        	self.fail("Regular user is allowed to restart network for users not in his domain ")
+        except Exception as e:
+                self.debug ("When user tries to restart network for users in other domain %s" %e)
+                if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+        	    self.fail("Error message validation failed when Regular user is allowed to restart network for users not in his domain ")
+
+    @staticmethod
+    def generateKeysForUser(apiclient,account):
+        user = User.list(
+                          apiclient,
+                          account=account.name,
+                          domainid=account.domainid
+                          )[0]
+
+        return (User.registerUserKeys(
+                        apiclient,
+                        user.id
+                      ))
+
+    @staticmethod
+    def createNetwork(apiclient,account,isolated_network_offering_id,zone):
+		network= {
+			 "name": "Network-",
+			 "displaytext": "Network-",
+			 "gateway" :"10.223.1.1",
+			 "netmask" :"255.255.255.0",
+			 "startip" :"10.223.1.2",
+			 "endip" :"10.223.1.100",
+			}
+
+		network["name"] = account.name +" -forupdate"
+		network["displayname"] = account.name + "-forupdate"
+
+		network = Network.create(
+				 apiclient,
+				 network,
+				 networkofferingid=isolated_network_offering_id,
+				 zoneid=zone.id
+				 )
+		return network
+
+
+    @staticmethod
+    def createVM(apiclient,zoneId,serviceOfferingId,templateId,networkId):
+	vmData = {"name":"prereq","dispayname":"prereq"}
+
+	vm  = VirtualMachine.create(
+            apiclient,
+	    vmData,
+            zoneid=zoneId,
+            serviceofferingid=serviceOfferingId,
+            templateid=templateId,	
+	    networkids=networkId
+        )
+
+	return vm

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/491eb1bb/tools/marvin/marvin/cloudstackException.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackException.py b/tools/marvin/marvin/cloudstackException.py
index c2eb57a..331ae91 100644
--- a/tools/marvin/marvin/cloudstackException.py
+++ b/tools/marvin/marvin/cloudstackException.py
@@ -63,3 +63,27 @@ def GetDetailExceptionInfo(e):
             exc_type, exc_value, exc_traceback)))
     else:
         return EXCEPTION_OCCURRED
+
+class CloudstackAclException():
+
+    NO_PERMISSION_TO_OPERATE_DOMAIN = "does not have permission to operate within domain"
+    UNABLE_TO_USE_NETWORK = "Unable to use network"
+    NO_PERMISSION_TO_OPERATE_ACCOUNT = "does not have permission to operate with resource Acct"
+    UNABLE_TO_LIST_NETWORK_ACCOUNT = "Can't create/list resources for account"
+    NO_PERMISSION_TO_ACCESS_ACCOUNT = "does not have permission to access resource Acct"
+
+    @staticmethod
+    def verifyMsginException(e,message):
+        if message in str(e):
+            return True
+        else:
+            return False
+
+    @staticmethod
+    def verifyErrorCodeinException(e,errorCode):
+        errorString = " errorCode: " + errorCode
+        if  errorString in str(e):
+            return True
+        else:
+            return False
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/491eb1bb/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index e6e5602..4d725a6 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -106,3 +106,8 @@ KVM = "kvm"
 VMWARE = "vmware"
 ROOT_DOMAIN_ADMIN="root domain admin"
 CHILD_DOMAIN_ADMIN="child domain admin"
+
+'''
+Network states
+'''
+ALLOCATED = "Allocated"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/491eb1bb/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 4ff5b84..61c1338 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -1005,5 +1005,157 @@ test_data = {
 		"name":"Adv-Xen-Zone1"
 	},
 	"vpnclient_count": 50,
-	"config_path":"/hudson/scripts3/auto_xen.cfg"
-}
+	"config_path":"/hudson/scripts3/auto_xen.cfg",
+    "acl":{
+            #data for domains and accounts
+            "domain1": {
+                "name": "D1",
+             },
+            "accountD1": {
+                "email": "testD1@test.com",
+                "firstname": "testD1",
+                "lastname": "Admin",
+                "username": "testD1",
+                "password": "password",
+                "accounttype": "1",
+            },
+            "accountD1A": {
+                "email": "testD1A@test.com",
+                "firstname": "testD1A",
+                "lastname": "User",
+                "username": "testD1A",
+                "password": "password",
+            },
+            "accountD1B": {
+                "email": "testD1B@test.com",
+                "firstname": "testD1B",
+                "lastname": "User",
+                "username": "testD1B",
+                "password": "password",
+            },
+            "domain11": {
+                "name": "D11",
+             },
+            "accountD11": {
+                "email": "testD11@test.com",
+                "firstname": "testD11",
+                "lastname": "Admin",
+                "username": "testD11",
+                "password": "password",
+                "accounttype": "1",
+            },
+            "accountD11A": {
+                "email": "testD11A@test.com",
+                "firstname": "testD11A",
+                "lastname": "User",
+                "username": "testD11A",
+                "password": "password",
+            },
+            "accountD11B": {
+                "email": "test11B@test.com",
+                "firstname": "testD11B",
+                "lastname": "User",
+                "username": "testD11B",
+                "password": "password",
+            },
+            "domain111": {
+                "name": "D111",
+             },
+            "accountD111": {
+                "email": "testD111@test.com",
+                "firstname": "testD111",
+                "lastname": "Admin",
+                "username": "testD111",
+                "password": "password",
+            },
+            "accountD111A": {
+                "email": "testD111A@test.com",
+                "firstname": "testD111A",
+                "lastname": "User",
+                "username": "testD111A",
+                "password": "password",
+            },
+            "accountD111B": {
+                "email": "testD111B@test.com",
+                "firstname": "testD111B",
+                "lastname": "User",
+                "username": "testD111B",
+                "password": "password",
+            },
+           "domain12": {
+                "name": "D12",
+             },
+            "accountD12A": {
+                "email": "testD12A@test.com",
+                "firstname": "testD12A",
+                "lastname": "User",
+                "username": "testD12A",
+                "password": "password",
+            },
+            "accountD12B": {
+                "email": "testD12B@test.com",
+                "firstname": "testD12B",
+                "lastname": "User",
+                "username": "testD12B",
+                "password": "password",
+            },
+
+ 
+            "domain2": {
+               "name": "D2",
+             },
+            "accountD2": {
+                "email": "testD2@test.com",
+                "firstname": "testD2",
+                "lastname": "User",
+                "username": "testD2",
+                "password": "password",
+                "accounttype": "1",
+            },
+            "accountD2A": {
+                "email": "testD2A@test.com",
+                "firstname": "testD2A",
+                "lastname": "User",
+                "username": "testD2A",
+                "password": "password",
+            },
+
+            "accountROOTA": {
+                "email": "testROOTA@test.com",
+                "firstname": "testROOTA",
+                "lastname": "User",
+                "username": "testROOTA",
+                "password": "password",
+            },
+
+            "accountROOT": {
+                "email": "testROOTA@test.com",
+                "firstname": "testROOT",
+                "lastname": "admin",
+                "username": "testROOT",
+                "password": "password",
+            },
+
+            #data reqd for Network creation
+
+            "network": {
+                 "name": "Network-",
+                 "displaytext": "Network-",
+                 "gateway" :"10.223.1.1",
+                 "netmask" :"255.255.255.0",
+                 "startip" :"10.223.1.2",
+                 "endip" :"10.223.1.100",
+            },
+            #small service offering
+            "service_offering": {
+                "small": {
+                    "name": "Small Instance",
+                    "displaytext": "Small Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,
+                    "memory": 128,
+                },
+            },
+            "ostype": 'CentOS 5.6 (64-bit)',
+    }
+ }


[05/50] [abbrv] CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_vpncustomergateways.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_vpncustomergateways.py b/test/integration/component/test_escalations_vpncustomergateways.py
new file mode 100644
index 0000000..dc65768
--- /dev/null
+++ b/test/integration/component/test_escalations_vpncustomergateways.py
@@ -0,0 +1,382 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (createVolume,
+                                  createTemplate)
+from marvin.lib.base import (Volume,
+                             Iso,
+                             VirtualMachine,
+                             Template,
+                             Snapshot,
+                             SecurityGroup,
+                             Account,
+                             Zone,
+                             Network,
+                             NetworkOffering,
+                             DiskOffering,
+                             ServiceOffering,
+                             VmSnapshot,
+                             SnapshotPolicy,
+                             SSHKeyPair,
+                             Resources,
+                             Configurations,
+                             VpnCustomerGateway,
+                             Hypervisor,
+                             VpcOffering,
+                             VPC,
+                             NetworkACL)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_os_types)
+from marvin.lib.utils import (validateList,
+                              cleanup_resources,
+                              random_gen)
+from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+from nose.plugins.attrib import attr
+import time
+
+class TestVpnCustomerGateways(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestVpnCustomerGateways, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            cls.services['mode'] = cls.zone.networktype
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created resources
+        cleanup_resources(self.apiClient, self.cleanup)
+        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)
+
+        return
+
+    def __verify_values(self, expected_vals, actual_vals):
+        """
+        @Desc: Function to verify expected and actual values
+        @Steps:
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_01_list_vpncustomergateways_pagination(self):
+        """
+        @Desc: Test to List VPN Customer Gateways pagination
+        @steps:
+        Step1: Listing all the VPN Customer Gateways for a user
+        Step2: Verifying that no VPN Customer Gateways are listed
+        Step3: Creating (page size + 1) number of VPN Customer Gateways
+        Step4: Listing all the VPN Customer Gateways again for a user
+        Step5: Verifying that list size is (page size + 1)
+        Step6: Listing all the VPN Customer Gateways in page1
+        Step7: Verifying that list size is (page size)
+        Step8: Listing all the VPN Customer Gateways in page2
+        Step9: Verifying that list size is 1
+        Step10: Deleting the VPN Customer Gateways present in page 2
+        Step11: Listing all the VPN Customer Gateways in page2
+        Step12: Verifying that no VPN Customer Gateways are listed
+        """
+        # Listing all the VPN Customer Gateways for a User
+        list_vpncustomergateways_before = VpnCustomerGateway.list(
+                                                                  self.userapiclient,
+                                                                  listall=self.services["listall"]
+                                                                  )
+        # Verifying that no VPN Customer Gateways are listed
+        self.assertIsNone(
+                          list_vpncustomergateways_before,
+                          "VPN Customer Gateways listed for newly created User"
+                          )
+        # Creating pagesize + 1 number of VPN Customer Gateways
+        for i in range(0, (self.services["pagesize"] + 1)):
+            vpncustomergateway_created = VpnCustomerGateway.create(
+                                                                   self.userapiclient,
+                                                                   self.services["vpncustomergateway"],
+                                                                   name="VPNCustGateway"+str(i+1),
+                                                                   gateway="10.102.153." + str(i+1),
+                                                                   cidrlist="10.0.0.0/24",
+                                                                   account=self.account.name,
+                                                                   domainid=self.domain.id
+                                                                   )
+            self.assertIsNotNone(
+                                 vpncustomergateway_created,
+                                 "VPN Customer Gateway creation failed"
+                                 )
+            if (i < self.services["pagesize"] + 1):
+                self.cleanup.append(vpncustomergateway_created)
+
+        # Listing all the VPN Customer Gateways for a User
+        list_vpncustomergateways_after = VpnCustomerGateway.list(
+                                                                 self.userapiclient,
+                                                                 listall=self.services["listall"]
+                                                                 )
+        status = validateList(list_vpncustomergateways_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VPN Customer Gateway creation failed"
+                          )
+        # Verifying that list size is pagesize + 1
+        self.assertEquals(
+                          self.services["pagesize"] + 1,
+                          len(list_vpncustomergateways_after),
+                          "Failed to create pagesize + 1 number of VPN Customer Gateways"
+                          )
+        # Listing all the VPN Customer Gateways in page 1
+        list_vpncustomergateways_page1 = VpnCustomerGateway.list(
+                                                                 self.userapiclient,
+                                                                 listall=self.services["listall"],
+                                                                 page=1,
+                                                                 pagesize=self.services["pagesize"]
+                                                                 )
+        status = validateList(list_vpncustomergateways_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list VPN Customer Gateways in page 1"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_vpncustomergateways_page1),
+                          "Size of VPN Customer Gateways in page 1 is not matching"
+                          )
+        # Listing all the VPN Customer Gateways in page 2
+        list_vpncustomergateways_page2 = VpnCustomerGateway.list(
+                                                                 self.userapiclient,
+                                                                 listall=self.services["listall"],
+                                                                 page=2,
+                                                                 pagesize=self.services["pagesize"]
+                                                                 )
+        status = validateList(list_vpncustomergateways_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list VPN Customer Gateways in page 2"
+                          )
+        # Verifying the list size to be equal to 1
+        self.assertEquals(
+                          1,
+                          len(list_vpncustomergateways_page2),
+                          "Size of VPN Customer Gateways in page 2 is not matching"
+                          )
+        # Deleting the VPM Customer Gateway present in page 2
+        VpnCustomerGateway.delete(
+                                  vpncustomergateway_created,
+                                  self.userapiclient
+                                  )
+        # Listing all the VPN Customer Gateways in page 2 again
+        list_vpncustomergateways_page2 = VpnCustomerGateway.list(
+                                                                 self.userapiclient,
+                                                                 listall=self.services["listall"],
+                                                                 page=2,
+                                                                 pagesize=self.services["pagesize"]
+                                                                 )
+        # Verifying that there are no VPN Customer Gateways listed
+        self.assertIsNone(
+                          list_vpncustomergateways_page2,
+                          "VPN Customer Gateways not deleted from page 2"
+                          )
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_02_update_vpncustomergateways(self):
+        """
+        @Desc: Test to update VPN Customer Gateways pagination
+        @steps:
+        Step1: Listing all the VPN Customer Gateways for a user
+        Step2: Verifying that no VPN Customer Gateways are listed
+        Step3: Creating a VPN Customer Gateways
+        Step4: Listing all the VPN Customer Gateways again for a user
+        Step5: Verifying that list size is 1
+        Step6: Updating the VPN Customer Gateways created in step3
+        Step7: Listing the VPN customer gateway by id
+        Step8: Verifying that list size is 1
+        Step9: Verifying the details of the listed VPN customer gateway are same as updated in step6
+        """
+        # Listing all the VPN Customer Gateways for a User
+        list_vpncustomergateways_before = VpnCustomerGateway.list(
+                                                                  self.userapiclient,
+                                                                  listall=self.services["listall"]
+                                                                  )
+        # Verifying that no VPN Customer Gateways are listed
+        self.assertIsNone(
+                          list_vpncustomergateways_before,
+                          "VPN Customer Gateways listed for newly created User"
+                          )
+        # Creating A VPN Customer Gateways
+        vpncustomergateway_created = VpnCustomerGateway.create(
+                                                               self.userapiclient,
+                                                               self.services["vpncustomergateway"],
+                                                               name="VPNCustGateway",
+                                                               gateway="10.102.153.90",
+                                                               cidrlist="10.0.0.0/24",
+                                                               account=self.account.name,
+                                                               domainid=self.domain.id
+                                                               )
+        self.assertIsNotNone(
+                             vpncustomergateway_created,
+                             "VPN Customer Gateway creation failed"
+                             )
+        self.cleanup.append(vpncustomergateway_created)
+        # Listing all the VPN Customer Gateways for a User
+        list_vpncustomergateways_after = VpnCustomerGateway.list(
+                                                                 self.userapiclient,
+                                                                 listall=self.services["listall"]
+                                                                 )
+        status = validateList(list_vpncustomergateways_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VPN Customer Gateway creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_vpncustomergateways_after),
+                          "Failed to create VPN Customer Gateways"
+                          )
+        # Updating the VPN Customer gateway
+        vpncustomergateway_updated = VpnCustomerGateway.update(
+                                                               vpncustomergateway_created,
+                                                               self.userapiclient,
+                                                               self.services["vpncustomergateway"],
+                                                               name="NewVPNCustGateway",
+                                                               gateway="10.102.153.90",
+                                                               cidrlist="10.0.0.0/24",
+                                                               )
+        self.assertIsNotNone(
+                             vpncustomergateway_updated,
+                             "Updation of VPN Customer Gateway failed"
+                             )
+        # Listing the VPN Customer Gateways by Id
+        list_vpncustomergateway = VpnCustomerGateway.list(
+                                                          self.userapiclient,
+                                                          listall=self.services["listall"],
+                                                          id=vpncustomergateway_created.id
+                                                          )
+        status = validateList(list_vpncustomergateway)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list VPN Customer Gateways by Id"
+                          )
+        # Verifying the list size to be equal to 1
+        self.assertEquals(
+                          1,
+                          len(list_vpncustomergateway),
+                          "Size of VPN Customer Gateways by id is not matching"
+                          )
+        # Verifying the details of the listed VPN Customer Gateway are same as updated
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "name":vpncustomergateway_updated.name,
+                         "id":vpncustomergateway_updated.id,
+                         "account":vpncustomergateway_updated.account,
+                         "domainid":vpncustomergateway_updated.domainid,
+                         "gateway":vpncustomergateway_updated.gateway,
+                         "cidrlist":vpncustomergateway_updated.cidrlist,
+                         "seckey":vpncustomergateway_updated.ipsecpsk,
+                         "ikepolicy":vpncustomergateway_updated.ikepolicy,
+                         "ikelifetime":vpncustomergateway_updated.ikelifetime,
+                         "esppolicy":vpncustomergateway_updated.esppolicy,
+                         "esplifetime":vpncustomergateway_updated.esplifetime,
+                         }
+        actual_dict = {
+                       "name":list_vpncustomergateway[0].name,
+                       "id":list_vpncustomergateway[0].id,
+                       "account":list_vpncustomergateway[0].account,
+                       "domainid":list_vpncustomergateway[0].domainid,
+                       "gateway":list_vpncustomergateway[0].gateway,
+                       "cidrlist":list_vpncustomergateway[0].cidrlist,
+                       "seckey":list_vpncustomergateway[0].ipsecpsk,
+                       "ikepolicy":list_vpncustomergateway[0].ikepolicy,
+                       "ikelifetime":list_vpncustomergateway[0].ikelifetime,
+                       "esppolicy":list_vpncustomergateway[0].esppolicy,
+                       "esplifetime":list_vpncustomergateway[0].esplifetime,
+                       }
+        vpncustomergateway_status = self.__verify_values(
+                                                         expected_dict,
+                                                         actual_dict
+                                                         )
+        self.assertEqual(
+                         True,
+                         vpncustomergateway_status,
+                         "Listed VPN Customer Gateway details are not as Updated"
+                         )
+        return
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 00f49d8..2783805 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -20,6 +20,7 @@
 """
 
 import marvin
+from utils import is_server_ssh_ready, random_gen
 from marvin.cloudstackAPI import *
 from marvin.codes import (FAILED, FAIL, PASS, RUNNING, STOPPED,
                           STARTING, DESTROYED, EXPUNGING,
@@ -621,6 +622,12 @@ class VirtualMachine:
         cmd.id = self.id
         apiclient.destroyVirtualMachine(cmd)
 
+    def expung(self, apiclient):
+        """Expung an Instance"""
+        cmd = expungeVirtualMachine.expungeVirtualMachineCmd()
+        cmd.id = self.id
+        apiclient.expungeVirtualMachine(cmd)
+
     def migrate(self, apiclient, hostid=None):
         """migrate an Instance"""
         cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
@@ -1506,6 +1513,18 @@ class StaticNATRule:
             cmd.vpcid = vpcid
         return StaticNATRule(apiclient.createFirewallRule(cmd).__dict__)
 
+    @classmethod
+    def createIpForwardingRule(cls, apiclient, startport, endport, protocol, ipaddressid, openfirewall):
+        """Creates static ip forwarding rule"""
+
+        cmd = createIpForwardingRule.createIpForwardingRuleCmd()
+        cmd.startport = startport
+        cmd.endport = endport
+        cmd.protocol = protocol
+        cmd.openfirewall = openfirewall
+        cmd.ipaddressid = ipaddressid
+        return StaticNATRule(apiclient.createIpForwardingRule(cmd).__dict__)
+
     def delete(self, apiclient):
         """Delete IP forwarding rule"""
         cmd = deleteIpForwardingRule.deleteIpForwardingRuleCmd()
@@ -1637,6 +1656,162 @@ class FireWallRule:
             cmd.listall=True
         return(apiclient.listFirewallRules(cmd))
 
+class Autoscale:
+
+    """Manage Auto scale"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def listCounters(cls, apiclient, **kwargs):
+        """Lists all available Counters."""
+
+        cmd = listCounters.listCountersCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listCounters(cmd))
+
+    @classmethod
+    def createCondition(cls, apiclient, counterid, relationaloperator, threshold):
+        """creates condition."""
+
+        cmd = createCondition.createConditionCmd()
+        cmd.counterid = counterid
+        cmd.relationaloperator = relationaloperator
+        cmd.threshold = threshold
+        return(apiclient.createCondition(cmd))
+
+    @classmethod
+    def listConditions(cls, apiclient, **kwargs):
+        """Lists all available Conditions."""
+
+        cmd = listConditions.listConditionsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listConditions(cmd))
+
+    @classmethod
+    def listAutoscalePolicies(cls, apiclient, **kwargs):
+        """Lists all available Autoscale Policies."""
+
+        cmd = listAutoScalePolicies.listAutoScalePoliciesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listAutoScalePolicies(cmd))
+
+    @classmethod
+    def createAutoscalePolicy(cls, apiclient, action, conditionids, duration, quiettime=None):
+        """creates condition."""
+
+        cmd = createAutoScalePolicy.createAutoScalePolicyCmd()
+        cmd.action = action
+        cmd.conditionids = conditionids
+        cmd.duration = duration
+        if quiettime:
+            cmd.quiettime = quiettime
+
+        return(apiclient.createAutoScalePolicy(cmd))
+
+    @classmethod
+    def updateAutoscalePolicy(cls, apiclient, id, **kwargs):
+        """Updates Autoscale Policy."""
+
+        cmd = updateAutoScalePolicy.updateAutoScalePolicyCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateAutoScalePolicy(cmd))
+
+    @classmethod
+    def listAutoscaleVmPofiles(cls, apiclient, **kwargs):
+        """Lists all available AutoscaleVM  Profiles."""
+
+        cmd = listAutoScaleVmProfiles.listAutoScaleVmProfilesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listAutoScaleVmProfiles(cmd))
+
+    @classmethod
+    def createAutoscaleVmProfile(cls, apiclient, serviceofferingid, zoneid, templateid, 
+                                 autoscaleuserid=None, destroyvmgraceperiod=None, counterparam=None):
+        """creates Autoscale VM Profile."""
+
+        cmd = createAutoScaleVmProfile.createAutoScaleVmProfileCmd()
+        cmd.serviceofferingid = serviceofferingid
+        cmd.zoneid = zoneid
+        cmd.templateid = templateid
+        if autoscaleuserid:
+            cmd.autoscaleuserid = autoscaleuserid
+
+        if destroyvmgraceperiod:
+            cmd.destroyvmgraceperiod = destroyvmgraceperiod
+
+        if counterparam:
+            for name, value in counterparam.items():
+                cmd.counterparam.append({
+                    'name': name,
+                    'value': value
+                })
+
+        return(apiclient.createAutoScaleVmProfile(cmd))
+
+    @classmethod
+    def updateAutoscaleVMProfile(cls, apiclient, id, **kwargs):
+        """Updates Autoscale Policy."""
+
+        cmd = updateAutoScaleVmProfile.updateAutoScaleVmProfileCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateAutoScaleVmProfile(cmd))
+
+    @classmethod
+    def createAutoscaleVmGroup(cls, apiclient, lbruleid, minmembers, maxmembers, 
+                                 scaledownpolicyids, scaleuppolicyids, vmprofileid, interval=None):
+        """creates Autoscale VM Group."""
+
+        cmd = createAutoScaleVmGroup.createAutoScaleVmGroupCmd()
+        cmd.lbruleid = lbruleid
+        cmd.minmembers = minmembers
+        cmd.maxmembers = maxmembers
+        cmd.scaledownpolicyids = scaledownpolicyids
+        cmd.scaleuppolicyids = scaleuppolicyids
+        cmd.vmprofileid = vmprofileid
+        if interval:
+            cmd.interval = interval
+
+        return(apiclient.createAutoScaleVmGroup(cmd))
+
+    @classmethod
+    def listAutoscaleVmGroup(cls, apiclient, **kwargs):
+        """Lists all available AutoscaleVM  Group."""
+
+        cmd = listAutoScaleVmGroups.listAutoScaleVmGroupsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listAutoScaleVmGroups(cmd))
+
+    @classmethod
+    def enableAutoscaleVmGroup(cls, apiclient, id, **kwargs):
+        """Enables AutoscaleVM  Group."""
+
+        cmd = enableAutoScaleVmGroup.enableAutoScaleVmGroupCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.enableAutoScaleVmGroup(cmd))
+
+    @classmethod
+    def disableAutoscaleVmGroup(cls, apiclient, id, **kwargs):
+        """Disables AutoscaleVM  Group."""
+
+        cmd = disableAutoScaleVmGroup.disableAutoScaleVmGroupCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.disableAutoScaleVmGroup(cmd))
+
+    @classmethod
+    def updateAutoscaleVMGroup(cls, apiclient, id, **kwargs):
+        """Updates Autoscale VM Group."""
+
+        cmd = updateAutoScaleVmGroup.updateAutoScaleVmGroupCmd()
+        cmd.id = id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateAutoScaleVmGroup(cmd))
+
 
 class ServiceOffering:
 
@@ -2011,6 +2186,18 @@ class LoadBalancerRule:
             cmd.listall=True
         return(apiclient.listLoadBalancerRules(cmd))
 
+    @classmethod
+    def listLoadBalancerRuleInstances(cls, apiclient, id, applied=None, **kwargs):
+        """Lists load balancing rule Instances"""
+
+        cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
+        cmd.id = id
+        if applied:
+            cmd.applied = applied
+
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return apiclient.listLoadBalancerRuleInstances(cmd)
+
 
 class Cluster:
 
@@ -2506,7 +2693,7 @@ class Vpn:
 
     @classmethod
     def create(cls, apiclient, publicipid, account=None, domainid=None,
-               projectid=None, networkid=None, vpcid=None):
+               projectid=None, networkid=None, vpcid=None, openfirewall=None):
         """Create VPN for Public IP address"""
         cmd = createRemoteAccessVpn.createRemoteAccessVpnCmd()
         cmd.publicipid = publicipid
@@ -2520,6 +2707,8 @@ class Vpn:
             cmd.networkid = networkid
         if vpcid:
             cmd.vpcid = vpcid
+        if openfirewall:
+            cmd.openfirewall = openfirewall
         return Vpn(apiclient.createRemoteAccessVpn(cmd).__dict__)
 
     def delete(self, apiclient):


[23/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6888: Read postable IP configuration from config

(cherry picked from commit 49467f295410f1f0e265e7ce5ee6dd849207c3e8)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b518d612
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b518d612
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b518d612

Branch: refs/heads/4.4
Commit: b518d612034805593eecc6aa55715b600dc7d439
Parents: 92a9703
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Jun 13 09:38:16 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:47 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 51 +++++++++------------
 tools/marvin/marvin/lib/common.py              | 37 ++++++++++++++-
 2 files changed, 58 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b518d612/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 77a5ab6..538318d 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -37,10 +37,11 @@ from marvin.lib.common import (get_zone,
                                get_domain,
                                get_region,
                                get_pod,
-                               isIpInDesiredState)
+                               isIpInDesiredState,
+                               getPortableIpRangeServices)
 from netaddr import IPAddress
 from marvin.sshClient import SshClient
-
+from marvin.codes import FAILED
 from nose.plugins.attrib import attr
 
 class Services:
@@ -142,15 +143,7 @@ class Services:
                                   "publicport": 22,
                                   "protocol": 'TCP',
                         },
-                        "ostype": 'CentOS 5.3 (64-bit)',
-                        "portableIpRange": {
-                            "gateway" : "10.223.252.195",
-                            "netmask" : "255.255.255.192",
-                            "startip" : "10.223.252.196",
-                            "endip"   : "10.223.252.197",
-                            "vlan"    : "1001"
-                        }
-
+                        "ostype": 'CentOS 5.3 (64-bit)'
           }
 
 class TestCreatePortablePublicIpRanges(cloudstackTestCase):
@@ -208,8 +201,8 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Create new portable ip range with root admin api
         # 2. Portable ip range should be created successfully
 
-        portable_ip_range_services = self.services["portableIpRange"]
-        if portable_ip_range_services is None:
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -231,9 +224,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Create new portable ip range with non root admin api client
         # 2. Portable ip range should not be created
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         try:
@@ -267,9 +260,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Try to create new portable ip range with invalid region id
         # 2. Portable ip range creation should fail
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = -1
@@ -321,9 +314,9 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -480,9 +473,9 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
 
         #create new portable ip range
-        self.portable_ip_range_services = self.services["portableIpRange"]
+        self.portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if self.portable_ip_range_services is None:
+        if self.portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         self.portable_ip_range_services["regionid"] = self.region.id
@@ -643,9 +636,9 @@ class TestAssociatePublicIp(cloudstackTestCase):
 
         self.cleanup = []
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -978,9 +971,9 @@ class TestDisassociatePublicIp(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
         self.cleanup = []
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -1172,8 +1165,8 @@ class TestDeleteAccount(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
 
-        portable_ip_range_services = self.services["portableIpRange"]
-        if portable_ip_range_services is None:
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         self.cleanup = []
@@ -1432,9 +1425,9 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
 
         #create new portable ip range
-        self.portable_ip_range_services = self.services["portableIpRange"]
+        self.portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if self.portable_ip_range_services is None:
+        if self.portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         self.portable_ip_range_services["regionid"] = self.region.id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b518d612/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 91fe053..7753385 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -61,7 +61,7 @@ from marvin.cloudstackAPI import (listConfigurations,
 
 from marvin.sshClient import SshClient
 from marvin.codes import (PASS, ISOLATED_NETWORK, VPC_NETWORK,
-                          BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE)
+                          BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE, FAILED)
 import random
 from marvin.lib.utils import *
 from marvin.lib.base import *
@@ -1187,3 +1187,38 @@ def createNetworkRulesForVM(apiclient, virtualmachine, ruletype,
     except Exception as e:
         [FAIL, e]
     return [PASS, public_ip]
+
+def getPortableIpRangeServices(config):
+    """ Reads config values related to portable ip and fills up
+    services accordingly"""
+
+    services = {}
+    attributeError = False
+
+    if config.portableIpRange.startip:
+        services["startip"] = config.portableIpRange.startip
+    else:
+        attributeError = True
+
+    if config.portableIpRange.endip:
+        services["endip"] = config.portableIpRange.endip
+    else:
+        attributeError = True
+
+    if config.portableIpRange.netmask:
+        services["netmask"] = config.portableIpRange.netmask
+    else:
+        attributeError = True
+
+    if config.portableIpRange.gateway:
+        services["gateway"] = config.portableIpRange.gateway
+    else:
+        attributeError = True
+
+    if config.portableIpRange.vlan:
+        services["vlan"] = config.portableIpRange.vlan
+
+    if attributeError:
+        services = FAILED
+
+    return services


[27/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-1466: Automation - Priamary Storage Limits

(cherry picked from commit a0f19d4bd5d7bec6613aa8130b3da9ecffc71d0b)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/12b6cf1b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/12b6cf1b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/12b6cf1b

Branch: refs/heads/4.4
Commit: 12b6cf1be5fafe918328937d33aad5b377d9eead
Parents: f753272
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue Jun 17 20:32:12 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:49 2014 +0200

----------------------------------------------------------------------
 .../component/test_ps_domain_limits.py          | 690 +++++++++++++++++++
 test/integration/component/test_ps_limits.py    | 588 ++++++++++++++++
 .../integration/component/test_ps_max_limits.py | 300 ++++++++
 .../component/test_ps_project_limits.py         | 238 +++++++
 .../component/test_ps_resize_volume.py          | 339 +++++++++
 tools/marvin/marvin/codes.py                    |  24 +
 tools/marvin/marvin/lib/base.py                 |  36 +-
 tools/marvin/marvin/lib/common.py               | 135 +++-
 8 files changed, 2343 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/test/integration/component/test_ps_domain_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_domain_limits.py b/test/integration/component/test_ps_domain_limits.py
new file mode 100644
index 0000000..afb0955
--- /dev/null
+++ b/test/integration/component/test_ps_domain_limits.py
@@ -0,0 +1,690 @@
+# 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 primary storage domain limits
+
+    Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domain+or+accounts
+
+    Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-1466
+
+    Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (Account,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Resources,
+                             Domain,
+                             Volume,
+                             DiskOffering,
+                             Snapshot)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               createSnapshotFromVirtualMachineVolume,
+                               isVmExpunged,
+                               isDomainResourceCountEqualToExpectedCount)
+from marvin.lib.utils import (cleanup_resources)
+from marvin.codes import (PASS,
+                          FAIL,
+                          FAILED,
+                          RESOURCE_PRIMARY_STORAGE)
+
+class TestMultipleChildDomain(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cloudstackTestClient = super(TestMultipleChildDomain,
+                               cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        # Fill services from the external config file
+        cls.services = cloudstackTestClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
+        cls.services["mode"] = cls.zone.networktype
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+
+        cls._cleanup = []
+        try:
+            cls.service_offering = ServiceOffering.create(cls.api_client,
+                    cls.services["service_offering"])
+            cls._cleanup.append(cls.service_offering)
+        except Exception as e:
+            cls.tearDownClass()
+            raise unittest.SkipTest("Exception in setUpClass: %s" % e)
+        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 = []
+        self.services["disk_offering"]["disksize"] = 5
+        try:
+            self.disk_offering = DiskOffering.create(
+                                    self.apiclient,
+                                    self.services["disk_offering"]
+                                    )
+            self.assertNotEqual(self.disk_offering, None, \
+                    "Disk offering is None")
+            self.cleanup.append(self.disk_offering)
+        except Exception as e:
+            self.tearDown()
+            self.skipTest("Failure while creating disk offering: %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+            pass
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def updateDomainResourceLimits(self, parentdomainlimit, subdomainlimit):
+        """Update primary storage limits of the parent domain and its
+        child domains"""
+
+        try:
+            #Update resource limit for domain
+            Resources.updateLimit(self.apiclient, resourcetype=10,
+                              max=parentdomainlimit,
+                              domainid=self.parent_domain.id)
+
+            # Update Resource limit for sub-domains
+            Resources.updateLimit(self.apiclient, resourcetype=10,
+                              max=subdomainlimit,
+                              domainid=self.cadmin_1.domainid)
+
+            Resources.updateLimit(self.apiclient, resourcetype=10,
+                              max=subdomainlimit,
+                              domainid=self.cadmin_2.domainid)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    def setupAccounts(self):
+        try:
+            self.parent_domain = Domain.create(self.apiclient,
+                                        services=self.services["domain"],
+                                        parentdomainid=self.domain.id)
+            self.parentd_admin = Account.create(self.apiclient, self.services["account"],
+                                            admin=True, domainid=self.parent_domain.id)
+
+            # Create sub-domains and their admin accounts
+            self.cdomain_1 = Domain.create(self.apiclient,
+                                       services=self.services["domain"],
+                                       parentdomainid=self.parent_domain.id)
+            self.cdomain_2 = Domain.create(self.apiclient,
+                                        services=self.services["domain"],
+                                        parentdomainid=self.parent_domain.id)
+
+            self.cadmin_1 = Account.create(self.apiclient, self.services["account"],
+                                       admin=True, domainid=self.cdomain_1.id)
+
+            self.cadmin_2 = Account.create(self.apiclient, self.services["account"],
+                                       admin=True, domainid=self.cdomain_2.id)
+
+            # Cleanup the resources created at end of test
+            self.cleanup.append(self.cadmin_1)
+            self.cleanup.append(self.cadmin_2)
+            self.cleanup.append(self.cdomain_1)
+            self.cleanup.append(self.cdomain_2)
+            self.cleanup.append(self.parentd_admin)
+            self.cleanup.append(self.parent_domain)
+
+            users = {
+                 self.cdomain_1: self.cadmin_1,
+                 self.cdomain_2: self.cadmin_2
+                 }
+        except Exception as e:
+            return [FAIL, e, None]
+        return [PASS, None, users]
+
+    @attr(tags=["advanced","selfservice"])
+    def test_01_multiple_domains_primary_storage_limits(self):
+        """Test primary storage limit of domain and its sub-domains
+
+        # Steps
+        1. Create a parent domain and two sub-domains in it (also admin accounts
+           of each domain)
+        2. Update primary storage limits of the parent domain and child domains
+        3. Deploy VM in child domain 1 so that total primary storage
+           is less than the limit of child domain
+        4. Repeat step 3 for child domain 2
+        5. Try to deploy VM in parent domain now so that the total primary storage in
+           parent domain (including that in sub-domains is more than the primary
+           storage limit of the parent domain
+        6. Delete the admin account of child domain 1 and check resource count
+           of the parent domain
+        7.  Delete VM deployed in account 2 and check primary storage count
+           of parent domain
+
+        # Validations:
+        1. Step 3 and 4 should succeed
+        2. Step 5 should fail as the resource limit exceeds in parent domain
+        3. After step 6, resource count in parent domain should decrease by equivalent
+           quantity
+        4. After step 7, resource count in parent domain should be 0"""
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS,\
+            "Failure while setting up accounts and domains: %s" % result[1])
+
+        templatesize = (self.template.size / (1024**3))
+        disksize = 10
+        subdomainlimit = (templatesize + disksize)
+
+        result = self.updateDomainResourceLimits(((subdomainlimit*3)- 1), subdomainlimit)
+        self.assertEqual(result[0], PASS,\
+            "Failure while updating resource limits: %s" % result[1])
+
+        try:
+            self.services["disk_offering"]["disksize"] = disksize
+            disk_offering_custom = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+            self.cleanup.append(disk_offering_custom)
+        except Exception as e:
+            self.fail("Failed to create disk offering")
+
+        # Get API clients of parent and child domain admin accounts
+        api_client_admin = self.testClient.getUserApiClient(
+                        UserName=self.parentd_admin.name,
+                        DomainName=self.parentd_admin.domain)
+        self.assertNotEqual(api_client_admin, FAILED,\
+            "Failed to create api client for account: %s" % self.parentd_admin.name)
+
+        api_client_cadmin_1 = self.testClient.getUserApiClient(
+                                UserName=self.cadmin_1.name,
+                                DomainName=self.cadmin_1.domain)
+        self.assertNotEqual(api_client_cadmin_1, FAILED,\
+            "Failed to create api client for account: %s" % self.cadmin_1.name)
+
+        api_client_cadmin_2 = self.testClient.getUserApiClient(
+                                UserName=self.cadmin_2.name,
+                                DomainName=self.cadmin_2.domain)
+        self.assertNotEqual(api_client_cadmin_2, FAILED,\
+            "Failed to create api client for account: %s" % self.cadmin_2.name)
+
+        VirtualMachine.create(
+                api_client_cadmin_1, self.services["virtual_machine"],
+                accountid=self.cadmin_1.name, domainid=self.cadmin_1.domainid,
+                diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
+                )
+
+        self.initialResourceCount = (templatesize + disksize)
+        result = isDomainResourceCountEqualToExpectedCount(
+                        self.apiclient, self.parent_domain.id,
+                        self.initialResourceCount, RESOURCE_PRIMARY_STORAGE)
+        self.assertFalse(result[0], result[1])
+        self.assertTrue(result[2], "Resource count does not match")
+
+        # Create VM in second child domain
+        vm_2 = VirtualMachine.create(
+                api_client_cadmin_2, self.services["virtual_machine"],
+                accountid=self.cadmin_2.name, domainid=self.cadmin_2.domainid,
+                diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
+                )
+
+        # Now the VMs in two child domains have exhausted the primary storage limit
+        # of parent domain, hence VM creation in parent domain with custom disk offering
+        # should fail
+        with self.assertRaises(Exception):
+            VirtualMachine.create(
+                    api_client_admin, self.services["virtual_machine"],
+                    accountid=self.parentd_admin.name, domainid=self.parentd_admin.domainid,
+                    diskofferingid=disk_offering_custom.id, serviceofferingid=self.service_offering.id
+                    )
+
+        # Deleting user account
+        self.cadmin_1.delete(self.apiclient)
+        self.cleanup.remove(self.cadmin_1)
+
+        expectedCount = self.initialResourceCount
+        result = isDomainResourceCountEqualToExpectedCount(
+                        self.apiclient, self.parent_domain.id,
+                        expectedCount, RESOURCE_PRIMARY_STORAGE)
+        self.assertFalse(result[0], result[1])
+        self.assertTrue(result[2], "Resource count does not match")
+
+        try:
+            vm_2.delete(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to delete instance: %s" % e)
+
+        self.assertTrue(isVmExpunged(self.apiclient, vm_2.id), "VM not expunged \
+                in allotted time")
+
+        expectedCount = 0
+        result = isDomainResourceCountEqualToExpectedCount(
+                    self.apiclient, self.parent_domain.id,
+                    expectedCount, RESOURCE_PRIMARY_STORAGE)
+        self.assertFalse(result[0], result[1])
+        self.assertTrue(result[2], "Resource count does not match")
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_02_multiple_domains_primary_storage_limits(self):
+        """Test primary storage counts in multiple child domains
+        # Steps
+        1. Create a parent domain and two sub-domains in it (also admin accounts
+           of each domain)
+        Repeat following steps for both the child domains
+        2. Deploy VM in child domain
+        3. Check if the resource count for domain is updated correctly
+        4. Create a volume and attach it to the VM
+        5. Check if the primary storage resource count is updated correctly
+
+        """
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS,\
+            "Failure while setting up accounts and domains: %s" % result[1])
+        users = result[2]
+
+        templatesize = (self.template.size / (1024**3))
+
+        for domain, admin in users.items():
+            self.account = admin
+            self.domain = domain
+
+            apiclient = self.testClient.getUserApiClient(
+                                UserName=self.account.name,
+                                DomainName=self.account.domain)
+            self.assertNotEqual(apiclient, FAILED,\
+            "Failed to create api client for account: %s" % self.account.name)
+            try:
+                vm = VirtualMachine.create(
+                        apiclient, self.services["virtual_machine"],
+                        accountid=self.account.name, domainid=self.account.domainid,
+                        diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
+                        )
+
+                expectedCount = templatesize + self.disk_offering.disksize
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                # Creating service offering with 10 GB volume
+                self.services["disk_offering"]["disksize"] = 10
+                disk_offering_10_GB = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+
+                self.cleanup.append(disk_offering_10_GB)
+
+                volume = Volume.create(
+                            apiclient, self.services["volume"],
+                            zoneid=self.zone.id, account=self.account.name,
+                            domainid=self.account.domainid, diskofferingid=disk_offering_10_GB.id
+                            )
+
+                volumeSize = (volume.size / (1024**3))
+                expectedCount += volumeSize
+
+       	        vm.attach_volume(apiclient, volume=volume)
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                expectedCount -= volumeSize
+                vm.detach_volume(apiclient, volume=volume)
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+            except Exception as e:
+                self.fail("Failure: %s" % e)
+	    return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_03_multiple_domains_multiple_volumes(self):
+        """Test primary storage counts in multiple child domains
+        # Steps
+        1. Create a parent domain and two sub-domains in it (also admin accounts
+           of each domain)
+        Repeat following steps for both the child domains
+        2. Deploy VM in child domain
+        3. Check if the resource count for domain is updated correctly
+        4. Create multiple volumes and attach it to the VM
+        5. Check if the primary storage resource count is updated correctly
+        6. Delete one of the volumes and check if the primary storage resource count
+           reduced by equivalent number
+        7. Detach other volume and check primary storage resource count remains the same
+
+        """
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        if result[0] == FAIL:
+            self.fail("Failure while setting up accounts and domains: %s" % result[1])
+        else:
+            users = result[2]
+
+        templatesize = (self.template.size / (1024**3))
+
+        for domain, admin in users.items():
+            self.account = admin
+            self.domain = domain
+
+            apiclient = self.testClient.getUserApiClient(
+                                UserName=self.account.name,
+                                DomainName=self.account.domain)
+            self.assertNotEqual(apiclient, FAILED,\
+            "Failed to create api client for account: %s" % self.account.name)
+
+            try:
+                vm = VirtualMachine.create(
+                        apiclient, self.services["virtual_machine"],
+                        accountid=self.account.name, domainid=self.account.domainid,
+                        diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
+                        )
+
+                expectedCount = templatesize + self.disk_offering.disksize
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                volume1size = self.services["disk_offering"]["disksize"] = 15
+                disk_offering_15_GB = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+
+                self.cleanup.append(disk_offering_15_GB)
+
+                volume2size = self.services["disk_offering"]["disksize"] = 20
+                disk_offering_20_GB = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+
+                self.cleanup.append(disk_offering_20_GB)
+
+                volume_1 = Volume.create(
+                            apiclient, self.services["volume"],
+                            zoneid=self.zone.id, account=self.account.name,
+                            domainid=self.account.domainid, diskofferingid=disk_offering_15_GB.id
+                            )
+
+                volume_2 = Volume.create(
+                            apiclient, self.services["volume"],
+                            zoneid=self.zone.id, account=self.account.name,
+                            domainid=self.account.domainid, diskofferingid=disk_offering_20_GB.id
+                            )
+
+                vm.attach_volume(apiclient, volume=volume_1)
+                vm.attach_volume(apiclient, volume=volume_2)
+
+                expectedCount += volume1size + volume2size
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                vm.detach_volume(apiclient, volume=volume_1)
+                volume_1.delete(apiclient)
+
+                expectedCount -= volume1size
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                expectedCount -= volume2size
+                vm.detach_volume(apiclient, volume=volume_2)
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+            except Exception as e:
+                self.fail("Failure: %s" % e)
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_04_create_template_snapshot(self):
+        """Test create snapshot and templates from volume
+
+        # Validate the following
+        1. Create parent domain with two child sub-domains (and their admin accounts)
+        Follow these steps for both the domains
+        # 1. Create template from snapshot and verify secondary storage resource count
+        # 2. Create Volume from Snapshot and verify primary storage resource count
+        # 3. Attach volume to instance which was created from snapshot and
+        #    verify primary storage resource count
+        # 4. Detach volume from instance which was created from snapshot and
+        #    verify the primary storage resource count
+        # 5. Delete volume which was created from snapshot and verify primary storage
+             resource count"""
+
+        result = self.setupAccounts()
+        if result[0] == FAIL:
+            self.fail("Failure while setting up accounts and domains: %s" % result[1])
+        users = result[2]
+
+        for domain, admin in users.items():
+            self.account = admin
+            self.domain = domain
+
+            try:
+                apiclient = self.testClient.getUserApiClient(
+                                UserName=self.account.name,
+                                DomainName=self.account.domain)
+                self.assertNotEqual(apiclient, FAILED,\
+                 "Failed to create api client for account: %s" % self.account.name)
+
+                vm = VirtualMachine.create(
+                            apiclient, self.services["virtual_machine"],
+                            accountid=self.account.name, domainid=self.account.domainid,
+                            diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
+                            )
+
+                templatesize = (self.template.size / (1024**3))
+
+                initialResourceCount = expectedCount = templatesize + self.disk_offering.disksize
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            initialResourceCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                vm.stop(self.apiclient)
+
+                response = createSnapshotFromVirtualMachineVolume(apiclient, self.account, vm.id)
+                self.assertEqual(response[0], PASS, response[1])
+                snapshot = response[1]
+
+                response = snapshot.validateState(apiclient, Snapshot.BACKED_UP)
+                self.assertEqual(response[0], PASS, response[1])
+
+                self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
+                volume = Volume.create_from_snapshot(apiclient,
+                                        snapshot_id=snapshot.id,
+                                        services=self.services["volume"],
+                                        account=self.account.name,
+                                        domainid=self.account.domainid)
+                volumeSize = (volume.size / (1024**3))
+                vm.attach_volume(apiclient, volume)
+                expectedCount = initialResourceCount + (volumeSize)
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                expectedCount -= volumeSize
+                vm.detach_volume(apiclient, volume)
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                volume.delete(apiclient)
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.domain.id,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+            except Exception as e:
+                self.fail("Failed with exception : %s" % e)
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_05_assign_virtual_machine_different_domain(self):
+	"""Test assign virtual machine to account belonging to different domain
+
+        # Steps
+        1. Create a parent domain and two sub-domains in it (also admin accounts
+           of each domain)
+        2. Deploy VM in child domain 1
+        3. Check if the resource count for domain 1 is updated correctly
+        4. Assign this virtual machine to account 2 in domain 2
+        5. Verify that primaru storage resource count of domain 1 is now 0 and
+           primary storage resource count of domain 2 is increased by equivalent number
+        """
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS, result[1])
+
+        apiclient = self.testClient.getUserApiClient(
+                                UserName=self.cadmin_1.name,
+                                DomainName=self.cadmin_1.domain)
+        self.assertNotEqual(apiclient, FAILED,\
+                 "Failed to create api client for account: %s" % self.cadmin_1.name)
+
+        try:
+            vm_1 = VirtualMachine.create(
+                    apiclient, self.services["virtual_machine"],
+                    accountid=self.cadmin_1.name, domainid=self.cadmin_1.domainid,
+                    diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
+                    )
+
+            templatesize = (self.template.size / (1024**3))
+
+            expectedCount = templatesize + self.disk_offering.disksize
+            result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.cadmin_1.domainid,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+            self.assertFalse(result[0], result[1])
+            self.assertTrue(result[2], "Resource count does not match")
+
+            vm_1.stop(apiclient)
+            vm_1.assign_virtual_machine(self.apiclient, account=self.cadmin_2.name,
+				    domainid=self.cadmin_2.domainid)
+
+            result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.cadmin_2.domainid,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+            self.assertFalse(result[0], result[1])
+            self.assertTrue(result[2], "Resource count does not match")
+
+            expectedCount = 0
+            result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.cadmin_1.domainid,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+            self.assertFalse(result[0], result[1])
+            self.assertTrue(result[2], "Resource count does not match")
+        except Exception as e:
+            self.fail("Failed with exception: %s" % e)
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_06_destroy_recover_vm(self):
+	"""Test primary storage counts while destroying and recovering VM
+        # Steps
+        1. Create a parent domain and two sub-domains in it (also admin accounts
+           of each domain)
+        Repeat following steps for both the child domains
+        2. Deploy VM in child domain
+        3. Check if the resource count for domain is updated correctly
+        4. Destroy the VM
+        5. Verify that the primary storage resource count remains the same
+        6. Recover the VM
+        7. Verify that the primary storage resource count remains the same
+        """
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS, result[1])
+        users = result[2]
+
+        for domain, admin in users.items():
+            self.account = admin
+            self.domain = domain
+            try:
+                vm_1 = VirtualMachine.create(
+                    self.apiclient, self.services["virtual_machine"],
+                    accountid=self.account.name, domainid=self.account.domainid,
+                    diskofferingid=self.disk_offering.id, serviceofferingid=self.service_offering.id
+                    )
+
+                templatesize = (self.template.size / (1024**3))
+
+                expectedCount = templatesize + self.disk_offering.disksize
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.account.domainid,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                vm_1.delete(self.apiclient)
+
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.account.domainid,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+
+                vm_1.recover(self.apiclient)
+
+                result = isDomainResourceCountEqualToExpectedCount(
+                            self.apiclient, self.account.domainid,
+                            expectedCount, RESOURCE_PRIMARY_STORAGE)
+                self.assertFalse(result[0], result[1])
+                self.assertTrue(result[2], "Resource count does not match")
+            except Exception as e:
+                self.fail("Failed with exception: %s" % e)
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/test/integration/component/test_ps_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_limits.py b/test/integration/component/test_ps_limits.py
new file mode 100644
index 0000000..1993e93
--- /dev/null
+++ b/test/integration/component/test_ps_limits.py
@@ -0,0 +1,588 @@
+# 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 primary storage limits
+
+    Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domain+or+accounts
+
+    Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-1466
+
+    Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (
+                             Account,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Domain,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               matchResourceCount,
+                               createSnapshotFromVirtualMachineVolume,
+                               isVmExpunged)
+from marvin.lib.utils import (cleanup_resources,
+                              validateList)
+from marvin.codes import (PASS,
+                          FAIL,
+                          RESOURCE_PRIMARY_STORAGE,
+                          CHILD_DOMAIN_ADMIN,
+                          ROOT_DOMAIN_ADMIN)
+from ddt import ddt, data
+
+@ddt
+class TestVolumeLimits(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cloudstackTestClient = super(TestVolumeLimits,
+                               cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        # Fill services from the external config file
+        cls.services = cloudstackTestClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
+        cls.services["mode"] = cls.zone.networktype
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
+        try:
+            cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
+            cls._cleanup.append(cls.service_offering)
+        except Exception as e:
+            cls.tearDownClass()
+            raise unittest.SkipTest("Exception in setUpClass: %s" % e)
+        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 = []
+        try:
+            self.services["disk_offering"]["disksize"] = 2
+            self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"])
+            self.assertNotEqual(self.disk_offering, None,\
+                    "Disk offering is None")
+            self.cleanup.append(self.disk_offering)
+        except Exception as e:
+            self.tearDown()
+            self.skipTest("Failure in setup: %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+            pass
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setupAccount(self, accountType):
+        """Setup the account required for the test"""
+
+        try:
+            if accountType == CHILD_DOMAIN_ADMIN:
+                self.domain = Domain.create(self.apiclient,
+                                        services=self.services["domain"],
+                                        parentdomainid=self.domain.id)
+
+            self.account = Account.create(self.apiclient, self.services["account"],
+                                      domainid=self.domain.id, admin=True)
+            self.cleanup.append(self.account)
+            if accountType == CHILD_DOMAIN_ADMIN:
+                self.cleanup.append(self.domain)
+
+            self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
+                            accountid=self.account.name, domainid=self.account.domainid,
+                            diskofferingid=self.disk_offering.id,
+                            serviceofferingid=self.service_offering.id)
+
+            accounts = Account.list(self.apiclient, id=self.account.id)
+
+            self.assertEqual(validateList(accounts)[0], PASS,
+                             "accounts list validation failed")
+
+            self.initialResourceCount = int(accounts[0].primarystoragetotal)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced", "selfservice"])
+    def test_stop_start_vm(self, value):
+        """Test Deploy VM with 5 GB volume & verify the usage
+
+        # Validate the following
+        # 1. Create a VM with custom disk offering and check the primary storage count
+        # 2. Stop VM and verify the resource count remains same
+        # 3. Start VM and verify resource count remains same"""
+
+        response = self.setupAccount(value)
+        self.assertEqual(response[0], PASS, response[1])
+
+        expectedCount = self.initialResourceCount
+        # Stopping instance
+        try:
+            self.virtualMachine.stop(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to stop instance: %s" % e)
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        # Starting instance
+        try:
+            self.virtualMachine.start(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to start instance: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return
+
+    @unittest.skip("skip")
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced", "selfservice"])
+    def test_destroy_recover_vm(self, value):
+        """Test delete and recover instance
+
+        # Validate the following
+        # 1. Create a VM with custom disk offering and check the primary storage count
+        # 2. Destroy VM and verify the resource count remains same
+        # 3. Recover VM and verify resource count remains same"""
+
+        response = self.setupAccount(value)
+        self.assertEqual(response[0], PASS, response[1])
+
+        expectedCount = self.initialResourceCount
+        # Stopping instance
+        try:
+            self.virtualMachine.delete(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to destroy instance: %s" % e)
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        # Recovering instance
+        try:
+            self.virtualMachine.recover(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to start instance: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return
+
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced", "selfservice"])
+    def test_attach_detach_volume(self, value):
+        """Stop attach and detach volume from VM
+
+        # Validate the following
+        # 1. Create a VM with custom disk offering and check the primary storage count
+        #    of account
+        # 2. Create custom volume in account
+        # 3. Verify that primary storage count increases by same amount
+        # 4. Attach volume to VM and verify resource count remains the same
+        # 5. Detach volume and verify resource count remains the same"""
+
+        response = self.setupAccount(value)
+        self.assertEqual(response[0], PASS, response[1])
+
+        apiclient = self.apiclient
+        if value == CHILD_DOMAIN_ADMIN:
+            apiclient = self.testClient.getUserApiClient(
+                                        UserName=self.account.name,
+                                        DomainName=self.account.domain
+                                        )
+            self.assertNotEqual(apiclient, FAIL, "Failure while getting\
+                    api client of account: %s" % self.account.name)
+
+        try:
+            self.services["disk_offering"]["disksize"] = 4
+            expectedCount = self.initialResourceCount + int(self.services["disk_offering"]["disksize"])
+            disk_offering = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+
+            self.cleanup.append(disk_offering)
+
+            volume = Volume.create(
+                    apiclient,self.services["volume"],zoneid=self.zone.id,
+                    account=self.account.name,domainid=self.account.domainid,
+                    diskofferingid=disk_offering.id)
+        except Exception as e:
+            self.fail("Failure: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+       	    self.virtualMachine.attach_volume(apiclient, volume=volume)
+        except Exception as e:
+            self.fail("Failed while attaching volume to VM: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.virtualMachine.detach_volume(apiclient, volume=volume)
+        except Exception as e:
+            self.fail("Failure while detaching volume: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return
+
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced", "selfservice"])
+    def test_create_multiple_volumes(self, value):
+        """Test create multiple volumes
+
+        # Validate the following
+        # 1. Create a VM with custom disk offering and check the primary storage count
+        #    of account
+        # 2. Create multiple volumes in account
+        # 3. Verify that primary storage count increases by same amount
+        # 4. Attach volumes to VM and verify resource count remains the same
+        # 5. Detach and delete both volumes one by one and verify resource count decreases
+        #    proportionately"""
+
+        # Creating service offering with 10 GB volume
+
+        response = self.setupAccount(value)
+        self.assertEqual(response[0], PASS, response[1])
+
+        apiclient = self.apiclient
+        if value == CHILD_DOMAIN_ADMIN:
+            apiclient = self.testClient.getUserApiClient(
+                                        UserName=self.account.name,
+                                        DomainName=self.account.domain
+                                        )
+            self.assertNotEqual(apiclient, FAIL, "Failure while getting\
+                                api client of account %s" % self.account.name)
+
+        try:
+            self.services["disk_offering"]["disksize"] = 5
+            disk_offering_5_GB = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+            self.cleanup.append(disk_offering_5_GB)
+
+            self.services["disk_offering"]["disksize"] = 10
+            disk_offering_10_GB = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+
+            self.cleanup.append(disk_offering_10_GB)
+
+            volume_1 = Volume.create(
+                    apiclient,self.services["volume"],zoneid=self.zone.id,
+                    account=self.account.name,domainid=self.account.domainid,
+                    diskofferingid=disk_offering_5_GB.id)
+
+            volume_2 = Volume.create(
+                    apiclient,self.services["volume"],zoneid=self.zone.id,
+                    account=self.account.name,domainid=self.account.domainid,
+                    diskofferingid=disk_offering_10_GB.id)
+
+            self.debug("Attaching volume %s to vm %s" % (volume_1.name, self.virtualMachine.name))
+            self.virtualMachine.attach_volume(apiclient, volume=volume_1)
+
+            self.debug("Attaching volume %s to vm %s" % (volume_2.name, self.virtualMachine.name))
+            self.virtualMachine.attach_volume(apiclient, volume=volume_2)
+        except Exception as e:
+            self.fail("Failure: %s" % e)
+
+        expectedCount = self.initialResourceCount + 15 # (5 + 10)
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            # Detaching and deleting volume 1
+            self.virtualMachine.detach_volume(apiclient, volume=volume_1)
+            volume_1.delete(apiclient)
+        except Exception as e:
+            self.fail("Failure while volume operation: %s" % e)
+
+        expectedCount -= 5 #After deleting first volume
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            # Detaching and deleting volume 2
+            self.virtualMachine.detach_volume(apiclient, volume=volume_2)
+            volume_2.delete(apiclient)
+        except Exception as e:
+            self.fail("Failure while volume operation: %s" % e)
+
+        expectedCount -= 10
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return
+
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced", "selfservice"])
+    def test_deploy_multiple_vm(self, value):
+        """Test Deploy multiple VMs with & verify the usage
+        # Validate the following
+        # 1. Deploy multiple VMs with this service offering
+        # 2. Update Resource count for the root admin Primary Storage usage
+        # 3. Primary Storage usage should list properly
+        # 4. Destroy one VM among multiple VM's and verify that primary storage count
+        #  decreases by equivalent amount
+        """
+
+        response = self.setupAccount(value)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.virtualMachine_2 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
+                            accountid=self.account.name, domainid=self.account.domainid,
+                            diskofferingid=self.disk_offering.id,
+                            serviceofferingid=self.service_offering.id)
+
+        expectedCount = (self.initialResourceCount * 2) #Total 2 vms
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.virtualMachine_3 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
+                            accountid=self.account.name, domainid=self.account.domainid,
+                            diskofferingid=self.disk_offering.id,
+                            serviceofferingid=self.service_offering.id)
+
+        expectedCount = (self.initialResourceCount * 3) #Total 3 vms
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.debug("Destroying instance: %s" % self.virtualMachine_2.name)
+        try:
+    	    self.virtualMachine_2.delete(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to delete instance: %s" % e)
+
+        self.assertTrue(isVmExpunged(self.apiclient, self.virtualMachine_2.id), "VM not expunged \
+                in allotted time")
+
+        expectedCount = (self.initialResourceCount * 2) #Total 2 vms
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+	return
+
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced","selfservice"])
+    def test_assign_vm_different_account(self, value):
+        """Test assign Vm to different account
+        # Validate the following
+        # 1. Deploy VM in account and check the primary storage resource count
+        # 2. Assign VM to another account
+        # 3. Resource count for first account should now equal to 0
+        # 4. Resource count for the account to which VM is assigned should
+        #    increase to that of initial resource count of first account
+        """
+
+        response = self.setupAccount(value)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            account_2 = Account.create(self.apiclient, self.services["account"],
+                                   domainid=self.domain.id, admin=True)
+            self.cleanup.insert(0, account_2)
+        except Exception as e:
+            self.fail("Failed to create account: %s" % e)
+
+        expectedCount = self.initialResourceCount
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.virtualMachine.stop(self.apiclient)
+    	    self.virtualMachine.assign_virtual_machine(self.apiclient,
+                    account_2.name ,account_2.domainid)
+        except Exception as e:
+            self.fail("Failed to assign virtual machine to account %s: %s" %
+                    (account_2.name,e))
+
+        # Checking resource count for account 2
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=account_2.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        expectedCount = 0
+        # Checking resource count for original account
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+	return
+
+    @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
+    @attr(tags=["advanced", "selfservice"])
+    def test_create_template_snapshot(self, value):
+        """Test create snapshot and templates from volume
+
+        # Validate the following
+        # 1. Deploy VM with custoom disk offering and check the
+        #    primary storage resource count
+        # 2. Stop the VM and create Snapshot from VM's volume
+        # 3. Create volume againt from this snapshto and attach to VM
+        # 4. Verify that primary storage count increases by the volume size
+        # 5. Detach and delete volume, verify primary storage count decreaes by volume size"""
+
+        response = self.setupAccount(value)
+        self.debug(response[0])
+        self.debug(response[1])
+        self.assertEqual(response[0], PASS, response[1])
+
+        apiclient = self.apiclient
+        if value == CHILD_DOMAIN_ADMIN:
+            apiclient = self.testClient.getUserApiClient(
+                                        UserName=self.account.name,
+                                        DomainName=self.account.domain
+                                        )
+            self.assertNotEqual(apiclient, FAIL, "Failure while getting api\
+                    client of account: %s" % self.account.name)
+
+        try:
+            self.virtualMachine.stop(apiclient)
+        except Exception as e:
+            self.fail("Failed to stop instance: %s" % e)
+        expectedCount = self.initialResourceCount
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.debug("Creating snapshot from ROOT volume: %s" % self.virtualMachine.name)
+        snapshot = None
+        response = createSnapshotFromVirtualMachineVolume(apiclient, self.account, self.virtualMachine.id)
+        self.assertEqual(response[0], PASS, response[1])
+        snapshot = response[1]
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
+            volume = Volume.create_from_snapshot(apiclient,
+                                        snapshot_id=snapshot.id,
+                                        services=self.services["volume"],
+                                        account=self.account.name,
+                                        domainid=self.account.domainid)
+
+            self.debug("Attaching the volume to vm: %s" % self.virtualMachine.name)
+            self.virtualMachine.attach_volume(apiclient, volume)
+        except Exception as e:
+            self.fail("Failure in volume operation: %s" % e)
+
+        expectedCount += int(self.services["volume"]["size"])
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.virtualMachine.detach_volume(apiclient, volume)
+        except Exception as e:
+            self.fail("Failure in detach volume operation: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.debug("deleting the volume: %s" % volume.name)
+            volume.delete(apiclient)
+        except Exception as e:
+            self.fail("Failure while deleting volume: %s" % e)
+
+        expectedCount -= int(self.services["volume"]["size"])
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.account.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/test/integration/component/test_ps_max_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_max_limits.py b/test/integration/component/test_ps_max_limits.py
new file mode 100644
index 0000000..8d047ef
--- /dev/null
+++ b/test/integration/component/test_ps_max_limits.py
@@ -0,0 +1,300 @@
+# 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 praimary storage - Maximum Limits
+
+    Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domain+or+accounts
+
+    Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-1466
+
+    Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (Account,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Resources,
+                             Domain,
+                             Project,
+                             Volume,
+                             DiskOffering)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template)
+from marvin.lib.utils import (cleanup_resources,
+                              validateList)
+from marvin.codes import PASS, FAIL
+
+class TestMaxPrimaryStorageLimits(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cloudstackTestClient = super(TestMaxPrimaryStorageLimits,
+                               cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        # Fill services from the external config file
+        cls.services = cloudstackTestClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
+        cls.services["mode"] = cls.zone.networktype
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
+        try:
+            cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
+            cls._cleanup.append(cls.service_offering)
+        except Exception as e:
+            cls.tearDownClass()
+            raise unittest.SkipTest("Exception in setUpClass: %s" % e)
+        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 = []
+        try:
+            response = self.setupAccounts()
+            if response[0] == FAIL:
+                self.skipTest("Failure while setting up accounts: %s" % response[1])
+            self.services["disk_offering"]["disksize"] = 2
+            self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"])
+            self.cleanup.append(self.disk_offering)
+        except Exception as e:
+            self.tearDown()
+            self.skipTest("Failure in setup: %s" % e)
+        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
+
+    def setupAccounts(self):
+
+        try:
+            self.child_domain = Domain.create(self.apiclient,services=self.services["domain"],
+                                          parentdomainid=self.domain.id)
+
+            self.child_do_admin = Account.create(self.apiclient, self.services["account"], admin=True,
+                                             domainid=self.child_domain.id)
+
+            # Create project as a domain admin
+            self.project = Project.create(self.apiclient, self.services["project"],
+                                      account=self.child_do_admin.name,
+                                      domainid=self.child_do_admin.domainid)
+
+            # Cleanup created project at end of test
+            self.cleanup.append(self.project)
+
+            # Cleanup accounts created
+            self.cleanup.append(self.child_do_admin)
+            self.cleanup.append(self.child_domain)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    def updatePrimaryStorageLimits(self, accountLimit=None, domainLimit=None,
+                                   projectLimit=None):
+
+        try:
+            # Update resource limits for account
+            if accountLimit:
+                Resources.updateLimit(self.apiclient, resourcetype=10,
+                                max=accountLimit, account=self.child_do_admin.name,
+                                domainid=self.child_do_admin.domainid)
+
+            if projectLimit:
+                Resources.updateLimit(self.apiclient, resourcetype=10,
+                                              max=projectLimit, projectid=self.project.id)
+
+            if domainLimit:
+                Resources.updateLimit(self.apiclient, resourcetype=10,
+                                              max=domainLimit, domainid=self.child_domain.id)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    @attr(tags=["advanced","selfservice"])
+    def test_01_deploy_vm_domain_limit_reached(self):
+        """Test Try to deploy VM with admin account where account has not used
+            the resources but @ domain they are not available
+
+        # Validate the following
+        # 1. Try to deploy VM with admin account where account has not used the
+        #    resources but @ domain they are not available
+        # 2. Deploy VM should error out saying  ResourceAllocationException
+        #    with "resource limit exceeds"""
+
+        self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
+                            accountid=self.child_do_admin.name, domainid=self.child_do_admin.domainid,
+                            serviceofferingid=self.service_offering.id)
+
+        accounts = Account.list(self.apiclient, id=self.child_do_admin.id)
+        self.assertEqual(validateList(accounts)[0], PASS,
+            "accounts list validation failed")
+
+        self.initialResourceCount = int(accounts[0].primarystoragetotal)
+        domainLimit = self.initialResourceCount + 3
+
+        self.debug("Setting up account and domain hierarchy")
+        response = self.updatePrimaryStorageLimits(domainLimit=domainLimit)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.services["volume"]["size"] = self.services["disk_offering"]["disksize"] = 2
+
+        try:
+            disk_offering = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+            self.cleanup.append(disk_offering)
+            Volume.create(self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.child_do_admin.name,
+                                   domainid=self.child_do_admin.domainid,
+                                   diskofferingid=disk_offering.id)
+        except Exception as e:
+            self.fail("Exception occured: %s" % e)
+
+        with self.assertRaises(Exception):
+            Volume.create(self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.child_do_admin.name,
+                                   domainid=self.child_do_admin.domainid,
+                                   diskofferingid=disk_offering.id)
+        return
+
+    @attr(tags=["advanced","selfservice"])
+    def test_02_deploy_vm_account_limit_reached(self):
+        """Test Try to deploy VM with admin account where account has used
+            the resources but @ domain they are available"""
+
+        self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
+                            accountid=self.child_do_admin.name, domainid=self.child_do_admin.domainid,
+                            diskofferingid=self.disk_offering.id,
+                            serviceofferingid=self.service_offering.id)
+
+        accounts = Account.list(self.apiclient, id=self.child_do_admin.id)
+        self.assertEqual(validateList(accounts)[0], PASS,
+            "accounts list validation failed")
+
+        self.initialResourceCount = int(accounts[0].primarystoragetotal)
+        accountLimit = self.initialResourceCount + 3
+
+        self.debug("Setting up account and domain hierarchy")
+        response = self.updatePrimaryStorageLimits(accountLimit=accountLimit)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.services["volume"]["size"] = self.services["disk_offering"]["disksize"] = 2
+
+        try:
+            disk_offering = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+            self.cleanup.append(disk_offering)
+            Volume.create(self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.child_do_admin.name,
+                                   domainid=self.child_do_admin.domainid,
+                                   diskofferingid=disk_offering.id)
+        except Exception as e:
+            self.fail("failed to create volume: %s" % e)
+
+        with self.assertRaises(Exception):
+            Volume.create(self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   account=self.child_do_admin.name,
+                                   domainid=self.child_do_admin.domainid,
+                                   diskofferingid=disk_offering.id)
+        return
+
+    @attr(tags=["advanced","selfservice"])
+    def test_03_deploy_vm_project_limit_reached(self):
+        """Test TTry to deploy VM with admin account where account has not used
+        the resources but @ project they are not available
+
+        # Validate the following
+        # 1. Try to deploy VM with admin account where account has not used the
+        #    resources but @ project they are not available
+        # 2. Deploy VM should error out saying  ResourceAllocationException
+        #    with "resource limit exceeds"""
+
+        self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
+                            projectid=self.project.id,
+                            diskofferingid=self.disk_offering.id,
+                            serviceofferingid=self.service_offering.id)
+
+        try:
+            projects = Project.list(self.apiclient, id=self.project.id, listall=True)
+        except Exception as e:
+            self.fail("failed to get projects list: %s" % e)
+
+        self.assertEqual(validateList(projects)[0], PASS,
+            "projects list validation failed")
+        self.initialResourceCount = int(projects[0].primarystoragetotal)
+
+        projectLimit = self.initialResourceCount + 3
+
+        self.debug("Setting up account and domain hierarchy")
+        response = self.updatePrimaryStorageLimits(projectLimit=projectLimit)
+        self.assertEqual(response[0], PASS, response[1])
+
+        self.services["volume"]["size"] = self.services["disk_offering"]["disksize"] = 2
+
+        try:
+            disk_offering = DiskOffering.create(self.apiclient,
+                                    services=self.services["disk_offering"])
+            self.cleanup.append(disk_offering)
+            Volume.create(self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   projectid=self.project.id,
+                                   diskofferingid=disk_offering.id)
+        except Exception as e:
+            self.fail("Exception occured: %s" % e)
+
+        with self.assertRaises(Exception):
+            Volume.create(self.apiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   projectid=self.project.id,
+                                   diskofferingid=disk_offering.id)
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/test/integration/component/test_ps_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_project_limits.py b/test/integration/component/test_ps_project_limits.py
new file mode 100644
index 0000000..471b4a1
--- /dev/null
+++ b/test/integration/component/test_ps_project_limits.py
@@ -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.
+
+""" P1 tests for primary storage Project limits
+
+    Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domain+or+accounts
+
+    Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-1466
+
+    Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (Account,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Host,
+                             Domain,
+                             Project,
+                             Volume)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               matchResourceCount,
+                               isVmExpunged)
+from marvin.lib.utils import (cleanup_resources,
+                              validateList)
+from marvin.codes import (PASS,
+                          FAIL,
+                          RESOURCE_PRIMARY_STORAGE)
+import time
+
+class TestProjectsVolumeLimits(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cloudstackTestClient = super(TestProjectsVolumeLimits,
+                               cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        # Fill services from the external config file
+        cls.services = cloudstackTestClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
+        cls.services["mode"] = cls.zone.networktype
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
+        try:
+            cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
+            cls._cleanup.append(cls.service_offering)
+        except Exception as e:
+            cls.tearDownClass()
+            raise unittest.SkipTest("Exception in setUpClass: %s" % e)
+        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 = []
+        response = self.setupProjectAccounts()
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.vm = VirtualMachine.create(
+                        self.apiclient,self.services["virtual_machine"],
+                        templateid=self.template.id,projectid=self.project.id,
+                        serviceofferingid=self.service_offering.id)
+            projects = Project.list(self.apiclient,id=self.project.id, listall=True)
+            self.assertEqual(validateList(projects)[0], PASS,\
+                    "projects list validation failed")
+            self.initialResourceCount = projects[0].primarystoragetotal
+        except Exception as e:
+            self.tearDown()
+            self.skipTest("Exception occured in setup: %s" % e)
+        return
+
+    def tearDown(self):
+        try:
+            # Clean up, terminate the created instance, volumes and snapshots
+            cleanup_resources(self.apiclient, self.cleanup)
+            pass
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setupProjectAccounts(self):
+
+        try:
+            self.domain = Domain.create(self.apiclient,
+                                        services=self.services["domain"],
+                                        parentdomainid=self.domain.id)
+            self.admin = Account.create(
+                            self.apiclient, self.services["account"],
+                            admin=True, domainid=self.domain.id)
+
+            # Create project as a domain admin
+            self.project = Project.create(
+                            self.apiclient,self.services["project"],
+                            account=self.admin.name,domainid=self.admin.domainid)
+            # Cleanup created project at end of test
+            self.cleanup.append(self.project)
+            self.cleanup.append(self.admin)
+            self.cleanup.append(self.domain)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_01_VM_start_stop(self):
+        """Test project primary storage count with VM stop/start operation
+
+        # Validate the following
+        # 1. Create VM with custom disk offering in a project and check
+        #    initial primary storage count
+        # 2. Stop the VM and verify primary storage count remains the same
+        # 3. Start the VM and verify priamay storage count remains the same
+        """
+
+        try:
+            self.vm.stop(self.apiclient)
+        except Exception as e:
+            self.fail("Faield to stop VM: %s" % e)
+
+        expectedCount = self.initialResourceCount
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        projectid=self.project.id)
+        self.assertEqual(response[0], PASS, response[1])
+
+        try:
+            self.vm.start(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to start VM: %s" % e)
+
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        projectid=self.project.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_02_migrate_vm(self):
+        """Test migrate VM in project
+
+        # Validate the following
+        # 1. Create VM with custom disk offering in a project and check
+        #    initial primary storage count
+        # 2. List the hosts suitable for migrating the VM
+        # 3. Migrate the VM and verify that primary storage count of project remains same"""
+
+        try:
+            hosts = Host.list(self.apiclient,virtualmachineid=self.vm.id,
+                              listall=True)
+            self.assertEqual(validateList(hosts)[0], PASS, "hosts list validation failed")
+            host = hosts[0]
+            self.vm.migrate(self.apiclient, host.id)
+        except Exception as e:
+            self.fail("Exception occured" % e)
+
+        expectedCount = self.initialResourceCount
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        projectid=self.project.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_03_delete_vm(self):
+        """Test delete VM belonging to project
+
+        # Validate the following
+        # 1. Create VM with custom disk offering in a project and check
+        #    initial primary storage count
+        # 2. Delete VM and verify that it's expunged
+        # 3. Verify that primary storage count of project equals 0"""
+
+        try:
+            self.vm.delete(self.apiclient)
+        except Exception as e:
+            self.fail("Failed to detroy VM: %s" % e)
+
+        self.assertTrue(isVmExpunged(self.apiclient, self.vm.id, self.project.id),\
+                "VM not expunged")
+
+        totalallottedtime = timeout = 600
+        while timeout >= 0:
+            volumes = Volume.list(self.apiclient, projectid=self.project.id, listall=True)
+            if volumes is None:
+                break
+            if timeout == 0:
+                self.fail("Volume attached to VM not cleaned up even\
+                        after %s seconds" % totalallottedtime)
+            timeout -= 60
+            time.sleep(60)
+
+        expectedCount = 0
+        response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        projectid=self.project.id)
+        self.assertEqual(response[0], PASS, response[1])
+        return


[11/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

(cherry picked from commit 378e1da42c235d310df3d39d3d82270ef00546df)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b38fcfee
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b38fcfee
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b38fcfee

Branch: refs/heads/4.4
Commit: b38fcfeea8965a28ab1f5cf6606ecf0eef039e52
Parents: 7107c73
Author: vinayvarmav <vi...@citrix.com>
Authored: Mon May 19 16:46:06 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:41 2014 +0200

----------------------------------------------------------------------
 .../component/test_escalations_instances.py     | 3448 ++++++++++++++
 .../component/test_escalations_ipaddresses.py   | 4192 ++++++++++++++++++
 .../component/test_escalations_isos.py          |  783 ++++
 .../test_escalations_securitygroups.py          |  588 +++
 .../component/test_escalations_snapshots.py     |  647 +++
 .../component/test_escalations_templates.py     |  944 ++++
 .../component/test_escalations_volumes.py       | 1703 +++++++
 .../test_escalations_vpncustomergateways.py     |  382 ++
 tools/marvin/marvin/lib/base.py                 |  191 +-
 9 files changed, 12877 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[34/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
Re-enabling fixed test cases

(cherry picked from commit 5863ab826ea6ac25111133171f5445bd40512074)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/be87c5c5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/be87c5c5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/be87c5c5

Branch: refs/heads/4.4
Commit: be87c5c5fb187471d9dff872c602ce8bc3f077c0
Parents: c98064b
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Wed Jun 25 17:13:47 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:52 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_guest_vlan_range.py   | 2 +-
 test/integration/smoke/test_non_contigiousvlan.py | 2 +-
 test/integration/smoke/test_scale_vm.py           | 2 +-
 test/integration/smoke/test_snapshots.py          | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be87c5c5/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index 000d71e..12ea52e 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -78,7 +78,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "guestvlanrange", "dedicate", "release"], BugId="CLOUDSTACK-6738", required_hardware="false")
+    @attr(tags=["advanced", "guestvlanrange", "dedicate", "release"], required_hardware="false")
     def test_dedicateGuestVlanRange(self):
         """Test guest vlan range dedication
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be87c5c5/test/integration/smoke/test_non_contigiousvlan.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py
index 7469829..e444618 100644
--- a/test/integration/smoke/test_non_contigiousvlan.py
+++ b/test/integration/smoke/test_non_contigiousvlan.py
@@ -38,7 +38,7 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
             raise Exception("Failed to set non contiguous vlan ids to test. Free some ids from \
                         from existing physical networks at ends")
 
-    @attr(tags = ["advanced"], BugId="CLOUDSTACK-6776", required_hardware="false")
+    @attr(tags = ["advanced"], required_hardware="false")
     def test_extendPhysicalNetworkVlan(self):
         """
         Test to update a physical network and extend its vlan

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be87c5c5/test/integration/smoke/test_scale_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index d77946c..b5c89be 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -103,7 +103,7 @@ class TestScaleVm(cloudstackTestCase):
         return
 
     @attr(hypervisor="xenserver")
-    @attr(tags=["advanced", "basic"], BugId="CLOUDSTACK-6768", required_hardware="true")
+    @attr(tags=["advanced", "basic"], required_hardware="true")
     def test_01_scale_vm(self):
         """Test scale virtual machine 
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/be87c5c5/test/integration/smoke/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index 2bb1a89..8b6fdd1 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -98,7 +98,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true",BugId="CLOUDSTACK-6878")
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_01_snapshot_root_disk(self):
         """Test Snapshot Root Disk
         """


[15/50] [abbrv] CLOUDSTACK-6282-Added Automated testes for Networks and VPC API's

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19cad0d9/test/integration/component/test_escalations_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_networks.py b/test/integration/component/test_escalations_networks.py
new file mode 100644
index 0000000..6f9266b
--- /dev/null
+++ b/test/integration/component/test_escalations_networks.py
@@ -0,0 +1,2602 @@
+# 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.
+
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
+from nose.plugins.attrib import attr
+from time import sleep
+ 
+class TestNetworks_1(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestNetworks_1, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            if cls.zone.localstorageenabled:
+                cls.storagetype = 'local'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+            else:
+                cls.storagetype = 'shared'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+
+            cls.services['mode'] = cls.zone.networktype
+            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+            cls.services["virtual_machine"]["template"] = cls.template.id
+            cls.services["network_without_acl"]["zoneid"] = cls.zone.id
+            # Create Network offering
+            cls.network_offering = NetworkOffering.create(
+                                        cls.api_client,
+                                        cls.services["network_offering_vlan"],
+                                        )
+            # Enable Network offering
+            cls.network_offering.update(cls.api_client, state='Enabled')
+            cls.services["network_without_acl"]["networkoffering"] = cls.network_offering.id
+            cls.service_offering = ServiceOffering.create(
+                                          cls.api_client,
+                                          cls.services["service_offerings"]["tiny"]
+                                          )
+            # Creating Disk offering, Service Offering and Account
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls.account_network = Network.create(
+                                                 cls.userapiclient,
+                                                 cls.services["network_without_acl"],
+                                                 cls.account.name,
+                                                 cls.account.domainid
+                                                 )
+            cls._cleanup.append(cls.account_network)
+            cls._cleanup.append(cls.account)
+            cls._cleanup.append(cls.service_offering)
+            cls._cleanup.append(cls.network_offering)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        # Clean up, terminate the created volumes
+        cleanup_resources(self.apiClient, self.cleanup)
+        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 __verify_values(self, expected_vals, actual_vals):
+        """  
+        @summary: Function to verify expected and actual values
+        Step1: Initializing return flag to True
+        Step2: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step3: Listing all the keys from expected dictionary
+        Step4: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step5: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced"])
+    def test_01_list_networks_pagination(self):
+        """
+        @Desc: Test List Networks pagination  
+        @Steps 
+        Step1    : Listing the networks for a user
+        Step2    : Verifying listed networks for account created at class level
+        Step3    : If number of networks is less than (pagesize + 1), then creating them
+        Step4    : Listing the networks again
+        Step5    : Verifying for the length of the networks that it is (pagesize + 1)
+        Step6    : Listing and verifying all the networks in page1
+        Step7    : Listing and verifying all the networks in page2
+        Step8    : Verifying that on page 2 only 1 network is present and the network on page 2 is not present in page1
+        """
+        list_zones = Zone.list(
+                                 self.userapiclient,
+                                 id=self.zone.id
+                               )
+        status = validateList(list_zones)
+        self.assertEquals(PASS, status[0], "No Zones found for a given id")
+        self.services["network_without_acl"]["zoneid"] = list_zones[0].id   
+        # Listing the networks for a user
+        list_networks_before = Network.list(
+                                            self.userapiclient, 
+                                            listall=self.services["listall"]
+                                            )
+        # Verifying listed networks for account created at class level
+        if list_networks_before is None:
+            self.assertEqual(
+                             len(list_networks_before),
+                             0,
+                             "Network create failed at class level"
+                             )
+        # If number of networks is less than (pagesize + 1), then creating network    
+        elif len(list_networks_before) == 1:
+            for i in range(0, (self.services["pagesize"])):
+                network_created = Network.create(
+                                             self.userapiclient,
+                                             self.services["network_without_acl"],
+                                             )
+                self.cleanup.append(network_created)
+                self.assertIsNotNone(
+                                     network_created,
+                                     "Network is not created"
+                                     )
+                # Creating expected and actual values dictionaries
+                expected_dict = {
+                                   "id":list_zones[0].id,
+                                   "name":self.services["network_without_acl"]["name"],
+                                   }
+                actual_dict = {
+                                   "id":network_created.zoneid,
+                                   "name":network_created.name,
+                                   }
+                network_status = self.__verify_values(
+                                                          expected_dict,
+                                                          actual_dict
+                                                          )
+                self.assertEqual(
+                                 True,
+                                 network_status,
+                                 "Listed network details are not as expected"
+                                 )
+        else:
+            self.assertEqual(
+                             len(list_networks_before),
+                             1,
+                             "more than 1 network created at class level"
+                             )
+        # Listing the networks  
+        list_networks_after = Network.list(self.userapiclient, listall=self.services["listall"])   
+        status = validateList(list_networks_after)
+        self.assertEquals(PASS, status[0], "No networks found using list call")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         len(list_networks_after),
+                         (self.services["pagesize"] + 1),
+                         "Number of networks created is not matching expected"
+                         )
+        # Listing all the networks in page1
+        list_networks_page1 = Network.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        status = validateList(list_networks_page1)
+        self.assertEquals(PASS, status[0], "No networks found at page 1")
+        self.assertEqual(
+                         len(list_networks_page1),
+                         self.services["pagesize"],
+                         "List network response is not matching with the page size length for page 1"
+                         )
+        # Listing all the networks in page2
+        list_networks_page2 = Network.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=2,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        status = validateList(list_networks_page2)
+        self.assertEquals(PASS, status[0], "No networks found at page 2")
+        self.assertEqual(
+                         len(list_networks_page2),
+                         1,
+                         "List network response is not matching with the page size length for page 2"
+                         )
+        network_page2 = list_networks_page2[0]
+        for i in range(0, len(list_networks_page1)):
+            network_page1 = list_networks_page1[i]
+            self.assertNotEquals(
+                                 network_page2.id,
+                                 network_page1.id,
+                                 "Network listed in page 2 is also listed in page 1"
+                                 )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_02_create_network_without_sourcenat(self):  
+        """
+        @Desc: Test create network if supported services doesn't have sourcenat
+        @Steps 
+        Step1    : Create Network Offering without sourcenat
+        Step2    : Enable network offering
+        Step3    : Create network with sourcenat diasbled network offering
+        Step4    : Verifying that it raises an exception
+        """
+        # Create Network offering specifically sourcenat disabled
+        network_offering_without_sourcenat = NetworkOffering.create(
+                                                                    self.apiClient,
+                                                                    self.services["network_offering_without_sourcenat"],
+                                                                    )
+        if network_offering_without_sourcenat is None:
+            self.fail("Creation of network offering without sourcenat failed")
+        self.cleanup.append(network_offering_without_sourcenat)
+             
+        # Enable network offering
+        network_offering_without_sourcenat.update(self.apiClient, state='Enabled')                            
+        self.services["network_without_acl"]["networkoffering"] = network_offering_without_sourcenat.id
+             
+        # Network create call raise an exception 
+        with self.assertRaises(Exception):
+            network_created = Network.create(
+                                             self.userapiclient,
+                                             self.services["network_without_acl"],
+                                             )
+            if network_created is not None:
+                self.cleanup.append(network_created)
+        self.services["network_without_acl"]["networkoffering"] = self.network_offering.id
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_03_list_vpc_pagination(self):  
+        """
+        @Desc: Test create vpc with network domain as parameter
+        @Steps 
+        Step1    : List VPC Offering
+        Step2    : List VPCs for newly created user
+        Step3    : Create VPCs without network domain based on page size
+        Step4    : Verify count of VPCs created
+        Step5    : Listing all the VPCs in page1
+        Step6    : Listing all the VPCs in page2
+        Step7    : Verifying that on page 2 only 1 vpc is present and the vpc on page 2 is not present in page1
+        Step8    : Deleting a single vpc and verifying that vpc does not exists on page 2
+        """
+        # List VPC Offering
+        vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+        if vpc_offs_list is None:
+            self.fail("Default VPC offerings not found")
+        else:
+            vpc_offs = vpc_offs_list[0]
+        # List VPCs
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        # verify no vpc is present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(FAIL, status[0], "VPCs found for newly created user")    
+        vpc_count_before = 0 
+        for i in range(0, (self.services["pagesize"] + 1)):
+            vpc_1 = VPC.create(
+                               self.userapiclient,
+                               self.services["vpc"],
+                               vpcofferingid=vpc_offs.id,
+                               zoneid=self.zone.id,
+                               )
+            if(i < (self.services["pagesize"])):
+                self.cleanup.append(vpc_1)
+            # verify vpc is created and not none 
+            self.assertIsNotNone(vpc_1, "VPC is not created")
+            # Verify VPC name with test data  
+            self.assertNotEquals(
+                                 -1,
+                                 vpc_1.name.find(self.services["vpc"]["name"]),
+                                 "VPC name not matched"
+                                 )
+            # verify zone with test data
+            self.assertEquals(
+                              self.zone.id,
+                              vpc_1.zoneid,
+                              "Zone is not matching in the vpc created"
+                              )
+        # Asserting for the length of the VPCs
+        vpc_count_after = VPC.list(self.userapiclient, listall=self.services["listall"])
+        status = validateList(vpc_count_after)
+        self.assertEquals(PASS, status[0], "VPC list count is null")          
+        self.assertEqual(
+                         len(vpc_count_after),
+                         (self.services["pagesize"] + 1),
+                         "Number of VPCs created is not matching expected"
+                         )
+        # Listing all the VPCs in page1
+        list_vpcs_page1 = VPC.list(
+                                     self.userapiclient,
+                                     listall=self.services["listall"],
+                                     page=1,
+                                     pagesize=self.services["pagesize"]
+                                     )
+        status = validateList(list_vpcs_page1)
+        self.assertEquals(PASS, status[0], "No vpcs found in Page 1")  
+        self.assertEqual(
+                         len(list_vpcs_page1),
+                         self.services["pagesize"],
+                         "List vpc response is not matching with the page size length for page 1"
+                         )
+        # Listing all the vpcs in page2
+        list_vpcs_page2 = VPC.list(
+                                     self.userapiclient,
+                                     listall=self.services["listall"],
+                                     page=2,
+                                     pagesize=self.services["pagesize"]
+                                     )
+        status = validateList(list_vpcs_page2)
+        self.assertEquals(PASS, status[0], "No vpc found in Page 2")  
+        self.assertEqual(
+                         1,
+                         len(list_vpcs_page2),
+                         "List VPCs response is not matching with the page size length for page 2"
+                         )
+        vpc_page2 = list_vpcs_page2[0]
+        # Verifying that on page 2 only 1 vpc is present and the vpc on page 2 is not present in page1
+        for i in range(0, len(list_vpcs_page1)):
+            vpc_page1 = list_vpcs_page1[i]
+            self.assertNotEquals(
+                                 vpc_page2.id,
+                                 vpc_page1.id,
+                                 "VPC listed in page 2 is also listed in page 1"
+                                 )
+        # Deleting a single vpc and verifying that vpc does not exists on page 2
+        VPC.delete(vpc_1, self.userapiclient)
+        list_vpc_response = VPC.list(
+                                     self.userapiclient,
+                                     listall=self.services["listall"],
+                                     page=2,
+                                     pagesize=self.services["pagesize"]
+                                     )
+        self.assertEqual(
+                        list_vpc_response,
+                        None,
+                        "vpc was not deleted"
+                    )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_04_create_vpc_with_networkdomain(self):  
+        """
+        @Desc: Test create vpc with network domain as parameter
+        @Steps 
+        Step1    : List VPC Offering
+        Step2    : List VPCs for newly created user
+        Step3    : Create VPC
+        Step4    : List VPC and verify that count is increased by 1
+        """
+        # List VPC Offering
+        vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+        if vpc_offs_list is None:
+            self.fail("Default VPC offerings not found")
+        else:
+            vpc_offs = vpc_offs_list[0]
+        # List VPCs for newly created user
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        # No VPCs should be present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(FAIL, status[0], "VPCs found for newly created user")   
+        vpc_count_before = 0 
+        vpc_1 = VPC.create(
+                           self.userapiclient,
+                           self.services["vpc_network_domain"],
+                           vpcofferingid=vpc_offs.id,
+                           zoneid=self.zone.id,
+                           )
+        self.assertIsNotNone(vpc_1, "VPC is not created")
+        self.cleanup.append(vpc_1)
+        # List VPCs
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        status = validateList(vpc_list)
+        self.assertEquals(PASS, status[0], "VPC is not created") 
+        self.assertEquals(
+                          vpc_count_before + 1,
+                          len(vpc_list),
+                          "VPC is not created"
+                          )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_05_list_network_offerings_with_and_without_vpc(self):  
+        """
+        @Desc: Test list network offerings for vpc true and false parameters
+        @Steps 
+        Step1    : List network offering
+        Step2    : Create network offering with default setting of vpc = false
+        Step3    : List network offering 
+        Step4    : Verify that count is incremented by 1
+        Step5    : List network offering with additional parameter of vpc = true
+        Step6    : Verify that its count is same as step 1
+        Step7    : List network offering with additional parameter of vpc = false
+        Step8    : Verify that its count is same as step 3
+        """
+        # List all network offering
+        network_offering_before_count = NetworkOffering.list(self.userapiclient)
+        status = validateList(network_offering_before_count)
+        self.assertEquals(PASS, status[0], "Default network offering not present")
+        # List network offering for vpc = true
+        network_offering_vpc_true_before_count = NetworkOffering.list(
+                                                                      self.userapiclient,
+                                                                      forvpc="true",
+                                                                      zoneid=self.zone.id,
+                                                                      guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                                      supportedServices="SourceNat",
+                                                                      specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                                      state="Enabled"
+                                                                      )
+        status = validateList(network_offering_vpc_true_before_count)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true") 
+        # List network offering 
+        network_offering_vpc_false_before_count = NetworkOffering.list(
+                                                                      self.userapiclient,
+                                                                      forvpc="false",
+                                                                      zoneid=self.zone.id,
+                                                                      guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                                      supportedServices="SourceNat",
+                                                                      specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                                      state="Enabled"
+                                                                       )
+        status = validateList(network_offering_vpc_false_before_count)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")  
+        # Create network Offering
+        network_offering = NetworkOffering.create(
+                                    self.apiClient,
+                                    self.services["network_offering_vlan"],
+                                    )
+        self.assertIsNotNone(network_offering, "Network offering is not created")
+        # Enable Network offering
+        network_offering.update(self.apiClient, state='Enabled')
+        self.cleanup.append(network_offering)
+        # List network offering
+        network_offering_after_count = NetworkOffering.list(self.userapiclient)
+        status = validateList(network_offering_after_count)
+        self.assertEquals(PASS, status[0], "Network Offering list results in null")          
+        # Verify that count is incremented by 1
+        self.assertEquals(
+                          len(network_offering_before_count) + 1,
+                          len(network_offering_after_count),
+                          "Network offering is not created"
+                          )
+        # List network offering with additional parameter of vpc = true
+        network_offering_vpc_true_after_count = NetworkOffering.list(
+                                                                      self.userapiclient,
+                                                                      forvpc="true",
+                                                                      zoneid=self.zone.id,
+                                                                      guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                                      supportedServices="SourceNat",
+                                                                      specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                                      state="Enabled"
+                                                                     )
+        status = validateList(network_offering_vpc_true_after_count)
+        self.assertEquals(PASS, status[0], "Network Offering list results in null") 
+        # Verify that its count is same as step 1
+        self.assertEquals(
+                          len(network_offering_vpc_true_before_count),
+                          len(network_offering_vpc_true_after_count),
+                          "Default Network offering is created with vpc as true"
+                          )
+        # List network offering with additional parameter of vpc = false
+        network_offering_vpc_false_after_count = NetworkOffering.list(
+                                                                      self.userapiclient,
+                                                                      forvpc="false",
+                                                                      zoneid=self.zone.id,
+                                                                      guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                                      supportedServices="SourceNat",
+                                                                      specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                                      state="Enabled"
+                                                                      )
+        status = validateList(network_offering_vpc_false_after_count)
+        self.assertEquals(PASS, status[0], "Network Offering list results in null")         
+        # Verify that its count is same as step 3
+        self.assertEquals(
+                          len(network_offering_vpc_false_before_count) + 1,
+                          len(network_offering_vpc_false_after_count),
+                          "Default Network offering is not created with vpc as false"
+                          )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_06_create_network_in_vpc(self):  
+        """
+        @Desc: Test create network in vpc and verify VPC name
+        @Steps 
+        Step1    : List VPC Offering
+        Step2    : List VPCs for newly created user
+        Step3    : Create VPC
+        Step4    : List VPC and verify that count is increased by 1
+        Step5    : Create network 
+        Step6    : List VPCs for specific network created in vpc
+        Step7    : Verify vpc name matches for newly created vpc name and name from vpc list
+        """
+        # List VPC Offering
+        vpc_offs_list = VpcOffering.list(self.userapiclient,
+                                         isdefault="true",
+                                         )
+        if vpc_offs_list is None:
+            self.fail("Default VPC offerings not found")
+        else:
+            vpc_offs = vpc_offs_list[0]
+        # List VPCs for newly created user
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        # No VPCs should be present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(FAIL, status[0], "VPCs found for newly created user")   
+        vpc_count_before = 0 
+        vpc_1 = VPC.create(
+                           self.userapiclient,
+                           self.services["vpc"],
+                           vpcofferingid=vpc_offs.id,
+                           zoneid=self.zone.id,
+                           )
+        self.assertIsNotNone(vpc_1, "VPC is not created")
+        # List VPCs
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        status = validateList(vpc_list)
+        self.assertEquals(PASS, status[0], "VPC is not created") 
+        self.assertEquals(
+                          vpc_count_before + 1,
+                          len(vpc_list),
+                          "VPC is not created"
+                          )
+        # Listing the networks for a user
+        list_networks_before = Network.list(self.userapiclient, listall=self.services["listall"])
+        # Verifying listed networks for account created at class level
+        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        # List network offering for vpc = true
+        network_offering_vpc_true_list = NetworkOffering.list(
+                                                               self.userapiclient,
+                                                               forvpc="true",
+                                                               zoneid=self.zone.id,
+                                                               guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                               supportedServices="SourceNat",
+                                                               specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                               state="Enabled"
+                                                               )
+        status = validateList(network_offering_vpc_true_list)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true") 
+        # Listing networks in VPC
+        list_networks_in_vpc = Network.list(self.userapiclient,
+                                            vpcid=vpc_1.id
+                                            )
+        self.assertIsNone(list_networks_in_vpc, "Networks found for newly created VPC")
+        # If number of networks is 1, then creating network    
+        if len(list_networks_before) == 1:
+                network_created = Network.create(
+                                                 self.userapiclient,
+                                                 self.services["network_without_acl"],
+                                                 networkofferingid=network_offering_vpc_true_list[0].id,
+                                                 vpcid=vpc_1.id,
+                                                 gateway=self.services["ntwk"]["gateway"],
+                                                 netmask=self.services["ntwk"]["netmask"],
+                                                 domainid=self.domain.id,
+                                                 accountid=self.account.name,
+                                             )
+                self.assertIsNotNone(
+            						network_created,
+            						"Network is not created"
+                					)
+                self.cleanup.append(network_created)
+                self.cleanup.append(vpc_1)
+                # Creating expected and actual values dictionaries
+                expected_dict = {
+                                   "id":self.services["network_without_acl"]["zoneid"],
+                                   "name":self.services["network_without_acl"]["name"],
+                                   }
+                actual_dict = {
+                                   "id":network_created.zoneid,
+                                   "name":network_created.name,
+                                   }
+                network_status = self.__verify_values(
+                                                          expected_dict,
+                                                          actual_dict
+                                                          )
+                self.assertEqual(
+                                 True,
+                                 network_status,
+                                 "Listed network details are not as expected"
+                                 )
+        else:
+            self.assertEqual(
+                             len(list_networks_before),
+                             1,
+                             "more than 1 network created at class level"
+                             )
+        # Listing the networks  
+        list_networks_after = Network.list(self.userapiclient, listall=self.services["listall"])   
+        status = validateList(list_networks_after)
+        self.assertEquals(PASS, status[0], "No networks found using list call")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         2,
+                         len(list_networks_after),
+                         "Number of networks created is not matching expected"
+                         )
+        # Listing networks in VPC after creation of network
+        list_networks_in_vpc = Network.list(self.userapiclient,
+                                            vpcid=vpc_1.id
+                                            )
+        status = validateList(list_networks_in_vpc)
+        self.assertEquals(PASS, status[0], "No networks found in vpc")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         1,
+                         len(list_networks_in_vpc),
+                         "Number of networks created in vpc is not matching expected"
+                         )
+        # List VPCs for specific network created in vpc
+        vpc_list = VPC.list(
+                             self.userapiclient,
+                             id=network_created.vpcid
+                             )
+        # verify no vpc is present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(PASS, status[0], "VPCs not found.")    
+        # verify vpc name matches for newly created vpc name and vpc list name
+        self.assertEqual(
+                         vpc_1.name,
+                         vpc_list[0].name,
+                         "VPC names not matching"
+                         )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_07_creation_deletion_network(self):  
+        """
+        @Desc: Test delete network
+        @Steps 
+        Step1    : Create Network
+        Step2    : Verify Network is created
+        Step3    : Delete Network
+        Step4    : Verify network is deleted
+        """
+        # Listing the networks for a user
+        list_networks_before = Network.list(self.userapiclient, listall=self.services["listall"])
+        # Verifying listed networks for account created at class level
+        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        # List network offering for vpc = false
+        network_offering_vpc_false_list = NetworkOffering.list(
+                                                               self.userapiclient,
+                                                               forvpc="false",
+                                                               zoneid=self.zone.id,
+                                                               guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                               supportedServices="SourceNat",
+                                                               specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                               state="Enabled"
+                                                               )
+        status = validateList(network_offering_vpc_false_list)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false") 
+        # If number of networks is 1, then creating network    
+        if len(list_networks_before) == 1:
+                network_created = Network.create(
+                                                 self.userapiclient,
+                                                 self.services["network_without_acl"],
+                                                 networkofferingid=network_offering_vpc_false_list[0].id,
+                                             )
+                self.assertIsNotNone(
+                                     network_created,
+                                     "Network is not created"
+                                     )
+                # Creating expected and actual values dictionaries
+                expected_dict = {
+                                   "id":self.services["network_without_acl"]["zoneid"],
+                                   "name":self.services["network_without_acl"]["name"],
+                                   }
+                actual_dict = {
+                                   "id":network_created.zoneid,
+                                   "name":network_created.name,
+                                   }
+                network_status = self.__verify_values(
+                                                          expected_dict,
+                                                          actual_dict
+                                                          )
+                self.assertEqual(
+                                 True,
+                                 network_status,
+                                 "Listed network details are not as expected"
+                                 )
+        else:
+            self.assertEqual(
+                             len(list_networks_before),
+                             1,
+                             "more than 1 network created at class level"
+                             )
+        # Listing the networks  
+        list_networks_after = Network.list(
+                                           self.userapiclient, 
+                                           listall=self.services["listall"]
+                                           )   
+        status = validateList(list_networks_after)
+        self.assertEquals(PASS, status[0], "No networks found using list call")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         2,
+                         len(list_networks_after),
+                         "Number of networks created is not matching expected"
+                         )
+        # Delete Network
+        Network.delete(network_created, self.userapiclient)
+        # List Networks
+        list_networks_after_delete = Network.list(
+                                                  self.userapiclient, 
+                                                  listall=self.services["listall"]
+                                                  )   
+        status = validateList(list_networks_after_delete)
+        self.assertEquals(PASS, status[0], "No networks found using list call") 
+        self.assertEqual(
+                         1,
+                         len(list_networks_after_delete),
+                         "Number of networks created is not matching expected"
+                         )      
+        # Verify deleted network is not present  
+        self.assertNotEquals(
+                             network_created.id,
+                             list_networks_after_delete[0].id,
+                             "Deleted network present"
+                             ) 
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_08_update_network(self):  
+        """
+        @Desc: Test update network
+        @Steps 
+        Step1    : Create Network
+        Step2    : Verify Network is created
+        Step3    : Update Network name, display text and network domain
+        Step4    : Verify network is updated
+        """
+        # Listing the networks for a user
+        list_networks_before = Network.list(self.userapiclient, listall=self.services["listall"])
+        # Verifying listed networks for account created at class level
+        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        self.assertEquals(
+        				1,
+        				len(list_networks_before),
+        				"More than 1 network created at class level"
+        				)
+        # List network offering for vpc = false
+        network_offering_vpc_false_list = NetworkOffering.list(
+                                                               self.userapiclient,
+                                                               forvpc="false",
+                                                               zoneid=self.zone.id,
+                                                               guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                               supportedServices="SourceNat",
+                                                               specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                               state="Enabled"
+                                                               )
+        status = validateList(network_offering_vpc_false_list)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = false")
+        # creating network    
+        network_created = Network.create(
+                                         self.userapiclient,
+                                         self.services["network_without_acl"],
+                                         networkofferingid=network_offering_vpc_false_list[0].id,
+                                     )
+        self.assertIsNotNone(
+        					network_created,
+        					"Network is not created"
+        					)
+        self.cleanup.append(network_created)
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                           "id":self.services["network_without_acl"]["zoneid"],
+                           "name":self.services["network_without_acl"]["name"],
+                           }
+        actual_dict = {
+                           "id":network_created.zoneid,
+                           "name":network_created.name,
+                           }
+        network_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         network_status,
+                         "Listed network details are not as expected"
+                         )
+        # Listing the networks  
+        list_networks_after = Network.list(self.userapiclient, listall=self.services["listall"])   
+        status = validateList(list_networks_after)
+        self.assertEquals(PASS, status[0], "No networks found using list call")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         2,
+                         len(list_networks_after),
+                         "Number of networks created is not matching expected"
+                         )
+        # Update Network
+        network_updated = Network.update(network_created,
+                                         self.userapiclient,
+                                         name="NewNetworkName",
+                                         displaytext="NewNetworkDisplayText",
+                                         networkdomain="cs13cloud.internal.new"
+                                         )
+        # List Networks
+        list_networks_after_update = Network.list(self.userapiclient, listall=self.services["listall"])   
+        status = validateList(list_networks_after_update)
+        self.assertEquals(PASS, status[0], "No networks found using list call") 
+        self.assertEqual(
+                         2,
+                         len(list_networks_after_update),
+                         "Number of networks created is not matching expected"
+                         )      
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                         "name":"NewNetworkName",
+                         "displaytext":"NewNetworkDisplayText",
+                         "networkdomain":"cs13cloud.internal.new"
+                         }
+        actual_dict = {
+                        "name":network_updated.name,
+                        "displaytext":network_updated.displaytext,
+                        "networkdomain":network_updated.networkdomain
+                        }
+        network_status = self.__verify_values(
+                                              expected_dict,
+                                              actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         network_status,
+                         "Listed network details are not as expected"
+                         )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_09_list_virtual_machines_single_network(self):  
+        """
+        @Desc: Test update network
+        @Steps 
+        Step1    : Create Network
+        Step2    : Verify Network is created
+        Step3    : Create Virtual Machine as per page size
+        Step4    : Verify list Virtual machines and pagination
+        """
+        # Listing the networks for a user
+        list_networks_before = Network.list(self.userapiclient, listall=self.services["listall"])
+        # Verifying listed networks for account created at class level
+        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        # Create Virtual Machine
+        # Listing all the instances for a user
+        list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
+        # Verifying listed instances for account created at class level
+        self.assertIsNone(
+                          list_instances_before,
+                          "Virtual Machine already exists for newly created user"
+                          )
+        # If number of instances are less than (pagesize + 1), then creating them    
+        for i in range(0, (self.services["pagesize"] + 1)):
+            vm_created = VirtualMachine.create(
+                                               self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               networkids=list_networks_before[0].id,
+                                               serviceofferingid=self.service_offering.id,
+                                               )
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "VM creation failed"
+                                 )
+            if(i < (self.services["pagesize"])):
+                self.cleanup.append(vm_created)
+    
+            self.assertEqual(
+                             self.services["virtual_machine"]["displayname"],
+                             vm_created.displayname,
+                             "Newly created VM name and the test data VM name are not matching"
+                             )
+        # Listing all the instances again after creating VM's        
+        list_instances_after = VirtualMachine.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   networkid=list_networks_before[0].id
+                                                   )
+        status = validateList(list_instances_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of instances after creation failed"
+                          )
+        # Verifying the length of the instances is (page size + 1)
+        self.assertEqual(
+                         len(list_instances_after),
+                         (self.services["pagesize"] + 1),
+                         "Number of instances created is not matching as expected"
+                         )
+        # Listing all the volumes in page1
+        list_instances_page1 = VirtualMachine.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   page=1,
+                                                   pagesize=self.services["pagesize"],
+                                                   networkid=list_networks_before[0].id
+                                                   )
+        status = validateList(list_instances_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of instances in page1 failed"
+                          )
+        # Verifying that the length of the instances in page 1 is (page size)
+        self.assertEqual(
+                         self.services["pagesize"],
+                         len(list_instances_page1),
+                         "List VM response is not matching with the page size length for page 1"
+                         )
+       # Listing all the VM's in page2
+        list_instances_page2 = VirtualMachine.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   page=2,
+                                                   pagesize=self.services["pagesize"],
+                                                   networkid=list_networks_before[0].id
+                                                   )
+        status = validateList(list_instances_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Listing of instances in page2 failed"
+                          )
+        # Verifying that the length of the VM's in page 2 is 1
+        self.assertEqual(
+                         1,
+                         len(list_instances_page2),
+                         "List VM response is not matching with the page size length for page 2"
+                         )
+        instance_page2 = list_instances_page2[0]
+        # Deleting a single VM
+        VirtualMachine.delete(vm_created, self.userapiclient)
+        # Listing the VM's in page 2
+        list_instance_response = VirtualMachine.list(
+                                                     self.userapiclient,
+                                                     listall=self.services["listall"],
+                                                     page=2,
+                                                     pagesize=self.services["pagesize"],
+                                                     networkid=list_networks_before[0].id
+                                                     )
+        # verifying that VM does not exists on page 2
+        self.assertEqual(
+                        list_instance_response,
+                        None,
+                        "VM was not deleted"
+                        )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_10_list_networks_in_vpc(self):  
+        """
+        @Desc: Test list networks in vpc and verify VPC name
+        @Steps 
+        Step1    : List VPC Offering
+        Step2    : List VPCs for newly created user
+        Step3    : Create VPC
+        Step4    : List VPC and verify that count is increased by 1
+        Step5    : Create network 
+        Step6    : List Networks in created vpc
+        Step7    : Verify network name matches for newly created network name and name from network list
+        """
+        # List VPC Offering
+        vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+        if vpc_offs_list is None:
+            self.fail("Default VPC offerings not found")
+        else:
+            vpc_offs = vpc_offs_list[0]
+        # List VPCs for newly created user
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        # No VPCs should be present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(FAIL, status[0], "VPCs found for newly created user")   
+        vpc_count_before = 0 
+        vpc_1 = VPC.create(
+                           self.userapiclient,
+                           self.services["vpc"],
+                           vpcofferingid=vpc_offs.id,
+                           zoneid=self.zone.id,
+                           )
+        self.assertIsNotNone(vpc_1, "VPC is not created")
+        # List VPCs
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        status = validateList(vpc_list)
+        self.assertEquals(PASS, status[0], "VPC is not created") 
+        self.assertEquals(
+                          vpc_count_before + 1,
+                          len(vpc_list),
+                          "VPC is not created"
+                          )
+        # Listing the networks for a user
+        list_networks_before = Network.list(self.userapiclient, listall=self.services["listall"])
+        # Verifying listed networks for account created at class level
+        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        # List network offering for vpc = true
+        network_offering_vpc_true_list = NetworkOffering.list(
+                                                               self.userapiclient,
+                                                               forvpc="true",
+                                                               zoneid=self.zone.id,
+                                                               guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                               supportedServices="SourceNat",
+                                                               specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                               state="Enabled"
+                                                               )
+        status = validateList(network_offering_vpc_true_list)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true") 
+        # If number of networks is 1, then creating network    
+        if len(list_networks_before) == 1:
+                network_created = Network.create(
+                                                 self.userapiclient,
+                                                 self.services["network_without_acl"],
+                                                 networkofferingid=network_offering_vpc_true_list[0].id,
+                                                 vpcid=vpc_1.id,
+                                                 gateway=self.services["ntwk"]["gateway"],
+                                                 netmask=self.services["ntwk"]["netmask"]
+                                             )
+                self.assertIsNotNone(
+                                     network_created,
+                                     "Network is not created"
+                                     )
+                self.cleanup.append(network_created)
+                self.cleanup.append(vpc_1)
+                # Creating expected and actual values dictionaries
+                expected_dict = {
+                                   "id":self.services["network_without_acl"]["zoneid"],
+                                   "name":self.services["network_without_acl"]["name"],
+                                   }
+                actual_dict = {
+                                   "id":network_created.zoneid,
+                                   "name":network_created.name,
+                                   }
+                network_status = self.__verify_values(
+                                                          expected_dict,
+                                                          actual_dict
+                                                          )
+                self.assertEqual(
+                                 True,
+                                 network_status,
+                                 "Listed network details are not as expected"
+                                 )
+        else:
+            self.assertEqual(
+                             len(list_networks_before),
+                             1,
+                             "more than 1 network created at class level"
+                             )
+        # Listing the networks  
+        list_networks_after = Network.list(self.userapiclient, listall=self.services["listall"])   
+        status = validateList(list_networks_after)
+        self.assertEquals(PASS, status[0], "No networks found using list call")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         2,
+                         len(list_networks_after),
+                         "Number of networks created is not matching expected"
+                         )
+        # Listing the networks  
+        list_networks_in_vpc = Network.list(
+                                            self.userapiclient,
+                                            listall=self.services["listall"],
+                                            vpcid=vpc_1.id
+                                            )   
+        status = validateList(list_networks_in_vpc)
+        self.assertEquals(PASS, status[0], "No networks found using list call")  
+        # Verify network name matches for newly created network name and name from network list
+        self.assertEqual(
+                         network_created.name,
+                         list_networks_in_vpc[0].name,
+                         "Network names not matching"
+                         )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_11_update_vpc(self):  
+        """
+        @Desc: Test create vpc with network domain as parameter
+        @Steps 
+        Step1    : List VPC Offering
+        Step2    : List VPCs for newly created user
+        Step3    : Create VPCs
+        Step4    : Verify count of VPCs created
+        Step5    : Update VPC name and display text
+        Step6    : Verify name and display text is updated
+        """
+        # List VPC Offering
+        vpc_offs_list = VpcOffering.list(self.userapiclient, isdefault="true")
+        if vpc_offs_list is None:
+            self.fail("Default VPC offerings not found")
+        else:
+            vpc_offs = vpc_offs_list[0]
+        # List VPCs
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        # verify no vpc is present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(FAIL, status[0], "VPCs found for newly created user")    
+        vpc_count_before = 0 
+        vpc_1 = VPC.create(
+                           self.userapiclient,
+                           self.services["vpc"],
+                           vpcofferingid=vpc_offs.id,
+                           zoneid=self.zone.id,
+                           )
+        self.assertIsNotNone(vpc_1, "VPC is not created")
+        self.cleanup.append(vpc_1)
+        # verify vpc is created and not none 
+        # Verify VPC name with test data  
+        self.assertNotEquals(
+                             -1,
+                             vpc_1.name.find(self.services["vpc"]["name"]),
+                             "VPC name not matched"
+                             )
+        # verify zone with test data
+        self.assertEquals(
+                  self.zone.id,
+                  vpc_1.zoneid,
+                  "Zone is not matching in the vpc created"
+                  )
+        # Asserting for the length of the VPCs
+        vpc_count_after = VPC.list(self.userapiclient, listall=self.services["listall"])
+        status = validateList(vpc_count_after)
+        self.assertEquals(PASS, status[0], "VPC list count is null")          
+        self.assertEqual(
+                         1,
+                         len(vpc_count_after),
+                         "Number of VPCs created is not matching expected"
+                         )
+        # Update VPC
+        vpc_updated = VPC.update(
+                                 vpc_1,
+                                 self.userapiclient,
+                                 name="NewVPCName",
+                                 displaytext="NewVPCDisplayText",
+                                 )
+        # List Networks
+        list_vpcs_after_update = VPC.list(
+                                          self.userapiclient, 
+                                          listall=self.services["listall"]
+                                          )   
+        status = validateList(list_vpcs_after_update)
+        self.assertEquals(PASS, status[0], "No vpcs found using list call") 
+        self.assertEqual(
+                         1,
+                         len(list_vpcs_after_update),
+                         "Number of vpcs created is not matching expected"
+                         )      
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                           "name":"NewVPCName",
+                           "displaytext":"NewVPCDisplayText",
+                           }
+        actual_dict = {
+                           "name":vpc_updated.name,
+                           "displaytext":vpc_updated.displaytext,
+                           }
+        vpc_status = self.__verify_values(
+                                          expected_dict,
+                                          actual_dict
+                                          )
+        self.assertEqual(
+                         True,
+                         vpc_status,
+                         "Listed vpc details are not as expected"
+                         )
+        return
+ 
+    @attr(tags=["advanced"])
+    def test_12_list_create_delete_networkACL(self):  
+        """
+        @Desc: Test create network in vpc and verify VPC name
+        @Steps 
+        Step1    : List VPC Offering
+        Step2    : List VPCs for newly created user
+        Step3    : Create VPC
+        Step4    : List VPC and verify that count is increased by 1
+        Step5    : Create network 
+        Step6    : Verify network is created
+        Step7    : List Network ACLs
+        Step8    : Create Network ACL
+        Step9    : Verify NetworkACL is created
+        Step10   : Delete NetworkACL
+        Step11   : Verify NetworkACL is deleted
+        """
+        # List VPC Offering
+        vpc_offs_list = VpcOffering.list(self.userapiclient,
+                                         isdefault="true",
+                                         )
+        if vpc_offs_list is None:
+            self.fail("Default VPC offerings not found")
+        else:
+            vpc_offs = vpc_offs_list[0]
+        # List VPCs for newly created user
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        # No VPCs should be present for newly created user
+        status = validateList(vpc_list)
+        self.assertEquals(FAIL, status[0], "VPCs found for newly created user")   
+        vpc_count_before = 0 
+        vpc_1 = VPC.create(
+                           self.userapiclient,
+                           self.services["vpc"],
+                           vpcofferingid=vpc_offs.id,
+                           zoneid=self.zone.id,
+                           )
+        self.assertIsNotNone(vpc_1, "VPC is not created")
+        # List VPCs
+        vpc_list = VPC.list(
+                            self.userapiclient,
+                            listall=self.services["listall"]
+                            )
+        status = validateList(vpc_list)
+        self.assertEquals(PASS, status[0], "VPC is not created") 
+        self.assertEquals(
+                          vpc_count_before + 1,
+                          len(vpc_list),
+                          "VPC is not created"
+                          )
+        # Listing the networks for a user
+        list_networks_before = Network.list(
+                                            self.userapiclient, 
+                                            listall=self.services["listall"]
+                                            )
+        # Verifying listed networks for account created at class level
+        self.assertIsNotNone(list_networks_before, "Network create failed at class level")
+        # List network offering for vpc = true
+        network_offering_vpc_true_list = NetworkOffering.list(
+                                                               self.userapiclient,
+                                                               forvpc="true",
+                                                               zoneid=self.zone.id,
+                                                               guestiptype=self.services["network_offering_vlan"]["guestiptype"],
+                                                               supportedServices="SourceNat",
+                                                               specifyvlan=self.services["network_offering_vlan"]["specifyvlan"],
+                                                               state="Enabled"
+                                                               )
+        status = validateList(network_offering_vpc_true_list)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true") 
+        # Listing networks in VPC
+        list_networks_in_vpc = Network.list(self.userapiclient,
+                                            vpcid=vpc_1.id
+                                            )
+        self.assertIsNone(list_networks_in_vpc, "Networks found for newly created VPC")
+        # If number of networks is 1, then creating network    
+        if len(list_networks_before) == 1:
+                network_created = Network.create(
+                                                 self.userapiclient,
+                                                 self.services["network_without_acl"],
+                                                 networkofferingid=network_offering_vpc_true_list[0].id,
+                                                 vpcid=vpc_1.id,
+                                                 gateway=self.services["ntwk"]["gateway"],
+                                                 netmask=self.services["ntwk"]["netmask"],
+                                                 domainid=self.domain.id,
+                                                 accountid=self.account.name,
+                                             )
+                self.cleanup.append(network_created)
+                self.cleanup.append(vpc_1)
+                self.assertIsNotNone(
+                                     network_created,
+                                     "Network is not created"
+                                     )
+                # Creating expected and actual values dictionaries
+                expected_dict = {
+                                   "id":self.services["network_without_acl"]["zoneid"],
+                                   "name":self.services["network_without_acl"]["name"],
+                                   }
+                actual_dict = {
+                                   "id":network_created.zoneid,
+                                   "name":network_created.name,
+                                   }
+                network_status = self.__verify_values(
+                                                          expected_dict,
+                                                          actual_dict
+                                                          )
+                self.assertEqual(
+                                 True,
+                                 network_status,
+                                 "Listed network details are not as expected"
+                                 )
+        else:
+            self.assertEqual(
+                             len(list_networks_before),
+                             1,
+                             "more than 1 network created at class level"
+                             )
+        # Listing the networks  
+        list_networks_after = Network.list(self.userapiclient, listall=self.services["listall"])   
+        status = validateList(list_networks_after)
+        self.assertEquals(PASS, status[0], "No networks found using list call")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         2,
+                         len(list_networks_after),
+                         "Number of networks created is not matching expected"
+                         )
+        # Listing networks in VPC after creation of network
+        list_networks_in_vpc = Network.list(self.userapiclient,
+                                            vpcid=vpc_1.id
+                                            )
+        status = validateList(list_networks_in_vpc)
+        self.assertEquals(PASS, status[0], "No networks found in vpc")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         1,
+                         len(list_networks_in_vpc),
+                         "Number of networks created in vpc is not matching expected"
+                         )
+        # List VPCs for specific network created in vpc
+        vpc_list = VPC.list(
+                             self.userapiclient,
+                             id=network_created.vpcid
+                             )
+        # List Network ACLs
+        list_network_acl = NetworkACL.list(
+                                           self.userapiclient,
+                                           networkid=network_created.id
+                                           )
+        self.assertIsNone(list_network_acl, "ACL list is not empty for newly created network")
+        # Create NetworkACL
+        network_acl_created = NetworkACL.create(
+                                                self.userapiclient,
+                                                self.services["network_acl_rule"],
+                                                networkid=network_created.id
+                                                )
+        self.assertIsNotNone(
+                             network_acl_created,
+                             "NetworkACL is not created"
+                             )
+        # List Network ACL
+        list_network_acl = NetworkACL.list(
+                                           self.userapiclient,
+                                           networkid=network_created.id
+                                           )
+        status = validateList(list_network_acl)
+        self.assertEquals(PASS, status[0], "No networks acls found after creating")
+        # Asserting for the length of the networks
+        self.assertEqual(
+                         1,
+                         len(list_network_acl),
+                         "Number of networks acls reated is not matching expected"
+                         )
+        # Delete Network ACL
+        NetworkACL.delete(network_acl_created, self.userapiclient)
+        # List Network ACL
+        list_network_acl = NetworkACL.list(
+                                           self.userapiclient,
+                                           networkid=network_created.id
+                                           )
+        self.assertIsNone(list_network_acl, "ACL list is not empty for newly created network")
+        return
+ 
+class TestNetworks_2(cloudstackTestCase):
+  
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestNetworks_2, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            cls.services['mode'] = cls.zone.networktype
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+  
+    def setUp(self):
+  
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+  
+    def tearDown(self):
+        # Clean up, terminate the created volumes
+        cleanup_resources(self.apiClient, self.cleanup)
+        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 __verify_values(self, expected_vals, actual_vals):
+        """ 
+        @summary: Function to verify expected and actual values
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+  
+        if len(expected_vals) != len(actual_vals):
+            return False
+  
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+  
+    @attr(tags=["advanced", "provisioning"])
+    def test_13_list_vpc_byid(self):
+        """ 
+        @summary: Test List VPC with Id
+        @Steps
+        Step1: Listing all the vpc for a user before creating a vpc
+        Step2: Verifying no VPCs are listed
+        Step3: Creating a vpc
+        Step4: Listing the vpc for a user after creating a vpc
+        Step5: Verifying the list vpc size is increased by 1
+        Step6: Listing the vpc by specifying vpc ID
+        Step7: Verifying the list vpc size is 1
+        Step8: Verifying the details of the vpc
+        """
+        # Listing all the vpc's for a user
+        list_vpc_before = VPC.list(self.userapiclient)
+        # Verifying No VPCs are listed
+        self.assertIsNone(
+                          list_vpc_before,
+                          "Vpc listed for newly created user"
+                         )
+        # Listing VPC Offerings
+        list_vpc_offering = VpcOffering.list(self.userapiclient)
+        status = validateList(list_vpc_offering)
+        self.assertEquals(PASS, status[0], "list vpc offering is none")
+        # Creating a vpc
+        vpc_created = VPC.create(
+                                 self.userapiclient,
+                                 self.services["vpc"],
+                                 list_vpc_offering[0].id,
+                                 self.zone.id
+                                )
+        self.assertIsNotNone(vpc_created, "VPC Creation Failed")
+        self.cleanup.append(vpc_created)
+        # Listing the vpc for a user after creating a vpc       
+        list_vpc_after = VPC.list(self.userapiclient)
+        status = validateList(list_vpc_after)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list VPC not as expected"
+                          )
+        # Verifying the list vpc size is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_vpc_after),
+                          "list VPC not equal as expected"
+                          )
+        # List the vpc by specifying vpc ID
+        list_vpc_byid = VPC.list(
+                                 self.userapiclient,
+                                 id=vpc_created.id, 
+                                 listall=self.services["listall"]
+                                ) 
+                 
+        status = validateList(list_vpc_byid)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list VPC not as expected"
+                          )
+        # Verifying the list vpc size is 1
+        self.assertEquals(
+                          1, 
+                          len(list_vpc_byid), 
+                          "list VPC not equal as expected"
+                          )
+         # Verifying the details of the vpc
+        expected_dict = {
+                         "cidr":self.services["vpc"]["cidr"],
+                         "id":vpc_created.id,
+                         "displaytext":vpc_created.displaytext,
+                         "account":self.account.name,
+                         "domain":vpc_created.domain,
+                         "domainid":self.domain.id,
+                         "name":vpc_created.name
+                        }
+        actual_dict = {
+                        "cidr":str(list_vpc_byid[0].cidr),
+                        "id":list_vpc_byid[0].id,
+                        "displaytext":list_vpc_byid[0].displaytext,
+                        "account":list_vpc_byid[0].account,
+                        "domain":list_vpc_byid[0].domain,
+                        "domainid":list_vpc_byid[0].domainid,
+                        "name":list_vpc_byid[0].name
+                      }
+        list_vpc_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                              )
+        self.assertEqual(
+                         True,
+                         list_vpc_status,
+                         "Listed VPC details are not as expected"
+                         )
+                 
+        return
+                  
+    @attr(tags=["advanced", "provisioning"])
+    def test_14_list_public_ipadress_by_associated_networkid(self):
+        """ 
+        @summary: Test List Public IPAddress with associatednetworkid
+        @Steps
+        Step1: Listing all the public ipadresses for a user before creating a public ipaddress
+        Step2: Verifying no Public ipaddress are listed
+        Step3: Creating a network
+        Step4: Associating public ipaddress for network created in step3
+        Step5: Listing the public ipaddress for a user after creating a public ipaddress
+        Step6: Verifying the list public ipaddress size is increased by 1
+        Step7: Listing the public ipaddress by specifying associatednetworkid
+        Step8: Verifying the list public ipaddress size is 1
+        Step9: Verifying the details of the public ipaddress
+        """
+        # Listing all the public ipadresses for a user
+        list_public_ipadress_before = PublicIPAddress.list(self.userapiclient)
+        # Verifying No VPCs are listed
+        self.assertIsNone(
+                          list_public_ipadress_before,
+                          "Public ipaddresses listed for newly created user"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat",
+                                                      zoneid=self.zone.id
+                                                      )
+        self.assertIsNotNone(
+                             network_offerings_list,
+                             "Isolated Network Offerings with sourceNat enabled are not found"
+                             )
+        #Creating a Network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network)
+        #  Associating public ipaddress for network created
+        public_ipaddress_created = PublicIPAddress.create(
+                                                         self.userapiclient,
+                                                         accountid=self.account.name, 
+                                                         zoneid=self.zone.id, 
+                                                         domainid=self.domain.id, 
+                                                         networkid=network.id
+                                                         )
+        self.assertIsNotNone(
+                             public_ipaddress_created, 
+                             "Failed to Associate Public IpAddress for Network"
+                            )
+        # Listing the public ipaddress for a user after associating a public ipaddress for network      
+        list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient)
+        status = validateList(list_public_ipaddress_after)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list Public IPAddress not as expected"
+                          )
+        # Verifying the list public ipaddress size is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_public_ipaddress_after),
+                          "list Public IPAddress not equal as expected"
+                          )
+        # List the public ipaddress by specifying public ipaddress ID
+        list_public_ipaddress_byid = PublicIPAddress.list(
+                                                          self.userapiclient,
+                                                          associatednetworkid=network.id, 
+                                                          listall=self.services["listall"]
+                                                         ) 
+        status = validateList(list_public_ipaddress_byid)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list pu

<TRUNCATED>

[13/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
 Fixing syntax error in base library

(cherry picked from commit 2cf16e5147d654216b0948950cd7fca058a5a1f2)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5cb6f737
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5cb6f737
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5cb6f737

Branch: refs/heads/4.4
Commit: 5cb6f7375e215b3add182dd33ec1e5e266c6e5ba
Parents: 19cad0d
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon May 26 14:52:40 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:43 2014 +0200

----------------------------------------------------------------------
 tools/marvin/marvin/lib/base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5cb6f737/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 53c7a98..a95d479 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -3893,7 +3893,7 @@ class PrivateGateway:
 
     @classmethod
     def create(cls, apiclient, gateway, ipaddress, netmask, vlan, vpcid,
-               physicalnetworkid=None, ,aclid=None):
+               physicalnetworkid=None, aclid=None):
         """Create private gateway"""
 
         cmd = createPrivateGateway.createPrivateGatewayCmd()


[03/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6655: Fixing cleanup issues with portable IP test cases

(cherry picked from commit 4e10b80293493d7bc78d75a43a00b6646acb52de)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7107c737
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7107c737
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7107c737

Branch: refs/heads/4.4
Commit: 7107c737f10c161e3e79318e55df7ba93593b5e4
Parents: 8d211fa
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Tue May 13 03:00:29 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:40 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 348 ++++++++------------
 tools/marvin/marvin/lib/common.py              |  33 +-
 2 files changed, 156 insertions(+), 225 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7107c737/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 61268eb..847bb4a 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -21,11 +21,24 @@
     Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/portable+public+IP
 """
 from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackException import CloudstackAPIException
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-from netaddr import *
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (VirtualMachine,
+                             PublicIPAddress,
+                             Network,
+                             NetworkOffering,
+                             ServiceOffering,
+                             NATRule,
+                             Account,
+                             PortablePublicIpRange,
+                             StaticNATRule,
+                             FireWallRule)
+from marvin.lib.common import (get_zone,
+                               get_template,
+                               get_domain,
+                               get_region,
+                               get_pod,
+                               isIpInDesiredState)
+from netaddr import IPAddress
 from marvin.sshClient import SshClient
 
 from nose.plugins.attrib import attr
@@ -196,29 +209,19 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 2. Portable ip range should be created successfully
 
         portable_ip_range_services = self.services["portableIpRange"]
-
-        self.debug(portable_ip_range_services)
-
         if portable_ip_range_services is None:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
 
-        self.debug("Creating new portable IP range with startip:%s and endip:%s" %
-                    (str(portable_ip_range_services["startip"]),
-                     str(portable_ip_range_services["endip"])))
-
-        #create new portable ip range
-        new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
+        try:
+            #create new portable ip range
+            new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                                              portable_ip_range_services)
 
-        self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
-                    (new_portable_ip_range.startip,
-                     new_portable_ip_range.endip,
-                     new_portable_ip_range.id))
-
-        self.cleanup.append(new_portable_ip_range)
-
+            self.cleanup.append(new_portable_ip_range)
+        except Exception as e:
+            self.fail("Failed to create portable IP range: %s" % e)
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -228,29 +231,32 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Create new portable ip range with non root admin api client
         # 2. Portable ip range should not be created
 
-        self.account = Account.create(
+        portable_ip_range_services = self.services["portableIpRange"]
+
+        if portable_ip_range_services is None:
+            self.skipTest('Failed to read config values related to portable ip range')
+
+        try:
+            self.account = Account.create(
                             self.apiclient,
                             self.services["account"],
                             domainid=self.domain.id
                             )
 
-        self.api_client_user = self.testClient.getUserApiClient(
+            self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.account.name,
                                             DomainName=self.account.domain
                                             )
 
-        portable_ip_range_services = self.services["portableIpRange"]
+            portable_ip_range_services["regionid"] = self.region.id
 
-        if portable_ip_range_services is None:
-            self.skipTest('Failed to read config values related to portable ip range')
-
-        portable_ip_range_services["regionid"] = self.region.id
-
-        self.debug("Trying to create portable ip range with non root-admin api client, should raise exception")
-        with self.assertRaises(Exception):
-            portable_ip_range = PortablePublicIpRange.create(self.api_client_user,
+            self.debug("Trying to create portable ip range with non root-admin api client, should raise exception")
+            with self.assertRaises(Exception):
+                portable_ip_range = PortablePublicIpRange.create(self.api_client_user,
                                          portable_ip_range_services)
-            self.cleanup.append(portable_ip_range)
+                self.cleanup.append(portable_ip_range)
+        except Exception as e:
+            self.fail(e)
 
         return
 
@@ -322,19 +328,10 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
 
         portable_ip_range_services["regionid"] = self.region.id
 
-        self.debug("Creating new portable IP range with startip:%s and endip:%s" %
-                    (str(portable_ip_range_services["startip"]),
-                     str(portable_ip_range_services["endip"])))
-
         #create new portable ip range
         self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                                              portable_ip_range_services)
 
-        self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
-                    (self.portable_ip_range.startip,
-                     self.portable_ip_range.endip,
-                     self.portable_ip_range.id))
-
         self.cleanup = []
         return
 
@@ -353,12 +350,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
         # 1. Try to delete the created range with root admin api client
         # 2. Portable range should be deleted successfully
 
-        self.debug("Deleting portable ip range with root-admin api")
-
         self.portable_ip_range.delete(self.apiclient)
-
-        self.debug("Deleted portable ip range")
-
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -368,23 +360,29 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
         # 1. Try to delete the created range with non root admin api client
         # 2. Portable range deletion should fail
 
-        self.account = Account.create(
+        try:
+            self.account = Account.create(
                             self.apiclient,
                             self.services["account"],
                             domainid=self.domain.id
                             )
 
-        self.cleanup.append(self.account)
+            self.cleanup.append(self.account)
 
-        self.api_client_user = self.testClient.getUserApiClient(
+            self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.account.name,
                                             DomainName=self.account.domain
                                             )
+        except Exception as e:
+            self.fail(e)
 
-        with self.assertRaises(Exception):
-            self.portable_ip_range.delete(self.api_client_user)
-
-        self.portable_ip_range.delete(self.apiclient)
+        try:
+            with self.assertRaises(Exception):
+                self.portable_ip_range.delete(self.api_client_user)
+        except Exception as e:
+            self.fail(e)
+        finally:
+            self.portable_ip_range.delete(self.apiclient)
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -395,30 +393,23 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
         # 2. Try to delete the portable ip range with root admin api client
         # 3. Portable ip range should not be deleted unless currently used ip is disassociated
 
-        self.account = Account.create(
+        try:
+            self.account = Account.create(
                             self.apiclient,
                             self.services["account"],
                             domainid=self.domain.id
                             )
 
-        self.cleanup.append(self.account)
-
-        self.debug(
-            "Creating n/w offering"
-            )
-        self.network_offering = NetworkOffering.create(
+            self.cleanup.append(self.account)
+            self.network_offering = NetworkOffering.create(
                                             self.apiclient,
                                             self.services["network_offering"],
                                             conservemode=False
                                             )
+            # Enable Network offering
+            self.network_offering.update(self.apiclient, state='Enabled')
 
-        self.debug("Created n/w offering with ID: %s" %
-                                                    self.network_offering.id)
-        # Enable Network offering
-        self.network_offering.update(self.apiclient, state='Enabled')
-        self.debug("Creating network")
-
-        self.network = Network.create(
+            self.network = Network.create(
                                     self.apiclient,
                                     self.services["network"],
                                     accountid=self.account.name,
@@ -426,10 +417,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
                                     networkofferingid=self.network_offering.id,
                                     zoneid=self.zone.id
                                     )
-
-        self.debug("Created network with id: %s" % self.network.id)
-        self.debug("Associating public ip address with network: %s with isportable=True" % self.network.id)
-        portableip = PublicIPAddress.create(
+            portableip = PublicIPAddress.create(
                                     self.apiclient,
                                     accountid=self.account.name,
                                     zoneid=self.zone.id,
@@ -437,19 +425,21 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
                                     networkid=self.network.id,
                                     isportable=True
                                     )
-        self.debug("Associated public ip address (portable): %s" % portableip.ipaddress.ipaddress)
-
-        with self.assertRaises(Exception):
-            self.debug("Trying to Delete portable ip range with root-admin api, this should fail")
-            self.portable_ip_range.delete(self.apiclient)
 
-        self.debug("Deleting portable ip range failed")
-        self.debug("Disassociating portable ip")
-        portableip.delete(self.apiclient)
-
-        self.debug("Deleting portable ip range")
-        self.portable_ip_range.delete(self.apiclient)
+        except Exception as e:
+            self.fail(e)
 
+        try:
+            with self.assertRaises(Exception):
+                self.debug("Trying to Delete portable ip range with root-admin api, this should fail")
+                self.portable_ip_range.delete(self.apiclient)
+        except Exception as e:
+            self.fail(e)
+        finally:
+            self.debug("Disassociating portable ip")
+            portableip.delete(self.apiclient)
+            self.debug("Deleting portable ip range")
+            self.portable_ip_range.delete(self.apiclient)
         return
 
 class TestListPortablePublicIpRanges(cloudstackTestCase):
@@ -660,21 +650,10 @@ class TestAssociatePublicIp(cloudstackTestCase):
 
         portable_ip_range_services["regionid"] = self.region.id
 
-        self.debug("Creating new portable IP range with startip:%s and endip:%s" %
-                    (str(portable_ip_range_services["startip"]),
-                     str(portable_ip_range_services["endip"])))
-
         #create new portable ip range
         self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                                              portable_ip_range_services)
-
-        self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
-                    (self.portable_ip_range.startip,
-                     self.portable_ip_range.endip,
-                     self.portable_ip_range.id))
-
         self.cleanup.append(self.portable_ip_range)
-
         return
 
     def tearDown(self):
@@ -755,7 +734,6 @@ class TestAssociatePublicIp(cloudstackTestCase):
                                    isportable=True
                                     )
             publicipaddress.delete(self.apiclient)
-        self.debug("Associating ip address failed")
         return
 
     @attr(tags=["advanced", "provisioning"])
@@ -803,10 +781,13 @@ class TestAssociatePublicIp(cloudstackTestCase):
                                     )
         self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
 
-        ipInCorrectState = is_public_ip_in_correct_state(self.apiclient, portableip.ipaddress.id, state="allocated")
-        if not ipInCorrectState:
+        response = isIpInDesiredState(self.apiclient, portableip.ipaddress.id, state="allocated")
+        exceptionOccured = response[0]
+        ipInDesiredState = response[1]
+        exceptionMessage = response[2]
+        if (exceptionOccured or (not ipInDesiredState)):
             portableip.delete(self.apiclient)
-            self.fail("Portable IP not in allocated state even after 10 mins")
+            self.fail(exceptionMessage)
 
         try:
             # Open up firewall port for SSH
@@ -1004,21 +985,10 @@ class TestDisassociatePublicIp(cloudstackTestCase):
 
         portable_ip_range_services["regionid"] = self.region.id
 
-        self.debug("Creating new portable IP range with startip:%s and endip:%s" %
-                    (str(portable_ip_range_services["startip"]),
-                     str(portable_ip_range_services["endip"])))
-
         #create new portable ip range
         new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                                              portable_ip_range_services)
-
-        self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
-                    (new_portable_ip_range.startip,
-                     new_portable_ip_range.endip,
-                     new_portable_ip_range.id))
-
         self.cleanup.append(new_portable_ip_range)
-
         return
 
     def tearDown(self):
@@ -1039,7 +1009,8 @@ class TestDisassociatePublicIp(cloudstackTestCase):
         # 3. Disassociate the portable ip with root admin api client
         # 4. Disassociating should be successful
 
-        portableip = PublicIPAddress.create(
+        try:
+            portableip = PublicIPAddress.create(
                                     self.apiclient,
                                     accountid=self.account.name,
                                     zoneid=self.zone.id,
@@ -1047,18 +1018,9 @@ class TestDisassociatePublicIp(cloudstackTestCase):
                                     networkid=self.network.id,
                                     isportable=True
                                     )
-        self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
-
-        try:
-            self.debug("Disassociating portable ip: %s with id: %s" %
-                        (portableip.ipaddress.ipaddress, portableip.ipaddress.id)
-                       )
-
             portableip.delete(self.apiclient)
-
         except Exception as e:
-            raise Exception("Exception while disassociating portable ip: %s" % e)
-
+            raise Exception("Exception occured: %s" % e)
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -1079,12 +1041,14 @@ class TestDisassociatePublicIp(cloudstackTestCase):
                                     networkid=self.network.id,
                                     isportable=True
                                     )
-        self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
 
-        ipInCorrectState = is_public_ip_in_correct_state(self.apiclient, portableip.ipaddress.id, state="allocated")
-        if not ipInCorrectState:
+        response = isIpInDesiredState(self.apiclient, portableip.ipaddress.id, state="allocated")
+        exceptionOccured = response[0]
+        ipInDesiredState = response[1]
+        exceptionMessage = response[2]
+        if (exceptionOccured or (not ipInDesiredState)):
             portableip.delete(self.apiclient)
-            self.fail("Portable IP not in allocated state even after 10 mins")
+            self.fail(exceptionMessage)
 
         try:
             # Open up firewall port for SSH
@@ -1111,15 +1075,9 @@ class TestDisassociatePublicIp(cloudstackTestCase):
             self.fail("Error: %s" % e)
 
         try:
-            self.debug("Disassociating portable ip: %s with id: %s" %
-                        (portableip.ipaddress.ipaddress, portableip.ipaddress.id)
-                       )
-
             portableip.delete(self.apiclient)
-
         except Exception as e:
             raise Exception("Exception while disassociating portable ip: %s" % e)
-
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -1132,7 +1090,8 @@ class TestDisassociatePublicIp(cloudstackTestCase):
         # 3. Try to Disassociate the portable ip with an account which is not owner of portable ip
         # 4. Disassociating should fail
 
-        portableip = PublicIPAddress.create(
+        try:
+            portableip = PublicIPAddress.create(
                                     self.apiclient,
                                     accountid=self.account.name,
                                     zoneid=self.zone.id,
@@ -1140,30 +1099,26 @@ class TestDisassociatePublicIp(cloudstackTestCase):
                                     networkid=self.network.id,
                                     isportable=True
                                     )
-        self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("Failed to create portable ip: %s" % e)
 
-        self.user_account = Account.create(
+        try:
+            self.user_account = Account.create(
                             self.apiclient,
                             self.services["account"],
                             domainid=self.domain.id
                             )
 
-        self.api_client_user = self.testClient.getUserApiClient(
+            self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.user_account.name,
                                             DomainName=self.user_account.domain
                                             )
-        try:
-            self.debug("Disassociating portable ip: %s with id: %s with other account :%s" %
-                        (portableip.ipaddress.ipaddress, portableip.ipaddress.id, self.user_account.name)
-                       )
 
             with self.assertRaises(Exception):
                 portableip.delete(self.api_client_user)
-
         except Exception as e:
-            raise Exception("Exception while disassociating portable ip: %s" % e)
-
-        portableip.delete(self.apiclient)
+            portableip.delete(self.apiclient)
+            self.fail("Exception while disassociating portable ip: %s" % e)
         return
 
 class TestDeleteAccount(cloudstackTestCase):
@@ -1194,7 +1149,7 @@ class TestDeleteAccount(cloudstackTestCase):
         # Set Zones and disk offerings
         cls.services["small"]["zoneid"] = cls.zone.id
         cls.services["small"]["template"] = template.id
- 
+
         cls._cleanup = []
         return
 
@@ -1211,52 +1166,32 @@ class TestDeleteAccount(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
 
-        self.account = Account.create(
+        portable_ip_range_services = self.services["portableIpRange"]
+        if portable_ip_range_services is None:
+            self.skipTest('Failed to read config values related to portable ip range')
+
+        self.cleanup = []
+        try:
+            self.account = Account.create(
                             self.apiclient,
                             self.services["account"],
                             domainid=self.domain.id,
                             admin=True
                             )
-        self.cleanup = []
-
-        portable_ip_range_services = self.services["portableIpRange"]
-
-        if portable_ip_range_services is None:
-            self.skipTest('Failed to read config values related to portable ip range')
-
-        portable_ip_range_services["regionid"] = self.region.id
-
-        self.debug("Creating new portable IP range with startip:%s and endip:%s" %
-                    (str(portable_ip_range_services["startip"]),
-                     str(portable_ip_range_services["endip"])))
-
-        #create new portable ip range
-        new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
+            portable_ip_range_services["regionid"] = self.region.id
+            #create new portable ip range
+            new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                                              portable_ip_range_services)
-
-        self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
-                    (new_portable_ip_range.startip,
-                     new_portable_ip_range.endip,
-                     new_portable_ip_range.id))
-
-        self.cleanup.append(new_portable_ip_range)
-
-        self.debug(
-            "Creating n/w offering"
-            )
-        self.network_offering = NetworkOffering.create(
+            self.cleanup.append(new_portable_ip_range)
+            self.network_offering = NetworkOffering.create(
                                             self.apiclient,
                                             self.services["network_offering"],
                                             conservemode=False
                                             )
+            # Enable Network offering
+            self.network_offering.update(self.apiclient, state='Enabled')
 
-        self.debug("Created n/w offering with ID: %s" %
-                                                    self.network_offering.id)
-        # Enable Network offering
-        self.network_offering.update(self.apiclient, state='Enabled')
-        self.debug("Creating network")
-
-        self.network = Network.create(
+            self.network = Network.create(
                                     self.apiclient,
                                     self.services["network"],
                                     accountid=self.account.name,
@@ -1264,17 +1199,14 @@ class TestDeleteAccount(cloudstackTestCase):
                                     networkofferingid=self.network_offering.id,
                                     zoneid=self.zone.id
                                     )
-
-        self.cleanup.append(self.network_offering)
-
-        self.debug("Created network with id: %s" % self.network.id)
+            self.cleanup.append(self.network_offering)
+        except Exception as e:
+            self.cleanup.append(self.account)
+            self.fail("Exception in setupClass: %s" % e)
         return
 
     def tearDown(self):
         try:
-            # Disable Network offering
-            self.network_offering.update(self.apiclient, state='Enabled')
-
             #Clean up, terminate the resources created
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
@@ -1289,7 +1221,8 @@ class TestDeleteAccount(cloudstackTestCase):
         # 2. Delete account
         # 3. Account should get deleted successfully
 
-        portableip = PublicIPAddress.create(
+        try:
+            portableip = PublicIPAddress.create(
                                     self.apiclient,
                                     accountid=self.account.name,
                                     zoneid=self.zone.id,
@@ -1297,18 +1230,12 @@ class TestDeleteAccount(cloudstackTestCase):
                                     networkid=self.network.id,
                                     isportable=True
                                     )
-        self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
-
-        self.debug("Deleting account: %s :" % self.account.name)
-
-        self.account.delete(self.apiclient)
-
-        self.debug("Account deleted successfully")
-
-        with self.assertRaises(Exception):
-            PublicIPAddress.list(self.apiclient,
+            self.account.delete(self.apiclient)
+            with self.assertRaises(Exception):
+                PublicIPAddress.list(self.apiclient,
                                  id=portableip.ipaddress.id)
-
+        except Exception as e:
+            self.fail(e)
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -1348,11 +1275,14 @@ class TestDeleteAccount(cloudstackTestCase):
                                     )
         self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
 
-        ipInCorrectState = is_public_ip_in_correct_state(self.apiclient, portableip.ipaddress.id, state="allocated")
-        if not ipInCorrectState:
+        response = isIpInDesiredState(self.apiclient, portableip.ipaddress.id, state="allocated")
+        exceptionOccured = response[0]
+        ipInDesiredState = response[1]
+        exceptionMessage = response[2]
+        if (exceptionOccured or (not ipInDesiredState)):
             portableip.delete(self.apiclient)
             self.account.delete(self.apiclient)
-            self.fail("Portable IP not in allocated state even after 10 mins")
+            self.fail(exceptionMessage)
 
         try:
             # Open up firewall port for SSH
@@ -1503,19 +1433,10 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
 
         self.portable_ip_range_services["regionid"] = self.region.id
 
-        self.debug("Creating new portable IP range with startip:%s and endip:%s" %
-                    (str(self.portable_ip_range_services["startip"]),
-                     str(self.portable_ip_range_services["endip"])))
-
         #create new portable ip range
         self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
                                                              self.portable_ip_range_services)
 
-        self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
-                    (self.portable_ip_range.startip,
-                     self.portable_ip_range.endip,
-                     self.portable_ip_range.id))
-
         self.cleanup = [self.portable_ip_range, ]
         return
 
@@ -1546,10 +1467,13 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
                                     isportable=True
                                     )
 
-        ipInCorrectState = is_public_ip_in_correct_state(self.apiclient, portableip.ipaddress.id, state="allocated")
-        if not ipInCorrectState:
+        response = isIpInDesiredState(self.apiclient, portableip.ipaddress.id, state="allocated")
+        exceptionOccured = response[0]
+        ipInDesiredState = response[1]
+        exceptionMessage = response[2]
+        if (exceptionOccured or (not ipInDesiredState)):
             portableip.delete(self.apiclient)
-            self.fail("Portable IP not in allocated state even after 10 mins")
+            self.fail(exceptionMessage)
 
         self.debug("created public ip address (portable): %s" % portableip.ipaddress.ipaddress)
         #Create NAT rule

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7107c737/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index b946b92..91fe053 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1022,24 +1022,31 @@ def setNonContiguousVlanIds(apiclient, zoneid):
 
     return physical_network, vlan
 
-
-def is_public_ip_in_correct_state(apiclient, ipaddressid, state):
+def isIpInDesiredState(apiclient, ipaddressid, state):
     """ Check if the given IP is in the correct state (given)
     and return True/False accordingly"""
     retriesCount = 10
-    while True:
-        portableips = PublicIPAddress.list(apiclient, id=ipaddressid)
-        assert validateList(
-            portableips)[0] == PASS, "IPs list validation failed"
-        if str(portableips[0].state).lower() == state:
-            break
-        elif retriesCount == 0:
-            return False
-        else:
+    ipInDesiredState = False
+    exceptionOccured = False
+    exceptionMessage = ""
+    try:
+        while retriesCount >= 0:
+            portableips = PublicIPAddress.list(apiclient, id=ipaddressid)
+            assert validateList(
+                portableips)[0] == PASS, "IPs list validation failed"
+            if str(portableips[0].state).lower() == state:
+                ipInDesiredState = True
+                break
             retriesCount -= 1
             time.sleep(60)
-            continue
-    return True
+    except Exception as e:
+        exceptionOccured = True
+        exceptionMessage = e
+        return [exceptionOccured, ipInDesiredState, e]
+    if not ipInDesiredState:
+        exceptionMessage = "Ip should be in %s state, it is in %s" %\
+                            (state, portableips[0].state)
+    return [False, ipInDesiredState, exceptionMessage]
 
 
 def setSharedNetworkParams(networkServices, range=20):


[24/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6861: Fixing nfs mount path

(cherry picked from commit a5415d93eb791bac52c40b9ede6a433a0d7f1dca)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f7532723
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f7532723
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f7532723

Branch: refs/heads/4.4
Commit: f75327239d99048ce7a0124ec9c73d0ae582092b
Parents: 45db234
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Tue Jun 17 15:37:25 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:48 2014 +0200

----------------------------------------------------------------------
 tools/marvin/marvin/lib/utils.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f7532723/tools/marvin/marvin/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index 4194e32..bdf5c09 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -348,7 +348,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
     nfsurl = secondaryStore.url
     from urllib2 import urlparse
     parse_url = urlparse.urlsplit(nfsurl, scheme='nfs')
-    host, path = parse_url.netloc, parse_url.path
+    host, path = str(parse_url.netloc), str(parse_url.path)
 
     if not config.mgtSvr:
         raise Exception(
@@ -364,11 +364,17 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
             user,
             passwd
         )
+
+        pathSeparator = "" #used to form host:dir format
+        if not host.endswith(':'):
+            pathSeparator= ":"
+
         cmds = [
             "mkdir -p %s /mnt/tmp",
-            "mount -t %s %s:%s /mnt/tmp" % (
+            "mount -t %s %s%s%s /mnt/tmp" % (
                 'nfs',
                 host,
+                pathSeparator,
                 path,
             ),
             "test -f %s && echo 'snapshot exists'" % (


[14/50] [abbrv] CLOUDSTACK-6282-Added Automated testes for Networks and VPC API's

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19cad0d9/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 9df3f2f..44ef8d5 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -41,6 +41,14 @@ test_data = {
             "name": "Project",
         "displaytext": "Test project"
     },
+    "private_gateway": {
+       "ipaddress": "172.16.1.2",
+       "gateway": "172.16.1.1",
+       "netmask": "255.255.255.0",
+       "vlan":"10",
+       "name":"test_private_gateway"
+        
+    },
     "account": {
         "email": "test-account@test.com",
         "firstname": "test",
@@ -214,6 +222,34 @@ test_data = {
             "StaticNat": "VirtualRouter"
         }
     },
+	"network_offering_vlan": {
+		    "name": 'Test Network offering',
+		    "displaytext": 'Test Network offering',
+		    "guestiptype": 'Isolated',
+		    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
+		    "traffictype": 'GUEST',
+		    "specifyvlan": 'False',
+		    "availability": 'Optional',
+		    "serviceProviderList" : {
+								   "Dhcp": 'VirtualRouter',
+								   "Dns": 'VirtualRouter',
+								   "SourceNat": 'VirtualRouter',
+								   "PortForwarding": 'VirtualRouter',
+			                     },
+	},
+	"network_offering_without_sourcenat": {
+	   "name": 'Test Network offering',
+	   "displaytext": 'Test Network offering',
+	   "guestiptype": 'Isolated',
+	   "supportedservices": 'Dhcp,Dns,UserData',
+	   "traffictype": 'GUEST',
+	   "availability": 'Optional',
+	   "serviceProviderList" : {
+							   "Dhcp": 'VirtualRouter',
+							   "Dns": 'VirtualRouter',
+							   "UserData": 'VirtualRouter',
+		},
+	},
     "isolated_network": {
         "name": "Isolated Network",
         "displaytext": "Isolated Network"
@@ -230,6 +266,10 @@ test_data = {
         "lbdevicecapacity": 2,
         "port": 22
     },
+	"network_without_acl": {
+		"name": "TestNetwork",
+		"displaytext": "TestNetwork",
+	},
     "virtual_machine": {
         "displayname": "Test VM",
         "username": "root",
@@ -345,6 +385,12 @@ test_data = {
         "displaytext": "TestVPC",
         "cidr": "10.0.0.1/24"
     },
+	"vpc_network_domain": {
+		"name": "TestVPC",
+		"displaytext": "TestVPC",
+		"cidr": '10.0.0.1/24',
+		"network_domain": "TestVPC"
+	},
     "clusters": {
         0: {
             "clustername": "Xen Cluster",
@@ -592,6 +638,13 @@ test_data = {
         },
 
     },
+	"network_acl_rule": {
+		   "protocol":"TCP", 
+		   "traffictype":"ingress", 
+		   "cidrlist":"0.0.0.0/0",
+		   "startport":"1",
+		   "endport":"1"
+	},
     "network_offering_internal_lb": {
         "name": "Network offering for internal lb service",
         "displaytext": "Network offering for internal lb service",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19cad0d9/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 2783805..53c7a98 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -2710,6 +2710,52 @@ class Vpn:
         if openfirewall:
             cmd.openfirewall = openfirewall
         return Vpn(apiclient.createRemoteAccessVpn(cmd).__dict__)
+    
+    @classmethod
+    def createVpnGateway(cls, apiclient, vpcid):
+        """Create VPN Gateway """
+        cmd = createVpnGateway.createVpnGatewayCmd()
+        cmd.vpcid = vpcid
+        return (apiclient.createVpnGateway(cmd).__dict__)
+    
+    @classmethod
+    def createVpnConnection(cls, apiclient, s2scustomergatewayid,s2svpngatewayid):
+        """Create VPN Connection """
+        cmd = createVpnConnection.createVpnConnectionCmd()
+        cmd.s2scustomergatewayid = s2scustomergatewayid
+        cmd.s2svpngatewayid = s2svpngatewayid
+        return (apiclient.createVpnGateway(cmd).__dict__)
+    
+    @classmethod
+    def resetVpnConnection(cls, apiclient,id):
+        """Reset VPN Connection """
+        cmd = resetVpnConnection.resetVpnConnectionCmd()
+        cmd.id = id
+        return (apiclient.resetVpnConnection(cmd).__dict__)
+    
+    @classmethod
+    def deleteVpnConnection(cls, apiclient,id):
+        """Delete VPN Connection """
+        cmd = deleteVpnConnection.deleteVpnConnectionCmd()
+        cmd.id = id
+        return (apiclient.deleteVpnConnection(cmd).__dict__)
+
+    @classmethod
+    def listVpnGateway(cls, apiclient, **kwargs):
+        """List all VPN Gateways matching criteria"""
+
+        cmd = listVpnGateways.listVpnGatewaysCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVpnGateways(cmd))
+    
+    @classmethod
+    def listVpnConnection(cls, apiclient, **kwargs):
+        """List all VPN Connections matching criteria"""
+
+        cmd = listVpnConnections.listVpnConnectionsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVpnConnections(cmd))
+
 
     def delete(self, apiclient):
         """Delete remote VPN access"""
@@ -3473,7 +3519,14 @@ class Configurations:
         if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
             cmd.listall=True
         return(apiclient.listConfigurations(cmd))
+    
+    @classmethod
+    def listCapabilities(cls, apiclient, **kwargs):
+        """Lists capabilities"""
 
+        cmd = listCapabilities.listCapabilitiesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listCapabilities(cmd))
 
 class NetScaler:
 
@@ -3840,7 +3893,7 @@ class PrivateGateway:
 
     @classmethod
     def create(cls, apiclient, gateway, ipaddress, netmask, vlan, vpcid,
-               physicalnetworkid=None):
+               physicalnetworkid=None, ,aclid=None):
         """Create private gateway"""
 
         cmd = createPrivateGateway.createPrivateGatewayCmd()
@@ -3851,6 +3904,8 @@ class PrivateGateway:
         cmd.vpcid = vpcid
         if physicalnetworkid:
             cmd.physicalnetworkid = physicalnetworkid
+        if aclid:
+            cmd.aclid = aclid
 
         return PrivateGateway(apiclient.createPrivateGateway(cmd).__dict__)
 


[40/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
Disable testcases

(cherry picked from commit bfba6d4a1e0ec9866aeebd45c3173264160c89f5)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8663fb04
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8663fb04
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8663fb04

Branch: refs/heads/4.4
Commit: 8663fb04170a63cf32595af9a3746142be7394a2
Parents: 491eb1b
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Sun Jun 29 22:26:39 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:54 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_deploy_vm_root_resize.py | 2 +-
 test/integration/smoke/test_vm_life_cycle.py         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8663fb04/test/integration/smoke/test_deploy_vm_root_resize.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index 0f0ddcc..48cdc02 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -233,7 +233,7 @@ class TestDeployVM(cloudstackTestCase):
         else:
             self.debug("test 01 does not support hypervisor type " + self.hypervisor);
 
-    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true")
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true", BugId="6984")
     def test_02_deploy_vm_root_resize(self):
         """Test proper failure to deploy virtual machine with rootdisksize less than template size
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8663fb04/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index e346157..240ab68 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -304,7 +304,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false", BugId="6984")
     def test_01_stop_vm(self):
         """Test Stop Virtual Machine
         """


[17/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6764: Marvin - Accomodating networkid parameter while deploying VM in advanced zone and account contains mor than one network

(cherry picked from commit 50d4963d5366f1c13c58b58ac3a4bac6f99973e6)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ed77cf84
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ed77cf84
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ed77cf84

Branch: refs/heads/4.4
Commit: ed77cf84f2f6f3575bf069f51bfb03d26fb0de19
Parents: 5cb6f73
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Tue May 27 14:41:59 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:44 2014 +0200

----------------------------------------------------------------------
 tools/marvin/marvin/lib/base.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ed77cf84/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index a95d479..9a11b3d 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -316,7 +316,8 @@ class VirtualMachine:
 
     @classmethod
     def access_ssh_over_nat(
-            cls, apiclient, services, virtual_machine, allow_egress=False):
+            cls, apiclient, services, virtual_machine, allow_egress=False,
+            networkid=None):
         """
         Program NAT and PF rules to open up ssh access to deployed guest
         @return:
@@ -326,7 +327,8 @@ class VirtualMachine:
             accountid=virtual_machine.account,
             zoneid=virtual_machine.zoneid,
             domainid=virtual_machine.domainid,
-            services=services
+            services=services,
+            networkid=networkid
         )
         FireWallRule.create(
             apiclient=apiclient,
@@ -482,7 +484,8 @@ class VirtualMachine:
                 apiclient,
                 services,
                 virtual_machine,
-                allow_egress=allow_egress)
+                allow_egress=allow_egress,
+                networkid=cmd.networkids[0] if cmd.networkids else None)
         elif mode.lower() == 'basic':
             if virtual_machine.publicip is not None:
                 # EIP/ELB (netscaler) enabled zone


[21/50] [abbrv] CLOUDSTACK-6282: Modified IPAddress tests to fix the failures. Modified Instances, snapshots, templates tests to handle KVM Hypervisor

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63feb451/test/integration/component/test_escalations_ipaddresses.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
index 23dd76b..0b31d2e 100644
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Import Local Modules
+# Import Local Modules
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackException import *
 from marvin.cloudstackAPI import *
@@ -27,6 +27,7 @@ from marvin.lib.utils import checkVolumeSize
 from marvin.codes import SUCCESS
 from nose.plugins.attrib import attr
 from time import sleep
+from ctypes.wintypes import BOOLEAN
 
 class TestIpAddresses(cloudstackTestCase):
 
@@ -37,6 +38,7 @@ class TestIpAddresses(cloudstackTestCase):
             cls.testClient = super(TestIpAddresses, cls).getClsTestClient()
             cls.api_client = cls.testClient.getApiClient()
             cls.services = cls.testClient.getParsedTestDataConfig()
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
             cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -51,7 +53,7 @@ class TestIpAddresses(cloudstackTestCase):
             else:
                 cls.storagetype = 'shared'
                 cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
-   
+
             cls.services['mode'] = cls.zone.networktype
             cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
             cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@@ -62,15 +64,7 @@ class TestIpAddresses(cloudstackTestCase):
                                                           )
             cls._cleanup.append(cls.service_offering)
             cls.services['mode'] = cls.zone.networktype
-            cls.account = Account.create(
-                                cls.api_client,
-                                cls.services["account"],
-                                domainid=cls.domain.id
-                                )
-            # Getting authentication for user in newly created Account
-            cls.user = cls.account.user[0]
-            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
-            cls._cleanup.append(cls.account)
+
         except Exception as e:
             cls.tearDownClass()
             raise Exception("Warning: Exception in setup : %s" % e)
@@ -80,9 +74,18 @@ class TestIpAddresses(cloudstackTestCase):
 
         self.apiClient = self.testClient.getApiClient()
         self.cleanup = []
+        self.account = Account.create(
+                                self.apiClient,
+                                self.services["account"],
+                                domainid=self.domain.id
+                                )
+        # Getting authentication for user in newly created Account
+        self.user = self.account.user[0]
+        self.userapiclient = self.testClient.getUserApiClient(self.user.username, self.domain.name)
+#         self.cleanup.append(self.account)
 
     def tearDown(self):
-        #Clean up, terminate the created volumes
+        # Clean up, terminate the created volumes
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -125,7 +128,7 @@ class TestIpAddresses(cloudstackTestCase):
 
     @attr(tags=["advanced", "provisioning"])
     def test_01_list_ipaddresses_pagination(self):
-        """  
+        """
         @summary: Test List IP Addresses pagination
         @Steps:
         Step1: Creating a network for the user
@@ -209,7 +212,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created user"
                           )
-        # Associating (pagesize + 1) number of IP Addresses    
+        # Associating (pagesize + 1) number of IP Addresses
         for i in range(0, (self.services["pagesize"] + 1)):
             ipaddress = PublicIPAddress.create(
                                                self.userapiclient,
@@ -220,7 +223,7 @@ class TestIpAddresses(cloudstackTestCase):
                                  ipaddress,
                                  "Failed to Associate IP Address"
                                  )
-       
+
         # Listing all the IP Addresses for a user
         list_ipaddresses_after = PublicIPAddress.list(
                                                       self.userapiclient,
@@ -290,11 +293,12 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddress_page2,
                           "Disassociation of IP Address Failed"
                           )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_02_list_ipaddresses_byid(self):
-        """  
+        """
         @summary: Test List IP Addresses details by ID
         @Steps:
         Step1: Creating a network for the user
@@ -391,7 +395,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created user"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -464,11 +468,12 @@ class TestIpAddresses(cloudstackTestCase):
                          ipaddress_status,
                          "Listed IP Address details are not as expected"
                          )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_03_associate_ipaddress_for_vpc(self):
-        """  
+        """
         @summary: Test to Associate IP Address for VPC
         @Steps:
         Step1: Creating a VPC for the user
@@ -507,12 +512,12 @@ class TestIpAddresses(cloudstackTestCase):
                              "VPC Creation Failed"
                              )
         self.cleanup.append(vpc_created)
-        # Listing the vpc for a user after creating a vpc       
+        # Listing the vpc for a user after creating a vpc
         list_vpc_after = VPC.list(self.userapiclient)
         status = validateList(list_vpc_after)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list VPC not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -537,7 +542,7 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_ipaddresses_before),
                           "Failed to List VPC IP Address"
                           )
-        # Associating an IP Addresses to VPC created 
+        # Associating an IP Addresses to VPC created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -615,11 +620,12 @@ class TestIpAddresses(cloudstackTestCase):
                          ipaddress_status,
                          "Listed IP Address details are not as expected"
                          )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_04_create_delete_lbrule_fornonvpc(self):
-        """  
+        """
         @summary: Test to list, create and delete Load Balancer Rule for IP Address associated to Non VPC network
         @Steps:
         Step1: Creating a Network for the user
@@ -682,7 +688,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -785,11 +791,12 @@ class TestIpAddresses(cloudstackTestCase):
                           list_lbrules_after,
                           "Failed to delete Load Balancer Rule"
                           )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_05_create_delete_lbrule_forvpc(self):
-        """  
+        """
         @summary: Test to list, create and delete Load Balancer Rule for IP Address associated to VPC
         @Steps:
         Step1: Creating a VPC for the user
@@ -829,12 +836,12 @@ class TestIpAddresses(cloudstackTestCase):
                              vpc_created,
                              "VPC Creation Failed"
                              )
-        # Listing the vpc for a user after creating a vpc       
+        # Listing the vpc for a user after creating a vpc
         list_vpc_after = VPC.list(self.userapiclient)
         status = validateList(list_vpc_after)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list VPC not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -843,25 +850,25 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_vpc_after),
                           "list VPC not equal as expected"
                           )
-        #List network offering for vpc = true
+        # List network offering for vpc = true
         network_offering_vpc_true_list = NetworkOffering.list(
                                                               self.userapiclient,
-                                                              forvpc = "true",
-                                                              zoneid = self.zone.id,
-                                                              supportedServices = "Lb",
-                                                              state = "Enabled"
+                                                              forvpc="true",
+                                                              zoneid=self.zone.id,
+                                                              supportedServices="Lb",
+                                                              state="Enabled"
                                                               )
         status = validateList(network_offering_vpc_true_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with Lb") 
-        # Creating network under VPC  
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with Lb")
+        # Creating network under VPC
         network_created = Network.create(
                                          self.userapiclient,
                                          self.services["ntwk"],
-                                         networkofferingid = network_offering_vpc_true_list[0].id,
-                                         vpcid = vpc_created.id,
+                                         networkofferingid=network_offering_vpc_true_list[0].id,
+                                         vpcid=vpc_created.id,
                                          zoneid=self.zone.id,
-                                         gateway= self.services["ntwk"]["gateway"],
-                                         netmask = self.services["ntwk"]["netmask"]
+                                         gateway=self.services["ntwk"]["gateway"],
+                                         netmask=self.services["ntwk"]["netmask"]
                                      )
         self.cleanup.append(network_created)
         self.assertIsNotNone(
@@ -876,8 +883,8 @@ class TestIpAddresses(cloudstackTestCase):
                                                        )
         status = validateList(list_ipaddresses_before)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list IP Addresses not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -886,7 +893,7 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_ipaddresses_before),
                           "list IP Addresses not equal as expected"
                           )
-        # Associating an IP Addresses to VPC created 
+        # Associating an IP Addresses to VPC created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -990,11 +997,12 @@ class TestIpAddresses(cloudstackTestCase):
                           list_lbrules_after,
                           "Failed to delete Load Balancer Rule"
                           )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_06_update_lbrule_name(self):
-        """  
+        """
         @summary: Test to Update Load Balancer Rule Name for IP Address associated to Non VPC network
         @Steps:
         Step1: Creating a Network for the user
@@ -1073,7 +1081,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -1186,11 +1194,12 @@ class TestIpAddresses(cloudstackTestCase):
                          lbrule_status,
                          "Updated Load Balancer Rule details are not as expected"
                          )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_07_assign_remove_lbrule_toinstance(self):
-        """  
+        """
         @summary: Test to Assign and Remove Load Balancer Rule to an Instance
         @Steps:
         Step1: Creating a Network for the user
@@ -1260,7 +1269,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -1501,11 +1510,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM Launched
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_08_list_create_delete_lbsticky_policy(self):
-        """  
+        """
         @summary: Test to List, Create, Delete Load Balancer Stickyness Policy
         @Steps:
         Step1: Creating a Network for the user
@@ -1586,7 +1596,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -1700,7 +1710,7 @@ class TestIpAddresses(cloudstackTestCase):
                          True,
                          lbstickypolicy_status,
                          "Created Load Balancer Sticky Policy details are not as expected"
-                         )        
+                         )
         # Listing Load Balancer Stickyness Policies for LB Rule
         list_lbstickypolicy_after = LoadBalancerRule.listStickyPolicies(
                                                                         self.userapiclient,
@@ -1737,11 +1747,12 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_lbstickypolicy_after[0].stickinesspolicy),
                           "Sticky Policy listed for newly created Load Balancer Rule"
                           )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_09_create_delete_portforwarding_fornonvpc(self):
-        """  
+        """
         @summary: Test to list, create and delete Port Forwarding for IP Address associated to Non VPC network
         @Steps:
         Step1: Creating a Network for the user
@@ -1804,7 +1815,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -1960,11 +1971,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM Launched
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_10_create_delete_portforwarding_forvpc(self):
-        """  
+        """
         @summary: Test to list, create and delete Port Forwarding Rule for IP Address associated to VPC
         @Steps:
         Step1: Creating a VPC for the user
@@ -2006,12 +2018,12 @@ class TestIpAddresses(cloudstackTestCase):
                              vpc_created,
                              "VPC Creation Failed"
                              )
-        # Listing the vpc for a user after creating a vpc       
+        # Listing the vpc for a user after creating a vpc
         list_vpc_after = VPC.list(self.userapiclient)
         status = validateList(list_vpc_after)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list VPC not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -2020,25 +2032,25 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_vpc_after),
                           "list VPC not equal as expected"
                           )
-        #List network offering for vpc = true
+        # List network offering for vpc = true
         network_offering_vpc_true_list = NetworkOffering.list(
                                                               self.userapiclient,
-                                                              forvpc = "true",
-                                                              zoneid = self.zone.id,
-                                                              supportedServices = "SourceNat,PortForwarding",
-                                                              state = "Enabled"
+                                                              forvpc="true",
+                                                              zoneid=self.zone.id,
+                                                              supportedServices="SourceNat,PortForwarding",
+                                                              state="Enabled"
                                                               )
         status = validateList(network_offering_vpc_true_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding") 
-        # Creating network under VPC  
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding")
+        # Creating network under VPC
         network_created = Network.create(
                                          self.userapiclient,
                                          self.services["ntwk"],
-                                         networkofferingid = network_offering_vpc_true_list[0].id,
-                                         vpcid = vpc_created.id,
+                                         networkofferingid=network_offering_vpc_true_list[0].id,
+                                         vpcid=vpc_created.id,
                                          zoneid=self.zone.id,
-                                         gateway= self.services["ntwk"]["gateway"],
-                                         netmask = self.services["ntwk"]["netmask"]
+                                         gateway=self.services["ntwk"]["gateway"],
+                                         netmask=self.services["ntwk"]["netmask"]
                                          )
         self.assertIsNotNone(
                              network_created,
@@ -2051,8 +2063,8 @@ class TestIpAddresses(cloudstackTestCase):
                                                        )
         status = validateList(list_ipaddresses_before)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list IP Addresses not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -2061,7 +2073,7 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_ipaddresses_before),
                           "list IP Addresses not equal as expected"
                           )
-        # Associating an IP Addresses to VPC created 
+        # Associating an IP Addresses to VPC created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -2183,11 +2195,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM Launched
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_11_create_delete_firewallrule(self):
-        """  
+        """
         @summary: Test to list, create and delete Firewall Rule for IP Address associated to Non VPC network
         @Steps:
         Step1: Creating a Network for the user
@@ -2250,7 +2263,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -2357,11 +2370,12 @@ class TestIpAddresses(cloudstackTestCase):
                           list_firewalls_after,
                           "Failed to create Firewall Rule"
                           )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_12_create_delete_remoteaccessvpn(self):
-        """  
+        """
         @summary: Test to list, create and delete Remote Access VPNs
         @Steps:
         Step1: Creating a Network for the user
@@ -2424,7 +2438,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -2528,11 +2542,12 @@ class TestIpAddresses(cloudstackTestCase):
                           list_vpns_after,
                           "Failed to create Remote Access VPN"
                           )
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_13_add_remove_vpnusers(self):
-        """  
+        """
         @summary: Test to list, add and remove VPN Users
         @Steps:
         Step1: Creating a Network for the user
@@ -2597,7 +2612,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -2738,11 +2753,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_14_enable_disable_staticnat_fornonvpc(self):
-        """  
+        """
         @summary: Test to Enable and Disable StaticNat for IP Address associated to Non VPC Network
         @Steps:
         Step1: Creating a Network for the user
@@ -2803,7 +2819,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress1 = PublicIPAddress.create(
                                                        self.userapiclient,
                                                        services=self.services["network"],
@@ -2813,7 +2829,7 @@ class TestIpAddresses(cloudstackTestCase):
                              associated_ipaddress1,
                              "Failed to Associate IP Address"
                              )
-        # Associating another IP Addresses to Network created 
+        # Associating another IP Addresses to Network created
         associated_ipaddress2 = PublicIPAddress.create(
                                                        self.userapiclient,
                                                        services=self.services["network"],
@@ -2913,11 +2929,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_15_enable_disable_staticnat_forvpc(self):
-        """  
+        """
         @summary: Test to Enable and Disable StaticNat for IP Address associated to VPC Network
         @Steps:
         Step1: Creating a VPC
@@ -2955,12 +2972,12 @@ class TestIpAddresses(cloudstackTestCase):
                              vpc_created,
                              "VPC Creation Failed"
                              )
-        # Listing the vpc for a user after creating a vpc       
+        # Listing the vpc for a user after creating a vpc
         list_vpc_after = VPC.list(self.userapiclient)
         status = validateList(list_vpc_after)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list VPC not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -2969,25 +2986,25 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_vpc_after),
                           "list VPC not equal as expected"
                           )
-        #List network offering for vpc = true
+        # List network offering for vpc = true
         network_offering_vpc_true_list = NetworkOffering.list(
                                                               self.userapiclient,
-                                                              forvpc = "true",
-                                                              zoneid = self.zone.id,
-                                                              supportedServices = "SourceNat,PortForwarding,StaticNat",
-                                                              state = "Enabled"
+                                                              forvpc="true",
+                                                              zoneid=self.zone.id,
+                                                              supportedServices="SourceNat,PortForwarding,StaticNat",
+                                                              state="Enabled"
                                                               )
         status = validateList(network_offering_vpc_true_list)
-        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding") 
-        # Creating network under VPC  
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with PortForwarding")
+        # Creating network under VPC
         network_created = Network.create(
                                          self.userapiclient,
                                          self.services["ntwk"],
-                                         networkofferingid = network_offering_vpc_true_list[0].id,
-                                         vpcid = vpc_created.id,
+                                         networkofferingid=network_offering_vpc_true_list[0].id,
+                                         vpcid=vpc_created.id,
                                          zoneid=self.zone.id,
-                                         gateway= self.services["ntwk"]["gateway"],
-                                         netmask = self.services["ntwk"]["netmask"]
+                                         gateway=self.services["ntwk"]["gateway"],
+                                         netmask=self.services["ntwk"]["netmask"]
                                          )
         self.assertIsNotNone(
                              network_created,
@@ -3000,8 +3017,8 @@ class TestIpAddresses(cloudstackTestCase):
                                                        )
         status = validateList(list_ipaddresses_before)
         self.assertEquals(
-                          PASS, 
-                          status[0], 
+                          PASS,
+                          status[0],
                           "list IP Addresses not as expected"
                           )
         # Verifying the list vpc size is increased by 1
@@ -3010,7 +3027,7 @@ class TestIpAddresses(cloudstackTestCase):
                           len(list_ipaddresses_before),
                           "list IP Addresses not equal as expected"
                           )
-        # Associating an IP Addresses to VPC created 
+        # Associating an IP Addresses to VPC created
         associated_ipaddress = PublicIPAddress.create(
                                                       self.userapiclient,
                                                       services=self.services["network"],
@@ -3113,11 +3130,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
-  
+
     @attr(tags=["advanced", "provisioning"])
     def test_16_create_delete_ipforwardingrule(self):
-        """  
+        """
         @summary: Test to list, create and delete IP Forwarding Rules for IP Address
         @Steps:
         Step1: Creating a Network for the user
@@ -3183,7 +3201,7 @@ class TestIpAddresses(cloudstackTestCase):
                           list_ipaddresses_before,
                           "IP Addresses listed for newly created User"
                           )
-        # Associating an IP Addresses to Network created 
+        # Associating an IP Addresses to Network created
         associated_ipaddress1 = PublicIPAddress.create(
                                                        self.userapiclient,
                                                        services=self.services["network"],
@@ -3193,7 +3211,7 @@ class TestIpAddresses(cloudstackTestCase):
                              associated_ipaddress1,
                              "Failed to Associate IP Address"
                              )
-        # Associating another IP Addresses to Network created 
+        # Associating another IP Addresses to Network created
         associated_ipaddress2 = PublicIPAddress.create(
                                                        self.userapiclient,
                                                        services=self.services["network"],
@@ -3320,11 +3338,12 @@ class TestIpAddresses(cloudstackTestCase):
         # Destroying the VM
         vm_created.delete(self.userapiclient)
         vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_17_create_update_autoscalepolicy(self):
-        """  
+        """
         @summary: Test to list, create and update Autoscale Policy
         @Steps:
         Step1: Creating a Network Offering for Supported Service LB with Netscaler
@@ -3346,238 +3365,264 @@ class TestIpAddresses(cloudstackTestCase):
         Step17: Updating Autoscale Policy created in step13 with condition2
         Step18: Verifying Autoscale policy is updated with condition2
         """
-        # Listing Network Offerings
-        list_nwoff_before = NetworkOffering.list(
-                                                 self.apiClient,
-                                                 forvpc="false",
-                                                 guestiptype="Isolated",
-                                                 state="Enabled",
-                                                 supportedservices="SourceNat,Lb",
-                                                 zoneid=self.zone.id
-                                                 )
-        # Creating Network Offerign with LB as Netscalar
-        nwoff_created = NetworkOffering.create(
-                                               self.apiClient,
-                                               self.services["nw_off_isolated_netscaler"]
-                                               )
-        self.assertIsNotNone(
-                             nwoff_created,
-                             "Failed to Create Network Offering with LB sercvice for Netscaler"
-                             )
-        # Enable Network offering
-        nwoff_created.update(self.apiClient, state='Enabled')
-        # Listing Network Offerings again
-        list_nwoff_after = NetworkOffering.list(
-                                                self.apiClient,
-                                                forvpc="false",
-                                                guestiptype="Isolated",
-                                                state="Enabled",
-                                                supportedservices="SourceNat,Lb",
-                                                zoneid=self.zone.id
-                                                )
-        self.assertEquals(
-                          len(list_nwoff_before)+1,
-                          len(list_nwoff_after),
-                          "Failed to create Network Offering"
-                          )
-        # Creating a Network Using the Network Offering
-        network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=nwoff_created.id,
-                                  zoneid=self.zone.id
-                                  )
-        self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
-        self.cleanup.append(network)
-        self.cleanup.append(nwoff_created)
-        # Launching a Virtual Machine
-        vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           networkids=network.id,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
-        self.assertIsNotNone(
-                             vm_created,
-                             "Failed to launch a VM under network created"
-                             )
-        # Listing all the IP Addresses for a user
-        list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
-        status = validateList(list_ipaddresses_before)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed while launching a VM"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         1,
-                         len(list_ipaddresses_before),
-                         "IP Addresses Association Failed while launching a VM"
-                         )
-        # Associating an IP Addresses to Network created 
-        associated_ipaddress = PublicIPAddress.create(
-                                                       self.userapiclient,
-                                                       services=self.services["network"],
-                                                       networkid=network.id
-                                                       )
-        self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
-                             )
-        # Listing all the IP Addresses for a user
-        list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         2,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
-        # Listing Counters
-        list_counters = Autoscale.listCounters(
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("ScaleVM is not supported on KVM. Hence, skipping the test")
+
+        list_physical_networks = PhysicalNetwork.list(
+                                                     self.apiClient,
+                                                     zoneid=self.zone.id
+                                                     )
+        physical_networks_size = 0
+        if list_physical_networks is not None:
+            physical_networks_size = len(list_physical_networks)
+
+        run_flag = False
+        for i in range(0, len(list_physical_networks)):
+            list_network_serviceprovider = NetworkServiceProvider.list(
+                                                                       self.apiClient,
+                                                                       physicalnetworkid=list_physical_networks[i].id
+                                                                       )
+            for j in range(0, len(list_network_serviceprovider)):
+                if((list_network_serviceprovider[j].name == 'Netscaler') and (list_network_serviceprovider[j].state == 'Enabled')):
+                    run_flag = True
+                    break
+
+        if(run_flag == False):
+            self.debug("Netscaler is not enabled and auto scale VM is applicable only for Netscaler")
+        else:
+            # Listing Network Offerings
+            list_nwoff_before = NetworkOffering.list(
+                                                     self.apiClient,
+                                                     forvpc="false",
+                                                     guestiptype="Isolated",
+                                                     state="Enabled",
+                                                     supportedservices="SourceNat,Lb",
+                                                     zoneid=self.zone.id
+                                                     )
+            # Creating Network Offerign with LB as Netscalar
+            nwoff_created = NetworkOffering.create(
+                                                   self.apiClient,
+                                                   self.services["nw_off_isolated_netscaler"]
+                                                   )
+            self.assertIsNotNone(
+                                 nwoff_created,
+                                 "Failed to Create Network Offering with LB sercvice for Netscaler"
+                                 )
+            # Enable Network offering
+            nwoff_created.update(self.apiClient, state='Enabled')
+            # Listing Network Offerings again
+            list_nwoff_after = NetworkOffering.list(
+                                                    self.apiClient,
+                                                    forvpc="false",
+                                                    guestiptype="Isolated",
+                                                    state="Enabled",
+                                                    supportedservices="SourceNat,Lb",
+                                                    zoneid=self.zone.id
+                                                    )
+            self.assertEquals(
+                              len(list_nwoff_before) + 1,
+                              len(list_nwoff_after),
+                              "Failed to create Network Offering"
+                              )
+            # Creating a Network Using the Network Offering
+            network = Network.create(
+                                      self.userapiclient,
+                                      self.services["network"],
+                                      accountid=self.account.name,
+                                      domainid=self.domain.id,
+                                      networkofferingid=nwoff_created.id,
+                                      zoneid=self.zone.id
+                                      )
+            self.assertIsNotNone(
+                                 network,
+                                 "Network creation failed"
+                                 )
+            self.cleanup.append(network)
+            self.cleanup.append(nwoff_created)
+            # Launching a Virtual Machine
+            vm_created = VirtualMachine.create(
                                                self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               networkids=network.id,
+                                               serviceofferingid=self.service_offering.id,
                                                )
-        status = validateList(list_counters)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list counters"
-                          )
-        #  Listing Conditions
-        list_conditions_before = Autoscale.listConditions(
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "Failed to launch a VM under network created"
+                                 )
+            # Listing all the IP Addresses for a user
+            list_ipaddresses_before = PublicIPAddress.list(
+                                                           self.userapiclient,
+                                                           listall=self.services["listall"]
+                                                           )
+            status = validateList(list_ipaddresses_before)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "IP Addresses Association Failed while launching a VM"
+                              )
+            # Verifying the length of the list is 1
+            self.assertEqual(
+                             1,
+                             len(list_ipaddresses_before),
+                             "IP Addresses Association Failed while launching a VM"
+                             )
+            # Associating an IP Addresses to Network created
+            associated_ipaddress = PublicIPAddress.create(
+                                                           self.userapiclient,
+                                                           services=self.services["network"],
+                                                           networkid=network.id
+                                                           )
+            self.assertIsNotNone(
+                                 associated_ipaddress,
+                                 "Failed to Associate IP Address"
+                                 )
+            # Listing all the IP Addresses for a user
+            list_ipaddresses_after = PublicIPAddress.list(
                                                           self.userapiclient,
-                                                          listall=self.services["listall"],
-                                                          account=self.account.name,
-                                                          domainid=self.domain.id
+                                                          listall=self.services["listall"]
                                                           )
-        self.assertIsNone(
-                          list_conditions_before,
-                          "Listed Conditions for newly created user"
-                          )
-        # Creating first Condition
-        condition_created1 = Autoscale.createCondition(
-                                                      self.userapiclient,
-                                                      counterid=list_counters[0].id,
-                                                      relationaloperator='GT',
-                                                      threshold='1000'
-                                                      )
-        self.assertIsNotNone(
-                             condition_created1,
-                             "Failed to create Condition"
-                             )
-        # Creating second Condition
-        condition_created2 = Autoscale.createCondition(
-                                                      self.userapiclient,
-                                                      counterid=list_counters[0].id,
-                                                      relationaloperator='GT',
-                                                      threshold='1500'
-                                                      )
-        self.assertIsNotNone(
-                             condition_created2,
-                             "Failed to create Condition"
-                             )
-        # Listing Conditions again
-        list_conditions_after = Autoscale.listConditions(
-                                                         self.userapiclient,
-                                                         listall=self.services["listall"],
-                                                         account=self.account.name,
-                                                         domainid=self.domain.id
-                                                         )
-        status = validateList(list_conditions_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Conditions after creation"
-                          )
-        # Listing Autoscale policies
-        list_autoscalepolicies_before = Autoscale.listAutoscalePolicies(
-                                                                        self.userapiclient,
-                                                                        listall=self.services["listall"]
-                                                                        )
-        # Verifying no Autoscale policies are listed
-        self.assertIsNone(
-                          list_autoscalepolicies_before,
-                          "Autoscale policies listed"
-                          )
-        # Creating Autoscale Policy
-        autoscalepolicy_created = Autoscale.createAutoscalePolicy(
-                                                                  self.userapiclient,
-                                                                  action='scaleup',
-                                                                  conditionids=condition_created1.id,
-                                                                  duration='100',
-                                                                  quiettime='100'
-                                                                  )
-        self.assertIsNotNone(
-                             autoscalepolicy_created,
-                             "Failed to create Autoscale VM Policy"
-                             )
-        # Verifying autoscalepolicy is created using condition1
-        self.assertEquals(
-                          condition_created1.id,
-                          autoscalepolicy_created.conditions[0].id,
-                          "Autoscale Policy not created by given condition"
-                          )
-        # Listing Autoscale policies
-        list_autoscalepolicies_after = Autoscale.listAutoscalePolicies(
-                                                                       self.userapiclient,
-                                                                       listall=self.services["listall"]
-                                                                       )
-        status = validateList(list_autoscalepolicies_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Autoscale Policy after creation"
-                          )
-        self.assertEquals(
-                          1,
-                          len(list_autoscalepolicies_after),
-                          "Autoscale Policies count is not matching"
-                          )
-        # Updating Autoscale Policy
-        autoscalepolicy_updated = Autoscale.updateAutoscalePolicy(
-                                                                  self.userapiclient,
-                                                                  id=autoscalepolicy_created.id,
-                                                                  conditionids=condition_created2.id,
-                                                                  duration='100',
-                                                                  quiettime='100'
-                                                                  )
-        self.assertIsNotNone(
-                             autoscalepolicy_updated,
-                             "Failed to update Autoscale Policy"
+            status = validateList(list_ipaddresses_after)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "IP Addresses Association Failed"
+                              )
+            # Verifying the length of the list is 1
+            self.assertEqual(
+                             2,
+                             len(list_ipaddresses_after),
+                             "Number of IP Addresses associated are not matching expected"
                              )
-        # Verifying the Autoscale Policy is updated
-        self.assertEquals(
-                          condition_created2.id,
-                          autoscalepolicy_updated.conditions[0].id,
-                          "Autoscale Policy not updated to given condition"
-                          )
-        # Destroying the VM
-        vm_created.delete(self.userapiclient)
-        vm_created.expung(self.apiClient)
+            # Listing Counters
+            list_counters = Autoscale.listCounters(
+                                                   self.userapiclient,
+                                                   )
+            status = validateList(list_counters)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list counters"
+                              )
+            #  Listing Conditions
+            list_conditions_before = Autoscale.listConditions(
+                                                              self.userapiclient,
+                                                              listall=self.services["listall"],
+                                                              account=self.account.name,
+                                                              domainid=self.domain.id
+                                                              )
+            self.assertIsNone(
+                              list_conditions_before,
+                              "Listed Conditions for newly created user"
+                              )
+            # Creating first Condition
+            condition_created1 = Autoscale.createCondition(
+                                                          self.userapiclient,
+                                                          counterid=list_counters[0].id,
+                                                          relationaloperator='GT',
+                                                          threshold='1000'
+                                                          )
+            self.assertIsNotNone(
+                                 condition_created1,
+                                 "Failed to create Condition"
+                                 )
+            # Creating second Condition
+            condition_created2 = Autoscale.createCondition(
+                                                          self.userapiclient,
+                                                          counterid=list_counters[0].id,
+                                                          relationaloperator='GT',
+                                                          threshold='1500'
+                                                          )
+            self.assertIsNotNone(
+                                 condition_created2,
+                                 "Failed to create Condition"
+                                 )
+            # Listing Conditions again
+            list_conditions_after = Autoscale.listConditions(
+                                                             self.userapiclient,
+                                                             listall=self.services["listall"],
+                                                             account=self.account.name,
+                                                             domainid=self.domain.id
+                                                             )
+            status = validateList(list_conditions_after)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Conditions after creation"
+                              )
+            # Listing Autoscale policies
+            list_autoscalepolicies_before = Autoscale.listAutoscalePolicies(
+                                                                            self.userapiclient,
+                                                                            listall=self.services["listall"]
+                                                                            )
+            # Verifying no Autoscale policies are listed
+            self.assertIsNone(
+                              list_autoscalepolicies_before,
+                              "Autoscale policies listed"
+                              )
+            # Creating Autoscale Policy
+            autoscalepolicy_created = Autoscale.createAutoscalePolicy(
+                                                                      self.userapiclient,
+                                                                      action='scaleup',
+                                                                      conditionids=condition_created1.id,
+                                                                      duration='100',
+                                                                      quiettime='100'
+                                                                      )
+            self.assertIsNotNone(
+                                 autoscalepolicy_created,
+                                 "Failed to create Autoscale VM Policy"
+                                 )
+            # Verifying autoscalepolicy is created using condition1
+            self.assertEquals(
+                              condition_created1.id,
+                              autoscalepolicy_created.conditions[0].id,
+                              "Autoscale Policy not created by given condition"
+                              )
+            # Listing Autoscale policies
+            list_autoscalepolicies_after = Autoscale.listAutoscalePolicies(
+                                                                           self.userapiclient,
+                                                                           listall=self.services["listall"]
+                                                                           )
+            status = validateList(list_autoscalepolicies_after)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Autoscale Policy after creation"
+                              )
+            self.assertEquals(
+                              1,
+                              len(list_autoscalepolicies_after),
+                              "Autoscale Policies count is not matching"
+                              )
+            # Updating Autoscale Policy
+            autoscalepolicy_updated = Autoscale.updateAutoscalePolicy(
+                                                                      self.userapiclient,
+                                                                      id=autoscalepolicy_created.id,
+                                                                      conditionids=condition_created2.id,
+                                                                      duration='100',
+                                                                      quiettime='100'
+                                                                      )
+            self.assertIsNotNone(
+                                 autoscalepolicy_updated,
+                                 "Failed to update Autoscale Policy"
+                                 )
+            # Verifying the Autoscale Policy is updated
+            self.assertEquals(
+                              condition_created2.id,
+                              autoscalepolicy_updated.conditions[0].id,
+                              "Autoscale Policy not updated to given condition"
+                              )
+            # Destroying the VM
+            vm_created.delete(self.userapiclient)
+            vm_created.expung(self.apiClient)
+        self.cleanup.append(self.account)
         return
- 
+
     @attr(tags=["advanced", "provisioning"])
     def test_18_create_update_autoscaleprofiles(self):
-        """  
+        """
         @summary: Test to list, create and update Autoscale VM Profiles
         @Steps:
         Step1: Creating a Network Offering for Supported Service LB with Netscaler
@@ -3597,277 +3642,303 @@ class TestIpAddresses(cloudstackTestCase):
         Step15: Updating Autoscale VM profile with destroy vm grace period
         Step16: Verifying that Autoscale VM is updated
         """
-        # Listing Network Offerings
-        list_nwoff_before = NetworkOffering.list(
-                                                 self.apiClient,
-                                                 forvpc="false",
-                                                 guestiptype="Isolated",
-                                                 state="Enabled",
-                                                 supportedservices="SourceNat,Lb",
-                                                 zoneid=self.zone.id
-                                                 )
-        # Creating Network Offerign with LB as Netscalar
-        nwoff_created = NetworkOffering.create(
-                                               self.apiClient,
-                                               self.services["nw_off_isolated_netscaler"]
-                                               )
-        self.assertIsNotNone(
-                             nwoff_created,
-                             "Failed to Create Network Offering with LB sercvice for Netscaler"
-                             )
-        # Enable Network offering
-        nwoff_created.update(self.apiClient, state='Enabled')
-        # Listing Network Offerings again
-        list_nwoff_after = NetworkOffering.list(
-                                                self.apiClient,
-                                                forvpc="false",
-                                                guestiptype="Isolated",
-                                                state="Enabled",
-                                                supportedservices="SourceNat,Lb",
-                                                zoneid=self.zone.id
-                                                )
-        self.assertEquals(
-                          len(list_nwoff_before)+1,
-                          len(list_nwoff_after),
-                          "Failed to create Network Offering"
-                          )
-        # Creating a Network Using the Network Offering
-        network = Network.create(
-                                  self.userapiclient,
-                                  self.services["network"],
-                                  accountid=self.account.name,
-                                  domainid=self.domain.id,
-                                  networkofferingid=nwoff_created.id,
-                                  zoneid=self.zone.id
-                                  )
-        self.assertIsNotNone(
-                             network,
-                             "Network creation failed"
-                             )
-        self.cleanup.append(network)
-        self.cleanup.append(nwoff_created)
-        # Launching a Virtual Machine
-        vm_created = VirtualMachine.create(
-                                           self.userapiclient,
-                                           self.services["virtual_machine"],
-                                           accountid=self.account.name,
-                                           domainid=self.account.domainid,
-                                           networkids=network.id,
-                                           serviceofferingid=self.service_offering.id,
-                                           )
-        self.assertIsNotNone(
-                             vm_created,
-                             "Failed to launch a VM under network created"
-                             )
-        # Listing all the IP Addresses for a user
-        list_ipaddresses_before = PublicIPAddress.list(
-                                                       self.userapiclient,
-                                                       listall=self.services["listall"]
-                                                       )
-        status = validateList(list_ipaddresses_before)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed while launching a VM"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         1,
-                         len(list_ipaddresses_before),
-                         "IP Addresses Association Failed while launching a VM"
-                         )
-        # Associating an IP Addresses to Network created 
-        associated_ipaddress = PublicIPAddress.create(
-                                                       self.userapiclient,
-                                                       services=self.services["network"],
-                                                       networkid=network.id
-                                                       )
-        self.assertIsNotNone(
-                             associated_ipaddress,
-                             "Failed to Associate IP Address"
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("ScaleVM is not supported on KVM. Hence, skipping the test")
+
+        list_physical_networks = PhysicalNetwork.list(
+                                                     self.apiClient,
+                                                     zoneid=self.zone.id
+                                                     )
+        physical_networks_size = 0
+        if list_physical_networks is not None:
+            physical_networks_size = len(list_physical_networks)
+
+        run_flag = False
+        for i in range(0, len(list_physical_networks)):
+            list_network_serviceprovider = NetworkServiceProvider.list(
+                                                                       self.apiClient,
+                                                                       physicalnetworkid=list_physical_networks[i].id
+                                                                       )
+            for j in range(0, len(list_network_serviceprovider)):
+                if((list_network_serviceprovider[j].name == 'Netscaler') and (list_network_serviceprovider[j].state == 'Enabled')):
+                    run_flag = True
+                    break
+
+        if(run_flag == False):
+            self.debug("Netscaler is not enabled and auto scale VM is applicable only for Netscaler")
+        else:
+            # Listing Network Offerings
+            list_nwoff_before = NetworkOffering.list(
+                                                     self.apiClient,
+                                                     forvpc="false",
+                                                     guestiptype="Isolated",
+                                                     state="Enabled",
+                                                     supportedservices="SourceNat,Lb",
+                                                     zoneid=self.zone.id
+                                                     )
+            # Creating Network Offerign with LB as Netscalar
+            nwoff_created = NetworkOffering.create(
+                                                   self.apiClient,
+                                                   self.services["nw_off_isolated_netscaler"]
+                                                   )
+            self.assertIsNotNone(
+                                 nwoff_created,
+                                 "Failed to Create Network Offering with LB sercvice for Netscaler"
+                                 )
+            # Enable Network offering
+            nwoff_created.update(self.apiClient, state='Enabled')
+            # Listing Network Offerings again
+            list_nwoff_after = NetworkOffering.list(
+                                                    self.apiClient,
+                                                    forvpc="false",
+                                                    guestiptype="Isolated",
+                                                    state="Enabled",
+                                                    supportedservices="SourceNat,Lb",
+                                                    zoneid=self.zone.id
+                                                    )
+            self.assertEquals(
+                              len(list_nwoff_before) + 1,
+                              len(list_nwoff_after),
+                              "Failed to create Network Offering"
+                              )
+            # Creating a Network Using the Network Offering
+            network = Network.create(
+                                      self.userapiclient,
+                                      self.services["network"],
+                                      accountid=self.account.name,
+                                      domainid=self.domain.id,
+                                      networkofferingid=nwoff_created.id,
+                                      zoneid=self.zone.id
+                                      )
+            self.assertIsNotNone(
+                                 network,
+                                 "Network creation failed"
+                                 )
+            self.cleanup.append(network)
+            self.cleanup.append(nwoff_created)
+            # Launching a Virtual Machine
+            vm_created = VirtualMachine.create(
+                                               self.userapiclient,
+                                               self.services["virtual_machine"],
+                                               accountid=self.account.name,
+                                               domainid=self.account.domainid,
+                                               networkids=network.id,
+                                               serviceofferingid=self.service_offering.id,
+                                               )
+            self.assertIsNotNone(
+                                 vm_created,
+                                 "Failed to launch a VM under network created"
+                                 )
+            # Listing all the IP Addresses for a user
+            list_ipaddresses_before = PublicIPAddress.list(
+                                                           self.userapiclient,
+                                                           listall=self.services["listall"]
+                                                           )
+            status = validateList(list_ipaddresses_before)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "IP Addresses Association Failed while launching a VM"
+                              )
+            # Verifying the length of the list is 1
+            self.assertEqual(
+                             1,
+                             len(list_ipaddresses_before),
+                             "IP Addresses Association Failed while launching a VM"
                              )
-        # Listing all the IP Addresses for a user
-        list_ipaddresses_after = PublicIPAddress.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"]
-                                                      )
-        status = validateList(list_ipaddresses_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "IP Addresses Association Failed"
-                          )
-        # Verifying the length of the list is 1
-        self.assertEqual(
-                         2,
-                         len(list_ipaddresses_after),
-                         "Number of IP Addresses associated are not matching expected"
-                         )
-        # Listing Service Offerings
-        list_service_offerings = ServiceOffering.list(
-                                                      self.userapiclient,
-                                                      listall=self.services["listall"],
-                                                      issystem='false'
-                                                      )
-        status = validateList(list_service_offerings)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Service Offerings"
-                          )
-        # Listing Users
-        list_users = User.list(
-                               self.apiClient,
-                               listall=self.services["listall"],
-                               account=self.account.name,
-                               domainid=self.domain.id
-                               )
-        status = validateList(list_users)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Users"
-                          )
-        # Listing Featured Templates
-        list_templates_featured = Template.list(
-                                                self.userapiclient,
-                                                listall=self.services["listall"],
-                                                templatefilter="featured",
-                                                zoneid=self.zone.id
-                                                )
-        status = validateList(list_templates_featured)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Featured Templates"
-                          )
-        # Listing Community Templates
-        list_templates_community = Template.list(
-                                                self.userapiclient,
-                                                listall=self.services["listall"],
-                                                templatefilter="community",
-                                                zoneid=self.zone.id
-                                                )
-        self.assertIsNone(
-                          list_templates_community,
-                          "Community Templates listed for newly created User"
-                          )
-        # Listing selfexecutable Templates
-        list_templates_selfexecutable = Template.list(
-                                                self.userapiclient,
-                                                listall=self.services["listall"],
-                                                templatefilter="selfexecutable",
-                                                zoneid=self.zone.id
-                                                )
-        self.assertIsNone(
-                          list_templates_selfexecutable,
-                          "Self Executable Templates listed for newly created User"
-                          )
-        # Listing Autoscale VM Profiles
-        list_autoscalevm_profiles_before = Autoscale.listAutoscaleVmPofiles(
-                                                                            self.userapiclient,
-                                                                            listall=self.services["listall"]
-                                                                            )
-        self.assertIsNone(
-                          list_autoscalevm_profiles_before,
-                          "Autoscale VM Profiles listed"
-                          )
-        # Creating Autoscale VM Profile
-        counterparam = { "snmpcommunity": "public", "snmpport": "161"}
-        autoscalevm_profile = Autoscale.createAutoscaleVmProfile(
-                                                                 self.userapiclient,
-                                                                 serviceofferingid=list_service_offerings[0].id,
-                                                                 zoneid=self.zone.id,
-                                                                 templateid=list_templates_featured[0].id,
-                                                                 autoscaleuserid=list_users[0].id,
-                                                                 destroyvmgraceperiod='100',
-                                                                 counterparam=counterparam
-                                                                 )
-        self.assertIsNotNone(
-                             autoscalevm_profile,
-                             "Failed to create Autoscale VM Profile"
+            # Associating an IP Addresses to Network created
+            associated_ipaddress = PublicIPAddress.create(
+                                                           self.userapiclient,
+                                                           services=self.services["network"],
+                                                           networkid=network.id
+                                                           )
+            self.assertIsNotNone(
+                                 associated_ipaddress,
+                                 "Failed to Associate IP Address"
+                                 )
+            # Listing all the IP Addresses for a user
+            list_ipaddresses_after = PublicIPAddress.list(
+                                                          self.userapiclient,
+                                                          listall=self.services["listall"]
+                                                          )
+            status = validateList(list_ipaddresses_after)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "IP Addresses Association Failed"
+                              )
+            # Verifying the length of the list is 1
+            self.assertEqual(
+                             2,
+                             len(list_ipaddresses_after),
+                             "Number of IP Addresses associated are not matching expected"
                              )
-        # Listing Autoscale VM Profiles
-        list_autoscalevm_profiles_after = Autoscale.listAutoscaleVmPofiles(
-                                                                           self.userapiclient,
-                                                                           listall=self.services["listall"]
-                                                                           )
-        status = validateList(list_autoscalevm_profiles_after)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Autoscale VM Profile after creation"
-                          )
-        # Verifying only 1 autoscale vm profile is created
-        self.assertEquals(
-                          1,
-                          len(list_autoscalevm_profiles_after),
-                          "Count of Autoscale VM profiles listed is not matching"
-                          )
-        # Listing the Autoscale VM Profile by id
-        list_autoscalvmprofile = Autoscale.listAutoscaleVmPofiles(
-                                                                  self.userapiclient,
-                                                                  listall=self.services["listall"],
-                                                                  id=autoscalevm_profile.id
-                                                                  )
-        status = validateList(list_autoscalvmprofile)
-        self.assertEquals(
-                          PASS,
-                          status[0],
-                          "Failed to list Autoscale VM Profile by Id after creation"
-                          )
-        # Verifying details of the listed Autoscale VM Profile
-        # Creating expected and actual values dictionaries
-        expected_dict = {
-                         "id":autoscalevm_profile.id,
-                         "account":self.account.name,
-                         "domainid":self.domain.id,
-                         "autoscaleuserid":list_users[0].id,
-                         "serviceofferingid":list_service_offerings[0].id,
-                         "zoneid":self.zone.id,
-                         "templateid":list_templates_featured[0].id,
-                         "destroyvmgraceperiod":autoscalevm_profile.destroyvmgraceperiod
-                         }
-        actual_dict = {
-                       "id":list_autoscalvmprofile[0].id,
-                       "account":list_autoscalvmprofile[0].account,
-                       "domainid":list_autoscalvmprofile[0].domainid,
-                       "autoscaleuserid":list_autoscalvmprofile[0].autoscaleuserid,
-                       "serviceofferingid":list_autoscalvmprofile[0].serviceofferingid,
-                       "zoneid":list_autoscalvmprofile[0].zoneid,
-                       "templateid":list_autoscalvmprofile[0].templateid,
-                       "destroyvmgraceperiod":list_autoscalvmprofile[0].destroyvmgraceperiod
-                       }
-        autoscalevm_profile_status = self.__verify_values(
-                                                          expected_dict,
-                                                          actual_dict
+            # Listing Service Offerings
+            list_service_offerings = ServiceOffering.list(
+                                                          self.userapiclient,
+                                                          listall=self.services["listall"],
+                                                          issystem='false'
                                                           )
-        self.assertEqual(
-                         True,
-                         autoscalevm_profile_status,
-                         "Created Autoscale VM Profile details are not as expected"
-                         )
-        # Updating destroyvmgrageperiod for created Autoscale VM Profile
-        autoscalevm_profile_updated = Autoscale.updateAutoscaleVMProfile(
-                                                                         self.userapiclient,
-                                                                         id=autoscalevm_profile.id,
-                                                                         autoscaleuserid=list_users[0].id,
-                                                                         destroyvmgraceperiod='200',
-                                                                         templateid=list_templates_featured[0].id,
-                                                                         )
-        self.assertIsNotNone(
-                             autoscalevm_profile_updated,
-                             "Failed to update Autoscale VM Profile"
+            status = validateList(list_service_offerings)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Service Offerings"
+                              )
+            # Listing Users
+            list_users = User.list(
+                                   self.apiClient,
+                                   listall=self.services["listall"],
+                                   account=self.account.name,
+                                   domainid=self.domain.id
+                                   )
+            status = validateList(list_users)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Users"
+                              )
+            # Listing Featured Templates
+            list_templates_featured = Template.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    templatefilter="featured",
+                                                    zoneid=self.zone.id
+                                                    )
+            status = validateList(list_templates_featured)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Featured Templates"
+                              )
+            # Listing Community Templates
+            list_templates_community = Template.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    templatefilter="community",
+                                                    zoneid=self.zone.id
+                                                    )
+            self.assertIsNone(
+                              list_templates_community,
+                              "Community Templates listed for newly created User"
+                              )
+            # Listing selfexecutable Templates
+            list_templates_selfexecutable = Template.list(
+                                   

<TRUNCATED>

[04/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6687: Fixed IP reservation test case failures with code re-factoring

(cherry picked from commit 77460e9556f7d1b9d6cac6c8ece199bf3b83cd9c)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8d211fa2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8d211fa2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8d211fa2

Branch: refs/heads/4.4
Commit: 8d211fa27b580961c893c97739b3c082803002d3
Parents: 2ec0b8f
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu May 15 03:45:22 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:40 2014 +0200

----------------------------------------------------------------------
 .../component/test_ip_reservation.py            | 121 ++++++++++++++-----
 tools/marvin/marvin/codes.py                    |   1 +
 tools/marvin/marvin/lib/common.py               |  28 +++--
 3 files changed, 106 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d211fa2/test/integration/component/test_ip_reservation.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py
index 390a959..c84f63c 100644
--- a/test/integration/component/test_ip_reservation.py
+++ b/test/integration/component/test_ip_reservation.py
@@ -35,9 +35,10 @@ from marvin.lib.common import (get_zone,
                                get_domain,
                                wait_for_cleanup,
                                createEnabledNetworkOffering,
-                               createNetworkRulesForVM)
+                               createNetworkRulesForVM,
+                               verifyNetworkState)
 from marvin.codes import (PASS, FAIL, FAILED, UNKNOWN, FAULT, MASTER,
-                          NAT_RULE, STATIC_NAT_RULE)
+                          NAT_RULE, STATIC_NAT_RULE, ERROR_CODE_530)
 import netaddr
 
 import random
@@ -1067,19 +1068,6 @@ class TestFailureScnarios(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    def create_virtual_machine(self, network_id=None, ip_address=None):
-        virtual_machine = VirtualMachine.create(self.apiclient,
-                                                          self.services["virtual_machine"],
-                                                          networkids=network_id,
-                                                          serviceofferingid=self.service_offering.id,
-                                                          accountid=self.account.name,
-                                                          domainid=self.domain.id,
-                                                          ipaddress=ip_address
-                                                          )
-        self.debug("Virtual Machine is created: " + virtual_machine.id)
-        self.cleanup.append(virtual_machine)
-        return virtual_machine
-
     @attr(tags=["advanced", "selfservice"])
     def test_network_not_implemented(self):
         # steps
@@ -1087,8 +1075,18 @@ class TestFailureScnarios(cloudstackTestCase):
         #
         # validation
         # should throw exception as network is not in implemented state as no vm is created
-        with self.assertRaises(Exception):
-            self.isolated_network.update(self.apiclient, guestvmcidr="10.1.1.0/26")
+
+        networkOffering = self.isolated_network_offering
+        resultSet = createIsolatedNetwork(self, networkOffering.id)
+        if resultSet[0] == FAIL:
+            self.fail("Failed to create isolated network")
+        else:
+            isolated_network = resultSet[1]
+
+        response = isolated_network.update(self.apiclient, guestvmcidr="10.1.1.0/26")
+        self.assertEqual(response.errorcode, ERROR_CODE_530, "Job should \
+                         have failed with error code %s, instead got response \
+                         %s" % (ERROR_CODE_530, response))
         return
 
     @attr(tags=["advanced", "selfservice"])
@@ -1102,14 +1100,31 @@ class TestFailureScnarios(cloudstackTestCase):
         # 1. guest vm cidr should be successfully updated with correct value
         # 2. existing guest vm ip should not be changed after reservation
         # 3. newly created VM should get ip in guestvmcidr
-        guest_vm_cidr = u"10.1.1.0/29"
+
+        networkOffering = self.isolated_persistent_network_offering
+        subnet = "10.1."+str(random.randrange(1,254))
+        gateway = subnet + ".1"
+        isolated_persistent_network = None
+        resultSet = createIsolatedNetwork(self, networkOffering.id, gateway=gateway)
+        if resultSet[0] == FAIL:
+            self.fail("Failed to create isolated network")
+        else:
+            isolated_persistent_network = resultSet[1]
+        guest_vm_cidr = subnet +".0/29"
         virtual_machine_1 = None
         try:
-            virtual_machine_1 = self.create_virtual_machine(network_id=self.isolated_persistent_network.id, ip_address=u"10.1.1.3")
+            virtual_machine_1 = VirtualMachine.create(self.apiclient,
+                                                          self.testData["virtual_machine"],
+                                                          networkids=isolated_persistent_network.id,
+                                                          serviceofferingid=self.service_offering.id,
+                                                          accountid=self.account.name,
+                                                          domainid=self.domain.id,
+                                                          ipaddress=subnet+".3"
+                                                          )
         except Exception as e:
-            self.skipTest("VM creation fails in network ")
+            self.fail("VM creation fails in network: %s" % e)
 
-        update_response = Network.update(self.isolated_persistent_network, self.apiclient, id=self.isolated_persistent_network.id, guestvmcidr=guest_vm_cidr)
+        update_response = Network.update(isolated_persistent_network, self.apiclient, id=isolated_persistent_network.id, guestvmcidr=guest_vm_cidr)
         self.assertEqual(guest_vm_cidr, update_response.cidr, "cidr in response is not as expected")
         vm_list = VirtualMachine.list(self.apiclient,
                                        id=virtual_machine_1.id)
@@ -1120,11 +1135,18 @@ class TestFailureScnarios(cloudstackTestCase):
                           virtual_machine_1.ipaddress,
                            "VM IP should not change after reservation")
         try:
-            virtual_machine_2 = self.create_virtual_machine(network_id=self.isolated_persistent_network.id)
+            virtual_machine_2 = VirtualMachine.create(self.apiclient,
+                                                          self.testData["virtual_machine"],
+                                                          networkids=isolated_persistent_network.id,
+                                                          serviceofferingid=self.service_offering.id,
+                                                          accountid=self.account.name,
+                                                          domainid=self.domain.id
+                                                          )
             if netaddr.IPAddress(virtual_machine_2.ipaddress) not in netaddr.IPNetwork(guest_vm_cidr):
                 self.fail("Newly created VM doesn't get IP from reserverd CIDR")
         except Exception as e:
             self.skipTest("VM creation fails, cannot validate the condition: %s" % e)
+        return
 
     @attr(tags=["advanced", "selfservice"])
     def test_reservation_after_router_restart(self):
@@ -1135,24 +1157,43 @@ class TestFailureScnarios(cloudstackTestCase):
         # validation
         # 1. guest vm cidr should be successfully updated with correct value
         # 2. network cidr should remain same after router restart
-        guest_vm_cidr = u"10.1.1.0/29"
+        networkOffering = self.isolated_persistent_network_offering
+        subnet = "10.1."+str(random.randrange(1,254))
+        gateway = subnet + ".1"
+        isolated_persistent_network = None
+        resultSet = createIsolatedNetwork(self, networkOffering.id, gateway=gateway)
+        if resultSet[0] == FAIL:
+            self.fail("Failed to create isolated network")
+        else:
+            isolated_persistent_network = resultSet[1]
+
+        response = verifyNetworkState(self.apiclient, isolated_persistent_network.id,\
+                        "implemented")
+        exceptionOccured = response[0]
+        isNetworkInDesiredState = response[1]
+        exceptionMessage = response[2]
 
-        update_response = Network.update(self.isolated_persistent_network, self.apiclient, id=self.isolated_persistent_network.id, guestvmcidr=guest_vm_cidr)
+        if (exceptionOccured or (not isNetworkInDesiredState)):
+            self.fail(exceptionMessage)
+        guest_vm_cidr = subnet +".0/29"
+
+        update_response = Network.update(isolated_persistent_network, self.apiclient, id=isolated_persistent_network.id, guestvmcidr=guest_vm_cidr)
         self.assertEqual(guest_vm_cidr, update_response.cidr, "cidr in response is not as expected")
 
         routers = Router.list(self.apiclient,
-                             networkid=self.isolated_persistent_network.id,
+                             networkid=isolated_persistent_network.id,
                              listall=True)
         self.assertEqual(validateList(routers)[0], PASS,
                     "routers list validation failed")
 
         Router.reboot(self.apiclient, routers[0].id)
-        networks = Network.list(self.apiclient, id=self.isolated_persistent_network.id)
+        networks = Network.list(self.apiclient, id=isolated_persistent_network.id)
         self.assertEqual(
                     validateList(networks)[0], PASS,
                     "list Networks should return valid response"
                     )
         self.assertEqual(networks[0].cidr, guest_vm_cidr, "guestvmcidr should match after router reboot")
+        return
 
     @attr(tags=["advanced", "selfservice"])
     def test_vm_create_outside_cidr_after_reservation(self):
@@ -1163,11 +1204,25 @@ class TestFailureScnarios(cloudstackTestCase):
         # validation
         # 1. guest vm cidr should be successfully updated with correct value
         # 2  newly created VM should not be created and result in exception
-        guest_vm_cidr = u"10.1.1.0/29"
-        update_response = Network.update(self.isolated_persistent_network, self.apiclient, id=self.isolated_persistent_network.id, guestvmcidr=guest_vm_cidr)
+        networkOffering = self.isolated_persistent_network_offering
+        subnet = "10.1."+str(random.randrange(1,254))
+        gateway = subnet + ".1"
+        isolated_persistent_network = None
+        resultSet = createIsolatedNetwork(self, networkOffering.id, gateway=gateway)
+        if resultSet[0] == FAIL:
+            self.fail("Failed to create isolated network")
+        else:
+            isolated_persistent_network = resultSet[1]
+        guest_vm_cidr = subnet +".0/29"
+        update_response = Network.update(isolated_persistent_network, self.apiclient, id=isolated_persistent_network.id, guestvmcidr=guest_vm_cidr)
         self.assertEqual(guest_vm_cidr, update_response.cidr, "cidr in response is not as expected")
-        try:
-            self.create_virtual_machine(network_id=self.isolated_persistent_network.id, ip_address=u"10.1.1.9")
-            self.fail("vm should not be created ")
-        except Exception as e:
-            self.debug("exception as IP is outside of guestvmcidr: %s" % e)
+        with self.assertRaises(Exception):
+            VirtualMachine.create(self.apiclient,
+                                  self.testData["virtual_machine"],
+                                  networkids=isolated_persistent_network.id,
+                                  serviceofferingid=self.service_offering.id,
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  ipaddress="10.1.1.9"
+                                  )
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d211fa2/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index ef49c0c..c72a6bd 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -60,6 +60,7 @@ JOB_INPROGRESS = 0
 JOB_SUCCEEDED = 1
 JOB_FAILED = 2
 JOB_CANCELLED = 3
+ERROR_CODE_530 = 530
 '''
 User Related Codes
 '''

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d211fa2/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index ad79588..b946b92 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1112,19 +1112,25 @@ def shouldTestBeSkipped(networkType, zoneType):
 
 def verifyNetworkState(apiclient, networkid, state):
     """List networks and check if the network state matches the given state"""
+    retriesCount = 10
+    isNetworkInDesiredState = False
+    exceptionOccured = False
+    exceptionMessage = ""
     try:
-        networks = Network.list(apiclient, id=networkid)
+        while retriesCount >= 0:
+            networks = Network.list(apiclient, id=networkid)
+            assert validateList(
+                networks)[0] == PASS, "Networks list validation failed"
+            if str(networks[0].state).lower() == state:
+                isNetworkInDesiredState = True
+                break
+            retriesCount -= 1
+            time.sleep(60)
     except Exception as e:
-        raise Exception(
-            "Failed while fetching network list with error: %s" %
-            e)
-    assert validateList(
-        networks)[0] == PASS, "Networks list validation failed, list is %s"\
-                              % networks
-    assert str(networks[0].state).lower(
-    ) == state, "network state should be %s, it is %s" \
-                % (state, networks[0].state)
-    return
+        exceptionOccured = True
+        exceptionMessage = e
+        return [exceptionOccured, isNetworkInDesiredState, exceptionMessage]
+    return [exceptionOccured, isNetworkInDesiredState, exceptionMessage]
 
 
 def verifyComputeOfferingCreation(apiclient, computeofferingid):


[09/50] [abbrv] CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_ipaddresses.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
new file mode 100644
index 0000000..23dd76b
--- /dev/null
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -0,0 +1,4192 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
+from nose.plugins.attrib import attr
+from time import sleep
+
+class TestIpAddresses(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestIpAddresses, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            if cls.zone.localstorageenabled:
+                cls.storagetype = 'local'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+            else:
+                cls.storagetype = 'shared'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+   
+            cls.services['mode'] = cls.zone.networktype
+            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            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_offerings"]["tiny"]
+                                                          )
+            cls._cleanup.append(cls.service_offering)
+            cls.services['mode'] = cls.zone.networktype
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created volumes
+        cleanup_resources(self.apiClient, self.cleanup)
+        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 __verify_values(self, expected_vals, actual_vals):
+        """  
+        @summary: Function to verify expected and actual values
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "provisioning"])
+    def test_01_list_ipaddresses_pagination(self):
+        """  
+        @summary: Test List IP Addresses pagination
+        @Steps:
+        Step1: Creating a network for the user
+        Step2: Listing all the IP Addresses for a user
+        Step3: Verifying that no IP Addresses are listed
+        Step4: Associating (pagesize + 1) number of IP Addresses
+        Step5: Listing all the IP Addresses again
+        Step6: Verifying the length of the IP Addresses is (page size + 1)
+        Step7: Listing all the IP Addresses in page1
+        Step8: Verifying that the length of the IP Addresses in page 1 is (page size)
+        Step9: Listing all the IP Addresses in page2
+        Step10: Verifying that the length of the IP Addresses in page 2 is 1
+        Step11: Dis-Associating the IP Addresses present in page 2
+        Step12: Listing for the IP Addresses on page 2
+        Step13: Verifying that no IP Addresses are listed
+        """
+        # Listing all the networks available
+        networks_list_before = Network.list(
+                                            self.userapiclient,
+                                            forvpc="false",
+                                            domainid=self.domain.id,
+                                            account=self.account.name,
+                                            )
+        self.assertIsNone(
+                          networks_list_before,
+                          "Networks listed for newly created user"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat",
+                                                      zoneid=self.zone.id
+                                                      )
+        status = validateList(network_offerings_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Isolated Network Offerings with sourceNat enabled are not found"
+                          )
+        # Creating a network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network)
+        # Listing all the networks available
+        networks_list_after = Network.list(
+                                           self.userapiclient,
+                                           forvpc="false",
+                                           domainid=self.domain.id,
+                                           account=self.account.name,
+                                           )
+        status = validateList(networks_list_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Network Creation Failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(networks_list_after),
+                          "Network creation failed"
+                          )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        self.assertIsNone(
+                          list_ipaddresses_before,
+                          "IP Addresses listed for newly created user"
+                          )
+        # Associating (pagesize + 1) number of IP Addresses    
+        for i in range(0, (self.services["pagesize"] + 1)):
+            ipaddress = PublicIPAddress.create(
+                                               self.userapiclient,
+                                               services=self.services["network"],
+                                               networkid=network.id
+                                               )
+            self.assertIsNotNone(
+                                 ipaddress,
+                                 "Failed to Associate IP Address"
+                                 )
+       
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the volumes is (page size + 1)
+        self.assertEqual(
+                         (self.services["pagesize"] + 1),
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing IP Address in page 1
+        list_ipaddress_page1 = PublicIPAddress.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    page=1,
+                                                    pagesize=self.services["pagesize"]
+                                                    )
+        status = validateList(list_ipaddress_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list IP Addresses in page1"
+                          )
+        # Verifying that list size is equals to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_ipaddress_page1),
+                          "Failed to list pagesize number of IP Addresses in page1"
+                          )
+        # Listing IP Address in page 2
+        list_ipaddress_page2 = PublicIPAddress.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    page=2,
+                                                    pagesize=self.services["pagesize"]
+                                                    )
+        status = validateList(list_ipaddress_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list IP Addresses in page2"
+                          )
+        # Verifying that List size is equal to 1
+        self.assertEquals(
+                          1,
+                          len(list_ipaddress_page2),
+                          "Failed to list IP Addresses in page2"
+                          )
+        # Dis-associating an IP Address
+        ipaddress.delete(self.userapiclient)
+        # Listing IP Address in page 2
+        list_ipaddress_page2 = PublicIPAddress.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    page=2,
+                                                    pagesize=self.services["pagesize"]
+                                                    )
+        # Verifying that no IP Addresses are listed
+        self.assertIsNone(
+                          list_ipaddress_page2,
+                          "Disassociation of IP Address Failed"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_02_list_ipaddresses_byid(self):
+        """  
+        @summary: Test List IP Addresses details by ID
+        @Steps:
+        Step1: Creating a network for the user
+        Step2: Listing all the IP Addresses for a user
+        Step3: Verifying that no IP Addresses are listed
+        Step4: Associating an IP Addresses for Network
+        Step5: Listing all the IP Addresses again
+        Step6: Verifying the length of the IP Addresses is 1
+        Step7: Listing  the IP Addresses by Id
+        Step8: Verifying that the length of the IP Addresses list is 1
+        Step9: Verifying the details of the Listed IP Address
+        """
+        # Listing all the networks available
+        networks_list_before = Network.list(
+                                            self.userapiclient,
+                                            forvpc="false",
+                                            domainid=self.domain.id,
+                                            account=self.account.name,
+                                            )
+        self.assertIsNone(
+                          networks_list_before,
+                          "Networks listed for newly created user"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat",
+                                                      zoneid=self.zone.id
+                                                      )
+        status = validateList(network_offerings_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Isolated Network Offerings with sourceNat enabled are not found"
+                          )
+        # Creating a network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network)
+        # Listing all the networks available
+        networks_list_after = Network.list(
+                                           self.userapiclient,
+                                           forvpc="false",
+                                           domainid=self.domain.id,
+                                           account=self.account.name,
+                                           )
+        status = validateList(networks_list_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Network Creation Failed"
+                          )
+        self.assertEquals(
+                          1,
+                          len(networks_list_after),
+                          "Network creation failed"
+                          )
+        # Listing the Network By ID
+        network_list_byid = Network.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         id=network.id
+                                         )
+        status = validateList(network_list_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list Network by Id"
+                          )
+        self.assertEquals(
+                          1,
+                          len(network_list_byid),
+                          "Failed to list Network by Id"
+                          )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        self.assertIsNone(
+                          list_ipaddresses_before,
+                          "IP Addresses listed for newly created user"
+                          )
+        # Associating an IP Addresses to Network created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      networkid=network_list_byid[0].id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing IP Address by id
+        list_ipaddress_byid = PublicIPAddress.list(
+                                                   self.userapiclient,
+                                                   id=associated_ipaddress.ipaddress.id
+                                                    )
+        status = validateList(list_ipaddress_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list IP Addresses by ID"
+                          )
+        # Verifying that list size is equals to 1
+        self.assertEquals(
+                          1,
+                          len(list_ipaddress_byid),
+                          "Failed to list IP Addresses by ID"
+                          )
+        # Verifying details of the listed IP Address to be same as IP Address created above
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":associated_ipaddress.ipaddress.id,
+                         "associatednetworkid":associated_ipaddress.ipaddress.associatednetworkid,
+                         "associatednetworkname":associated_ipaddress.ipaddress.associatednetworkname,
+                         "ipaddress":associated_ipaddress.ipaddress.ipaddress,
+                         "issourcenat":associated_ipaddress.ipaddress.issourcenat,
+                         "isstaticnat":associated_ipaddress.ipaddress.isstaticnat,
+                         "networkid":associated_ipaddress.ipaddress.networkid
+                         }
+        actual_dict = {
+                       "id":list_ipaddress_byid[0].id,
+                       "associatednetworkid":list_ipaddress_byid[0].associatednetworkid,
+                       "associatednetworkname":list_ipaddress_byid[0].associatednetworkname,
+                       "ipaddress":list_ipaddress_byid[0].ipaddress,
+                       "issourcenat":list_ipaddress_byid[0].issourcenat,
+                       "isstaticnat":list_ipaddress_byid[0].isstaticnat,
+                       "networkid":list_ipaddress_byid[0].networkid
+                       }
+        ipaddress_status = self.__verify_values(
+                                                expected_dict,
+                                                actual_dict
+                                                )
+        self.assertEqual(
+                         True,
+                         ipaddress_status,
+                         "Listed IP Address details are not as expected"
+                         )
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_03_associate_ipaddress_for_vpc(self):
+        """  
+        @summary: Test to Associate IP Address for VPC
+        @Steps:
+        Step1: Creating a VPC for the user
+        Step2: Listing all the IP Addresses for a user
+        Step3: Verifying that 1 IP Addresses is listed
+        Step4: Associating an IP Addresses for VPC
+        Step5: Listing all the IP Addresses again
+        Step6: Verifying the length of the IP Addresses list is 2
+        Step7: Listing  the IP Addresses by Id
+        Step8: Verifying that the length of the IP Addresses list is 1
+        Step9: Verifying the details of the Listed IP Address
+        """
+        # Listing all the vpc's for a user
+        list_vpc_before = VPC.list(self.userapiclient)
+        # Verifying No VPCs are listed
+        self.assertIsNone(
+                          list_vpc_before,
+                          "VPC's Listed for newly Created User"
+                          )
+        # Listing VPC Offerings
+        list_vpc_offering = VpcOffering.list(self.userapiclient)
+        status = validateList(list_vpc_offering)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "list vpc offering is none")
+        # Creating a vpc
+        vpc_created = VPC.create(
+                                 self.userapiclient,
+                                 self.services["vpc"],
+                                 list_vpc_offering[0].id,
+                                 self.zone.id
+                                )
+        self.assertIsNotNone(
+                             vpc_created,
+                             "VPC Creation Failed"
+                             )
+        self.cleanup.append(vpc_created)
+        # Listing the vpc for a user after creating a vpc       
+        list_vpc_after = VPC.list(self.userapiclient)
+        status = validateList(list_vpc_after)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list VPC not as expected"
+                          )
+        # Verifying the list vpc size is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_vpc_after),
+                          "list VPC not equal as expected"
+                          )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        status = validateList(list_ipaddresses_before)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to List VPC IP Address"
+                          )
+        self.assertEquals(
+                          1,
+                          len(list_ipaddresses_before),
+                          "Failed to List VPC IP Address"
+                          )
+        # Associating an IP Addresses to VPC created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      vpcid=vpc_created.id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         len(list_ipaddresses_before) + 1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing IP Address by id
+        list_ipaddress_byid = PublicIPAddress.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   page=1,
+                                                   pagesize=self.services["pagesize"],
+                                                   id=associated_ipaddress.ipaddress.id
+                                                   )
+        status = validateList(list_ipaddress_byid)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list IP Addresses by ID"
+                          )
+        # Verifying that list size is equals to 1
+        self.assertEquals(
+                          1,
+                          len(list_ipaddress_byid),
+                          "Failed to list IP Addresses by ID"
+                          )
+        # Verifying details of the listed IP Address to be same as IP Address created above
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":associated_ipaddress.ipaddress.id,
+                         "associatednetworkid":associated_ipaddress.ipaddress.associatednetworkid,
+                         "associatednetworkname":associated_ipaddress.ipaddress.associatednetworkname,
+                         "ipaddress":associated_ipaddress.ipaddress.ipaddress,
+                         "issourcenat":associated_ipaddress.ipaddress.issourcenat,
+                         "isstaticnat":associated_ipaddress.ipaddress.isstaticnat,
+                         "networkid":associated_ipaddress.ipaddress.networkid,
+                         "vpcid":associated_ipaddress.ipaddress.vpcid
+                         }
+        actual_dict = {
+                       "id":list_ipaddress_byid[0].id,
+                       "associatednetworkid":list_ipaddress_byid[0].associatednetworkid,
+                       "associatednetworkname":list_ipaddress_byid[0].associatednetworkname,
+                       "ipaddress":list_ipaddress_byid[0].ipaddress,
+                       "issourcenat":list_ipaddress_byid[0].issourcenat,
+                       "isstaticnat":list_ipaddress_byid[0].isstaticnat,
+                       "networkid":list_ipaddress_byid[0].networkid,
+                       "vpcid":list_ipaddress_byid[0].vpcid
+                       }
+        ipaddress_status = self.__verify_values(
+                                                expected_dict,
+                                                actual_dict
+                                                )
+        self.assertEqual(
+                         True,
+                         ipaddress_status,
+                         "Listed IP Address details are not as expected"
+                         )
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_04_create_delete_lbrule_fornonvpc(self):
+        """  
+        @summary: Test to list, create and delete Load Balancer Rule for IP Address associated to Non VPC network
+        @Steps:
+        Step1: Creating a Network for the user
+        Step2: Associating an IP Addresses for Network
+        Step3: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step4: Verifying that no Load Balancer Rules are listed
+        Step5: Creating a Load Balancer Rule for IP Address associated in Step2
+        Step6: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step7: Verifying 1 Load Balancer Rule is listed
+        Step8: Deleting the Load Balancer Rule created in Step5
+        Step9: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step10: Verifying that no Load Balancer Rules are listed
+        """
+        # Listing all the Networks's for a user
+        list_networks_before = Network.list(
+                                            self.userapiclient,
+                                            listall=self.services["listall"]
+                                            )
+        # Verifying No Networks are listed
+        self.assertIsNone(
+                          list_networks_before,
+                          "Networks listed for newly created User"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat,Lb",
+                                                      zoneid=self.zone.id
+                                                      )
+        status = validateList(network_offerings_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
+                          )
+        # Creating a network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network)
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        # Verifying no IP Addresses are listed
+        self.assertIsNone(
+                          list_ipaddresses_before,
+                          "IP Addresses listed for newly created User"
+                          )
+        # Associating an IP Addresses to Network created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      networkid=network.id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_before = LoadBalancerRule.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    publicipid=associated_ipaddress.ipaddress.id
+                                                    )
+        # Verifying no Load Balancer Rules are listed
+        self.assertIsNone(
+                          list_lbrules_before,
+                          "Load Balancer Rules listed for newly Acquired Ip Address"
+                          )
+        self.services["lbrule"]["openfirewall"] = 'false'
+        # Creating a Load Balancer Rule for Ip Address
+        lb_rule = LoadBalancerRule.create(
+                                          self.userapiclient,
+                                          self.services["lbrule"],
+                                          ipaddressid=associated_ipaddress.ipaddress.id,
+                                          )
+        self.assertIsNotNone(
+                             lb_rule,
+                             "Failed to create Load Balancer Rule"
+                             )
+        # Verifying details of created Load Balancer Rule
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                         "algorithm":self.services["lbrule"]["alg"],
+                         "privateport":str(self.services["lbrule"]["privateport"]),
+                         "publicport":str(self.services["lbrule"]["publicport"]),
+                         "name":self.services["lbrule"]["name"],
+                         }
+        actual_dict = {
+                       "algorithm":str(lb_rule.algorithm),
+                       "privateport":str(lb_rule.privateport),
+                       "publicport":str(lb_rule.publicport),
+                       "name":str(lb_rule.name),
+                       }
+        lbrule_status = self.__verify_values(
+                                             expected_dict,
+                                             actual_dict
+                                             )
+        self.assertEqual(
+                         True,
+                         lbrule_status,
+                         "Created Load Balancer Rule details are not as expected"
+                         )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id
+                                                   )
+        status = validateList(list_lbrules_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Load Balancer Rule creation Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbrules_after),
+                         "Load Balancer Rule creation Failed"
+                         )
+        # Deleting Load Balancer Rule
+        lb_rule.delete(self.userapiclient)
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id
+                                                   )
+        # Verifying no Load Balancer Rules are Listed
+        self.assertIsNone(
+                          list_lbrules_after,
+                          "Failed to delete Load Balancer Rule"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_05_create_delete_lbrule_forvpc(self):
+        """  
+        @summary: Test to list, create and delete Load Balancer Rule for IP Address associated to VPC
+        @Steps:
+        Step1: Creating a VPC for the user
+        Step2: Creating Network inside VPC
+        Step3: Associating an IP Addresses for VPC
+        Step4: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step5: Verifying that no Load Balancer Rules are listed
+        Step6: Creating a Load Balancer Rule for IP Address associated in Step2
+        Step7: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step8: Verifying 1 Load Balancer Rule is listed
+        Step9: Deleting the Load Balancer Rule created in Step5
+        Step10: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step11: Verifying that no Load Balancer Rules are listed
+        """
+        # Listing all the vpc's for a user
+        list_vpc_before = VPC.list(self.userapiclient)
+        # Verifying No VPCs are listed
+        self.assertIsNone(
+                          list_vpc_before,
+                          "VPC's Listed for newly Created User"
+                          )
+        # Listing VPC Offerings
+        list_vpc_offering = VpcOffering.list(self.userapiclient)
+        status = validateList(list_vpc_offering)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "list vpc offering is none")
+        # Creating a vpc
+        vpc_created = VPC.create(
+                                 self.userapiclient,
+                                 self.services["vpc"],
+                                 list_vpc_offering[0].id,
+                                 self.zone.id
+                                )
+        self.assertIsNotNone(
+                             vpc_created,
+                             "VPC Creation Failed"
+                             )
+        # Listing the vpc for a user after creating a vpc       
+        list_vpc_after = VPC.list(self.userapiclient)
+        status = validateList(list_vpc_after)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list VPC not as expected"
+                          )
+        # Verifying the list vpc size is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_vpc_after),
+                          "list VPC not equal as expected"
+                          )
+        #List network offering for vpc = true
+        network_offering_vpc_true_list = NetworkOffering.list(
+                                                              self.userapiclient,
+                                                              forvpc = "true",
+                                                              zoneid = self.zone.id,
+                                                              supportedServices = "Lb",
+                                                              state = "Enabled"
+                                                              )
+        status = validateList(network_offering_vpc_true_list)
+        self.assertEquals(PASS, status[0], "Default network offering not present for vpc = true with Lb") 
+        # Creating network under VPC  
+        network_created = Network.create(
+                                         self.userapiclient,
+                                         self.services["ntwk"],
+                                         networkofferingid = network_offering_vpc_true_list[0].id,
+                                         vpcid = vpc_created.id,
+                                         zoneid=self.zone.id,
+                                         gateway= self.services["ntwk"]["gateway"],
+                                         netmask = self.services["ntwk"]["netmask"]
+                                     )
+        self.cleanup.append(network_created)
+        self.assertIsNotNone(
+                             network_created,
+                             "Network is not created"
+                             )
+        self.cleanup.append(vpc_created)
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        status = validateList(list_ipaddresses_before)
+        self.assertEquals(
+                          PASS, 
+                          status[0], 
+                          "list IP Addresses not as expected"
+                          )
+        # Verifying the list vpc size is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_ipaddresses_before),
+                          "list IP Addresses not equal as expected"
+                          )
+        # Associating an IP Addresses to VPC created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      vpcid=vpc_created.id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         len(list_ipaddresses_before) + 1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_before = LoadBalancerRule.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    publicipid=associated_ipaddress.ipaddress.id
+                                                    )
+        # Verifying no Load Balancer Rules are listed
+        self.assertIsNone(
+                          list_lbrules_before,
+                          "Load Balancer Rules listed for newly Acquired Ip Address"
+                          )
+        self.services["lbrule"]["openfirewall"] = 'false'
+        # Creating a Load Balancer Rule for Ip Address
+        lb_rule = LoadBalancerRule.create(
+                                          self.userapiclient,
+                                          self.services["lbrule"],
+                                          ipaddressid=associated_ipaddress.ipaddress.id,
+                                          networkid=network_created.id
+                                          )
+        self.assertIsNotNone(
+                             lb_rule,
+                             "Failed to create Load Balancer Rule"
+                             )
+        # Verifying details of created Load Balancer Rule
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                         "algorithm":self.services["lbrule"]["alg"],
+                         "privateport":str(self.services["lbrule"]["privateport"]),
+                         "publicport":str(self.services["lbrule"]["publicport"]),
+                         "name":self.services["lbrule"]["name"],
+                         }
+        actual_dict = {
+                       "algorithm":str(lb_rule.algorithm),
+                       "privateport":str(lb_rule.privateport),
+                       "publicport":str(lb_rule.publicport),
+                       "name":str(lb_rule.name),
+                       }
+        lbrule_status = self.__verify_values(
+                                             expected_dict,
+                                             actual_dict
+                                             )
+        self.assertEqual(
+                         True,
+                         lbrule_status,
+                         "Created Load Balancer Rule details are not as expected"
+                         )
+       # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id,
+                                                   )
+        status = validateList(list_lbrules_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Load Balancer Rule creation Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbrules_after),
+                         "Load Balancer Rule creation Failed"
+                         )
+        # Deleting Load Balancer Rule
+        lb_rule.delete(self.userapiclient)
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id
+                                                   )
+        # Verifying no Load Balancer Rules are Listed
+        self.assertIsNone(
+                          list_lbrules_after,
+                          "Failed to delete Load Balancer Rule"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_06_update_lbrule_name(self):
+        """  
+        @summary: Test to Update Load Balancer Rule Name for IP Address associated to Non VPC network
+        @Steps:
+        Step1: Creating a Network for the user
+        Step2: Associating an IP Addresses for Network
+        Step3: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step4: Verifying that no Load Balancer Rules are listed
+        Step5: Creating a Load Balancer Rule for IP Address associated in Step2
+        Step6: Listing Load Balancer Rules for the IP Address associated in Step2
+        Step7: Verifying 1 Load Balancer Rule is listed
+        Step8: Updating the Load Balancer Rule created in Step5
+        Step9: Verifying that Load Balancer Rule details are updated
+        """
+        # Listing all the Networks's for a user
+        list_networks_before = Network.list(
+                                            self.userapiclient,
+                                            listall=self.services["listall"]
+                                            )
+        # Verifying No Networks are listed
+        self.assertIsNone(
+                          list_networks_before,
+                          "Networks listed for newly created User"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat,Lb",
+                                                      zoneid=self.zone.id
+                                                      )
+        status = validateList(network_offerings_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
+                          )
+        # Creating a network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network)
+        # Listing Networks again
+        list_networks_after = Network.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"]
+                                           )
+        status = validateList(list_networks_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Network Creation Failed"
+                          )
+        # Verifying network list count is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_networks_after),
+                          "Network Creation Failed"
+                          )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        # Verifying no IP Addresses are listed
+        self.assertIsNone(
+                          list_ipaddresses_before,
+                          "IP Addresses listed for newly created User"
+                          )
+        # Associating an IP Addresses to Network created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      networkid=network.id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_before = LoadBalancerRule.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    publicipid=associated_ipaddress.ipaddress.id
+                                                    )
+        # Verifying no Load Balancer Rules are listed
+        self.assertIsNone(
+                          list_lbrules_before,
+                          "Load Balancer Rules listed for newly Acquired Ip Address"
+                          )
+        self.services["lbrule"]["openfirewall"] = 'false'
+        # Creating a Load Balancer Rule for Ip Address
+        lb_rule = LoadBalancerRule.create(
+                                          self.userapiclient,
+                                          self.services["lbrule"],
+                                          ipaddressid=associated_ipaddress.ipaddress.id,
+                                          )
+        self.assertIsNotNone(
+                             lb_rule,
+                             "Failed to create Load Balancer Rule"
+                             )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id
+                                                   )
+        status = validateList(list_lbrules_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Load Balancer Rule creation Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbrules_after),
+                         "Load Balancer Rule creation Failed"
+                         )
+        # Updating Load Balancer Rule Name
+        updated_lb_rule = LoadBalancerRule.update(
+                                                  lb_rule,
+                                                  self.userapiclient,
+                                                  algorithm="source",
+                                                  name="NewLBRuleName"
+                                                  )
+        self.assertIsNotNone(
+                             updated_lb_rule,
+                             "Failed to update Load Balancer Rule details"
+                             )
+        # Verifying details of the updated Load Balancer Rule
+        # Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":lb_rule.id,
+                         "account":lb_rule.account,
+                         "algorithm":"source",
+                         "domainid":lb_rule.domainid,
+                         "name":"NewLBRuleName",
+                         "networkid":lb_rule.networkid,
+                         "zoneid":lb_rule.zoneid,
+                         "privateport":lb_rule.privateport,
+                         "publicip":lb_rule.publicip,
+                         "publicport":lb_rule.publicport,
+                         }
+        actual_dict = {
+                       "id":updated_lb_rule.id,
+                       "account":updated_lb_rule.account,
+                       "algorithm":updated_lb_rule.algorithm,
+                       "domainid":updated_lb_rule.domainid,
+                       "name":updated_lb_rule.name,
+                       "networkid":updated_lb_rule.networkid,
+                       "zoneid":updated_lb_rule.zoneid,
+                       "privateport":updated_lb_rule.privateport,
+                       "publicip":updated_lb_rule.publicip,
+                       "publicport":updated_lb_rule.publicport,
+                       }
+        lbrule_status = self.__verify_values(
+                                             expected_dict,
+                                             actual_dict
+                                             )
+        self.assertEqual(
+                         True,
+                         lbrule_status,
+                         "Updated Load Balancer Rule details are not as expected"
+                         )
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_07_assign_remove_lbrule_toinstance(self):
+        """  
+        @summary: Test to Assign and Remove Load Balancer Rule to an Instance
+        @Steps:
+        Step1: Creating a Network for the user
+        Step2: Associating an IP Addresses for Network
+        Step3: Launching a VM using the network created in Step 1
+        Step4: Creating a Load Balancer Rule for IP Address associated in Step2
+        Step5: Listing Load Balancer Rule Instances for applied as true
+        Step6: Verifying no Load balancer rule instances are listed
+        Step7: Listing Load Balancer Rule Instances for applied as false
+        Step8: Verifying that list size is 1
+        Step9: Assigning the Instance to Load Balancer Rule
+        Step10: Listing Load Balancer Rule Instances for applied as true
+        Step11: Verifying list size is 1
+        Step12: Listing Load Balancer Rule Instances for applied as false
+        Step13: Verifying no Load balancer rule instances are listed
+        Step14: Removing the Load Balancer Rule assigned form Instance
+        Step15: Listing Load Balancer Rule Instances for applied as true
+        Step16: Verifying no Load balancer rule instances are listed
+        Step17: Listing Load Balancer Rule Instances for applied as false
+        Step18: Verifying that list size is 1
+        """
+        # Listing all the Networks's for a user
+        list_networks_before = Network.list(
+                                            self.userapiclient,
+                                            listall=self.services["listall"]
+                                            )
+        # Verifying No Networks are listed
+        self.assertIsNone(
+                          list_networks_before,
+                          "Networks listed for newly created User"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat,Lb",
+                                                      zoneid=self.zone.id
+                                                      )
+        status = validateList(network_offerings_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
+                          )
+        # Creating a network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        # Verifying no IP Addresses are listed
+        self.assertIsNone(
+                          list_ipaddresses_before,
+                          "IP Addresses listed for newly created User"
+                          )
+        # Associating an IP Addresses to Network created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      networkid=network.id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Launching a Virtual Machine with above created Network
+        vm_created = VirtualMachine.create(
+                                           self.userapiclient,
+                                           self.services["virtual_machine"],
+                                           accountid=self.account.name,
+                                           domainid=self.account.domainid,
+                                           networkids=network.id,
+                                           serviceofferingid=self.service_offering.id,
+                                           )
+        self.assertIsNotNone(
+                             vm_created,
+                             "Failed to launch a VM under network created"
+                             )
+        self.cleanup.append(network)
+        # Listing Virtual Machines in Running state in the network created above
+        list_vms_running = VirtualMachine.list(
+                                               self.userapiclient,
+                                               listall=self.services["listall"],
+                                               account=self.account.name,
+                                               domainid=self.domain.id,
+                                               state="Running",
+                                               networkid=network.id
+                                               )
+        status = validateList(list_vms_running)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM Created is not in Running state"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_vms_running),
+                         "VM Created is not in Running state"
+                         )
+        self.assertEquals(
+                          vm_created.id,
+                          list_vms_running[0].id,
+                          "VM Created is not in Running state"
+                          )
+        # Listing Virtual Machines in Stopped state in the network created above
+        list_vms_stopped = VirtualMachine.list(
+                                               self.userapiclient,
+                                               listall=self.services["listall"],
+                                               account=self.account.name,
+                                               domainid=self.domain.id,
+                                               state="Stopped",
+                                               networkid=network.id
+                                               )
+        # Verifying that no vms are listed
+        self.assertIsNone(
+                          list_vms_stopped,
+                          "Created VM is in Stopped state"
+                          )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_before = LoadBalancerRule.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    publicipid=associated_ipaddress.ipaddress.id
+                                                    )
+        # Verifying no Load Balancer Rules are listed
+        self.assertIsNone(
+                          list_lbrules_before,
+                          "Load Balancer Rules listed for newly Acquired Ip Address"
+                          )
+        self.services["lbrule"]["openfirewall"] = 'false'
+        # Creating a Load Balancer Rule for Ip Address
+        lb_rule = LoadBalancerRule.create(
+                                          self.userapiclient,
+                                          self.services["lbrule"],
+                                          ipaddressid=associated_ipaddress.ipaddress.id,
+                                          )
+        self.assertIsNotNone(
+                             lb_rule,
+                             "Failed to create Load Balancer Rule"
+                             )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id
+                                                   )
+        status = validateList(list_lbrules_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Load Balancer Rule creation Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbrules_after),
+                         "Load Balancer Rule creation Failed"
+                         )
+        # Listing Load Balancer Rule Instances for applied as true
+        list_lbruleinstance_applied_true = LoadBalancerRule.listLoadBalancerRuleInstances(
+                                                                                          self.userapiclient,
+                                                                                          id=lb_rule.id,
+                                                                                          applied="true"
+                                                                                          )
+        # Verifying No Instances are assigned to the Load Balancer Rule
+        self.assertIsNone(
+                          list_lbruleinstance_applied_true,
+                          "Instances are assigned to Newly created Load Balancer Rule"
+                          )
+        # Listing Load Balancer Rule Instances for applied as false
+        list_lbruleinstance_applied_false = LoadBalancerRule.listLoadBalancerRuleInstances(
+                                                                                          self.userapiclient,
+                                                                                          id=lb_rule.id,
+                                                                                          applied="false"
+                                                                                          )
+        status = validateList(list_lbruleinstance_applied_false)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "No Instances are available to assign to Load Balancer Rule"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbruleinstance_applied_false),
+                         "No Instances are available to assign to Load Balancer Rule"
+                         )
+        # Verifying that Instance created above is listed
+        self.assertEquals(
+                          vm_created.id,
+                          list_lbruleinstance_applied_false[0].id,
+                          "Failed to list Instance available to asign a Load Balancer Rule"
+                          )
+        # Assigning Instance created to Load Balancer Rule
+        LoadBalancerRule.assign(
+                                lb_rule,
+                                self.userapiclient,
+                                vms=[vm_created]
+                                )
+        # Listing Load Balancer Rule Instances for applied as true
+        list_lbruleinstance_applied_true = LoadBalancerRule.listLoadBalancerRuleInstances(
+                                                                                          self.userapiclient,
+                                                                                          id=lb_rule.id,
+                                                                                          applied="true"
+                                                                                          )
+        status = validateList(list_lbruleinstance_applied_false)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "No Instances are available to assign to Load Balancer Rule"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbruleinstance_applied_false),
+                         "No Instances are available to assign to Load Balancer Rule"
+                         )
+        # Verifying Instances is assigned to the Load Balancer Rule
+        self.assertEquals(
+                          vm_created.id,
+                          list_lbruleinstance_applied_true[0].id,
+                          "Failed to assign Load Balancer Rule to given Instance"
+                          )
+        # Listing Load Balancer Rule Instances for applied as false
+        list_lbruleinstance_applied_false = LoadBalancerRule.listLoadBalancerRuleInstances(
+                                                                                          self.userapiclient,
+                                                                                          id=lb_rule.id,
+                                                                                          applied="false"
+                                                                                          )
+        # Verifying No Load Balancer Rules Instances are available to assign
+        self.assertIsNone(
+                          list_lbruleinstance_applied_false,
+                          "Instances are available for assigning a Load Balancer Rule"
+                          )
+        # Removing Load balancer Rule from Instance
+        LoadBalancerRule.remove(
+                                lb_rule,
+                                self.userapiclient,
+                                vms=[vm_created]
+                                )
+        # Listing Load Balancer Rule Instances for applied as true
+        list_lbruleinstance_applied_true = LoadBalancerRule.listLoadBalancerRuleInstances(
+                                                                                          self.userapiclient,
+                                                                                          id=lb_rule.id,
+                                                                                          applied="true"
+                                                                                          )
+        # Verifying that there are no Instances assigned to the Load Balancer Rule
+        self.assertIsNone(
+                          list_lbruleinstance_applied_true,
+                          "Instances is assigned to Load balancer Rule"
+                          )
+        # Listing Load Balancer Rule Instances for applied as false
+        list_lbruleinstance_applied_false = LoadBalancerRule.listLoadBalancerRuleInstances(
+                                                                                          self.userapiclient,
+                                                                                          id=lb_rule.id,
+                                                                                          applied="false"
+                                                                                          )
+        status = validateList(list_lbruleinstance_applied_false)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "No Instances are available to assign to Load Balancer Rule"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbruleinstance_applied_false),
+                         "No Instances are available to assign to Load Balancer Rule"
+                         )
+        # Verifying that Instance created above is listed
+        self.assertEquals(
+                          vm_created.id,
+                          list_lbruleinstance_applied_false[0].id,
+                          "Failed to list Instance available to asign a Load Balancer Rule"
+                          )
+        # Destroying the VM Launched
+        vm_created.delete(self.userapiclient)
+        vm_created.expung(self.apiClient)
+        return
+ 
+    @attr(tags=["advanced", "provisioning"])
+    def test_08_list_create_delete_lbsticky_policy(self):
+        """  
+        @summary: Test to List, Create, Delete Load Balancer Stickyness Policy
+        @Steps:
+        Step1: Creating a Network for the user
+        Step2: Associating an IP Addresses for Network
+        Step3: Creating a Load Balancer Rule for IP Address associated in Step2
+        Step4: Listing Load Balancer Sticky Policies for LB Rule created in Step3
+        Step5: Verifying that no Load Balancer Sticky Policies are listed
+        Step6: Creating a Load Balancer Sticky Policies for LB Rule created in Step3
+        Step7: Listing Load Balancer Sticky Policies for LB Rule created in Step3
+        Step8: Verifying 1 Load Balancer Sticky Policy is listed
+        Step9: Deleting the Load Balancer Sticky Policies
+        Step10: Listing Load Balancer Sticky Policies for LB Rule created in Step3
+        Step11: Verifying that no Load Balancer Sticky Policies are listed
+        """
+        # Listing all the Networks's for a user
+        list_networks_before = Network.list(
+                                            self.userapiclient,
+                                            listall=self.services["listall"]
+                                            )
+        # Verifying No Networks are listed
+        self.assertIsNone(
+                          list_networks_before,
+                          "Networks listed for newly created User"
+                          )
+        # Listing Network Offerings
+        network_offerings_list = NetworkOffering.list(
+                                                      self.apiClient,
+                                                      forvpc="false",
+                                                      guestiptype="Isolated",
+                                                      state="Enabled",
+                                                      supportedservices="SourceNat,Lb",
+                                                      zoneid=self.zone.id
+                                                      )
+        status = validateList(network_offerings_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Isolated Network Offerings with sourceNat, Lb enabled are not found"
+                          )
+        # Creating a network
+        network = Network.create(
+                                  self.userapiclient,
+                                  self.services["network"],
+                                  accountid=self.account.name,
+                                  domainid=self.domain.id,
+                                  networkofferingid=network_offerings_list[0].id,
+                                  zoneid=self.zone.id
+                                  )
+        self.assertIsNotNone(
+                             network,
+                             "Network creation failed"
+                             )
+        self.cleanup.append(network)
+        # Listing Networks again
+        list_networks_after = Network.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"]
+                                           )
+        status = validateList(list_networks_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Network Creation Failed"
+                          )
+        # Verifying network list count is increased by 1
+        self.assertEquals(
+                          1,
+                          len(list_networks_after),
+                          "Network Creation Failed"
+                          )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_before = PublicIPAddress.list(
+                                                       self.userapiclient,
+                                                       listall=self.services["listall"]
+                                                       )
+        # Verifying no IP Addresses are listed
+        self.assertIsNone(
+                          list_ipaddresses_before,
+                          "IP Addresses listed for newly created User"
+                          )
+        # Associating an IP Addresses to Network created 
+        associated_ipaddress = PublicIPAddress.create(
+                                                      self.userapiclient,
+                                                      services=self.services["network"],
+                                                      networkid=network.id
+                                                      )
+        self.assertIsNotNone(
+                             associated_ipaddress,
+                             "Failed to Associate IP Address"
+                             )
+        # Listing all the IP Addresses for a user
+        list_ipaddresses_after = PublicIPAddress.list(
+                                                      self.userapiclient,
+                                                      listall=self.services["listall"]
+                                                      )
+        status = validateList(list_ipaddresses_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "IP Addresses Association Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_ipaddresses_after),
+                         "Number of IP Addresses associated are not matching expected"
+                         )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_before = LoadBalancerRule.list(
+                                                    self.userapiclient,
+                                                    listall=self.services["listall"],
+                                                    publicipid=associated_ipaddress.ipaddress.id
+                                                    )
+        # Verifying no Load Balancer Rules are listed
+        self.assertIsNone(
+                          list_lbrules_before,
+                          "Load Balancer Rules listed for newly Acquired Ip Address"
+                          )
+        self.services["lbrule"]["openfirewall"] = 'false'
+        # Creating a Load Balancer Rule for Ip Address
+        lb_rule = LoadBalancerRule.create(
+                                          self.userapiclient,
+                                          self.services["lbrule"],
+                                          ipaddressid=associated_ipaddress.ipaddress.id,
+                                          )
+        self.assertIsNotNone(
+                             lb_rule,
+                             "Failed to create Load Balancer Rule"
+                             )
+        # Listing Load Balancer Rules for the Ip Address
+        list_lbrules_after = LoadBalancerRule.list(
+                                                   self.userapiclient,
+                                                   listall=self.services["listall"],
+                                                   publicipid=associated_ipaddress.ipaddress.id
+                                                   )
+        status = validateList(list_lbrules_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Load Balancer Rule creation Failed"
+                          )
+        # Verifying the length of the list is 1
+        self.assertEqual(
+                         1,
+                         len(list_lbrules_after),
+                         "Load Balancer Rule creation Failed"
+                         )
+        # Listing Load Balancer Stickyness Policies for LB Rule
+        list_lbstickypolicy_before = LoadBalancerRule.listStickyPolicies(
+                                                                         self.userapiclient,
+                                                                         lbruleid=lb_rule.id,
+                                                                         listall=self.services["listall"]
+                                                                         )
+        # Verifying no Sticky Policies are listed
+        self.assertEquals(
+                          0,
+                          len(list_lbstickypolicy_before[0].stickinesspolicy),
+                          "Sticky Policy listed for newly created Load Balancer Rule"
+                          )
+        # Creating a Sticy Policy for Load Balancer Rule
+        sticky_policy = LoadBalancerRule.createSticky(
+                                                      lb_rule,
+                                                      self.userapiclient,
+                                                      methodname='LbCookie',
+                                                      name='LbCookieSticky'
+                                                      )
+        self.assertIsNotNone(
+                             sticky_policy,
+                             "Failed to create Sticky Policy for Load Balancer Rule"
+                             )
+    

<TRUNCATED>

[29/50] [abbrv] CLOUDSTACK-6932: Removing redundant file test_escalations.py

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dc75e46f/test/integration/component/test_escalations.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations.py b/test/integration/component/test_escalations.py
deleted file mode 100644
index 1b596a7..0000000
--- a/test/integration/component/test_escalations.py
+++ /dev/null
@@ -1,8202 +0,0 @@
-# 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.
-
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor)
-from marvin.lib.common import (get_zone,
-                               get_domain,
-                               get_template,
-                               list_os_types)
-from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, EMPTY_LIST)
-from nose.plugins.attrib import attr
-import time
-
-class TestVolumes(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-
-        cls.testClient = super(TestVolumes, cls).getClsTestClient()
-        cls.api_client = cls.testClient.getApiClient()
-        cls.services = cls.testClient.getParsedTestDataConfig()
-        # Get Domain, Zone, Template
-        cls.domain = get_domain(cls.api_client)
-        cls.zone = get_zone(cls.api_client)
-        cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        if cls.zone.localstorageenabled:
-            cls.storagetype = 'local'
-            cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
-            cls.services["disk_offering"]["storagetype"] = 'local'
-        else:
-            cls.storagetype = 'shared'
-            cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
-            cls.services["disk_offering"]["storagetype"] = 'shared'
-
-        cls.services['mode'] = cls.zone.networktype
-        cls.services["virtual_machine"]["hypervisor"] = 'XenServer'
-        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-        cls.services["virtual_machine"]["template"] = cls.template.id
-        cls.services["custom_volume"]["zoneid"] = cls.zone.id
-
-        # Creating Disk offering, Service Offering and Account
-        cls.disk_offering = DiskOffering.create(
-                                    cls.api_client,
-                                    cls.services["disk_offering"]
-                                    )
-        cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offerings"]["tiny"]
-                                            )
-        cls.account = Account.create(
-                            cls.api_client,
-                            cls.services["account"],
-                            domainid=cls.domain.id
-                            )
-
-        # Getting authentication for user in newly created Account
-        cls.user = cls.account.user[0]
-
-        cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
-
-        # Creating Virtual Machine
-        cls.virtual_machine = VirtualMachine.create(
-                                    cls.userapiclient,
-                                    cls.services["virtual_machine"],
-                                    accountid=cls.account.name,
-                                    domainid=cls.account.domainid,
-                                    serviceofferingid=cls.service_offering.id,
-                                )
-        cls._cleanup = [
-                        cls.virtual_machine,
-                        cls.disk_offering,
-                        cls.service_offering,
-                        cls.account
-                        ]
-
-    def setUp(self):
-
-        self.apiClient = self.testClient.getApiClient()
-        self.cleanup = []
-
-    def tearDown(self):
-        #Clean up, terminate the created volumes
-        cleanup_resources(self.apiClient, self.cleanup)
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            cls.apiclient = super(TestVolumes, cls).getClsTestClient().getApiClient()
-            cleanup_resources(cls.apiclient, cls._cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-
-
-    def __verify_values(self, expected_vals, actual_vals):
-        """
-        @summary: Function to verify expected and actual values
-        Step1: Initializing return flag to True
-        Step1: Verifying length of expected and actual dictionaries is matching.
-               If not matching returning false
-        Step2: Listing all the keys from expected dictionary
-        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
-               If not making return flag to False
-        Step4: returning the return flag after all the values are verified
-        """
-        return_flag = True
-
-        if len(expected_vals) != len(actual_vals):
-            return False
-
-        keys = expected_vals.keys()
-        for i in range(0, len(expected_vals)):
-            exp_val = expected_vals[keys[i]]
-            act_val = actual_vals[keys[i]]
-            if exp_val == act_val:
-                return_flag = return_flag and True
-            else:
-                return_flag = return_flag and False
-                self.debug("expected Value: %s, is not matching with actual value: %s" % (
-                                                                                          exp_val,
-                                                                                          act_val
-                                                                                          ))
-        return return_flag
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_01_list_volumes_pagination(self):
-        """  
-        @summary: Test List Volumes pagination
-        
-        Step1: Listing all the volumes for a user
-        Step2: Verifying listed volumes for account created at class level
-        Step3: If number of volumes is less than (page size + 1), then creating them
-        Step4: Listing all the volumes again after creation of volumes
-        Step5: Verifying the length of the volumes is (page size + 1)
-        Step6: Listing all the volumes in page1
-        Step7: Verifying that the length of the volumes in page 1 is (page size)
-        Step8: Listing all the volumes in page2
-        Step9: Verifying that the length of the volumes in page 2 is 1
-        Step10: Deleting the volume present in page 2
-        Step11: Listing for the volumes on page 2
-        Step12: Verifying that there are no volumes present in page 2
-        """
-        # Listing all the volumes for a user
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        # Verifying listed volumes for account created at class level
-        self.assertIsNotNone(
-                             list_volumes_before,
-                             "create volume from VM failed at class setup method"
-                             )
-        self.assertEqual(
-                         len(list_volumes_before),
-                         1,
-                         "more than 1 volume created from VM at class level"
-                         )
-
-        # If number of volumes is less than (pagesize + 1), then creating them    
-        for i in range(0, (self.services["pagesize"])):
-            volume_created = Volume.create(
-                                   self.userapiclient,
-                                   self.services["volume"],
-                                   zoneid=self.zone.id,
-                                   diskofferingid=self.disk_offering.id
-                                   )
-            self.assertIsNotNone(
-                                 volume_created,
-                                 "Volume is not created"
-                                 )
-            if(i < (self.services["pagesize"] - 1)):
-                self.cleanup.append(volume_created)
-                
-            self.assertEqual(
-                             self.services["volume"]["diskname"],
-                             volume_created.name,
-                             "Newly created volume name and the test data volume name are not matching"
-                             )
-
-        # Listing all the volumes again after creation of volumes        
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"]) 
-
-        # Verifying the length of the volumes is (page size + 1)
-        self.assertEqual(
-                         len(list_volumes_after),
-                         (self.services["pagesize"] + 1),
-                         "Number of volumes created is not matching expected"
-                         )
-
-        # Listing all the volumes in page1
-        list_volumes_page1 = Volume.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"],
-                                         page=1,
-                                         pagesize=self.services["pagesize"]
-                                         )
-        self.assertIsNotNone(
-                             list_volumes_page1,
-                             "No volumes found in Page 1"
-                             )
-        # Verifying that the length of the volumes in page 1 is (page size)
-        self.assertEqual(
-                         len(list_volumes_page1),
-                         self.services["pagesize"],
-                         "List Volume response is not matching with the page size length for page 1"
-                         )
-
-        # Listing all the volumes in page2
-        list_volumes_page2 = Volume.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"],
-                                         page=2,
-                                         pagesize=self.services["pagesize"]
-                                         )
-        self.assertIsNotNone(
-                             list_volumes_page2,
-                             "No volumes found in Page 2"
-                             )
-        # Verifying that the length of the volumes in page 2 is 1
-        self.assertEqual(
-                         len(list_volumes_page2),
-                         1,
-                         "List Volume response is not matching with the page size length for page 2"
-                         )
-        volume_page2 = list_volumes_page2[0]
-
-        # Verifying that the volume on page 2 is not present in page1
-        for i in range(0, len(list_volumes_page1)):
-            volume_page1 = list_volumes_page1[i]
-            self.assertNotEquals(
-                                 volume_page2.id,
-                                 volume_page1.id,
-                                 "Volume listed in page 2 is also listed in page 1"
-                                 )
-
-        # Deleting a single volume
-        Volume.delete(volume_created, self.userapiclient)
-
-        # Listing the volumes in page 2
-        list_volume_response = Volume.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"],
-                                         page=2,
-                                         pagesize=self.services["pagesize"]
-                                         )
-        # verifying that volume does not exists on page 2
-        self.assertEqual(
-                        list_volume_response,
-                        None,
-                        "Volume was not deleted"
-                    )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"]) 
-    def test_02_list_volume_byid(self):
-        """       
-        @summary: Test List Volumes with Id
-       
-        Step1: Listing all the volumes for a user before creating a data volume
-        Step2: Verifying the length of the list as 1
-        Step3: Creating a data volume
-        Step4: Listing all the volumes for a user after creating a data volume
-        Step5: Verifying the list volume size is increased by 1
-        Step6: List the volumes by specifying root volume Id
-        Step7: Verifying the details of the root volume
-        Step8: List the volumes by specifying data volume Id
-        Step9: Verifying the details of the data volume
-        """
-        # Listing all the volumes for a user before creating a data volume
-        list_volumes_before = Volume.list(
-                                          self.userapiclient,
-                                          listall=self.services["listall"]
-                                          )
-        self.assertIsNotNone(
-                             list_volumes_before,
-                             "create volume from VM failed at class setup method")
-        # Verifying the length of the list as 1
-        self.assertEqual(
-                         len(list_volumes_before),
-                         1,
-                         "more than 1 volume created at class level"
-                         )
-        root_volume = list_volumes_before[0]
-
-        # Creating a data volume
-        volume_created = Volume.create(
-                                   self.userapiclient,
-                                   self.services["volume"],
-                                   zoneid=self.zone.id,
-                                   diskofferingid=self.disk_offering.id
-                                   )
-        self.assertIsNotNone(
-                             volume_created,
-                             "Volume is not created"
-                             )
-        self.cleanup.append(volume_created)
-        
-        self.assertEqual(
-                         self.services["volume"]["diskname"],
-                         volume_created.name,
-                         "Newly created volume name and the test data volume name are not matching"
-                         )
-        # Listing all the volumes for a user after creating a data volume
-        list_volumes_after = Volume.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"]
-                                         )
-        self.assertIsNotNone(
-                             list_volumes_after,
-                             "Volume creation failed"
-                             )
-        # Verifying the list volume size is increased by 1
-        self.assertEqual(
-                         len(list_volumes_before) + 1,
-                         len(list_volumes_after),
-                         "list volume is not matching with Number of volumes created"
-                         )
-
-        # Listing a Root Volume by Id and verifying the volume details
-        list_volumes_by_id = Volume.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"],
-                                         id=root_volume.id
-                                         )  
-        self.assertIsNotNone(
-                             list_volumes_by_id,
-                             "Root volume is not listed"
-                             ) 
-        self.assertEqual(
-                         1,
-                         len(list_volumes_by_id),
-                         "list volume is not matching with Number of volumes created"
-                         )
-        obtained_volume = list_volumes_by_id[0]
-
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                           "id":root_volume.id,
-                           "name":root_volume.name,
-                           "vmname":self.virtual_machine.name,
-                           "state":"Ready",
-                           "type":"ROOT",
-                           "zoneid":self.zone.id,
-                           "account":self.account.name,
-                           "storagetype":self.storagetype,
-                           "size":self.template.size
-                           }
-        actual_dict = {
-                           "id":obtained_volume.id,
-                           "name":obtained_volume.name,
-                           "vmname":obtained_volume.vmname,
-                           "state":obtained_volume.state,
-                           "type":obtained_volume.type,
-                           "zoneid":obtained_volume.zoneid,
-                           "account":obtained_volume.account,
-                           "storagetype":obtained_volume.storagetype,
-                           "size":obtained_volume.size,
-                           }
-        root_volume_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
-        self.assertEqual(
-                         True,
-                         root_volume_status,
-                         "Listed Root Volume details are not as expected"
-                         )
-        # Listing a Data Volume by Id and verifying the volume details
-        list_volumes_by_id = Volume.list(
-                                         self.userapiclient,
-                                         listall=self.services["listall"],
-                                         id=volume_created.id
-                                         )  
-        self.assertIsNotNone(
-                             list_volumes_by_id,
-                             "Data volume is not listed"
-                             ) 
-        self.assertEqual(
-                         len(list_volumes_by_id),
-                         1,
-                         "list volume is not matching with Number of volumes created"
-                         )
-        obtained_volume = list_volumes_by_id[0]
-
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                           "id":volume_created.id,
-                           "name":volume_created.name,
-                           "state":"Allocated",
-                           "type":"DATADISK",
-                           "zoneid":self.zone.id,
-                           "account":self.account.name,
-                           "storagetype":self.storagetype,
-                           "size":self.disk_offering.disksize
-                           }
-        actual_dict = {
-                           "id":obtained_volume.id,
-                           "name":obtained_volume.name,
-                           "state":obtained_volume.state,
-                           "type":obtained_volume.type,
-                           "zoneid":obtained_volume.zoneid,
-                           "account":obtained_volume.account,
-                           "storagetype":obtained_volume.storagetype,
-                           "size":obtained_volume.size/(1024*1024*1024),
-                           }
-        root_volume_status = self.__verify_values(
-                                                  expected_dict,
-                                                  actual_dict
-                                                  )
-        self.assertEqual(
-                         True,
-                         root_volume_status,
-                         "Listed Data Volume details are not as expected"
-                         )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_03_data_volume_resize(self):
-        """  
-        @summary: Test to verify creation and resize of data volume
-         
-        Step1: Listing the volumes for a user before creating data volume
-        Step2: Creating a data volume
-        Step3: Listing the volumes for a user after creating data volume
-        Step4: Attaching and Detaching data volume created to Virtual Machine
-        Step5: Verifying if there exists a disk offering with higher size
-                If not present creating it
-        Step6: Resizing data volume
-        """
-        # Listing volumes for a user before creating a volume
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        # Creating a data volume
-        volume_created = Volume.create(
-                                       self.userapiclient,
-                                       self.services["volume"],
-                                       zoneid=self.zone.id,
-                                       diskofferingid=self.disk_offering.id
-                                       )
-        self.assertIsNotNone(volume_created, "Data volume creation failed")
-
-        self.cleanup.append(volume_created)
-
-        # Listing volumes for a user after creating data volume
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Data volume creation failed"
-                          )
-
-        # Attaching data volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-
-        # Detaching data volume from Virtual Machine
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-
-        # Verifying if there exists a disk offering with higher size. If not present creating it
-        list_disk_offerings = DiskOffering.list(self.apiClient)
-
-        large_disk_offering_exists = False
-        # Converting disk_size in bytes to GB
-        current_disk_size = volume_created.size/(1024*1024*1024)
-
-        for disk_offering in list_disk_offerings:
-            if ((disk_offering.disksize > current_disk_size) and (not disk_offering.iscustomized) and disk_offering.storagetype == self.storagetype):
-                new_disk_offering = disk_offering
-                large_disk_offering_exists = True
-                break
-
-        if large_disk_offering_exists == False:
-            new_size = (volume_created.size/(1024*1024*1024)) + 1
-            self.services["disk_offering"]["disksize"] = new_size
-            new_disk_offering = DiskOffering.create(
-                                                    self.apiClient,
-                                                    self.services["disk_offering"]
-                                                    )
-            if new_disk_offering is not None:
-                self.cleanup.append(new_disk_offering)
-        else:
-            new_size = new_disk_offering.disksize
-
-        # Resizing data volume
-        resized_volume = volume_created.resize(
-                                               self.userapiclient,
-                                               diskofferingid=new_disk_offering.id,
-                                               shrinkok='false',
-                                               )
-        self.assertIsNotNone(resized_volume, "Resize Volume failed")
-        # Verifying data volume size is increased
-        self.assertEquals(
-                          new_size,
-                          (resized_volume.size/(1024*1024*1024)),
-                          "volume not resized to expected value"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_04_custom_volume_resize(self):
-        """  
-        @summary: Test to verify creation and resize of custom volume
-         
-        Step1: Checking if Custom disk offering already exists.
-               If not present then creating custom Disk Offering
-        Step2: Listing the volumes for a user before creating custom volume
-        Step3: Creating a custom volume
-        Step4: Listing the volumes for a user after creating custom volume
-        Step5: Attaching and Detaching custom volume created to Virtual Machine
-        Step6: Resizing custom volume
-        """
-        # Listing all the disk offerings
-        list_disk_offerings = DiskOffering.list(self.apiClient)
-
-        custom_disk_offering_exists = False
-
-        # Verifying if a custom disk offering already exists
-        if list_disk_offerings is not None:
-            for disk_offering in list_disk_offerings:
-                if (disk_offering.iscustomized and disk_offering.storagetype == self.storagetype):
-                    custom_disk_offering = disk_offering
-                    custom_disk_offering_exists = True
-                    break
-
-        # If a custom disk offering does not exists, then creating a custom disk offering
-        if custom_disk_offering_exists == False:
-            custom_disk_offering = DiskOffering.create(
-                                    self.apiClient,
-                                    self.services["disk_offering"],
-                                    custom=True
-                                    )
-            if custom_disk_offering is not None:
-                self.cleanup.append(custom_disk_offering)
-
-        # Listing the volumes for a user before creating custom volume
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        # Creating a custom volume
-        volume_created = Volume.create_custom_disk(
-                                    self.userapiclient,
-                                    self.services["custom_volume"],
-                                    account=self.account.name,
-                                    domainid=self.account.domainid,
-                                    diskofferingid=custom_disk_offering.id
-                                    )
-        self.assertIsNotNone(
-                             volume_created,
-                             "Custom volume did not get created"
-                             )
-
-        self.cleanup.append(volume_created)
-
-        # Listing the volumes for a user after creating custom volume
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        # Verifyign that volume list is increased by 1 after creation of custion volume
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Custom volume did not get created"
-                          )
-
-        # Attaching custom volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-
-        # Detaching custom volume from Virtual Machine
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-
-        # Resizing custom volume
-        # Increasing custom disk size by 1
-        new_size = self.services["custom_volume"]["customdisksize"] + 1
-        resized_volume = volume_created.resize(
-                                               self.userapiclient,
-                                               diskofferingid=custom_disk_offering.id,
-                                               shrinkok='false',
-                                               size=new_size)
-        self.assertIsNotNone(resized_volume, "Resize Volume failed")
-        # Verifying that custom disk size is increased
-        self.assertEquals(
-                          new_size,
-                          (resized_volume.size/(1024*1024*1024)),
-                          "volume not resized to expected value"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_05_volume_snapshot(self):
-        """  
-        @summary: Test to verify creation of snapshot from volume and creation of template, volume from snapshot
-         
-        Step1: Creating a volume
-        Step2: Attaching and Detaching custom volume created to Virtual Machine
-        Step3: Creating Snapshot from volume
-        Step4: Creating Volume from snapshot
-        Step5: Creating Template from Snapshot
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-
-        self.assertIsNotNone(volume_created, "Volume not created")
-
-        if volume_created is not None:
-            self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-        # Attaching and Detaching custom volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-        # Creating Snapshot from volume
-        snapshot_created = Snapshot.create(
-                                           self.userapiclient,
-                                           volume_created.id,
-                                           )
-
-        self.assertIsNotNone(snapshot_created, "Snapshot not created")
-
-        self.cleanup.append(snapshot_created)
-
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                           "id":volume_created.id,
-                           "intervaltype":"MANUAL",
-                           "snapshottype":"MANUAL",
-                           "volumetype":volume_created.type,
-                           "domain":self.domain.id
-                           }
-        actual_dict = {
-                           "id":snapshot_created.volumeid,
-                           "intervaltype":snapshot_created.intervaltype,
-                           "snapshottype":snapshot_created.snapshottype,
-                           "volumetype":snapshot_created.volumetype,
-                           "domain":snapshot_created.domainid,
-                           }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Snapshot created from Volume details are not as expected"
-                         )
-        # Creating Volume from snapshot
-        cmd = createVolume.createVolumeCmd()
-        cmd.name = "-".join([self.services["volume"]["diskname"], random_gen()])
-        cmd.snapshotid = snapshot_created.id
-
-        volume_from_snapshot = Volume(self.userapiclient.createVolume(cmd).__dict__)
-
-        self.assertIsNotNone(
-                             volume_from_snapshot,
-                             "Volume creation failed from snapshot"
-                             )
-        self.cleanup.append(volume_from_snapshot)
-
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                           "snapshotid":snapshot_created.id,
-                           "volumetype":snapshot_created.volumetype,
-                           "size":self.disk_offering.disksize,
-                           "accounr":self.account.name,
-                           "domain":self.domain.id,
-                           "storagetype":self.storagetype,
-                           "zone":self.zone.id
-                           }
-        actual_dict = {
-                           "snapshotid":volume_from_snapshot.snapshotid,
-                           "volumetype":volume_from_snapshot.type,
-                           "size":volume_from_snapshot.size/(1024*1024*1024),
-                           "accounr":volume_from_snapshot.account,
-                           "domain":volume_from_snapshot.domainid,
-                           "storagetype":volume_from_snapshot.storagetype,
-                           "zone":volume_from_snapshot.zoneid,
-                           }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Volume created from Snapshot details are not as expected"
-                         )
-        # Creating Template from Snapshot
-        list_templates_before = Template.list(self.userapiclient, templatefilter='self')
-
-        if list_templates_before is None:
-            templates_before_size = 0
-        else:
-            templates_before_size = len(list_templates_before)
-
-        cmd = createTemplate.createTemplateCmd()
-        cmd.name = self.services["ostype"]
-        cmd.displaytext = self.services["ostype"]
-        cmd.ostypeid = self.template.ostypeid
-        cmd.snapshotid = snapshot_created.id
-        cmd.ispublic = False
-        cmd.passwordenabled = False
-
-        template_from_snapshot = Template(self.userapiclient.createTemplate(cmd).__dict__)
-
-        self.assertIsNotNone(
-                             template_from_snapshot,
-                             "Template creation failed from snapshot"
-                             )
-
-        self.cleanup.append(template_from_snapshot)
-
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                           "name":self.services["ostype"],
-                           "ostypeid":self.template.ostypeid,
-                           "type":"USER",
-                           "zone":self.zone.id,
-                           "domain":self.domain.id,
-                           "account":self.account.name,
-                           "passwordenabled":False,
-                           "ispublic":False,
-                           "size":self.disk_offering.disksize
-                           }
-        actual_dict = {
-                           "name":template_from_snapshot.name,
-                           "ostypeid":template_from_snapshot.ostypeid,
-                           "type":template_from_snapshot.templatetype,
-                           "zone":template_from_snapshot.zoneid,
-                           "domain":template_from_snapshot.domainid,
-                           "account":template_from_snapshot.account,
-                           "passwordenabled":template_from_snapshot.passwordenabled,
-                           "ispublic":template_from_snapshot.ispublic,
-                           "size":template_from_snapshot.size/(1024*1024*1024)
-                           }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Template created from Snapshot details are not as expected"
-                         )
-
-        list_templates_after = Template.list(self.userapiclient, templatefilter='self')
-
-        self.assertEquals(
-                          templates_before_size + 1,
-                          len(list_templates_after),
-                          "Template creation failed from snapshot"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_06_volume_snapshot_policy_hourly(self):
-        """  
-        @summary: Test to verify creation of Hourly Snapshot policies from volume
-         
-        Step1: Creating a Volume.
-        Step2: Attaching volume created in Step2 to virtual machine
-        Step3: Detaching the volume created in step2 from virtual machine
-        Step4: Listing snapshot policies for a volume created in step1
-        Step5: Creating Hourly snapshot policy
-        Step6: Listing snapshot policies for a volume created in step1 again
-        Step7: Verifyign that the list snapshot policy length is increased by 1
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-
-        self.assertIsNotNone(volume_created, "Volume not created")
-        self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-
-        # Attaching volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        # Detaching volume created from Virtual Machine
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-        # Creating Hourly Snapshot Policy from volume
-        self.services["recurring_snapshot"]["intervaltype"] = 'hourly'
-        self.services["recurring_snapshot"]["schedule"] = '1'
-
-        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        snapshot_policy_before_size = 0
-
-        if list_snapshot_policy_before is not None:
-            snapshot_policy_before_size = len(list_snapshot_policy_before)
-
-        snapshot_policy_hourly = SnapshotPolicy.create(
-                                                       self.userapiclient,
-                                                       volume_created.id,
-                                                       self.services["recurring_snapshot"]
-                                                       )
-        self.assertIsNotNone(
-                             snapshot_policy_hourly,
-                             "Hourly Snapshot policy creation failed"
-                             )
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                         "schedule":self.services["recurring_snapshot"]["schedule"],
-                         "intervaltype":0,
-                         "volumeid":volume_created.id
-                         }
-        actual_dict = {
-                       "schedule":snapshot_policy_hourly.schedule,
-                       "intervaltype":snapshot_policy_hourly.intervaltype,
-                       "volumeid":snapshot_policy_hourly.volumeid
-                       }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Hourly Snapshot Policy details are not as expected"
-                         )
-
-        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        self.assertIsNotNone(
-                             list_snapshot_policy_after,
-                             "Hourly Snapshot policy creation failed"
-                             ) 
-        self.assertEquals(
-                          snapshot_policy_before_size + 1,
-                          len(list_snapshot_policy_after),
-                          "Hourly Snapshot policy creation failed"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_07_volume_snapshot_policy_daily(self):
-        """  
-        @summary: Test to verify creation of Daily Snapshot policies from volume
-         
-        Step1: Creating a Volume.
-        Step2: Attaching volume created in Step2 to virtual machine
-        Step3: Detaching the volume created in step2 from virtual machine
-        Step4: Listing snapshot policies for a volume created in step1
-        Step5: Creating Daily snapshot policy
-        Step6: Listing snapshot policies for a volume created in step1 again
-        Step7: Verifyign that the list snapshot policy length is increased by 1
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-
-        self.assertIsNotNone(volume_created, "Volume not created")
-        self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-        # Attaching volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        # Detaching volume created from Virtual Machine
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-        # Creating Daily Snapshot Policy from volume
-        self.services["recurring_snapshot"]["intervaltype"] = 'daily'
-        self.services["recurring_snapshot"]["schedule"] = '00:00'
-
-        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        snapshot_policy_before_size = 0
-
-        if list_snapshot_policy_before is not None:
-            snapshot_policy_before_size = len(list_snapshot_policy_before)
-
-        snapshot_policy_daily = SnapshotPolicy.create(
-                                                       self.userapiclient,
-                                                       volume_created.id,
-                                                       self.services["recurring_snapshot"]
-                                                       )
-        self.assertIsNotNone(
-                             snapshot_policy_daily,
-                             "Daily Snapshot policy creation failed"
-                             )
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                         "schedule":self.services["recurring_snapshot"]["schedule"],
-                         "intervaltype":1,
-                         "volumeid":volume_created.id
-                         }
-        actual_dict = {
-                       "schedule":snapshot_policy_daily.schedule,
-                       "intervaltype":snapshot_policy_daily.intervaltype,
-                       "volumeid":snapshot_policy_daily.volumeid
-                       }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Daily Snapshot Policy details are not as expected"
-                         )
-
-        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        self.assertIsNotNone(
-                             list_snapshot_policy_after,
-                             "Daily Snapshot policy creation failed"
-                             )
-        self.assertEquals(
-                          snapshot_policy_before_size + 1,
-                          len(list_snapshot_policy_after),
-                          "Daily Snapshot policy creation failed"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_08_volume_snapshot_policy_weekly(self):
-        """  
-        @summary: Test to verify creation of Weekly Snapshot policies from volume
-         
-        Step1: Creating a Volume.
-        Step2: Attaching volume created in Step2 to virtual machine
-        Step3: Detaching the volume created in step2 from virtual machine
-        Step4: Listing snapshot policies for a volume created in step1
-        Step5: Creating Weekly snapshot policy
-        Step6: Listing snapshot policies for a volume created in step1 again
-        Step7: Verifyign that the list snapshot policy length is increased by 1
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-
-        self.assertIsNotNone(volume_created, "Volume not created")
-        self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-
-        # Attaching volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        # Detaching volume created to Virtual Machine
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-        # Creating Weekly Snapshot Policy from volume
-        self.services["recurring_snapshot"]["intervaltype"] = 'weekly'
-        self.services["recurring_snapshot"]["schedule"] = '00:00:1'
-
-        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        snapshot_policy_before_size = 0
-
-        if list_snapshot_policy_before is not None:
-            snapshot_policy_before_size = len(list_snapshot_policy_before)
-
-        snapshot_policy_weekly = SnapshotPolicy.create(
-                                                       self.userapiclient,
-                                                       volume_created.id,
-                                                       self.services["recurring_snapshot"]
-                                                       )
-        self.assertIsNotNone(
-                             snapshot_policy_weekly,
-                             "Weekly Snapshot policy creation failed"
-                             )
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                         "schedule":self.services["recurring_snapshot"]["schedule"],
-                         "intervaltype":2,
-                         "volumeid":volume_created.id
-                         }
-        actual_dict = {
-                       "schedule":snapshot_policy_weekly.schedule,
-                       "intervaltype":snapshot_policy_weekly.intervaltype,
-                       "volumeid":snapshot_policy_weekly.volumeid
-                       }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Weekly Snapshot Policy details are not as expected"
-                         )
-
-        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        self.assertIsNotNone(
-                             list_snapshot_policy_after,
-                             "Weekly Snapshot policy creation failed"
-                             )
-        self.assertEquals(
-                          snapshot_policy_before_size + 1,
-                          len(list_snapshot_policy_after),
-                          "Weekly Snapshot policy creation failed"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_09_volume_snapshot_policy_monthly(self):
-        """  
-        @summary: Test to verify creation of Monthly Snapshot policies from volume
-         
-        Step1: Creating a Volume.
-        Step2: Attaching volume created in Step2 to virtual machine
-        Step3: Detaching the volume created in step2 from virtual machine
-        Step4: Listing snapshot policies for a volume created in step1
-        Step5: Creating Monthly snapshot policy
-        Step6: Listing snapshot policies for a volume created in step1 again
-        Step7: Verifyign that the list snapshot policy length is increased by 1
-        Step8: Deleting monthly snapshot policy created in step5
-        Step9: List snapshot policies for a volume again
-        Step10: Verifying that the list snapshot policy length is decreased by 1
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-        self.assertIsNotNone(volume_created, "Volume not created")
-        self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-        # Attaching and Detaching custom volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-        # Creating Monthly Snapshot Policy from volume
-        self.services["recurring_snapshot"]["intervaltype"] = 'monthly'
-        self.services["recurring_snapshot"]["schedule"] = '00:00:1'
-
-        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        snapshot_policy_before_size = 0
-
-        if list_snapshot_policy_before is not None:
-            snapshot_policy_before_size = len(list_snapshot_policy_before)
-
-        snapshot_policy_monthly = SnapshotPolicy.create(
-                                                       self.userapiclient,
-                                                       volume_created.id,
-                                                       self.services["recurring_snapshot"])
-        self.assertIsNotNone(
-                             snapshot_policy_monthly,
-                             "Monthly Snapshot policy creation failed"
-                             )
-        #Creating expected and actual values dictionaries
-        expected_dict = {
-                         "schedule":self.services["recurring_snapshot"]["schedule"],
-                         "intervaltype":3,
-                         "volumeid":volume_created.id
-                         }
-        actual_dict = {
-                       "schedule":snapshot_policy_monthly.schedule,
-                       "intervaltype":snapshot_policy_monthly.intervaltype,
-                       "volumeid":snapshot_policy_monthly.volumeid
-                       }
-        status = self.__verify_values(
-                                      expected_dict,
-                                      actual_dict
-                                      )
-        self.assertEqual(
-                         True,
-                         status,
-                         "Monthly Snapshot Policy details are not as expected"
-                         )
-
-        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        self.assertIsNotNone(
-                             list_snapshot_policy_after,
-                             "Monthly Snapshot policy creation failed"
-                             )
-        self.assertEquals(
-                          snapshot_policy_before_size + 1,
-                          len(list_snapshot_policy_after),
-                          "Monthly Snapshot policy creation failed"
-                          )
-        # Deleting monthly snapshot policy 
-        SnapshotPolicy.delete(snapshot_policy_monthly, self.userapiclient)
-
-        list_snapshot_policies = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
-
-        self.assertIsNone(
-                          list_snapshot_policies, 
-                          "Deletion of Monthly Snapshot policy failed"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_10_volume_snapshots_pagination(self):
-        """  
-        @summary: Test to verify pagination of snapshots for Volume
-         
-        Step1: Creating a Volume.
-        Step2: Attaching volume created in Step2 to virtual machine
-        Step3: Detaching the volume created in step2 from virtual machine
-        Step4: Listing all the snapshots for a volume
-        Step5: Creating Pagesize + 1 number of snapshots for a volume
-        Step6: Listing all the snapshots for a volume
-        Step7: Verifying that there are pagesize + 1 number of snapshots listsed
-        Step8: Listing all the snapshots in page 1
-        Step9: Listing all the snapshots in page 2
-        Step10: Deleting the snapshot present in page 2
-        Step11: Listign the snapshots from page 2 again and verifyign that list returns none
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        # Creating a Volume 
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-        self.assertIsNotNone(volume_created, "Volume not created")
-        self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-        #Attaching volume to virtual machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        #Detaching volume from virtual machine
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-
-        #Creating 3 Snapshots from volume
-        list_snapshot_before = Snapshot.list(
-                                             self.userapiclient,
-                                             volumeid=volume_created.id,
-                                             listall=self.services["listall"]
-                                             )
-        self.assertIsNone(
-                          list_snapshot_before,
-                          "Newly created volume is already having snapshots"
-                          )
-
-        list_snapshot_before_size = 0
-        for i in range(0, 3):
-            snapshot_created = Snapshot.create(
-                                       self.userapiclient,
-                                       volume_created.id,
-                                       )
-            self.assertIsNotNone(snapshot_created, "Snapshot not created")
-            self.cleanup.append(snapshot_created)
-     
-            self.assertEquals(
-                              volume_created.id,
-                              snapshot_created.volumeid,
-                              "Snapshot not created for given volume"
-                              )
-
-        list_snapshot_after = Snapshot.list(
-                                            self.userapiclient,
-                                            volumeid=volume_created.id,
-                                            listall=self.services["listall"]
-                                            )
-        self.assertEqual(
-                         list_snapshot_before_size+3,
-                         len(list_snapshot_after),
-                         "Number of snapshots created is not matching expected"
-                         )
-        #Listing all the snapshots in page1
-        list_snapshots_page1 = Snapshot.list(
-                                             self.userapiclient,
-                                             volumeid=volume_created.id,
-                                             listall=self.services["listall"],
-                                             page=1,
-                                             pagesize=2
-                                             )
-        self.assertEqual(
-                         2,
-                         len(list_snapshots_page1),
-                         "List snapshots response is not matching with the page size length for page 1"
-                         )
-
-        #Listing all the snapshots in page2 and ensuring only 1 snapshot is present 
-        list_snapshots_page2 = Snapshot.list(
-                                             self.userapiclient,
-                                             volumeid=volume_created.id,
-                                             listall=self.services["listall"],
-                                             page=2,
-                                             pagesize=2
-                                             )
-        self.assertEqual(
-                         len(list_snapshots_page2),
-                         1,
-                         "List snapshots response is not matching with the page size length for page 2"
-                         )
-        snapshot_page2 = list_snapshots_page2[0]
-
-        # Verifying that the snapshot on page 2 is not present in page1
-        for i in range(0, len(list_snapshots_page1)):
-            snapshot_page1 = list_snapshots_page1[i]
-            self.assertNotEquals(
-                                 snapshot_page2.id,
-                                 snapshot_page1.id,
-                                 "Snapshot listed in page 2 is also listed in page 1"
-                                 )
-        # Deleting a single snapshot and verifying that snapshot does not exists on page 2
-        Snapshot.delete(snapshot_created, self.userapiclient)
-
-        list_snapshot_page2 = Snapshot.list(
-                                            self.userapiclient,
-                                            volumeid=volume_created.id,
-                                            listall=self.services["listall"],
-                                            page=2,
-                                            pagesize=2
-                                            )
-        self.assertEqual(
-                         None,
-                         list_snapshot_page2,
-                         "Snapshot was not deleted"
-                         )
-        list_snapshot_page1 = Snapshot.list(
-                                            self.userapiclient,
-                                            volumeid=volume_created.id,
-                                            listall=self.services["listall"],
-                                            page=1,
-                                            pagesize=2
-                                            )
-        self.assertEqual(
-                         2,
-                         len(list_snapshot_page1),
-                         "Snapshots on page 1 are not matching"
-                         )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_11_volume_extract(self):
-        """  
-        @summary: Test to verify extract/download a Volume
-         
-        Step1: Listing Volumes before creating a Volume
-        Step2: Creating a Volume.
-        Step3: Verifying that created volume is not none and adding to clean up
-        Step4: Listing the volumes after creation
-        Step5: Verifying that the list volume size is increased by 1
-        Step6: Attaching volume created in Step2 to virtual machine
-        Step7: Detaching the volume created in step2 from virtual machine
-        Step8: Extracting/Downloadign the volume
-        Step9: Verifyign that a download URL is created for volume download
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertIsNotNone(
-                             list_volumes_before,
-                             "volume not created for the vm launched at class level"
-                             )
-        volume_created = Volume.create(
-                                    self.userapiclient,
-                                    self.services["volume"],
-                                    zoneid=self.zone.id,
-                                    diskofferingid=self.disk_offering.id
-                                    )
-
-        self.assertIsNotNone(volume_created, "Volume not created")
-        self.cleanup.append(volume_created)
-
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertIsNotNone(
-                             list_volumes_after,
-                             "volume creation failed"
-                             )
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "Volume not created"
-                          )
-        #Attaching and Detaching volume created to Virtual Machine
-        self.virtual_machine.attach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        attached_volume = list_volumes[0]
-
-        self.assertIsNotNone(
-                             attached_volume.vmname,
-                             "VM is not attached to Volume"
-                             )
-        self.assertEquals(
-                          self.virtual_machine.name,
-                          attached_volume.vmname,
-                          "VM Name is not matching with attached vm"
-                          )
-        self.virtual_machine.detach_volume(
-                                           self.userapiclient,
-                                           volume_created
-                                           )
-        list_volumes = Volume.list(
-                                   self.userapiclient,
-                                   listall=self.services["listall"],
-                                   id=volume_created.id
-                                   )
-        detached_volume = list_volumes[0]
-        self.assertIsNone(
-                          detached_volume.vmname,
-                          "VM is not detached from volume"
-                          )
-        #Extract/Download the volume
-        self.services["mode"] = "HTTP_DOWNLOAD"
-
-        extract_volume_response = Volume.extract(
-                                                 self.userapiclient,
-                                                 volume_created.id,
-                                                 self.zone.id,
-                                                 self.services["mode"]
-                                                 )
-        self.assertIsNotNone(extract_volume_response, "Extract/Download volume failed")
-
-        self.assertEquals(
-                          "DOWNLOAD_URL_CREATED",
-                          extract_volume_response.state,
-                          "Failed to create Download URL"
-                          )
-        self.assertIsNotNone(
-                             extract_volume_response.url,
-                             "Extract/Download volume URL is NULL"
-                             )
-        self.assertTrue(
-                        (extract_volume_response.url.find("https://")!=-1),
-                        "Extract/Download volume URL doesnot contain https://"
-                        )
-        self.assertEquals(
-                          volume_created.id,
-                          extract_volume_response.id,
-                          "Extracted/Downloaded volume is not matching with original volume"
-                          )
-        return
-
-    @attr(tags=["advanced", "basic", "provisioning"])
-    def test_12_volume_upload(self):
-        """  
-        @summary: Test to verify upload volume
-        
-        Step1: Listing the volumes for a user before uploading volume
-        Step2: Uploading a volume
-        Step3: Listing the volumes for a user after uploading data volume
-        Step4: Verifying that the list volume length after upload is increased by 1
-        """
-        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertIsNotNone(
-                             list_volumes_before,
-                             "volume not created for the vm launched at class level"
-                             )
-        #Uploading a Volume
-        volume_uploaded = Volume.upload(
-                                       self.userapiclient,
-                                       self.services["upload_volume"],
-                                       self.zone.id
-                                       )
-        self.assertIsNotNone(volume_uploaded, "volume uploading failed")
-
-        self.assertEquals(
-                          self.services["upload_volume"]["diskname"],
-                          volume_uploaded.name,
-                          "Uploaded volume name is not matching with name provided while uploading")
-
-        #Listing the volumes for a user after uploading data volume
-        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
-
-        self.assertIsNotNone(
-                             list_volumes_after,
-                             "volume not created for the vm launched at class level"
-                             )
-        #Asserting that the list volume length after upload is increased by 1
-        self.assertEquals(
-                          len(list_volumes_before) + 1,
-                          len(list_volumes_after),
-                          "upload volume failed"
-                          )
-        return
-
-class TestListInstances(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        try:
-            cls._cleanup = []        
-            cls.testClient = super(TestListInstances, cls).getClsTestClient()
-            cls.api_client = cls.testClient.getApiClient()
-            cls.services = cls.testClient.getParsedTestDataConfig()
-
-            # Get Domain, Zone, Template
-            cls.domain = get_domain(cls.api_client)
-            cls.zone = get_zone(cls.api_client)
-            cls.template = get_template(
-                                        cls.api_client,
-                                        cls.zone.id,
-                                        cls.services["ostype"]
-                                        )
-            if cls.zone.localstorageenabled:
-                cls.storagetype = 'local'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
-                cls.services["disk_offering"]["storagetype"] = 'local'
-            else:
-                cls.storagetype = 'shared'
-                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
-                cls.services["disk_offering"]["storagetype"] = 'shared'
-
-            cls.services['mode'] = cls.zone.networktype
-            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
-            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-            cls.services["virtual_machine"]["template"] = cls.template.id
-            cls.services["custom_volume"]["zoneid"] = cls.zone.id
-
-            # Creating Disk offering, Service Offering and Account
-            cls.disk_offering = DiskOffering.create(
-                                                    cls.api_client,
-                                                    cls.services["disk_offering"]
-                                                    )
-            cls._cleanup.append(cls.disk_offering)
-            cls.service_offering = ServiceOffering.create(
-                                                          cls.api_client,
-                                                          cls.services["service_offerings"]["tiny"]
-                                                          )
-            cls._cleanup.append(cls.service_offering)
-            cls.account = Account.create(
-                                         cls.api_client,
-                                         cls.services["account"],
-                                         domainid=cls.domain.id
-                                         )
-            # Getting authentication for user in newly created Account
-            cls.user = cls.account.user[0]
-            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
-            # Updating resource Limits
-            for i in range(0,12):
-                Resources.updateLimit(
-                                      cls.api_client,
-                                      account=cls.account.name,
-                                      domainid=cls.domain.id,
-                                      max=-1,
-                                      resourcetype=i
-                                      )
-
-            cls._cleanup.append(cls.account)
-        except Exception as e:
-            cls.tearDownClass()
-            raise Exception("Warning: Exception in setup : %s" % e)
-        return
-
-    def setUp(self):
-
-        self.apiClient = self.testClient.getApiClient()
-        self.cleanup = []
-
-    def tearDown(self):
-        #Clean up, terminate the created resources
-        cleanup_resources(self.apiClient, self.cleanup)
-        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)
-
-        return
-
-    def __verify_values(self, expected_vals, actual_vals):
-        """  
-        @Desc: Function to verify expected and actual values
-        @Steps:
-        Step1: Initializing return flag to True
-        Step1: Verifying length of expected and actual dictionaries is matching.
-               If not matching returning false
-        Step2: Listing all the keys from expected dictionary
-        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
-               If not making return flag to False
-        Step4: returning the return flag after all the values are verified
-        """
-        return_flag = True
-
-        if len(expected_vals) != len(actual_vals):
-            return False
-
-        keys = expected_vals.keys()
-        for i in range(0, len(expected_vals)):
-            exp_val = expected_vals[keys[i]]
-            act_val = actual_vals[keys[i]]
-            if exp_val == act_val:
-                return_flag = return_flag and True
-            else:
-                return_flag = return_flag and False
-                self.debug("expected Value: %s, is not matching with actual value: %s" % (
-                                                                                          exp_val,
-                                                                                          act_val
-                                                                                          ))
-        return return_flag
-
-    @attr(tags=["advanced", "basic", "selfservice"])
-    def test_01_list_instances_pagination(self):
-        """  
-        @Desc: Test List Instances pagination
-        @Steps:
-        Step1: Listing all the Instances for a user
-        Step2: Verifying listed Instances for account created at class level
-        Step3: If number of volumes is less than (page size + 1), then creating them
-        Step4: Listing all the volumes again after creation of volumes
-        Step5: Verifying the length of the volumes is (page size + 1)
-        Step6: Listing all the volumes in page1
-        Step7: Verifying that the length of the volumes in page 1 is (page size)
-        Step8: Listing all the volumes in page2
-        Step9: Verifying that the length of the volumes in page 2 is 1
-        Step10: Deleting the volume present in page 2
-        Step11: Listing for the volumes on page 2
-        Step12: Verifying that there are no volumes present in page 2
-        """
-        # Listing all the instances for a user
-        list_instances_before = VirtualMachine.list(self.userapiclient, listall=self.services["listall"])
-
-        # Verifying listed instances for account created at class level
-        self.assertIsNone(
-                          list_instances_before,
-                          "Virtual Machine already exists for newly created user"
-                          )
-        # If number of instances are less than (pagesize + 1), then creating them    
-        for i in range(0, (self.services["pagesize"] + 1)):
-            vm_created = VirtualMachine.create(
-                                               self.userapiclient,
-                                               self.services["virtual_machine"],
-                                               accountid=self.account.name,
-                                               domainid=self.account.dom

<TRUNCATED>

[44/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7062: Enabled back the test as not able to repro

(cherry picked from commit 5e181acbdb0865c0d26307c4e5359ec9c615f615)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2ca71f47
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2ca71f47
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2ca71f47

Branch: refs/heads/4.4
Commit: 2ca71f473706eb04df4e4174a3817d367236fcc6
Parents: e1cfd8d
Author: Koushik Das <ko...@apache.org>
Authored: Fri Jul 11 17:07:06 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:56 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_primary_storage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2ca71f47/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index a723652..66aec59 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -144,7 +144,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             return
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true", BugId="7062")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_01_primary_storage_iscsi(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """


[33/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6906: Fixing volume resize BVT

(cherry picked from commit ba270efd4b842480482953ec2c4f7641e8ad04ca)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aca8ae06
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aca8ae06
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aca8ae06

Branch: refs/heads/4.4
Commit: aca8ae06bec5f35814905030d34bd9975fc2368c
Parents: dc75e46
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Jun 20 07:12:18 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:51 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_volumes.py | 37 +++++++++++++++--------------
 1 file changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aca8ae06/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 3a30768..79cc5b2 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -621,9 +621,16 @@ class TestVolumes(cloudstackTestCase):
         # resize the data disk
         self.debug("Resize Volume ID: %s" % self.volume.id)
 
+        self.services["disk_offering"]["disksize"] = 20
+        disk_offering_20_GB = DiskOffering.create(
+                                    self.apiclient,
+                                    self.services["disk_offering"]
+                                    )
+        self.cleanup.append(disk_offering_20_GB)
+
         cmd                = resizeVolume.resizeVolumeCmd()
         cmd.id             = self.volume.id
-        cmd.diskofferingid = self.services['customresizeddiskofferingid']
+        cmd.diskofferingid = disk_offering_20_GB.id
 
         self.apiClient.resizeVolume(cmd)
 
@@ -636,7 +643,7 @@ class TestVolumes(cloudstackTestCase):
                                                 type='DATADISK'
                                                 )
             for vol in list_volume_response:
-                if vol.id == self.volume.id and vol.size == 3221225472L and vol.state == 'Ready':
+                if vol.id == self.volume.id and int(vol.size) == (int(disk_offering_20_GB.disksize) * (1024** 3)) and vol.state == 'Ready':
                     success = True
             if success:
                 break
@@ -650,22 +657,16 @@ class TestVolumes(cloudstackTestCase):
                          "Check if the data volume resized appropriately"
                          )
 
-        # resize the root disk
-        self.debug("Resize Root for : %s" % self.virtual_machine.id)
-
-        # get root vol from created vm
-        list_volume_response = Volume.list(
-                                            self.apiClient,
-                                            virtualmachineid=self.virtual_machine.id,
-                                            type='ROOT',
-                                            listall=True
-                                            )
-
-        rootvolume = list_volume_response[0]
+        self.services["disk_offering"]["disksize"] = 10
+        disk_offering_10_GB = DiskOffering.create(
+                                    self.apiclient,
+                                    self.services["disk_offering"]
+                                    )
+        self.cleanup.append(disk_offering_10_GB)
 
         cmd                = resizeVolume.resizeVolumeCmd()
-        cmd.id             = rootvolume.id
-        cmd.size           = 10
+        cmd.id             = self.volume.id
+        cmd.diskofferingid = disk_offering_10_GB.id
         cmd.shrinkok       = "true"
 
         self.apiClient.resizeVolume(cmd)
@@ -675,10 +676,10 @@ class TestVolumes(cloudstackTestCase):
         while count < 3:
             list_volume_response = Volume.list(
                                                 self.apiClient,
-                                                id=rootvolume.id
+                                                id=self.volume.id
                                                 )
             for vol in list_volume_response:
-                if vol.id == rootvolume.id and vol.size == 10737418240L and vol.state == 'Ready':
+                if vol.id == self.volume.id and int(vol.size) == (int(disk_offering_10_GB.disksize) * (1024 ** 3)) and vol.state == 'Ready':
                     success = True
             if success:
                 break


[20/50] [abbrv] CLOUDSTACK-6282: Modified IPAddress tests to fix the failures. Modified Instances, snapshots, templates tests to handle KVM Hypervisor

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63feb451/test/integration/component/test_escalations_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
index 2367253..0aa36c3 100644
--- a/test/integration/component/test_escalations_snapshots.py
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -15,42 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor,
-                             VpcOffering,
-                             VPC,
-                             NetworkACL)
-from marvin.lib.common import (get_zone,
-                               get_domain,
-                               get_template,
-                               list_os_types)
-from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
 from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
 
 class TestSnapshots(cloudstackTestCase):
 
@@ -61,6 +38,7 @@ class TestSnapshots(cloudstackTestCase):
             cls.testClient = super(TestSnapshots, cls).getClsTestClient()
             cls.api_client = cls.testClient.getApiClient()
             cls.services = cls.testClient.getParsedTestDataConfig()
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
             # Get Domain, Zone, Template
             cls.domain = get_domain(cls.api_client)
             cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
@@ -123,7 +101,7 @@ class TestSnapshots(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created resources
+        # Clean up, terminate the created resources
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -387,7 +365,7 @@ class TestSnapshots(cloudstackTestCase):
                           "Size of the list volume snapshot by Id is not matching"
                           )
         # Verifying details of the listed snapshot to be same as snapshot created above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":snapshot_created.id,
                          "name":snapshot_created.name,
@@ -435,6 +413,8 @@ class TestSnapshots(cloudstackTestCase):
         Step11: Listing all the volume snapshots in page2
         Step12: Verifying that list size is 0
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
         # Listing all the VM snapshots for a User
         list_vm_snaps_before = VmSnapshot.list(
                                                self.userapiclient,
@@ -529,7 +509,7 @@ class TestSnapshots(cloudstackTestCase):
                           "VM snapshot not deleted from page 2"
                           )
         # Deleting all the existing VM snapshots
-        list_vm_snaps =  VmSnapshot.list(
+        list_vm_snaps = VmSnapshot.list(
                                          self.userapiclient,
                                          listall=self.services["listall"],
                                          )
@@ -567,6 +547,8 @@ class TestSnapshots(cloudstackTestCase):
         Step7: Verifying that list size is 1
         Step8: Verifying details of the listed VM snapshot
         """
+        if self.hypervisor.lower() == 'kvm':
+            raise unittest.SkipTest("VM Snapshot is not supported on KVM. Hence, skipping the test")
         # Listing all the VM snapshots for a User
         list_vm_snaps_before = VmSnapshot.list(
                                                self.userapiclient,
@@ -622,7 +604,7 @@ class TestSnapshots(cloudstackTestCase):
                           "Size of the list vm snapshot by Id is not matching"
                           )
         # Verifying details of the listed snapshot to be same as snapshot created above
-        #Creating expected and actual values dictionaries
+        # Creating expected and actual values dictionaries
         expected_dict = {
                          "id":snapshot_created.id,
                          "name":snapshot_created.name,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63feb451/test/integration/component/test_escalations_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 083ba90..06e3d42 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -15,42 +15,19 @@
 # specific language governing permissions and limitations
 # under the License.
 
-#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (createVolume,
-                                  createTemplate)
-from marvin.lib.base import (Volume,
-                             Iso,
-                             VirtualMachine,
-                             Template,
-                             Snapshot,
-                             SecurityGroup,
-                             Account,
-                             Zone,
-                             Network,
-                             NetworkOffering,
-                             DiskOffering,
-                             ServiceOffering,
-                             VmSnapshot,
-                             SnapshotPolicy,
-                             SSHKeyPair,
-                             Resources,
-                             Configurations,
-                             VpnCustomerGateway,
-                             Hypervisor,
-                             VpcOffering,
-                             VPC,
-                             NetworkACL)
-from marvin.lib.common import (get_zone,
-                               get_domain,
-                               get_template,
-                               list_os_types)
-from marvin.lib.utils import (validateList,
-                              cleanup_resources,
-                              random_gen)
-from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
 from nose.plugins.attrib import attr
-import time
+from time import sleep
+from ctypes.wintypes import BOOLEAN
 
 class TestTemplates(cloudstackTestCase):
 
@@ -91,7 +68,7 @@ class TestTemplates(cloudstackTestCase):
         self.cleanup = []
 
     def tearDown(self):
-        #Clean up, terminate the created resources
+        # Clean up, terminate the created resources
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
@@ -168,14 +145,12 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_before,
                           "Templates listed for newly created User"
                           )
-        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-        self.services["template"]["format"] = "VHD"
-        self.services["template"]["ostype"] = self.services["ostype"]
+        self.services["templateregister"]["ostype"] = self.services["ostype"]
         # Creating pagesize + 1 number of Templates
         for i in range(0, (self.services["pagesize"] + 1)):
             template_created = Template.register(
                                                  self.userapiclient,
-                                                 self.services["template"],
+                                                 self.services["templateregister"],
                                                  self.zone.id,
                                                  hypervisor=self.hypervisor
                                                  )
@@ -290,9 +265,7 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_page2,
                           "Templates not deleted from page 2"
                           )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
+        del self.services["templateregister"]["ostype"]
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -322,14 +295,12 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_before,
                           "Templates listed for newly created User"
                           )
-        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-        self.services["template"]["format"] = "VHD"
-        self.services["template"]["ostype"] = self.services["ostype"]
-        self.services["template"]["isextractable"] = True
+        self.services["templateregister"]["ostype"] = self.services["ostype"]
+        self.services["templateregister"]["isextractable"] = True
         # Creating aTemplate
         template_created = Template.register(
                                              self.userapiclient,
-                                             self.services["template"],
+                                             self.services["templateregister"],
                                              self.zone.id,
                                              hypervisor=self.hypervisor
                                              )
@@ -410,10 +381,8 @@ class TestTemplates(cloudstackTestCase):
                           download_template.id,
                           "Download Template details are not same as Template created"
                           )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
-        del self.services["template"]["isextractable"]
+        del self.services["templateregister"]["ostype"]
+        del self.services["templateregister"]["isextractable"]
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -451,13 +420,11 @@ class TestTemplates(cloudstackTestCase):
                           list_templates_before,
                           "Templates listed for newly created User"
                           )
-        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-        self.services["template"]["format"] = "VHD"
-        self.services["template"]["ostype"] = self.services["ostype"]
+        self.services["templateregister"]["ostype"] = self.services["ostype"]
         # Creating aTemplate
         template_created = Template.register(
                                              self.userapiclient,
-                                             self.services["template"],
+                                             self.services["templateregister"],
                                              self.zone.id,
                                              hypervisor=self.hypervisor
                                              )
@@ -727,9 +694,7 @@ class TestTemplates(cloudstackTestCase):
                          edit_template_status,
                          "Edited Template details are not as expected"
                          )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
+        del self.services["templateregister"]["ostype"]
         return
 
     @attr(tags=["advanced", "basic", "provisioning"])
@@ -768,7 +733,7 @@ class TestTemplates(cloudstackTestCase):
                           "Failed to list Zones"
                           )
         if not len(zones_list) > 1:
-            self.fail("Enough zones doesnot exists to copy template")
+            raise unittest.SkipTest("Enough zones doesnot exists to copy template")
         else:
             # Listing all the Templates for a User in Zone 1
             list_templates_zone1 = Template.list(
@@ -794,10 +759,8 @@ class TestTemplates(cloudstackTestCase):
                               list_templates_zone2,
                               "Templates listed for newly created User in Zone2"
                               )
-            self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
-            self.services["template"]["format"] = "VHD"
-            self.services["template"]["ostype"] = self.services["ostype"]
-            #Listing Hypervisors in Zone 1
+            self.services["templateregister"]["ostype"] = self.services["ostype"]
+            # Listing Hypervisors in Zone 1
             hypervisor_list = Hypervisor.list(
                                               self.apiClient,
                                               zoneid=zones_list[0].id
@@ -811,7 +774,7 @@ class TestTemplates(cloudstackTestCase):
             # Creating aTemplate in Zone 1
             template_created = Template.register(
                                                  self.userapiclient,
-                                                 self.services["template"],
+                                                 self.services["templateregister"],
                                                  zones_list[0].id,
                                                  hypervisor=hypervisor_list[0].name
                                                  )
@@ -938,7 +901,5 @@ class TestTemplates(cloudstackTestCase):
                               list_templates_zone2[0].isready,
                               "Failed to copy Template"
                               )
-        del self.services["template"]["url"]
-        del self.services["template"]["format"]
-        del self.services["template"]["ostype"]
+        del self.services["templateregister"]["ostype"]
         return
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63feb451/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 44ef8d5..801c549 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -741,6 +741,13 @@ test_data = {
         "ostype": "CentOS 5.3 (64-bit)",
         "templatefilter": 'self',
     },
+	"templateregister": {
+        "displaytext": "xs",
+        "name": "xs",
+        "passwordenabled": False,
+        "url": "http://10.147.28.7/templates/ttylinux_pv.vhd",
+        "format": "VHD"
+    },
     "security_group": {"name": "custom_Sec_Grp"},
     "ingress_rule": {
         "protocol": "TCP",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63feb451/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 9a11b3d..9b011f2 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1562,7 +1562,7 @@ class StaticNATRule:
         return
 
     @classmethod
-    def disable(cls, apiclient, ipaddressid, virtualmachineid):
+    def disable(cls, apiclient, ipaddressid, virtualmachineid=None):
         """Disables Static NAT rule"""
 
         cmd = disableStaticNat.disableStaticNatCmd()


[26/50] [abbrv] CLOUDSTACK-1466: Automation - Priamary Storage Limits

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/test/integration/component/test_ps_resize_volume.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ps_resize_volume.py b/test/integration/component/test_ps_resize_volume.py
new file mode 100644
index 0000000..737f910
--- /dev/null
+++ b/test/integration/component/test_ps_resize_volume.py
@@ -0,0 +1,339 @@
+# 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 testing resize volume functionality with primary storage limit constraints on
+    account/domain
+
+    Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domain+or+accounts
+
+    Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-1466
+
+    Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (Account,
+                             ServiceOffering,
+                             VirtualMachine,
+                             Resources,
+                             Domain,
+                             DiskOffering,
+                             Volume)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               matchResourceCount,
+                               isDomainResourceCountEqualToExpectedCount)
+from marvin.lib.utils import (cleanup_resources,
+                              get_hypervisor_type)
+from marvin.codes import (PASS,
+                          FAIL,
+                          FAILED,
+                          RESOURCE_PRIMARY_STORAGE,
+                          RESOURCE_SECONDARY_STORAGE,
+                          XEN_SERVER)
+
+class TestResizeVolume(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cloudstackTestClient = super(TestResizeVolume,
+                               cls).getClsTestClient()
+        cls.api_client = cloudstackTestClient.getApiClient()
+        # Fill services from the external config file
+        cls.services = cloudstackTestClient.getParsedTestDataConfig()
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests())
+        cls.services["mode"] = cls.zone.networktype
+        cls.resourcetypemapping = {RESOURCE_PRIMARY_STORAGE: 10,
+                                   RESOURCE_SECONDARY_STORAGE: 11}
+
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        cls.services["volume"]["zoneid"] = cls.zone.id
+
+        cls._cleanup = []
+        try:
+            cls.hypervisor = str(get_hypervisor_type(cls.api_client)).lower()
+
+            # Creating service offering with normal config
+            cls.service_offering = ServiceOffering.create(cls.api_client,
+                                            cls.services["service_offering"])
+            cls._cleanup.append(cls.service_offering)
+
+            cls.services["disk_offering"]["disksize"] = 5
+            cls.disk_offering_5_GB = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+            cls._cleanup.append(cls.disk_offering_5_GB)
+
+            cls.services["disk_offering"]["disksize"] = 20
+            cls.disk_offering_20_GB = DiskOffering.create(
+                                    cls.api_client,
+                                    cls.services["disk_offering"]
+                                    )
+            cls._cleanup.append(cls.disk_offering_20_GB)
+        except Exception as e:
+            cls.tearDownClass()
+            raise unittest.SkipTest("Failure while creating disk offering: %s" % e)
+        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)
+            pass
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def updateResourceLimits(self, accountLimit=None, domainLimit=None):
+        """Update primary storage limits of the parent domain and its
+        child domains"""
+
+        try:
+            if domainLimit:
+                #Update resource limit for domain
+                Resources.updateLimit(self.apiclient, resourcetype=10,
+                              max=domainLimit,
+                              domainid=self.parent_domain.id)
+            if accountLimit:
+                #Update resource limit for domain
+                Resources.updateLimit(self.apiclient, resourcetype=10,
+                              max=accountLimit, account=self.parentd_admin.name,
+                              domainid=self.parent_domain.id)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    def setupAccounts(self):
+        try:
+            self.parent_domain = Domain.create(self.apiclient,
+                                        services=self.services["domain"],
+                                        parentdomainid=self.domain.id)
+            self.parentd_admin = Account.create(self.apiclient, self.services["account"],
+                                            admin=True, domainid=self.parent_domain.id)
+
+            # Cleanup the resources created at end of test
+            self.cleanup.append(self.parentd_admin)
+            self.cleanup.append(self.parent_domain)
+        except Exception as e:
+            return [FAIL, e]
+        return [PASS, None]
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_01_increase_volume_size_within_account_limit(self):
+	"""Test increasing volume size within the account limit and verify primary storage usage
+
+        # Validate the following
+        # 1. Create a domain and its admin account
+        # 2. Set account primary storage limit well beyond (20 GB volume + template size of VM)
+        # 3. Deploy a VM without any disk offering (only root disk)
+        # 4. Create a volume of 5 GB in the account and attach it to the VM
+        # 5. Increase (resize) the volume to 20 GB
+        # 6. Resize opearation should be successful and primary storage counnt for
+        #    account should be updated successfully"""
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS, result[1])
+
+        apiclient = self.testClient.getUserApiClient(
+                        UserName=self.parentd_admin.name,
+                        DomainName=self.parentd_admin.domain)
+        self.assertNotEqual(apiclient, FAILED, "Failed to get api client\
+                            of account: %s" % self.parentd_admin.name)
+
+        templateSize = (self.template.size / (1024**3))
+        accountLimit = (templateSize + self.disk_offering_20_GB.disksize)
+        response = self.updateResourceLimits(accountLimit=accountLimit)
+        self.assertEqual(response[0], PASS, response[1])
+        try:
+            virtualMachine = VirtualMachine.create(
+                    apiclient, self.services["virtual_machine"],
+                    accountid=self.parentd_admin.name, domainid=self.parent_domain.id,
+                    serviceofferingid=self.service_offering.id
+                    )
+
+            volume = Volume.create(
+                    apiclient,self.services["volume"],zoneid=self.zone.id,
+                    account=self.parentd_admin.name,domainid=self.parent_domain.id,
+                    diskofferingid=self.disk_offering_5_GB.id)
+
+            virtualMachine.attach_volume(apiclient, volume=volume)
+
+            expectedCount = (templateSize + self.disk_offering_5_GB.disksize)
+            response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.parentd_admin.id)
+            if response[0] == FAIL:
+                raise Exception(response[1])
+
+            if self.hypervisor == str(XEN_SERVER).lower():
+                virtualMachine.stop(self.apiclient)
+            volume.resize(apiclient, diskofferingid=self.disk_offering_20_GB.id)
+
+            expectedCount = (templateSize + self.disk_offering_20_GB.disksize)
+            response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.parentd_admin.id)
+            if response[0] == FAIL:
+                raise Exception(response[1])
+        except Exception as e:
+            self.fail("Failed with exception: %s" % e)
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_02_increase_volume_size_above_account_limit(self):
+	"""Test increasing volume size above the account limit
+
+        # Validate the following
+        # 1. Create a domain and its admin account
+        # 2. Set account primary storage limit more than (5 GB volume + template size of VM)
+        #    and less than (20 GB volume+ template size of VM)
+        # 3. Deploy a VM without any disk offering (only root disk)
+        # 4. Create a volume of 5 GB in the account and attach it to the VM
+        # 5. Try to (resize) the volume to 20 GB
+        # 6. Resize opearation should fail"""
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS, result[1])
+
+        templateSize = (self.template.size / (1024**3))
+        accountLimit = ((templateSize + self.disk_offering_20_GB.disksize) - 1)
+        response = self.updateResourceLimits(accountLimit=accountLimit)
+        self.assertEqual(response[0], PASS, response[1])
+
+        apiclient = self.testClient.getUserApiClient(
+                        UserName=self.parentd_admin.name,
+                        DomainName=self.parentd_admin.domain)
+        self.assertNotEqual(apiclient, FAILED, "Failed to get api client\
+                            of account: %s" % self.parentd_admin.name)
+
+        try:
+            virtualMachine = VirtualMachine.create(
+                    apiclient, self.services["virtual_machine"],
+                    accountid=self.parentd_admin.name, domainid=self.parent_domain.id,
+                    serviceofferingid=self.service_offering.id
+                    )
+
+            volume = Volume.create(
+                    apiclient,self.services["volume"],zoneid=self.zone.id,
+                    account=self.parentd_admin.name,domainid=self.parent_domain.id,
+                    diskofferingid=self.disk_offering_5_GB.id)
+
+            virtualMachine.attach_volume(apiclient, volume=volume)
+
+            expectedCount = (templateSize + self.disk_offering_5_GB.disksize)
+            response = matchResourceCount(
+                        self.apiclient, expectedCount,
+                        RESOURCE_PRIMARY_STORAGE,
+                        accountid=self.parentd_admin.id)
+            if response[0] == FAIL:
+                raise Exception(response[1])
+        except Exception as e:
+            self.fail("Failed with exception: %s" % e)
+
+        if self.hypervisor == str(XEN_SERVER).lower():
+            virtualMachine.stop(self.apiclient)
+        with self.assertRaises(Exception):
+            volume.resize(apiclient, diskofferingid=self.disk_offering_20_GB.id)
+        return
+
+    @attr(tags=["advanced", "selfservice"])
+    def test_03_increase_volume_size_above_domain_limit(self):
+	"""Test increasing volume size above the domain limit
+
+        # Validate the following
+        # 1. Create a domain and its admin account
+        # 2. Set domain primary storage limit more than (5 GB volume + template size of VM)
+        #    and less than (20 GB volume+ template size of VM)
+        # 3. Deploy a VM without any disk offering (only root disk)
+        # 4. Create a volume of 5 GB in the account and attach it to the VM
+        # 5. Try to (resize) the volume to 20 GB
+        # 6. Resize opearation should fail"""
+
+        # Setting up account and domain hierarchy
+        result = self.setupAccounts()
+        self.assertEqual(result[0], PASS, result[1])
+
+        templateSize = (self.template.size / (1024**3))
+        domainLimit = ((templateSize + self.disk_offering_20_GB.disksize) - 1)
+        response = self.updateResourceLimits(domainLimit=domainLimit)
+        self.assertEqual(response[0], PASS, response[1])
+
+        apiclient = self.testClient.getUserApiClient(
+                        UserName=self.parentd_admin.name,
+                        DomainName=self.parentd_admin.domain)
+        self.assertNotEqual(apiclient, FAILED, "Failed to get api client\
+                            of account: %s" % self.parentd_admin.name)
+
+        try:
+            virtualMachine = VirtualMachine.create(
+                    apiclient, self.services["virtual_machine"],
+                    accountid=self.parentd_admin.name, domainid=self.parent_domain.id,
+                    serviceofferingid=self.service_offering.id
+                    )
+
+            volume = Volume.create(
+                    apiclient,self.services["volume"],zoneid=self.zone.id,
+                    account=self.parentd_admin.name,domainid=self.parent_domain.id,
+                    diskofferingid=self.disk_offering_5_GB.id)
+
+            virtualMachine.attach_volume(apiclient, volume=volume)
+
+            expectedCount = (templateSize + self.disk_offering_5_GB.disksize)
+            result = isDomainResourceCountEqualToExpectedCount(
+                        self.apiclient, self.parent_domain.id,
+                        expectedCount, RESOURCE_PRIMARY_STORAGE)
+            self.assertFalse(result[0], result[1])
+            self.assertTrue(result[2], "Resource count does not match")
+        except Exception as e:
+            self.fail("Failed with exception: %s" % e)
+
+        if self.hypervisor == str(XEN_SERVER).lower():
+            virtualMachine.stop(self.apiclient)
+        with self.assertRaises(Exception):
+            volume.resize(apiclient, diskofferingid=self.disk_offering_20_GB.id)
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/tools/marvin/marvin/codes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py
index c72a6bd..e6e5602 100644
--- a/tools/marvin/marvin/codes.py
+++ b/tools/marvin/marvin/codes.py
@@ -30,12 +30,28 @@
 @DateAdded: 20th October 2013
 """
 
+'''
+VM STATES - START
+'''
 RUNNING = "Running"
 STOPPED = "Stopped"
 STOPPING = "Stopping"
 STARTING = "Starting"
 DESTROYED = "Destroyed"
 EXPUNGING = "Expunging"
+'''
+VM STATES - END
+'''
+
+'''
+Snapshot States - START
+'''
+BACKED_UP = "backedup"
+BACKING_UP = "backingup"
+'''
+Snapshot States - END
+'''
+
 RECURRING = "RECURRING"
 ENABLED = "Enabled"
 NETWORK_OFFERING = "network_offering"
@@ -82,3 +98,11 @@ USER = 0
 XEN_SERVER = "XenServer"
 ADMIN_ACCOUNT = 'ADMIN_ACCOUNT'
 USER_ACCOUNT = 'USER_ACCOUNT'
+RESOURCE_CPU = 8
+RESOURCE_MEMORY = 9
+RESOURCE_PRIMARY_STORAGE = 10
+RESOURCE_SECONDARY_STORAGE = 11
+KVM = "kvm"
+VMWARE = "vmware"
+ROOT_DOMAIN_ADMIN="root domain admin"
+CHILD_DOMAIN_ADMIN="child domain admin"

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 9b011f2..d45b7cc 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -20,11 +20,10 @@
 """
 
 import marvin
-from utils import is_server_ssh_ready, random_gen
 from marvin.cloudstackAPI import *
 from marvin.codes import (FAILED, FAIL, PASS, RUNNING, STOPPED,
                           STARTING, DESTROYED, EXPUNGING,
-                          STOPPING)
+                          STOPPING, BACKED_UP, BACKING_UP)
 from marvin.cloudstackException import GetDetailExceptionInfo
 from marvin.lib.utils import validateList, is_server_ssh_ready, random_gen
 # Import System modules
@@ -957,6 +956,12 @@ class Snapshot:
     """Manage Snapshot Lifecycle
     """
 
+    '''Class level variables'''
+    # Variables denoting possible Snapshot states - start
+    BACKED_UP = BACKED_UP
+    BACKING_UP = BACKING_UP
+    # Variables denoting possible Snapshot states - end
+
     def __init__(self, items):
         self.__dict__.update(items)
 
@@ -990,6 +995,33 @@ class Snapshot:
             cmd.listall=True
         return(apiclient.listSnapshots(cmd))
 
+    def validateState(self, apiclient, snapshotstate, timeout=600):
+        """Check if snapshot is in required state
+           returnValue: List[Result, Reason]
+                 @Result: PASS if snapshot is in required state,
+                          else FAIL
+                 @Reason: Reason for failure in case Result is FAIL
+        """
+        isSnapshotInRequiredState = False
+        try:
+            while timeout >= 0:
+                snapshots = Snapshot.list(apiclient, id=self.id)
+                assert validateList(snapshots)[0] == PASS, "snapshots list\
+                        validation failed"
+                if str(snapshots[0].state).lower() == snapshotstate:
+                    isSnapshotInRequiredState = True
+                    break
+                timeout -= 60
+                time.sleep(60)
+            #end while
+            if isSnapshotInRequiredState:
+                return[PASS, None]
+            else:
+                raise Exception("Snapshot not in required state")
+        except Exception as e:
+            return [FAIL, e]
+
+
 
 class Template:
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b6cf1b/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 7753385..42ffc51 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -60,12 +60,29 @@ from marvin.cloudstackAPI import (listConfigurations,
 
 
 from marvin.sshClient import SshClient
-from marvin.codes import (PASS, ISOLATED_NETWORK, VPC_NETWORK,
-                          BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE, FAILED)
+from marvin.codes import (PASS, FAILED, ISOLATED_NETWORK, VPC_NETWORK,
+                          BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE,
+                          RESOURCE_PRIMARY_STORAGE, RESOURCE_SECONDARY_STORAGE,
+                          RESOURCE_CPU, RESOURCE_MEMORY)
+from marvin.lib.utils import (validateList, xsplit, get_process_status)
+from marvin.lib.base import (PhysicalNetwork,
+                             PublicIPAddress,
+                             NetworkOffering,
+                             NATRule,
+                             StaticNATRule,
+                             Volume,
+                             Account,
+                             Project,
+                             Snapshot,
+                             NetScaler,
+                             VirtualMachine,
+                             FireWallRule,
+                             Template,
+                             Network,
+                             Host,
+                             Resources,
+                             Configurations)
 import random
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.codes import PASS
 
 
 # Import System modules
@@ -1222,3 +1239,111 @@ def getPortableIpRangeServices(config):
         services = FAILED
 
     return services
+
+
+def uploadVolume(apiclient, zoneid, account, services):
+    try:
+        # Upload the volume
+        volume = Volume.upload(apiclient, services["volume"],
+                                   zoneid=zoneid, account=account.name,
+                                   domainid=account.domainid, url=services["url"])
+
+        volume.wait_for_upload(apiclient)
+
+        # Check List Volume response for newly created volume
+        volumes = Volume.list(apiclient, id=volume.id,
+                                  zoneid=zoneid, listall=True)
+        validationresult = validateList(volumes)
+        assert validationresult[0] == PASS,\
+                            "volumes list validation failed: %s" % validationresult[2]
+        assert str(volumes[0].state).lower() == "uploaded",\
+                    "Volume state should be 'uploaded' but it is %s" % volumes[0].state
+    except Exception as e:
+        return [FAIL, e]
+    return [PASS, volume]
+
+def matchResourceCount(apiclient, expectedCount, resourceType,
+                              accountid=None, projectid=None):
+    """Match the resource count of account/project with the expected
+    resource count"""
+    try:
+        resourceholderlist = None
+        if accountid:
+            resourceholderlist = Account.list(apiclient, id=accountid)
+        elif projectid:
+            resourceholderlist = Project.list(apiclient, id=projectid, listall=True)
+        validationresult = validateList(resourceholderlist)
+        assert validationresult[0] == PASS,\
+               "accounts list validation failed"
+        if resourceType == RESOURCE_PRIMARY_STORAGE:
+            resourceCount = resourceholderlist[0].primarystoragetotal
+        elif resourceType == RESOURCE_SECONDARY_STORAGE:
+            resourceCount = resourceholderlist[0].secondarystoragetotal
+        elif resourceType == RESOURCE_CPU:
+            resourceCount = resourceholderlist[0].cputotal
+        elif resourceType == RESOURCE_MEMORY:
+            resourceCount = resourceholderlist[0].memorytotal
+        assert str(resourceCount) == str(expectedCount),\
+                "Resource count %s should match with the expected resource count %s" %\
+                (resourceCount, expectedCount)
+    except Exception as e:
+        return [FAIL, e]
+    return [PASS, None]
+
+def createSnapshotFromVirtualMachineVolume(apiclient, account, vmid):
+    """Create snapshot from volume"""
+
+    try:
+        volumes = Volume.list(apiclient, account=account.name,
+                              domainid=account.domainid, virtualmachineid=vmid)
+        validationresult = validateList(volumes)
+        assert validateList(volumes)[0] == PASS,\
+                            "List volumes should return a valid response"
+        snapshot = Snapshot.create(apiclient, volume_id=volumes[0].id,
+                                   account=account.name, domainid=account.domainid)
+        snapshots = Snapshot.list(apiclient, id=snapshot.id,
+                                      listall=True)
+        validationresult = validateList(snapshots)
+        assert validationresult[0] == PASS,\
+               "List snapshot should return a valid list"
+    except Exception as e:
+       return[FAIL, e]
+    return [PASS, snapshot]
+
+def isVmExpunged(apiclient, vmid, projectid=None, timeout=600):
+    """Verify if VM is expunged or not"""
+    vmExpunged= False
+    while timeout>=0:
+        try:
+            vms = VirtualMachine.list(apiclient, id=vmid, projectid=projectid)
+            if vms is None:
+                vmExpunged = True
+                break
+            timeout -= 60
+            time.sleep(60)
+        except Exception:
+           vmExpunged = True
+            break
+     #end while
+    return vmExpunged
+
+def isDomainResourceCountEqualToExpectedCount(apiclient, domainid, expectedcount,
+                                              resourcetype):
+    """Get the resource count of specific domain and match
+    it with the expected count
+    Return list [isExceptionOccured, reasonForException, isResourceCountEqual]"""
+    isResourceCountEqual = False
+    isExceptionOccured = False
+    reasonForException = None
+    try:
+        response = Resources.updateCount(apiclient, domainid=domainid,
+                                         resourcetype=resourcetype)
+    except Exception as e:
+        reasonForException = "Failed while updating resource count: %s" % e
+        isExceptionOccured = True
+        return [isExceptionOccured, reasonForException, isResourceCountEqual]
+
+    resourcecount = (response[0].resourcecount / (1024**3))
+    if resourcecount == expectedcount:
+        isResourceCountEqual = True
+    return [isExceptionOccured, reasonForException, isResourceCountEqual]


[28/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6887: Code enhancement to ensure better cleanup

(cherry picked from commit 588e3e37afdd5740816d1225d449164ed2024c03)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b44f66e1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b44f66e1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b44f66e1

Branch: refs/heads/4.4
Commit: b44f66e12fe6e43888c93548158e7caa99101c9a
Parents: 12b6cf1
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Jun 18 13:06:55 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:49 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_accounts.py     | 83 +++++++++++---------
 .../component/test_add_remove_network.py        | 68 +++++++++-------
 .../component/test_affinity_groups.py           | 64 ++++++---------
 test/integration/component/test_portable_ip.py  | 22 +++---
 test/integration/component/test_vpc_network.py  | 10 +--
 5 files changed, 125 insertions(+), 122 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py
index cf5f2b6..a39880c 100644
--- a/test/integration/component/test_accounts.py
+++ b/test/integration/component/test_accounts.py
@@ -272,8 +272,8 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
                             cls.services["account"]
                             )
 
-        cls._cleanup = [
-                        cls.service_offering,
+        cls._cleanup =  [cls.account,
+                         cls.service_offering,
                         ]
         return
 
@@ -773,6 +773,13 @@ class TestTemplateHierarchy(cloudstackTestCase):
                             domainid=cls.domain_2.id
                             )
 
+        cls._cleanup = [
+                        cls.account_2,
+                        cls.domain_2,
+                        cls.account_1,
+                        cls.domain_1,
+                        ]
+
         builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id)
         cls.services["template"]["url"] = builtin_info[0] 
         cls.services["template"]["hypervisor"] = builtin_info[1]     
@@ -793,14 +800,6 @@ class TestTemplateHierarchy(cloudstackTestCase):
 
         # Wait for template status to be changed across
         time.sleep(60)
-
-        cls._cleanup = [
-                        cls.account_2,
-                        cls.domain_2,
-                        cls.template,
-                        cls.account_1,
-                        cls.domain_1,
-                        ]
         return
 
     @classmethod
@@ -926,6 +925,13 @@ class TestAddVmToSubDomain(cloudstackTestCase):
                                     cls.services["service_offering"],
                                     domainid=cls.domain.id
                                     )
+
+        cls._cleanup = [
+                        cls.account_2,
+                        cls.account_1,
+                        cls.sub_domain,
+                        cls.service_offering
+                        ]
         cls.template = get_template(
                             cls.api_client,
                             cls.zone.id,
@@ -949,12 +955,6 @@ class TestAddVmToSubDomain(cloudstackTestCase):
                                     domainid=cls.account_2.domainid,
                                     serviceofferingid=cls.service_offering.id
                                     )
-        cls._cleanup = [
-                        cls.account_2,
-                        cls.account_1,
-                        cls.sub_domain,
-                        cls.service_offering
-                        ]
         return
 
     @classmethod
@@ -1573,16 +1573,17 @@ class TestDomainForceRemove(cloudstackTestCase):
                                      domainid=domain.id
                                      )
 
-        self.debug("Creating a tiny service offering for VM deployment")
-        self.service_offering = ServiceOffering.create(
+        try:
+            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.debug("Deploying virtual machine in account 1: %s" %
                                                 self.account_1.name)
-        vm_1 = VirtualMachine.create(
+            vm_1 = VirtualMachine.create(
                                     self.apiclient,
                                     self.services["virtual_machine"],
                                     templateid=self.template.id,
@@ -1591,9 +1592,9 @@ class TestDomainForceRemove(cloudstackTestCase):
                                     serviceofferingid=self.service_offering.id
                                     )
 
-        self.debug("Deploying virtual machine in account 2: %s" %
+            self.debug("Deploying virtual machine in account 2: %s" %
                                                 self.account_2.name)
-        vm_2 = VirtualMachine.create(
+            VirtualMachine.create(
                                     self.apiclient,
                                     self.services["virtual_machine"],
                                     templateid=self.template.id,
@@ -1602,22 +1603,22 @@ class TestDomainForceRemove(cloudstackTestCase):
                                     serviceofferingid=self.service_offering.id
                                     )
 
-        networks = Network.list(
+            networks = Network.list(
                                 self.apiclient,
                                 account=self.account_1.name,
                                 domainid=self.account_1.domainid,
                                 listall=True
                                 )
-        self.assertEqual(
+            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" % (
+            network_1 = networks[0]
+            self.debug("Default network in account 1: %s is %s" % (
                                                 self.account_1.name,
                                                 network_1.name))
-        src_nat_list = PublicIPAddress.list(
+            src_nat_list = PublicIPAddress.list(
                                     self.apiclient,
                                     associatednetworkid=network_1.id,
                                     account=self.account_1.name,
@@ -1625,44 +1626,48 @@ class TestDomainForceRemove(cloudstackTestCase):
                                     listall=True,
                                     issourcenat=True,
                                     )
-        self.assertEqual(
+            self.assertEqual(
                          isinstance(src_nat_list, list),
                          True,
                          "List Public IP should return a valid source NAT"
                          )
-        self.assertNotEqual(
+            self.assertNotEqual(
                     len(src_nat_list),
                     0,
                     "Length of response from listPublicIp should not be 0"
                     )
 
-        src_nat = src_nat_list[0]
+            src_nat = src_nat_list[0]
 
-        self.debug(
-            "Trying to create a port forwarding rule in source NAT: %s" %
+            self.debug(
+                      "Trying to create a port forwarding rule in source NAT: %s" %
                                                             src_nat.ipaddress)
-        #Create NAT rule
-        nat_rule = NATRule.create(
+            #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)
+            self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
 
-        nat_rules = NATRule.list(self.apiclient, id=nat_rule.id)
+            nat_rules = NATRule.list(self.apiclient, id=nat_rule.id)
 
-        self.assertEqual(
+            self.assertEqual(
                          isinstance(nat_rules, list),
                          True,
                          "List NAT should return a valid port forwarding rules"
                          )
 
-        self.assertNotEqual(
+            self.assertNotEqual(
                     len(nat_rules),
                     0,
                     "Length of response from listLbRules should not be 0"
                     )
+        except Exception as e:
+            self.clenaup.append(self.account_1)
+            self.cleanup.append(self.account_2)
+            self.fail(e)
 
         self.debug("Deleting domain with force option")
         try:
@@ -1759,7 +1764,7 @@ class TestDomainForceRemove(cloudstackTestCase):
 
         self.debug("Deploying virtual machine in account 2: %s" %
                                                 self.account_2.name)
-        vm_2 = VirtualMachine.create(
+        VirtualMachine.create(
                                     self.apiclient,
                                     self.services["virtual_machine"],
                                     templateid=self.template.id,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_add_remove_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py
index 609a67e..dbba59b 100644
--- a/test/integration/component/test_add_remove_network.py
+++ b/test/integration/component/test_add_remove_network.py
@@ -196,10 +196,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
         # Create Accounts & networks
         cls.services["isolated_network"]["zoneid"] = cls.zone.id
         cls.services["shared_network"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
 
         cls.account = Account.create(cls.api_client, cls.services["account"], domainid = cls.domain.id)
+        cls._cleanup.append(cls.account)
 
         cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+        cls._cleanup.append(cls.service_offering)
 
         cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],accountid=cls.account.name,
                                                     domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id,
@@ -209,6 +212,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
 
         # Create Shared Network Offering
         cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"])
+        cls._cleanup.append(cls.isolated_network_offering)
         # Enable Isolated Network offering
         cls.isolated_network_offering.update(cls.api_client, state='Enabled')
 
@@ -232,9 +236,8 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
 
         cls.shared_network = Network.create(cls.api_client,cls.services["shared_network"],cls.account.name,
                                             cls.account.domainid,networkofferingid=cls.shared_network_offering.id)
-
-        cls._cleanup = [cls.account,cls.service_offering,cls.shared_network,cls.isolated_network_offering,
-                        cls.shared_network_offering]
+        cls._cleanup.append(cls.shared_network)
+        cls._cleanup.append(cls.shared_network_offering)
         return
 
     def setUp(self):
@@ -602,37 +605,40 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
 
         network = None #The network which we are adding to the vm
 
-        self.child_domain_1 = Domain.create(self.apiclient,
+        try:
+            tempCleanupList = []
+            self.child_domain_1 = Domain.create(self.apiclient,
                                             services=self.services["domain"],
                                             parentdomainid=self.domain.id)
+            tempCleanupList.append(self.child_domain_1)
 
-        self.child_do_admin_1 = Account.create(
+            self.child_do_admin_1 = Account.create(
                                 self.apiclient,
                                 self.services["account"],
                                 admin=True,
                                 domainid=self.child_domain_1.id
                                 )
+            tempCleanupList.append(self.child_do_admin_1)
 
-        self.debug("Creating a domain under: %s" % self.domain.name)
-
-        self.child_domain_2 = Domain.create(self.apiclient,
+            self.child_domain_2 = Domain.create(self.apiclient,
                                               services=self.services["domain"],
                                               parentdomainid=self.domain.id)
+            tempCleanupList.append(self.child_domain_2)
 
-        self.child_do_admin_2 = Account.create(
+            self.child_do_admin_2 = Account.create(
                                     self.apiclient,
                                     self.services["account"],
                                     admin=True,
                                     domainid=self.child_domain_2.id)
+            tempCleanupList.append(self.child_do_admin_2)
+        except Exception as e:
+            tempCleanupList.reverse()
+            self.cleanup += tempCleanupList
+            self.fail(e)
 
         network = Network.create(self.api_client,self.services["isolated_network"],self.child_do_admin_1.name,
                                      self.child_do_admin_1.domainid,networkofferingid=self.isolated_network_offering.id)
 
-        self.cleanup.append(self.child_do_admin_1)
-        self.cleanup.append(self.child_domain_1)
-        self.cleanup.append(self.child_do_admin_2)
-        self.cleanup.append(self.child_domain_2)
-
         virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"],accountid=self.child_do_admin_2.name,
                                                     domainid=self.child_do_admin_2.domainid, serviceofferingid=self.service_offering.id,
                                                     mode=self.zone.networktype)
@@ -663,12 +669,9 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
                                 self.services["account"],
                                 domainid=self.domain.id
                                 )
-        self.debug("create account %s" % account_1.name)
-
         self.cleanup.append(account_1)
 
         self.debug("setting network limit of account: %s as 1" % account_1.name)
-
         update_resource_limit(
                               self.apiclient,
                               6, # Network
@@ -744,22 +747,25 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
         # Create Accounts & networks
         cls.services["isolated_network"]["zoneid"] = cls.zone.id
         cls.services["shared_network"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
 
         cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
+        cls._cleanup.append(cls.account)
 
         cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+        cls._cleanup.append(cls.service_offering)
 
         cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],accountid=cls.account.name,
                                                     domainid=cls.account.domainid,serviceofferingid=cls.service_offering.id,
                                                     mode=cls.zone.networktype)
         # Create Shared Network Offering
         cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"])
+        cls._cleanup.append(cls.isolated_network_offering)
+
         # Enable Isolated Network offering
         cls.isolated_network_offering.update(cls.api_client, state='Enabled')
         cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
                                               cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
-
-        cls._cleanup = [cls.account,cls.service_offering,cls.isolated_network_offering,]
         return
 
     def setUp(self):
@@ -1141,21 +1147,25 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
         cls.services["virtual_machine"]["template"] = template.id
         # Create Accounts & networks
         cls.services["isolated_network"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
         cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
+        cls._cleanup.append(cls.account)
+
         cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+        cls._cleanup.append(cls.service_offering)
 
         cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
                                                     accountid=cls.account.name,domainid=cls.account.domainid,
                                                     serviceofferingid=cls.service_offering.id,mode=cls.zone.networktype)
         # Create Shared Network Offering
         cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"],)
+        cls._cleanup.append(cls.isolated_network_offering)
+
         # Enable Isolated Network offering
         cls.isolated_network_offering.update(cls.api_client, state='Enabled')
 
         cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
                                               cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
-
-        cls._cleanup = [cls.account,cls.service_offering,cls.isolated_network_offering,]
         return
 
     def setUp(self):
@@ -1378,9 +1388,14 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
         # Create Accounts & networks
         cls.services["isolated_network"]["zoneid"] = cls.zone.id
         cls.services["shared_network"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
 
         cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
+        cls.append(cls.account)
+
         cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+        cls._cleanup.append(cls.service_offering)
+
         cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
                                                     accountid=cls.account.name,domainid=cls.account.domainid,
                                                     serviceofferingid=cls.service_offering.id,
@@ -1388,6 +1403,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
 
         # Create Shared Network Offering
         cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"],)
+        cls._cleanup.append(cls.isolated_network_offering)
         # Enable Isolated Network offering
         cls.isolated_network_offering.update(cls.api_client, state='Enabled')
         cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
@@ -1395,8 +1411,6 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
 
         # Add network to VM
         cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id)
-
-        cls._cleanup = [cls.account,cls.service_offering,cls.isolated_network_offering,]
         return
 
     def setUp(self):
@@ -1558,10 +1572,13 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
         # Create Accounts & networks
         cls.services["isolated_network"]["zoneid"] = cls.zone.id
         cls.services["shared_network"]["zoneid"] = cls.zone.id
+        cls._cleanup = []
 
         cls.account = Account.create(cls.api_client, cls.services["account"], domainid = cls.domain.id)
+        cls._cleanup.append(cls.account)
 
         cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
+        cls._cleanup.append(cls.service_offering)
 
         cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
                                                     accountid=cls.account.name,domainid=cls.account.domainid,
@@ -1571,6 +1588,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
 
         # Create Shared Network Offering
         cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"],)
+        cls._cleanup.append(cls.isolated_network_offering)
         # Enable Isolated Network offering
         cls.isolated_network_offering.update(cls.api_client, state='Enabled')
 
@@ -1578,8 +1596,6 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
                                               cls.account.name,cls.account.domainid,
                                               networkofferingid=cls.isolated_network_offering.id)
         cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id)
-        cls._cleanup = [cls.account,cls.service_offering,
-                        cls.isolated_network_offering,]
         return
 
     def setUp(self):
@@ -1713,8 +1729,6 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
 
         self.debug("Creating new account")
         account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id)
-        self.debug("Created account %s" % account.name)
-
         self.cleanup.append(account)
 
         self.debug("Creating virtual machine in the account %s" % account.name)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py
index eb58777..9a53c4c 100644
--- a/test/integration/component/test_affinity_groups.py
+++ b/test/integration/component/test_affinity_groups.py
@@ -113,11 +113,14 @@ class TestCreateAffinityGroup(cloudstackTestCase):
         cls.services["template"] = cls.template.id
         cls.services["zoneid"] = cls.zone.id
 
+        cls._cleanup = []
+
         cls.account = Account.create(
             cls.api_client,
             cls.services["account"],
             domainid=cls.domain.id
         )
+        cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
         cls.services["domainid"] = cls.domain.id
@@ -126,11 +129,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"]
         )
-
-        cls._cleanup = [
-            cls.service_offering,
-            cls.account,
-        ]
+        cls._cleanup.append(cls.service_offering)
         return
 
     def setUp(self):
@@ -221,10 +220,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
 
         self.user = Account.create(self.api_client, self.services["new_account"],
                                   domainid=self.domain.id)
+        self.cleanup.append(self.user)
 
         userapiclient = self.testClient.getUserApiClient(self.user.name, self.domain.name)
-
-        self.cleanup.append(self.user)
         aff_grp = self.create_aff_grp(api_client=userapiclient, aff_grp=self.services["host_anti_affinity"],
                             acc=self.user.name, domainid=self.domain.id)
         aff_grp.delete(userapiclient)
@@ -309,11 +307,14 @@ class TestListAffinityGroups(cloudstackTestCase):
         cls.services["template"] = cls.template.id
         cls.services["zoneid"] = cls.zone.id
 
+        cls._cleanup = []
+
         cls.account = Account.create(
             cls.api_client,
             cls.services["account"],
             domainid=cls.domain.id
         )
+        cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
         cls.services["domainid"] = cls.domain.id
@@ -322,12 +323,7 @@ class TestListAffinityGroups(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"]
         )
-
-        cls.__cleanup = [
-            cls.service_offering,
-            cls.account,
-        ]
-
+        cls._cleanup.append(cls.service_offering)
         # Create multiple Affinity Groups
         return
 
@@ -558,11 +554,14 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
         cls.services["template"] = cls.template.id
         cls.services["zoneid"] = cls.zone.id
 
+        cls._cleanup = []
+
         cls.account = Account.create(
             cls.api_client,
             cls.services["account"],
             domainid=cls.domain.id
         )
+        cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
         cls.services["domainid"] = cls.domain.id
@@ -571,12 +570,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"]
         )
-
-        cls.__cleanup = [
-            cls.service_offering,
-            cls.account,
-        ]
-
+        cls._cleanup.append(cls.service_offering)
         # Create multiple Affinity Groups
         return
 
@@ -831,11 +825,14 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
         cls.services["template"] = cls.template.id
         cls.services["zoneid"] = cls.zone.id
 
+        cls._cleanup = []
+
         cls.account = Account.create(
             cls.api_client,
             cls.services["account"],
             domainid=cls.domain.id
         )
+        cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
         cls.services["domainid"] = cls.domain.id
@@ -844,12 +841,7 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"]
         )
-
-        cls.__cleanup = [
-            cls.service_offering,
-            cls.account,
-        ]
-
+        cls._cleanup.append(cls.service_offering)
         # Create multiple Affinity Groups
         return
 
@@ -1118,11 +1110,14 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
         cls.services["template"] = cls.template.id
         cls.services["zoneid"] = cls.zone.id
 
+        cls._cleanup = []
+
         cls.account = Account.create(
             cls.api_client,
             cls.services["account"],
             domainid=cls.domain.id
         )
+        cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
         cls.services["domainid"] = cls.domain.id
@@ -1131,13 +1126,7 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"]
         )
-
-        cls.__cleanup = [
-            cls.service_offering,
-            cls.account,
-        ]
-
-        # Create multiple Affinity Groups
+        cls._cleanup.append(cls.service_offering)
         return
 
     def setUp(self):
@@ -1468,11 +1457,14 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
         cls.services["template"] = cls.template.id
         cls.services["zoneid"] = cls.zone.id
 
+        cls._cleanup = []
+
         cls.account = Account.create(
             cls.api_client,
             cls.services["account"],
             domainid=cls.domain.id
         )
+        cls._cleanup.append(cls.account)
 
         cls.services["account"] = cls.account.name
         cls.services["domainid"] = cls.domain.id
@@ -1481,13 +1473,7 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
             cls.api_client,
             cls.services["service_offering"]
         )
-
-        cls.__cleanup = [
-            cls.service_offering,
-            cls.account,
-        ]
-
-        # Create multiple Affinity Groups
+        cls._cleanup.append(cls.service_offering)
         return
 
     def setUp(self):

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py b/test/integration/component/test_portable_ip.py
index 538318d..b9c9059 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -235,6 +235,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
                             self.services["account"],
                             domainid=self.domain.id
                             )
+            self.cleanup.append(self.account)
 
             self.api_client_user = self.testClient.getUserApiClient(
                                             UserName=self.account.name,
@@ -597,6 +598,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
                             domainid=cls.domain.id,
                             admin=True
                             )
+        cls._cleanup = [cls.account, ]
 
         cls.network_offering = NetworkOffering.create(
                                             cls.api_client,
@@ -615,8 +617,6 @@ class TestAssociatePublicIp(cloudstackTestCase):
                                     networkofferingid=cls.network_offering.id,
                                     zoneid=cls.zone.id
                                     )
-
-        cls._cleanup = [cls.account]
         return
 
     @classmethod
@@ -907,6 +907,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
         # Set Zones and disk offerings
         cls.services["small"]["zoneid"] = cls.zone.id
         cls.services["small"]["template"] = template.id
+        cls._cleanup = []
 
         cls.account = Account.create(
                             cls.api_client,
@@ -914,11 +915,13 @@ class TestDisassociatePublicIp(cloudstackTestCase):
                             domainid=cls.domain.id,
                             admin=True
                             )
+        cls._cleanup.append(cls.account)
 
         cls.service_offering = ServiceOffering.create(
             cls.api_client,
             cls.services["service_offering"]
         )
+        cls._cleanup.append(cls.service_offering)
 
         cls.network_offering = NetworkOffering.create(
                                             cls.api_client,
@@ -928,6 +931,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
 
         # Enable Network offering
         cls.network_offering.update(cls.api_client, state='Enabled')
+        cls._cleanup.append(cls.network_offering)
 
         cls.network = Network.create(
                                     cls.api_client,
@@ -947,12 +951,6 @@ class TestDisassociatePublicIp(cloudstackTestCase):
                                                     networkids = [cls.network.id],
                                                     mode=cls.services['mode']
                                                     )
-
-        cls._cleanup = [
-                        cls.account,
-                        cls.service_offering,
-                        cls.network_offering
-                       ]
         return
 
     @classmethod
@@ -1177,6 +1175,7 @@ class TestDeleteAccount(cloudstackTestCase):
                             domainid=self.domain.id,
                             admin=True
                             )
+            self.cleanup.append(self.account)
             portable_ip_range_services["regionid"] = self.region.id
             #create new portable ip range
             new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
@@ -1200,7 +1199,6 @@ class TestDeleteAccount(cloudstackTestCase):
                                     )
             self.cleanup.append(self.network_offering)
         except Exception as e:
-            self.cleanup.append(self.account)
             self.fail("Exception in setupClass: %s" % e)
         return
 
@@ -1353,6 +1351,8 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
         cls.services["vm2"]["zoneid"] = cls.zone.id
         cls.services["vm2"]["template"] = template.id
 
+        cls._cleanup = []
+
         # Set Zones and Network offerings
         cls.account = Account.create(
                             cls.api_client,
@@ -1360,12 +1360,14 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
                             domainid=cls.domain.id,
                             admin=True
                             )
+        cls._cleanup.append(cls.account)
 
         cls.network_offering = NetworkOffering.create(
                                             cls.api_client,
                                             cls.services["network_offering"],
                                             conservemode=False
                                             )
+        cls._cleanup.append(cls.network_offering)
 
         # Enable Network offering
         cls.network_offering.update(cls.api_client, state='Enabled')
@@ -1407,8 +1409,6 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
                                             serviceofferingid=cls.service_offering.id,
                                             networkids = [cls.network2.id],
                                             )
-        cls._cleanup = [cls.account, cls.network_offering]
-
         return
 
     @classmethod

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b44f66e1/test/integration/component/test_vpc_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index a449948..c5d9da6 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -294,8 +294,7 @@ class TestVPCNetwork(cloudstackTestCase):
                                      admin=True,
                                      domainid=self.domain.id
                                      )
-        self.cleanup = []
-        self.cleanup.insert(0, self.account)
+        self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
@@ -1056,8 +1055,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
                                      admin=True,
                                      domainid=self.domain.id
                                      )
-        self.cleanup = []
-        self.cleanup.insert(0, self.account)
+        self.cleanup = [self.account, ]
         return
 
     def tearDown(self):
@@ -1516,6 +1514,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
                                      admin=True,
                                      domainid=self.domain.id
                                 )
+        self.cleanup.append(account)
 
         # Creating network using the network offering created
         self.debug("Creating network from diff account than VPC")
@@ -1584,8 +1583,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
                                      admin=True,
                                      domainid=self.domain.id
                                      )
-        self.cleanup = []
-        self.cleanup.insert(0, self.account)
+        self.cleanup = [self.account, ]
         return
 
     def tearDown(self):


[50/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7148: Adding missing list method

(cherry picked from commit dd138ceec5faa5d5b0fcdfe5cc655199b8f9187b)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/58987452
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/58987452
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/58987452

Branch: refs/heads/4.4
Commit: 58987452994f1abc621a2f8f7fcdd24b443cf0e9
Parents: 1ca9abd
Author: Ashutosh K <as...@clogeny.com>
Authored: Tue Jul 22 05:05:47 2014 -0400
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:58 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_redundant_router_cleanups.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/58987452/test/integration/component/test_redundant_router_cleanups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_redundant_router_cleanups.py b/test/integration/component/test_redundant_router_cleanups.py
index 444fa3a..47e60c8 100644
--- a/test/integration/component/test_redundant_router_cleanups.py
+++ b/test/integration/component/test_redundant_router_cleanups.py
@@ -592,7 +592,7 @@ class TestRedundantRouterNetworkCleanups(cloudstackTestCase):
             self.fail("Failed to stop guest Vm: %s - %s" %
                                             (virtual_machine.name, e))
 
-        interval = Configurations(
+        interval = Configurations.list(
                                     self.apiclient,
                                     name='network.gc.interval'
                                     )


[07/50] [abbrv] CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
new file mode 100644
index 0000000..2367253
--- /dev/null
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -0,0 +1,647 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (createVolume,
+                                  createTemplate)
+from marvin.lib.base import (Volume,
+                             Iso,
+                             VirtualMachine,
+                             Template,
+                             Snapshot,
+                             SecurityGroup,
+                             Account,
+                             Zone,
+                             Network,
+                             NetworkOffering,
+                             DiskOffering,
+                             ServiceOffering,
+                             VmSnapshot,
+                             SnapshotPolicy,
+                             SSHKeyPair,
+                             Resources,
+                             Configurations,
+                             VpnCustomerGateway,
+                             Hypervisor,
+                             VpcOffering,
+                             VPC,
+                             NetworkACL)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_os_types)
+from marvin.lib.utils import (validateList,
+                              cleanup_resources,
+                              random_gen)
+from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+from nose.plugins.attrib import attr
+import time
+
+class TestSnapshots(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestSnapshots, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            if cls.zone.localstorageenabled:
+                cls.storagetype = 'local'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.services["disk_offering"]["storagetype"] = 'local'
+            else:
+                cls.storagetype = 'shared'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.services["disk_offering"]["storagetype"] = 'shared'
+
+            cls.services['mode'] = cls.zone.networktype
+            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+            cls.services["virtual_machine"]["template"] = cls.template.id
+            cls.services["custom_volume"]["zoneid"] = cls.zone.id
+            # Creating Disk offering, Service Offering and Account
+            cls.disk_offering = DiskOffering.create(
+                                        cls.api_client,
+                                        cls.services["disk_offering"]
+                                        )
+            cls._cleanup.append(cls.disk_offering)
+            cls.service_offering = ServiceOffering.create(
+                                                cls.api_client,
+                                                cls.services["service_offerings"]["tiny"]
+                                                )
+            cls._cleanup.append(cls.service_offering)
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+            # Creating Virtual Machine
+            cls.virtual_machine = VirtualMachine.create(
+                                        cls.userapiclient,
+                                        cls.services["virtual_machine"],
+                                        accountid=cls.account.name,
+                                        domainid=cls.account.domainid,
+                                        serviceofferingid=cls.service_offering.id,
+                                    )
+            cls._cleanup.append(cls.virtual_machine)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created resources
+        cleanup_resources(self.apiClient, self.cleanup)
+        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)
+
+        return
+
+    def __verify_values(self, expected_vals, actual_vals):
+        """
+        @Desc: Function to verify expected and actual values
+        @Steps:
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_01_list_volume_snapshots_pagination(self):
+        """
+        @Desc: Test to List Volume Snapshots pagination
+        @steps:
+        Step1: Listing all the volume snapshots for a user
+        Step2: Verifying that list size is 0
+        Step3: Creating (page size + 1) number of volume snapshots
+        Step4: Listing all the volume snapshots again for a user
+        Step5: Verifying that list size is (page size + 1)
+        Step6: Listing all the volume snapshots in page1
+        Step7: Verifying that list size is (page size)
+        Step8: Listing all the volume snapshots in page2
+        Step9: Verifying that list size is 1
+        Step10: Deleting the volume snapshot present in page 2
+        Step11: Listing all the volume snapshots in page2
+        Step12: Verifying that list size is 0
+        """
+        # Listing all the volume snapshots for a User
+        list_vol_snaps_before = Snapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"]
+                                              )
+        # Verifying list size is 0
+        self.assertIsNone(
+                          list_vol_snaps_before,
+                          "Volume snapshots exists for newly created user"
+                          )
+        # Listing the root volumes available for the user
+        volumes_list = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"]
+                                   )
+        status = validateList(volumes_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Root volume did not get created while deploying a VM"
+                          )
+        # Verifying list size to be 1
+        self.assertEquals(
+                          1,
+                          len(volumes_list),
+                          "More than 1 root volume created for deployed VM"
+                          )
+        root_volume = volumes_list[0]
+        # Creating pagesize + 1 number of volume snapshots
+        for i in range(0, (self.services["pagesize"] + 1)):
+            snapshot_created = Snapshot.create(
+                                               self.userapiclient,
+                                               root_volume.id,
+                                               )
+            self.assertIsNotNone(
+                                 snapshot_created,
+                                 "Snapshot creation failed"
+                                 )
+            self.cleanup.append(snapshot_created)
+
+        # Listing all the volume snapshots for user again
+        list_vol_snaps_after = Snapshot.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"]
+                                             )
+        status = validateList(list_vol_snaps_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Volume snapshot creation failed"
+                          )
+        # Verifying that list size is pagesize + 1
+        self.assertEquals(
+                          self.services["pagesize"] + 1,
+                          len(list_vol_snaps_after),
+                          "Failed to create pagesize + 1 number of Volume snapshots"
+                          )
+        # Listing all the volume snapshots in page 1
+        list_vol_snaps_page1 = Snapshot.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        status = validateList(list_vol_snaps_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list volume snapshots in page 1"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_vol_snaps_page1),
+                          "Size of volume snapshots in page 1 is not matching"
+                          )
+        # Listing all the volume snapshots in page 2
+        list_vol_snaps_page2 = Snapshot.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=2,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        status = validateList(list_vol_snaps_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list volume snapshots in page 2"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          1,
+                          len(list_vol_snaps_page2),
+                          "Size of volume snapshots in page 2 is not matching"
+                          )
+        # Deleting the volume snapshot present in page 2
+        Snapshot.delete(
+                        snapshot_created,
+                        self.userapiclient
+                        )
+        # Listing all the snapshots in page 2 again
+        list_vol_snaps_page2 = Snapshot.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             page=2,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        # Verifying that list size is 0
+        self.assertIsNone(
+                          list_vol_snaps_page2,
+                          "Volume snapshot not deleted from page 2"
+                          )
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_02_list_volume_snapshots_byid(self):
+        """
+        @Desc: Test to List Volume Snapshots by Id
+        @Steps:
+        Step1: Listing all the volume snapshots for a user
+        Step2: Verifying that list size is 0
+        Step3: Creating a volume snapshot
+        Step4: Listing all the volume snapshots again for a user
+        Step5: Verifying that list size is 1
+        Step6: Listing all the volume snapshots by specifying snapshot id
+        Step7: Verifying that list size is 1
+        Step8: Verifying details of the listed volume snapshot
+        """
+        # Listing all the volume snapshots for a User
+        list_vol_snaps_before = Snapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"]
+                                              )
+        # Verifying list size is 0
+        self.assertIsNone(
+                          list_vol_snaps_before,
+                          "Volume snapshots exists for newly created user"
+                          )
+        # Listing the root volumes available for the user
+        volumes_list = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"]
+                                   )
+        status = validateList(volumes_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Root volume did not get created while deploying a VM"
+                          )
+        # Verifying list size to be 1
+        self.assertEquals(
+                          1,
+                          len(volumes_list),
+                          "More than 1 root volume created for deployed VM"
+                          )
+        root_volume = volumes_list[0]
+        # Creating a volume snapshot
+        snapshot_created = Snapshot.create(
+                                           self.userapiclient,
+                                           root_volume.id,
+                                           )
+        self.assertIsNotNone(
+                             snapshot_created,
+                             "Snapshot creation failed"
+                             )
+        self.cleanup.append(snapshot_created)
+        # Listing all the volume snapshots for user again
+        list_vol_snaps_after = Snapshot.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"]
+                                             )
+        status = validateList(list_vol_snaps_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Volume snapshot creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_vol_snaps_after),
+                          "Failed to create Volume snapshot"
+                          )
+        # Listing volume snapshot by id
+        list_vol_snapshot = Snapshot.list(
+                                          self.userapiclient,
+                                          listall=self.services["listall"],
+                                          id=snapshot_created.id
+                                          )
+        status = validateList(list_vol_snapshot)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list Volume snapshot by Id"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_vol_snapshot),
+                          "Size of the list volume snapshot by Id is not matching"
+                          )
+        # Verifying details of the listed snapshot to be same as snapshot created above
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":snapshot_created.id,
+                         "name":snapshot_created.name,
+                         "state":snapshot_created.state,
+                         "intervaltype":snapshot_created.intervaltype,
+                         "account":snapshot_created.account,
+                         "domain":snapshot_created.domainid,
+                         "volume":snapshot_created.volumeid
+                         }
+        actual_dict = {
+                       "id":list_vol_snapshot[0].id,
+                       "name":list_vol_snapshot[0].name,
+                       "state":list_vol_snapshot[0].state,
+                       "intervaltype":list_vol_snapshot[0].intervaltype,
+                       "account":list_vol_snapshot[0].account,
+                       "domain":list_vol_snapshot[0].domainid,
+                       "volume":list_vol_snapshot[0].volumeid
+                       }
+        vol_snapshot_status = self.__verify_values(
+                                                   expected_dict,
+                                                   actual_dict
+                                                   )
+        self.assertEqual(
+                         True,
+                         vol_snapshot_status,
+                         "Listed Volume Snapshot details are not as expected"
+                         )
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_03_list_vm_snapshots_pagination(self):
+        """
+        @Desc: Test to List VM Snapshots pagination
+        @Steps:
+        Step1: Listing all the VM snapshots for a user
+        Step2: Verifying that list size is 0
+        Step3: Creating (page size + 1) number of VM snapshots
+        Step4: Listing all the VM snapshots again for a user
+        Step5: Verifying that list size is (page size + 1)
+        Step6: Listing all the VM snapshots in page1
+        Step7: Verifying that list size is (page size)
+        Step8: Listing all the VM snapshots in page2
+        Step9: Verifying that list size is 1
+        Step10: Deleting the VM snapshot present in page 2
+        Step11: Listing all the volume snapshots in page2
+        Step12: Verifying that list size is 0
+        """
+        # Listing all the VM snapshots for a User
+        list_vm_snaps_before = VmSnapshot.list(
+                                               self.userapiclient,
+                                               listall=self.services["listall"]
+                                               )
+        # Verifying list size is 0
+        self.assertIsNone(
+                          list_vm_snaps_before,
+                          "VM snapshots exists for newly created user"
+                          )
+        # Creating pagesize + 1 number of VM snapshots
+        for i in range(0, (self.services["pagesize"] + 1)):
+            snapshot_created = VmSnapshot.create(
+                                                 self.userapiclient,
+                                                 self.virtual_machine.id,
+                                                 )
+            self.assertIsNotNone(
+                                 snapshot_created,
+                                 "Snapshot creation failed"
+                                 )
+
+        # Listing all the VM snapshots for user again
+        list_vm_snaps_after = VmSnapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"]
+                                              )
+        status = validateList(list_vm_snaps_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM snapshot creation failed"
+                          )
+        # Verifying that list size is pagesize + 1
+        self.assertEquals(
+                          self.services["pagesize"] + 1,
+                          len(list_vm_snaps_after),
+                          "Failed to create pagesize + 1 number of VM snapshots"
+                          )
+        # Listing all the VM snapshots in page 1
+        list_vm_snaps_page1 = VmSnapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=1,
+                                              pagesize=self.services["pagesize"]
+                                              )
+        status = validateList(list_vm_snaps_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list vm snapshots in page 1"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_vm_snaps_page1),
+                          "Size of vm snapshots in page 1 is not matching"
+                          )
+        # Listing all the vm snapshots in page 2
+        list_vm_snaps_page2 = VmSnapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=2,
+                                              pagesize=self.services["pagesize"]
+                                              )
+        status = validateList(list_vm_snaps_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list vm snapshots in page 2"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          1,
+                          len(list_vm_snaps_page2),
+                          "Size of vm snapshots in page 2 is not matching"
+                          )
+        # Deleting the vm snapshot present in page 2
+        VmSnapshot.deleteVMSnapshot(
+                                    self.userapiclient,
+                                    snapshot_created.id
+                                    )
+        # Listing all the snapshots in page 2 again
+        list_vm_snaps_page2 = VmSnapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              page=2,
+                                              pagesize=self.services["pagesize"]
+                                              )
+        # Verifying that list size is 0
+        self.assertIsNone(
+                          list_vm_snaps_page2,
+                          "VM snapshot not deleted from page 2"
+                          )
+        # Deleting all the existing VM snapshots
+        list_vm_snaps =  VmSnapshot.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         )
+        status = validateList(list_vm_snaps)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "All VM snapshots deleted"
+                          )
+        # Verifying that list size is equal to page size
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_vm_snaps),
+                          "VM Snapshots count is not matching"
+                          )
+        # Deleting all the existing VM snapshots
+        for i in range(0, len(list_vm_snaps)):
+            VmSnapshot.deleteVMSnapshot(
+                                    self.userapiclient,
+                                    list_vm_snaps[i].id
+                                    )
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_04_list_vm_snapshots_byid(self):
+        """
+        @summary: Test to List VM Snapshots by Id
+
+        Step1: Listing all the VM snapshots for a user
+        Step2: Verifying that list size is 0
+        Step3: Creating a VM snapshot
+        Step4: Listing all the VM snapshots again for a user
+        Step5: Verifying that list size is 1
+        Step6: Listing all the VM snapshots by specifying snapshot id
+        Step7: Verifying that list size is 1
+        Step8: Verifying details of the listed VM snapshot
+        """
+        # Listing all the VM snapshots for a User
+        list_vm_snaps_before = VmSnapshot.list(
+                                               self.userapiclient,
+                                               listall=self.services["listall"]
+                                               )
+        # Verifying list size is 0
+        self.assertIsNone(
+                          list_vm_snaps_before,
+                          "VM snapshots exists for newly created user"
+                          )
+        # Creating a VM snapshot
+        snapshot_created = VmSnapshot.create(
+                                             self.userapiclient,
+                                             self.virtual_machine.id,
+                                             )
+        self.assertIsNotNone(
+                             snapshot_created,
+                             "Snapshot creation failed"
+                             )
+        # Listing all the VM snapshots for user again
+        list_vm_snaps_after = VmSnapshot.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"]
+                                              )
+        status = validateList(list_vm_snaps_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "VM snapshot creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_vm_snaps_after),
+                          "Failed to create VM snapshot"
+                          )
+        # Listing vm snapshot by id
+        list_vm_snapshot = VmSnapshot.list(
+                                           self.userapiclient,
+                                           listall=self.services["listall"],
+                                           vmsnapshotid=snapshot_created.id
+                                          )
+        status = validateList(list_vm_snapshot)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list VM snapshot by Id"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_vm_snapshot),
+                          "Size of the list vm snapshot by Id is not matching"
+                          )
+        # Verifying details of the listed snapshot to be same as snapshot created above
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "id":snapshot_created.id,
+                         "name":snapshot_created.name,
+                         "state":snapshot_created.state,
+                         "vmid":snapshot_created.virtualmachineid,
+                         }
+        actual_dict = {
+                       "id":list_vm_snapshot[0].id,
+                       "name":list_vm_snapshot[0].name,
+                       "state":list_vm_snapshot[0].state,
+                       "vmid":list_vm_snapshot[0].virtualmachineid,
+                       }
+        vm_snapshot_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         vm_snapshot_status,
+                         "Listed VM Snapshot details are not as expected"
+                         )
+        return
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
new file mode 100644
index 0000000..083ba90
--- /dev/null
+++ b/test/integration/component/test_escalations_templates.py
@@ -0,0 +1,944 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackAPI import (createVolume,
+                                  createTemplate)
+from marvin.lib.base import (Volume,
+                             Iso,
+                             VirtualMachine,
+                             Template,
+                             Snapshot,
+                             SecurityGroup,
+                             Account,
+                             Zone,
+                             Network,
+                             NetworkOffering,
+                             DiskOffering,
+                             ServiceOffering,
+                             VmSnapshot,
+                             SnapshotPolicy,
+                             SSHKeyPair,
+                             Resources,
+                             Configurations,
+                             VpnCustomerGateway,
+                             Hypervisor,
+                             VpcOffering,
+                             VPC,
+                             NetworkACL)
+from marvin.lib.common import (get_zone,
+                               get_domain,
+                               get_template,
+                               list_os_types)
+from marvin.lib.utils import (validateList,
+                              cleanup_resources,
+                              random_gen)
+from marvin.codes import (PASS, FAIL, EMPTY_LIST)
+from nose.plugins.attrib import attr
+import time
+
+class TestTemplates(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestTemplates, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            cls.hypervisor = cls.testClient.getHypervisorInfo()
+            cls.services['mode'] = cls.zone.networktype
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created resources
+        cleanup_resources(self.apiClient, self.cleanup)
+        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)
+
+        return
+
+    def __verify_values(self, expected_vals, actual_vals):
+        """
+        @Desc: Function to verify expected and actual values
+        @Steps:
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_01_list_templates_pagination(self):
+        """
+        @Desc: Test to List Templates pagination
+        @steps:
+        Step1: Listing all the Templates for a user
+        Step2: Verifying that no Templates are listed
+        Step3: Creating (page size + 1) number of Templates
+        Step4: Listing all the Templates again for a user
+        Step5: Verifying that list size is (page size + 1)
+        Step6: Listing all the Templates in page1
+        Step7: Verifying that list size is (page size)
+        Step8: Listing all the Templates in page2
+        Step9: Verifying that list size is 1
+        Step10: Listing the template by Id
+        Step11: Verifying if the template is downloaded and ready.
+                If yes the continuing
+                If not waiting and checking for template to be ready till timeout
+        Step12: Deleting the Template present in page 2
+        Step13: Listing all the Templates in page2
+        Step14: Verifying that no Templates are listed
+        """
+        # Listing all the Templates for a User
+        list_templates_before = Template.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              templatefilter=self.services["templatefilter"]
+                                              )
+        # Verifying that no Templates are listed
+        self.assertIsNone(
+                          list_templates_before,
+                          "Templates listed for newly created User"
+                          )
+        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
+        self.services["template"]["format"] = "VHD"
+        self.services["template"]["ostype"] = self.services["ostype"]
+        # Creating pagesize + 1 number of Templates
+        for i in range(0, (self.services["pagesize"] + 1)):
+            template_created = Template.register(
+                                                 self.userapiclient,
+                                                 self.services["template"],
+                                                 self.zone.id,
+                                                 hypervisor=self.hypervisor
+                                                 )
+            self.assertIsNotNone(
+                                 template_created,
+                                 "Template creation failed"
+                                 )
+            if(i < self.services["pagesize"]):
+                self.cleanup.append(template_created)
+
+        # Listing all the Templates for a User
+        list_templates_after = Template.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             templatefilter=self.services["templatefilter"]
+                                             )
+        status = validateList(list_templates_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Templates creation failed"
+                          )
+        # Verifying that list size is pagesize + 1
+        self.assertEquals(
+                          self.services["pagesize"] + 1,
+                          len(list_templates_after),
+                          "Failed to create pagesize + 1 number of Templates"
+                          )
+        # Listing all the Templates in page 1
+        list_templates_page1 = Template.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             templatefilter=self.services["templatefilter"],
+                                             page=1,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        status = validateList(list_templates_page1)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list Templates in page 1"
+                          )
+        # Verifying the list size to be equal to pagesize
+        self.assertEquals(
+                          self.services["pagesize"],
+                          len(list_templates_page1),
+                          "Size of Templates in page 1 is not matching"
+                          )
+        # Listing all the Templates in page 2
+        list_templates_page2 = Template.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             templatefilter=self.services["templatefilter"],
+                                             page=2,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        status = validateList(list_templates_page2)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list Templates in page 2"
+                          )
+        # Verifying the list size to be equal to 1
+        self.assertEquals(
+                          1,
+                          len(list_templates_page2),
+                          "Size of Templates in page 2 is not matching"
+                          )
+        # Verifying the state of the template to be ready. If not waiting for state to become ready
+        template_ready = False
+        count = 0
+        while template_ready is False:
+            list_template = Template.list(
+                                          self.userapiclient,
+                                          id=template_created.id,
+                                          listall=self.services["listall"],
+                                          templatefilter=self.services["templatefilter"],
+                                          )
+            status = validateList(list_template)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Templates by Id"
+                              )
+            if list_template[0].isready is True:
+                template_ready = True
+            elif (str(list_template[0].status) == "Error"):
+                self.fail("Created Template is in Errored state")
+                break
+            elif count > 10:
+                self.fail("Timed out before Template came into ready state")
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                count = count + 1
+
+        # Deleting the Template present in page 2
+        Template.delete(
+                        template_created,
+                        self.userapiclient
+                        )
+        # Listing all the Templates in page 2 again
+        list_templates_page2 = Template.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             templatefilter=self.services["templatefilter"],
+                                             page=2,
+                                             pagesize=self.services["pagesize"]
+                                             )
+        # Verifying that there are no Templates listed
+        self.assertIsNone(
+                          list_templates_page2,
+                          "Templates not deleted from page 2"
+                          )
+        del self.services["template"]["url"]
+        del self.services["template"]["format"]
+        del self.services["template"]["ostype"]
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_02_download_template(self):
+        """
+        @Desc: Test to Download Template
+        @steps:
+        Step1: Listing all the Templates for a user
+        Step2: Verifying that no Templates are listed
+        Step3: Creating a Templates
+        Step4: Listing all the Templates again for a user
+        Step5: Verifying that list size is 1
+        Step6: Verifying if the template is in ready state.
+                If yes the continuing
+                If not waiting and checking for template to be ready till timeout
+        Step7: Downloading the template (Extract)
+        Step8: Verifying that Template is downloaded
+        """
+        # Listing all the Templates for a User
+        list_templates_before = Template.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              templatefilter=self.services["templatefilter"]
+                                              )
+        # Verifying that no Templates are listed
+        self.assertIsNone(
+                          list_templates_before,
+                          "Templates listed for newly created User"
+                          )
+        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
+        self.services["template"]["format"] = "VHD"
+        self.services["template"]["ostype"] = self.services["ostype"]
+        self.services["template"]["isextractable"] = True
+        # Creating aTemplate
+        template_created = Template.register(
+                                             self.userapiclient,
+                                             self.services["template"],
+                                             self.zone.id,
+                                             hypervisor=self.hypervisor
+                                             )
+        self.assertIsNotNone(
+                             template_created,
+                             "Template creation failed"
+                             )
+        self.cleanup.append(template_created)
+        # Listing all the Templates for a User
+        list_templates_after = Template.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             templatefilter=self.services["templatefilter"]
+                                             )
+        status = validateList(list_templates_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Templates creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_templates_after),
+                          "Failed to create a Template"
+                          )
+        # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+        template_ready = False
+        count = 0
+        while template_ready is False:
+            list_template = Template.list(
+                                          self.userapiclient,
+                                          id=template_created.id,
+                                          listall=self.services["listall"],
+                                          templatefilter=self.services["templatefilter"],
+                                          )
+            status = validateList(list_template)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Templates by Id"
+                              )
+            if list_template[0].isready is True:
+                template_ready = True
+            elif (str(list_template[0].status) == "Error"):
+                self.fail("Created Template is in Errored state")
+                break
+            elif count > 10:
+                self.fail("Timed out before Template came into ready state")
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                count = count + 1
+
+        # Downloading the Template name
+        download_template = Template.extract(
+                                             self.userapiclient,
+                                             template_created.id,
+                                             mode="HTTP_DOWNLOAD",
+                                             zoneid=self.zone.id
+                                             )
+        self.assertIsNotNone(
+                             download_template,
+                             "Download Template failed"
+                             )
+         # Verifying the details of downloaded template
+        self.assertEquals(
+                          "DOWNLOAD_URL_CREATED",
+                          download_template.state,
+                          "Download URL not created for Template"
+                          )
+        self.assertIsNotNone(
+                             download_template.url,
+                             "Download URL not created for Template"
+                             )
+        self.assertEquals(
+                          template_created.id,
+                          download_template.id,
+                          "Download Template details are not same as Template created"
+                          )
+        del self.services["template"]["url"]
+        del self.services["template"]["format"]
+        del self.services["template"]["ostype"]
+        del self.services["template"]["isextractable"]
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_03_edit_template_details(self):
+        """
+        @Desc: Test to Edit Template name, displaytext, OSType
+        @steps:
+        Step1: Listing all the Templates for a user
+        Step2: Verifying that no Templates are listed
+        Step3: Creating a Templates
+        Step4: Listing all the Templates again for a user
+        Step5: Verifying that list size is 1
+        Step6: Verifying if the template is in ready state.
+                If yes the continuing
+                If not waiting and checking for template to be ready till timeout
+        Step7: Editing the template name
+        Step8: Verifying that Template name is edited
+        Step9: Editing the template displaytext
+        Step10: Verifying that Template displaytext is edited
+        Step11: Editing the template ostypeid
+        Step12: Verifying that Template ostypeid is edited
+        Step13: Editing the template name, displaytext
+        Step14: Verifying that Template name, displaytext are edited
+        Step15: Editing the template name, displaytext, ostypeid
+        Step16: Verifying that Template name, displaytext and ostypeid are edited
+        """
+        # Listing all the Templates for a User
+        list_templates_before = Template.list(
+                                              self.userapiclient,
+                                              listall=self.services["listall"],
+                                              templatefilter=self.services["templatefilter"]
+                                              )
+        # Verifying that no Templates are listed
+        self.assertIsNone(
+                          list_templates_before,
+                          "Templates listed for newly created User"
+                          )
+        self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
+        self.services["template"]["format"] = "VHD"
+        self.services["template"]["ostype"] = self.services["ostype"]
+        # Creating aTemplate
+        template_created = Template.register(
+                                             self.userapiclient,
+                                             self.services["template"],
+                                             self.zone.id,
+                                             hypervisor=self.hypervisor
+                                             )
+        self.assertIsNotNone(
+                             template_created,
+                             "Template creation failed"
+                             )
+        self.cleanup.append(template_created)
+        # Listing all the Templates for a User
+        list_templates_after = Template.list(
+                                             self.userapiclient,
+                                             listall=self.services["listall"],
+                                             templatefilter=self.services["templatefilter"]
+                                             )
+        status = validateList(list_templates_after)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Templates creation failed"
+                          )
+        # Verifying that list size is 1
+        self.assertEquals(
+                          1,
+                          len(list_templates_after),
+                          "Failed to create a Template"
+                          )
+        # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+        template_ready = False
+        count = 0
+        while template_ready is False:
+            list_template = Template.list(
+                                          self.userapiclient,
+                                          id=template_created.id,
+                                          listall=self.services["listall"],
+                                          templatefilter=self.services["templatefilter"],
+                                          )
+            status = validateList(list_template)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Templates by Id"
+                              )
+            if list_template[0].isready is True:
+                template_ready = True
+            elif (str(list_template[0].status) == "Error"):
+                self.fail("Created Template is in Errored state")
+                break
+            elif count > 10:
+                self.fail("Timed out before Template came into ready state")
+                break
+            else:
+                time.sleep(self.services["sleep"])
+                count = count + 1
+
+        # Editing the Template name
+        edited_template = Template.update(
+                                          template_created,
+                                          self.userapiclient,
+                                          name="NewTemplateName"
+                                          )
+        self.assertIsNotNone(
+                             edited_template,
+                             "Editing Template failed"
+                             )
+         # Verifying the details of edited template
+        expected_dict = {
+                         "id":template_created.id,
+                         "name":"NewTemplateName",
+                         "displaytest":template_created.displaytext,
+                         "account":template_created.account,
+                         "domainid":template_created.domainid,
+                         "format":template_created.format,
+                         "ostypeid":template_created.ostypeid,
+                         "templatetype":template_created.templatetype,
+                         }
+        actual_dict = {
+                       "id":edited_template.id,
+                       "name":edited_template.name,
+                       "displaytest":edited_template.displaytext,
+                       "account":edited_template.account,
+                       "domainid":edited_template.domainid,
+                       "format":edited_template.format,
+                       "ostypeid":edited_template.ostypeid,
+                       "templatetype":edited_template.templatetype,
+                       }
+        edit_template_status = self.__verify_values(
+                                                    expected_dict,
+                                                    actual_dict
+                                                    )
+        self.assertEqual(
+                         True,
+                         edit_template_status,
+                         "Edited Template details are not as expected"
+                         )
+        # Editing the Template displaytext
+        edited_template = Template.update(
+                                          template_created,
+                                          self.userapiclient,
+                                          displaytext="TemplateDisplaytext"
+                                          )
+        self.assertIsNotNone(
+                             edited_template,
+                             "Editing Template failed"
+                             )
+         # Verifying the details of edited template
+        expected_dict = {
+                         "id":template_created.id,
+                         "name":"NewTemplateName",
+                         "displaytest":"TemplateDisplaytext",
+                         "account":template_created.account,
+                         "domainid":template_created.domainid,
+                         "format":template_created.format,
+                         "ostypeid":template_created.ostypeid,
+                         "templatetype":template_created.templatetype,
+                         }
+        actual_dict = {
+                       "id":edited_template.id,
+                       "name":edited_template.name,
+                       "displaytest":edited_template.displaytext,
+                       "account":edited_template.account,
+                       "domainid":edited_template.domainid,
+                       "format":edited_template.format,
+                       "ostypeid":edited_template.ostypeid,
+                       "templatetype":edited_template.templatetype,
+                       }
+        edit_template_status = self.__verify_values(
+                                                    expected_dict,
+                                                    actual_dict
+                                                    )
+        self.assertEqual(
+                         True,
+                         edit_template_status,
+                         "Edited Template details are not as expected"
+                         )
+        # Editing the Template ostypeid
+        ostype_list = list_os_types(self.userapiclient)
+        status = validateList(ostype_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list OS Types"
+                          )
+        for i in range(0, len(ostype_list)):
+            if ostype_list[i].id != template_created.ostypeid:
+                newostypeid = ostype_list[i].id
+                break
+
+        edited_template = Template.update(
+                                          template_created,
+                                          self.userapiclient,
+                                          ostypeid=newostypeid
+                                          )
+        self.assertIsNotNone(
+                             edited_template,
+                             "Editing Template failed"
+                             )
+         # Verifying the details of edited template
+        expected_dict = {
+                         "id":template_created.id,
+                         "name":"NewTemplateName",
+                         "displaytest":"TemplateDisplaytext",
+                         "account":template_created.account,
+                         "domainid":template_created.domainid,
+                         "format":template_created.format,
+                         "ostypeid":newostypeid,
+                         "templatetype":template_created.templatetype,
+                         }
+        actual_dict = {
+                       "id":edited_template.id,
+                       "name":edited_template.name,
+                       "displaytest":edited_template.displaytext,
+                       "account":edited_template.account,
+                       "domainid":edited_template.domainid,
+                       "format":edited_template.format,
+                       "ostypeid":edited_template.ostypeid,
+                       "templatetype":edited_template.templatetype,
+                       }
+        edit_template_status = self.__verify_values(
+                                                    expected_dict,
+                                                    actual_dict
+                                                    )
+        self.assertEqual(
+                         True,
+                         edit_template_status,
+                         "Edited Template details are not as expected"
+                         )
+        # Editing the Template name, displaytext
+        edited_template = Template.update(
+                                          template_created,
+                                          self.userapiclient,
+                                          name=template_created.name,
+                                          displaytext=template_created.displaytext
+                                          )
+        self.assertIsNotNone(
+                             edited_template,
+                             "Editing Template failed"
+                             )
+         # Verifying the details of edited template
+        expected_dict = {
+                         "id":template_created.id,
+                         "name":template_created.name,
+                         "displaytest":template_created.displaytext,
+                         "account":template_created.account,
+                         "domainid":template_created.domainid,
+                         "format":template_created.format,
+                         "ostypeid":newostypeid,
+                         "templatetype":template_created.templatetype,
+                         }
+        actual_dict = {
+                       "id":edited_template.id,
+                       "name":edited_template.name,
+                       "displaytest":edited_template.displaytext,
+                       "account":edited_template.account,
+                       "domainid":edited_template.domainid,
+                       "format":edited_template.format,
+                       "ostypeid":edited_template.ostypeid,
+                       "templatetype":edited_template.templatetype,
+                       }
+        edit_template_status = self.__verify_values(
+                                                    expected_dict,
+                                                    actual_dict
+                                                    )
+        self.assertEqual(
+                         True,
+                         edit_template_status,
+                         "Edited Template details are not as expected"
+                         )
+        # Editing the Template name, displaytext, ostypeid
+        edited_template = Template.update(
+                                          template_created,
+                                          self.userapiclient,
+                                          name="NewTemplateName",
+                                          displaytext="TemplateDisplaytext",
+                                          ostypeid=template_created.ostypeid
+                                          )
+        self.assertIsNotNone(
+                             edited_template,
+                             "Editing Template failed"
+                             )
+         # Verifying the details of edited template
+        expected_dict = {
+                         "id":template_created.id,
+                         "name":"NewTemplateName",
+                         "displaytest":"TemplateDisplaytext",
+                         "account":template_created.account,
+                         "domainid":template_created.domainid,
+                         "format":template_created.format,
+                         "ostypeid":template_created.ostypeid,
+                         "templatetype":template_created.templatetype,
+                         }
+        actual_dict = {
+                       "id":edited_template.id,
+                       "name":edited_template.name,
+                       "displaytest":edited_template.displaytext,
+                       "account":edited_template.account,
+                       "domainid":edited_template.domainid,
+                       "format":edited_template.format,
+                       "ostypeid":edited_template.ostypeid,
+                       "templatetype":edited_template.templatetype,
+                       }
+        edit_template_status = self.__verify_values(
+                                                    expected_dict,
+                                                    actual_dict
+                                                    )
+        self.assertEqual(
+                         True,
+                         edit_template_status,
+                         "Edited Template details are not as expected"
+                         )
+        del self.services["template"]["url"]
+        del self.services["template"]["format"]
+        del self.services["template"]["ostype"]
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_04_copy_template(self):
+        """
+        @Desc: Test to copy Template from one zone to another
+        @steps:
+        Step1: Listing Zones available for a user
+        Step2: Verifying if the zones listed are greater than 1.
+               If Yes continuing.
+               If not halting the test.
+        Step3: Listing all the templates for a user in zone1
+        Step4: Verifying that no templates are listed
+        Step5: Listing all the templates for a user in zone2
+        Step6: Verifying that no templates are listed
+        Step7: Creating a Template in zone 1
+        Step8: Listing all the Templates again for a user in zone1
+        Step9: Verifying that list size is 1
+        Step10: Listing all the templates for a user in zone2
+        Step11: Verifying that no templates are listed
+        Step12: Copying the template created in step7 from zone1 to zone2
+        Step13: Listing all the templates for a user in zone2
+        Step14: Verifying that list size is 1
+        Step15: Listing all the Templates for a user in zone1
+        Step16: Verifying that list size is 1
+        """
+        # Listing Zones available for a user
+        zones_list = Zone.list(
+                               self.userapiclient,
+                               available=True
+                               )
+        status = validateList(zones_list)
+        self.assertEquals(
+                          PASS,
+                          status[0],
+                          "Failed to list Zones"
+                          )
+        if not len(zones_list) > 1:
+            self.fail("Enough zones doesnot exists to copy template")
+        else:
+            # Listing all the Templates for a User in Zone 1
+            list_templates_zone1 = Template.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 templatefilter=self.services["templatefilter"],
+                                                 zoneid=zones_list[0].id
+                                                 )
+            # Verifying that no Templates are listed
+            self.assertIsNone(
+                              list_templates_zone1,
+                              "Templates listed for newly created User in Zone1"
+                              )
+            # Listing all the Templates for a User in Zone 2
+            list_templates_zone2 = Template.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 templatefilter=self.services["templatefilter"],
+                                                 zoneid=zones_list[1].id
+                                                 )
+            # Verifying that no Templates are listed
+            self.assertIsNone(
+                              list_templates_zone2,
+                              "Templates listed for newly created User in Zone2"
+                              )
+            self.services["template"]["url"] = "http://10.147.28.7/templates/ttylinux_pv.vhd"
+            self.services["template"]["format"] = "VHD"
+            self.services["template"]["ostype"] = self.services["ostype"]
+            #Listing Hypervisors in Zone 1
+            hypervisor_list = Hypervisor.list(
+                                              self.apiClient,
+                                              zoneid=zones_list[0].id
+                                              )
+            status = validateList(zones_list)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Failed to list Hypervisors in Zone 1"
+                              )
+            # Creating aTemplate in Zone 1
+            template_created = Template.register(
+                                                 self.userapiclient,
+                                                 self.services["template"],
+                                                 zones_list[0].id,
+                                                 hypervisor=hypervisor_list[0].name
+                                                 )
+            self.assertIsNotNone(
+                                 template_created,
+                                 "Template creation failed"
+                                 )
+            self.cleanup.append(template_created)
+            # Listing all the Templates for a User in Zone 1
+            list_templates_zone1 = Template.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 templatefilter=self.services["templatefilter"],
+                                                 zoneid=zones_list[0].id
+                                                 )
+            status = validateList(list_templates_zone1)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Templates creation failed in Zone1"
+                              )
+            # Verifying that list size is 1
+            self.assertEquals(
+                              1,
+                              len(list_templates_zone1),
+                              "Failed to create a Template"
+                              )
+            # Listing all the Templates for a User in Zone 2
+            list_templates_zone2 = Template.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 templatefilter=self.services["templatefilter"],
+                                                 zoneid=zones_list[1].id
+                                                 )
+            # Verifying that no Templates are listed
+            self.assertIsNone(
+                              list_templates_zone2,
+                              "Templates listed for newly created User in Zone2"
+                              )
+            # Verifying the state of the template to be ready. If not waiting for state to become ready till time out
+            template_ready = False
+            count = 0
+            while template_ready is False:
+                list_template = Template.list(
+                                              self.userapiclient,
+                                              id=template_created.id,
+                                              listall=self.services["listall"],
+                                              templatefilter=self.services["templatefilter"],
+                                              )
+                status = validateList(list_template)
+                self.assertEquals(
+                                  PASS,
+                                  status[0],
+                                  "Failed to list Templates by Id"
+                                  )
+                if list_template[0].isready is True:
+                    template_ready = True
+                elif (str(list_template[0].status) == "Error"):
+                    self.fail("Created Template is in Errored state")
+                    break
+                elif count > 10:
+                    self.fail("Timed out before Template came into ready state")
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    count = count + 1
+
+            # Copying the Template from Zone1 to Zone2
+            copied_template = Template.copy(
+                                            self.userapiclient,
+                                            template_created.id,
+                                            sourcezoneid=template_created.zoneid,
+                                            destzoneid=zones_list[1].id
+                                            )
+            self.assertIsNotNone(
+                                 copied_template,
+                                 "Copying Template from Zone1 to Zone2 failed"
+                                 )
+            # Listing all the Templates for a User in Zone 1
+            list_templates_zone1 = Template.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 templatefilter=self.services["templatefilter"],
+                                                 zoneid=zones_list[0].id
+                                                 )
+            status = validateList(list_templates_zone1)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Templates creation failed in Zone1"
+                              )
+            # Verifying that list size is 1
+            self.assertEquals(
+                              1,
+                              len(list_templates_zone1),
+                              "Failed to create a Template"
+                              )
+            # Listing all the Templates for a User in Zone 2
+            list_templates_zone2 = Template.list(
+                                                 self.userapiclient,
+                                                 listall=self.services["listall"],
+                                                 templatefilter=self.services["templatefilter"],
+                                                 zoneid=zones_list[1].id
+                                                 )
+            status = validateList(list_templates_zone2)
+            self.assertEquals(
+                              PASS,
+                              status[0],
+                              "Template failed to copy into Zone2"
+                              )
+            # Verifying that list size is 1
+            self.assertEquals(
+                              1,
+                              len(list_templates_zone2),
+                              "Template failed to copy into Zone2"
+                              )
+            self.assertNotEquals(
+                                 "Connection refused",
+                                 list_templates_zone2[0].status,
+                                 "Failed to copy Template"
+                                 )
+            self.assertEquals(
+                              True,
+                              list_templates_zone2[0].isready,
+                              "Failed to copy Template"
+                              )
+        del self.services["template"]["url"]
+        del self.services["template"]["format"]
+        del self.services["template"]["ostype"]
+        return
\ No newline at end of file


[41/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7026 mark the test_01_primary_storage_iscsi as test that requires hardware

Signed-off-by: Abhinandan Prateek <ap...@apache.org>
(cherry picked from commit a28d65fc4a535b85d3f04e7f2dcccf6ec8092c8f)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2b717834
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2b717834
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2b717834

Branch: refs/heads/4.4
Commit: 2b717834827899e79176d254c91d158162488cf0
Parents: 16d50b8
Author: Bharat Kumar <bh...@citrix.com>
Authored: Tue Jul 1 11:22:14 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:55 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_primary_storage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2b717834/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 0312ad6..66aec59 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -144,7 +144,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             return
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_01_primary_storage_iscsi(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """


[16/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6282-Added Automated testes for Networks and VPC API's

Signed-off-by: Abhinandan Prateek <ap...@apache.org>
(cherry picked from commit 7dc0fca2e90822014d3d6e3a01d2592e7caae5d2)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/19cad0d9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/19cad0d9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/19cad0d9

Branch: refs/heads/4.4
Commit: 19cad0d9b6c89a0a829582a36840779e2e4411b8
Parents: e75b1ac
Author: vinayvarmav <Vi...@citrix.com>
Authored: Fri May 23 16:21:04 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:43 2014 +0200

----------------------------------------------------------------------
 .../component/test_escalations_networks.py      | 2602 ++++++++++++++++++
 tools/marvin/marvin/config/test_data.py         |   53 +
 tools/marvin/marvin/lib/base.py                 |   57 +-
 3 files changed, 2711 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[25/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
Fixing indetation issue

(cherry picked from commit 095be48314c96b74ed18280a95d710071482d2d6)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7e5bad48
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7e5bad48
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7e5bad48

Branch: refs/heads/4.4
Commit: 7e5bad487ca85b2a0c8971982d8b642e641a3737
Parents: b44f66e
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Jun 18 13:18:04 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:49 2014 +0200

----------------------------------------------------------------------
 tools/marvin/marvin/lib/common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e5bad48/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 42ffc51..7b0c7ad 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1322,7 +1322,7 @@ def isVmExpunged(apiclient, vmid, projectid=None, timeout=600):
             timeout -= 60
             time.sleep(60)
         except Exception:
-           vmExpunged = True
+            vmExpunged = True
             break
      #end while
     return vmExpunged


[30/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6932: Removing redundant file test_escalations.py

(cherry picked from commit 7e4303821570d58ad962c85a1a3bd6dbf32f8d73)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dc75e46f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dc75e46f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dc75e46f

Branch: refs/heads/4.4
Commit: dc75e46f9069b96b456a3891f4c1690d3f9c7932
Parents: 7e5bad4
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Wed Jun 18 16:26:13 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:50 2014 +0200

----------------------------------------------------------------------
 test/integration/component/test_escalations.py | 8202 -------------------
 1 file changed, 8202 deletions(-)
----------------------------------------------------------------------



[42/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7062: Tagging test case with BugId

(cherry picked from commit f5139f78395146ee99b9e0fdc376351b28c34063)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/999daec7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/999daec7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/999daec7

Branch: refs/heads/4.4
Commit: 999daec763077cede39ca797286e81eaca447b72
Parents: 2b71783
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Jul 3 16:10:48 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:55 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_primary_storage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/999daec7/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 66aec59..a723652 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -144,7 +144,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             return
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true", BugId="7062")
     def test_01_primary_storage_iscsi(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """


[36/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6995:Stress Test to test multiple Remote Access VPN Connections to VPC

(cherry picked from commit defed59b97324ff51360a24edc470b5e6efda7ac)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/32a9ab6c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/32a9ab6c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/32a9ab6c

Branch: refs/heads/4.4
Commit: 32a9ab6c0523e6f998a7834a4b8812f95dd1b954
Parents: 8e374c5
Author: Chandan Purushothama <Ch...@citrix.com>
Authored: Wed Jun 25 16:31:14 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:53 2014 +0200

----------------------------------------------------------------------
 .../stress/test_multipleremotevpn_vpc.py        | 795 +++++++++++++++++++
 tools/marvin/marvin/config/test_data.py         |  50 +-
 2 files changed, 844 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32a9ab6c/test/integration/stress/test_multipleremotevpn_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/stress/test_multipleremotevpn_vpc.py b/test/integration/stress/test_multipleremotevpn_vpc.py
new file mode 100755
index 0000000..e3ff9b9
--- /dev/null
+++ b/test/integration/stress/test_multipleremotevpn_vpc.py
@@ -0,0 +1,795 @@
+# 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.
+
+""" Component tests Multiple Connections for Remote Access VPN on VPC Functionality.
+"""
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.lib.base import (Vpn,
+                             VpnUser,
+                             VPC,
+                             Account,
+                             User,
+                             VpcOffering,
+                             VPC,
+                             ServiceOffering,
+                             NATRule,
+                             NetworkACL,
+                             PublicIPAddress,
+                             NetworkOffering,
+                             Network,
+                             VirtualMachine,
+                             StaticNATRule,
+                             Template,
+                             Configurations
+                             )
+from marvin.lib.common import (list_publicIP,
+                               get_domain,
+                               get_zone,
+                               get_template,
+                               list_networks,
+                               list_templates,
+                               list_service_offering,
+                               list_vpc_offerings,
+                               list_network_offerings,
+                               list_routers,
+                               list_hosts                               
+                               )
+from marvin.lib.utils import (cleanup_resources,
+                              random_gen,
+                              get_process_status,
+                              get_host_credentials
+                              )
+import time
+import string
+from marvin.sshClient import SshClient
+import traceback
+import thread
+import json
+from marvin.codes import (
+    SUCCESS, FAILED
+)
+
+class TestMultipleVPNAccessonVPC(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+                    
+        
+        cloudstackTestClient = super(
+                                     TestMultipleVPNAccessonVPC,
+                                     cls
+                                    ).getClsTestClient()
+        
+        cls.debug("Obtain the Admin's API Client")                                
+        cls.api_client = cloudstackTestClient.getApiClient()
+        cls.debug("Get the dictionary information that will be used during CCP tests, from test_data.py present on the Client")
+        cls.services = cloudstackTestClient.getParsedTestDataConfig()
+        
+        if cls.services is None:
+            cls.debug("Services Object is None")
+            raise Exception("Services Object is None")
+        
+        cls.debug("Procure the CloudStack Setup configuration Information")
+        with open(cls.services["config_path"], 'rb') as fp:
+            cls.pullconfig = json.load(fp)
+        
+        cls.debug("Update 'remote.access.vpn.client.iprange','remote.access.vpn.user.limit','max.account.primary.storage','max.account.public.ips','max.account.user.vms','max.account.volumes','max.account.cpus', Global Configuration Parameters")
+        
+        update_vpn_client_iprange = Configurations.update(
+            cls.api_client, 
+            name="remote.access.vpn.client.iprange", 
+            value="10.1.2.1-10.1.2.120")
+        
+        cls.debug("'remote.access.vpn.client.iprange' Global Configuration Parameter Updated Successfully")
+        
+        update_vpn_user_limit = Configurations.update(
+            cls.api_client,
+            name="remote.access.vpn.user.limit", 
+            value=str(int(cls.services["vpnclient_count"]*2))
+        )    
+        
+        cls.debug("'remote.access.vpn.user.limit' Global Configuration Parameter Updated Successfully")
+
+        update_max_account_primary_stg_limit = Configurations.update(
+            cls.api_client,
+            name="max.account.primary.storage", 
+            value=str(int(cls.services["vpnclient_count"]*20 + 100))
+        )
+        cls.debug("'max.account.primary.storage' Global Configuration Parameter Updated Successfully")
+
+        update_max_account_public_ips_limit = Configurations.update(
+            cls.api_client,
+            name="max.account.public.ips", 
+            value=str(int(cls.services["vpnclient_count"]*2 + 10))
+        )
+        cls.debug("'max.account.public.ips' Global Configuration Parameter Updated Successfully")
+        
+        update_max_account_user_vms_limit = Configurations.update(
+            cls.api_client,
+            name="max.account.user.vms", 
+            value=str(int(cls.services["vpnclient_count"]*2))
+        )
+        cls.debug("'max.account.user.vms' Global Configuration Parameter Updated Successfully")
+        
+        update_max_account_volumes_limit = Configurations.update(
+            cls.api_client,
+            name="max.account.volumes", 
+            value=str(int(cls.services["vpnclient_count"]*2))
+        )
+        cls.debug("'max.account.volumes' Global Configuration Parameter Updated Successfully")
+
+        update_max_account_cpus_limit = Configurations.update(
+            cls.api_client,
+            name="max.account.cpus", 
+            value=str(int(cls.services["vpnclient_count"]*2))
+        )
+        cls.debug("'max.account.cpus' Global Configuration Parameter Updated Successfully")
+        
+        cls.debug("Restart the Management Server")
+        TestMultipleVPNAccessonVPC.restart_mgmt_server(cls.services["config_path"])
+        cls.debug("Completed restarting the Management Server")
+        
+        cls.debug("Wait for 120 seconds...")
+        time.sleep(120)
+        cls.debug("End of 120 seconds wait time....")
+        
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client)
+        cls.zone = get_zone(
+            cls.api_client,
+            zone_name = cls.services["zone_vpn"]["name"])
+        
+        cls.debug("Use an Existing 'Tiny Instance' Service Offering on the Setup")
+        list_service_offerings = []
+        list_service_offerings = list_service_offering(
+            cls.api_client,
+            keyword="Tiny Instance",
+        )
+        
+        cls._cleanup = []
+            
+        if list_service_offerings is not None:
+            cls.debug("Found an Existing 'Tiny Instance' Service Offering on the Setup")
+            cls.service_offering = list_service_offerings[0]
+            
+        else:
+            cls.debug("Create a service offering which will be used for VM deployments in this test")
+            cls.service_offering = ServiceOffering.create(
+                cls.api_client,
+                cls.services["service_offering"]
+            )
+            
+            cls.debug("Add the created service offering to the _cleanup queue")
+            cls._cleanup.append(cls.service_offering)
+        
+        try:
+            cls.debug("Create or Use Existing Account to own the VPN Clients, which is used to test Remote VPN Access to VPC")
+            cls.api_client_vpn_client_reg_user = cloudstackTestClient.getUserApiClient(
+                UserName="CSRegularVPNClientUser",
+                DomainName="ROOT"
+            )
+
+            list_vpn_client_regular_user = User.list(
+                cls.api_client,
+                username="CSRegularVPNClientUser"
+            )
+            
+            cls.debug("Procure the Account Name and DomainID Information of the Regular Account")
+            cls.vpn_client_reg_acct_name = list_vpn_client_regular_user[0].account
+            cls.vpn_client_reg_domain_id = list_vpn_client_regular_user[0].domainid
+            
+            list_vpn_client_regular_user_acct = Account.list(
+                cls.api_client,
+                name = cls.vpn_client_reg_acct_name,
+                listall = True
+            )
+            
+            cls._cleanup.append(Account(list_vpn_client_regular_user_acct[0].__dict__))
+            
+            # Register a Template that already has VPN client installed on it. The template registered here
+            # has extra scripts to facilitate automated operations to execute Test Cases.
+            # Template has pre-configured configuration files required for the VPN Client operations.
+            # The following files are present on the registered template. The location of the files are locations
+            # on a VM deployed from this template
+            #            1. "/tmp/ipsec.conf"
+            #            2. "/tmp/ipsec.secrets"
+            #            3. "/tmp/options.xl2tpd.client"
+            #            4. "/tmp/xl2tpd.conf"
+            #            5  "/tmp/vpnclient_services.sh"
+            #            6. "/tmp/firstconn_expectscript.exp"
+            #            7. "/tmp/secondconn_expectscript.exp"
+            
+            cls.debug("Use an Existing VPN Client Template on the Setup")
+            list_vpn_client_templates = list_templates(
+                cls.api_client_vpn_client_reg_user,
+                keyword="VPNClient",
+                templatefilter="featured",
+                zoneid = cls.zone.id
+            )
+            
+            if list_vpn_client_templates is not None:
+                cls.debug("Found an Existing VPN Client Template on the Setup")
+                cls.template = list_vpn_client_templates[0]
+            
+            else:
+                cls.debug("Register a Template that already has VPN client installed on it")
+                cls.template = Template.register(
+                    cls.api_client, 
+                    cls.services["vpn_template"], 
+                    zoneid=cls.zone.id,
+                    hypervisor='XenServer' 
+                )
+
+                cls._cleanup.append(cls.template)
+
+                cls.debug("Sleep for {0} seconds specified in the dictionary before checking for Template's Availability".format(cls.services["sleep"]))
+                time.sleep(cls.services["sleep"])
+                
+            cls.debug("Procure Timeout Value from the dictionary")
+            timeout = cls.services["timeout"]
+            
+            while True:
+                list_template_response = list_templates(
+                    cls.api_client_vpn_client_reg_user,
+                    templatefilter='featured',
+                    id=cls.template.id,
+                )
+            
+                if isinstance(list_template_response, list):
+                    break
+                elif timeout == 0:
+                    raise Exception("List template failed!")
+
+                time.sleep(5)
+                timeout = timeout - 1
+            
+            cls.debug("Verify template response to check whether template is present")
+            
+            if list_template_response is None: 
+                raise Exception("Check whether the VPN Client Template is available")
+            template_response = list_template_response[0]
+            if template_response.isready == False: 
+                raise Exception("Template state is not ready, it is %r" % template_response.isready)
+            
+            # Queue that holds all the VPN Client VMs Information
+            cls.vpnclientvms = []
+            
+            cls.debug("Deploy {0} VPN Clients in the account".format(int(cls.services["vpnclient_count"])))
+            
+            for vm in xrange(0,int(cls.services["vpnclient_count"])):
+                
+                cls.debug("Deploy a new VM {0} in first account. This VM which will be configured as VPN Client".format(int(vm)))
+                new_vpnclient_vm = VirtualMachine.create(
+                    cls.api_client_vpn_client_reg_user,
+                    cls.services["virtual_machine"],
+                    zoneid=cls.zone.id,
+                    serviceofferingid=cls.service_offering.id,
+                    templateid=cls.template.id,
+                )
+                
+                cls.debug("Add new VM {0} to the vpnclientvms Queue".format(int(vm)))
+                cls.vpnclientvms.append(new_vpnclient_vm)                
+
+                cls.debug("Allow SSH Access to the new VPN Client VM {0}".format(int(vm)))
+                new_vpnclient_vm.access_ssh_over_nat(
+                    cls.api_client_vpn_client_reg_user, 
+                    cls.services, 
+                    new_vpnclient_vm, 
+                    allow_egress=True
+                )
+                cls.debug("VM for VPNClient Access Got Created with Public IP Address %s" % new_vpnclient_vm.public_ip)
+            
+            cls.debug("Create or Use existing Account in which we deploy VPCs and test remote access to them from the First Account's VMs present on isolated Network")          
+            cls.api_client_vpn_server_reg_user = cloudstackTestClient.getUserApiClient(
+                UserName="CSRegularVPNServerUser",
+                DomainName="ROOT"
+            )
+
+            list_vpn_server_regular_user = User.list(
+                cls.api_client,
+                username="CSRegularVPNServerUser"
+            )
+            
+            cls.debug("Procure the Account Name and DomainID Information of the Regular Account")
+            cls.vpn_server_reg_acct_name = list_vpn_server_regular_user[0].account
+            cls.vpn_server_reg_domain_id = list_vpn_server_regular_user[0].domainid
+        
+            list_vpn_server_regular_user_acct = Account.list(
+                cls.api_client,
+                name = cls.vpn_server_reg_acct_name,
+                listall = True
+            )
+            
+            cls._cleanup.append(Account(list_vpn_server_regular_user_acct[0].__dict__))        
+        
+            cls.debug("Use an Existing 'VPC off-' Service Offering on the Setup")
+            list_available_vpc_offerings = list_vpc_offerings(
+                cls.api_client,
+                keyword="VPC off-",
+            )
+            
+            if list_available_vpc_offerings is not None:
+                cls.debug("Found an Existing 'VPC off-' Service Offering on the Setup")
+                cls.vpc_offering = VpcOffering(list_available_vpc_offerings[0].__dict__)
+            
+            else:
+                cls.debug("Creating a VPC offering..")
+                cls.vpc_offering = VpcOffering.create(
+                    cls.api_client,
+                    cls.services["vpc_offering"]
+                )
+
+                # Add the created VPC Offering to __cleanup queue
+                cls._cleanup.append(cls.vpc_offering)
+
+            # Enable to created VPC Offering inorder to deploy VPCs with it       
+            cls.debug("Enabling the VPC offering created")
+            cls.vpc_offering.update(cls.api_client, state='Enabled')
+            cls.debug("Enabled the VPC Offering")
+
+            # Create a VPC for the second account
+            cls.debug("Creating a VPC in the account: %s" % cls.vpn_server_reg_acct_name)
+            cls.firstvpc = VPC.create(
+                cls.api_client_vpn_server_reg_user,
+                cls.services["vpc_remote_vpn"],
+                vpcofferingid=cls.vpc_offering.id,
+                zoneid=cls.zone.id
+            )        
+        
+            cls.debug("Use an Existing 'NET_OFF-RemoteAccessVPNTest-' Network Offering on the Setup")
+            list_available_network_offerings = list_network_offerings(
+                cls.api_client,
+                keyword="NET_OFF-RemoteAccessVPNTest-",
+            )
+            
+            if list_available_network_offerings is not None:
+                cls.debug("Found an Existing 'NET_OFF-RemoteAccessVPNTest-' Network Offering on the Setup")
+                cls.network_off = NetworkOffering(list_available_network_offerings[0].__dict__)
+            
+            else:
+                cls.debug('Create NetworkOffering for Networks in VPC')
+                cls.services["vpc_network_offering"]["name"] = "NET_OFF-RemoteAccessVPNTest-"+ random_gen()
+                cls.network_off = NetworkOffering.create(
+                    cls.api_client,
+                    cls.services["vpc_network_offering"],
+                    conservemode=False
+                )
+
+                # Add the created Network Offering to __cleanup queue
+                cls._cleanup.append(cls.network_off)
+        
+            # Enable Network offering
+            cls.network_off.update(cls.api_client, state='Enabled')
+                    
+            cls.debug('Created and Enabled NetworkOffering')
+            cls.services["network"]["name"] = "NETWORK-" + random_gen()
+            
+            # Create First Network Tier in the First VPC created for second account using the network offering created above.    
+            cls.debug('Adding Network=%s' % cls.services["network"])
+            cls.firstnetworktier = Network.create(
+                cls.api_client_vpn_server_reg_user,
+                cls.services["network"],
+                networkofferingid=cls.network_off.id,
+                zoneid=cls.zone.id,
+                gateway=cls.services["firstnetwork_tier"]["gateway"],
+                netmask=cls.services["firstnetwork_tier"]["netmask"],
+                vpcid=cls.firstvpc.id 
+            )
+        
+            cls.debug("Created network with ID: %s" % cls.firstnetworktier.id)
+        
+            # Create Ingress and Egress NetworkACL rules for First Network Tier in the First VPC created for second account.
+            cls.debug("Adding NetworkACL rules to make Network accessible for all Protocols and all CIDRs ")
+            NetworkACL.create(
+                cls.api_client_vpn_server_reg_user,
+                cls.services["all_rule"],
+                networkid=cls.firstnetworktier.id,
+                traffictype='Ingress'
+            )
+        
+            NetworkACL.create(
+                cls.api_client_vpn_server_reg_user,
+                cls.services["all_rule"],
+                networkid=cls.firstnetworktier.id,
+                traffictype='Egress'
+            )
+         
+            listFirstVPC = VPC.list(
+                cls.api_client_vpn_server_reg_user,
+                id=cls.firstvpc.id
+            )
+            
+            cls.debug("Information about the VPC: {0}".format(str(listFirstVPC)))
+        
+            cls.debug("Obtain the source nat IP Address of the first VPC.")
+            cls.listFirstVPCPublicIpAddress = list_publicIP(
+                cls.api_client_vpn_server_reg_user,
+                issourcenat="true",
+                vpcid=listFirstVPC[0].id,
+                listall="true"
+            )
+            cls.debug("Information about the VPC's Source NAT IP Address: {0}".format(str(cls.listFirstVPCPublicIpAddress)))
+        
+            cls.debug("Enable Remote Access VPN on the source nat Public IP Address of the first VPC")
+            cls.FirstVPNonFirstVPC = Vpn.create(
+                cls.api_client_vpn_server_reg_user,
+                cls.listFirstVPCPublicIpAddress[0].id
+            )
+
+            cls.debug("Successfully Created First VPN on VPC with preshared key:"+ cls.FirstVPNonFirstVPC.presharedkey)
+            cls.listfirstNetworkTier = list_networks(
+                cls.api_client_vpn_server_reg_user,
+                id=cls.firstnetworktier.id,
+                listall=True
+            )
+
+
+            cls.debug("Create a VM using the default template on the First Network Tier in the First VPC of the Second Account")
+            cls.vm1 = VirtualMachine.create(
+                cls.api_client_vpn_server_reg_user,
+                cls.services["virtual_machine"],
+                zoneid=cls.zone.id,
+                serviceofferingid=cls.service_offering.id,
+                templateid=cls.template.id,
+                networkids=[str(cls.firstnetworktier.id)]
+            )
+        
+            cls.debug("First VM deployed in the first Network Tier")
+        
+        except Exception as e:
+            cleanup_resources(cls.api_client, cls._cleanup)
+            printex = traceback.format_exc()
+            cls.debug("Exception Occurred : {0}".format(printex))
+            raise Exception("Warning: Exception during Setting Up the Test Suite Configuration : %s" % e)
+        
+        return
+            
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            print("Warning: Exception during cleanup : %s" % e)
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+    
+    @classmethod
+    def filecopy(cls,virtual_machine,localfile=None,remotefilelocation=None,permissions="644"):
+        cls.ssh = SshClient(
+            host=virtual_machine.public_ip,
+            port=TestMultipleVPNAccessonVPC.services["virtual_machine"]["ssh_port"],
+            user='root',
+            passwd='password')
+        
+        cls.ssh.scp(localfile,remotefilelocation)
+        cls.ssh.runCommand('chmod %s %s' % (permissions,remotefilelocation))
+        cls.debug("%s file successfully copied to %s " % (localfile, remotefilelocation))
+        
+        cls.ssh.close()
+
+    @classmethod
+    def restart_mgmt_server(cls,config):
+        
+        cls.ssh = SshClient(
+            host=cls.pullconfig["mgtSvr"][0]["mgtSvrIp"],
+            port=22,
+            user=cls.pullconfig["mgtSvr"][0]["user"],
+            passwd=cls.pullconfig["mgtSvr"][0]["passwd"]
+                             )
+        
+        result = cls.ssh.runCommand("/etc/init.d/cloudstack-management restart")
+        
+        if result["status"] == SUCCESS:
+            time.sleep(120)
+        else:
+            raise Exception("Failure in restarting cloudstack Management Server")
+            
+        cls.ssh.close()
+ 
+    @staticmethod
+    def char_xrange(firstchar, lastchar):
+        #Generates a range of Alphabetical Characters, lastchar inclusive
+        for c in xrange(ord(firstchar),ord(lastchar)+1):
+            yield chr(c)
+            
+    @staticmethod
+    def get_guest_ip_address(guest_ip_address):
+        
+        for ch in ["'","[","]","\\","n"]:
+            if ch in guest_ip_address:
+                guest_ip_address = guest_ip_address.replace(ch,"")
+    
+        return guest_ip_address
+
+    @staticmethod
+    def configureVPNClientServicesFile(virtual_machine,vpnclient_services_script,vpnserverip=None,vpnnetworkcidr="192.168.10.0/24",psk=None,vpnuser=None,vpnuserpassword=None):
+        
+        ssh = SshClient(
+            host=virtual_machine.public_ip,
+            port=TestMultipleVPNAccessonVPC.services["virtual_machine"]["ssh_port"],
+            user='root',
+            passwd='password')
+        
+        
+        cidr = "\/".join(vpnnetworkcidr.rsplit("/",1))
+                
+        ssh.execute(''' sed -i "s/VPN_ADDR=.*/VPN_ADDR='%s'/g" %s ''' % (vpnserverip,vpnclient_services_script))
+        ssh.execute(''' sed -i "s/CIDR=.*/CIDR='%s'/g" %s ''' % (cidr,vpnclient_services_script))
+        ssh.execute(''' sed -i "s/PSK=.*/PSK='%s'/g" %s ''' % (psk,vpnclient_services_script))
+        ssh.execute(''' sed -i "s/VPN_USR=.*/VPN_USR='%s'/g" %s ''' % (vpnuser,vpnclient_services_script))
+        ssh.execute(''' sed -i "s/VPN_USR_PWD=.*/VPN_USR_PWD='%s'/g" %s ''' % (vpnuserpassword,vpnclient_services_script))
+        ssh.execute('echo "VPN Client Services File Ready" >> /tmp/executionoutput.txt')
+        
+        ssh.close()
+
+    @staticmethod
+    def vpnClientServicesInit(virtual_machine,vpnclient_services_script):
+        
+        ssh = SshClient(
+            host=virtual_machine.public_ip,
+            port=TestMultipleVPNAccessonVPC.services["virtual_machine"]["ssh_port"],
+            user='root',
+            passwd='password')
+                                     
+        ssh.execute('%s init >> /tmp/executionoutput.txt' % (vpnclient_services_script))
+        ssh.execute('echo "VPN Client Services Configuration Files Initiated" >> /tmp/executionoutput.txt')
+        
+        ssh.close()
+                                   
+    @staticmethod
+    def vpnClientServicesStart(virtual_machine,vpnclient_services_script):
+        
+        ssh = SshClient(
+            host=virtual_machine.public_ip,
+            port=TestMultipleVPNAccessonVPC.services["virtual_machine"]["ssh_port"],
+            user='root',
+            passwd='password')
+                                     
+        ssh.execute('%s start >> /tmp/executionoutput.txt' % (vpnclient_services_script))
+        ssh.execute('echo "VPN Client Services Started" >> /tmp/executionoutput.txt')
+        
+        ssh.close()
+        
+        
+    def exec_script_on_user_vm(self, virtual_machine,script, exec_cmd_params, expected_result, negative_test=False,public_ip=None):
+        try:
+            exec_success = False
+
+            if public_ip is not None:
+                self.debug("getting SSH client for Vm: %s with ip %s" % (virtual_machine.id,public_ip))
+                sshClient = virtual_machine.get_ssh_client(ipaddress=public_ip)
+            else:
+                self.debug("getting SSH client for Vm: %s with ip %s" % (virtual_machine.id,virtual_machine.public_ip))
+                sshClient = virtual_machine.get_ssh_client(ipaddress=virtual_machine.public_ip)
+            
+            result = sshClient.execute(script+exec_cmd_params)
+
+            self.debug("script: %s" % script+exec_cmd_params)
+            self.debug("result: %s" % result)
+
+            str_result = str(str(result).strip())
+            str_expected_result = str(expected_result).strip()
+            if str_result == str_expected_result:
+                exec_success = True
+
+            if negative_test:
+                self.assertEqual(exec_success,
+                                 True,
+                                 "Script result is %s matching with %s" % (str_result, str_expected_result))
+            else:
+                self.assertEqual(exec_success,
+                                 True,
+                                 "Script result is %s is not matching with %s" % (str_result, str_expected_result))
+
+        except Exception as e:
+            self.debug('Error=%s' % e)
+            printex = traceback.format_exc()
+            self.debug("Exception Occurred : {0}".format(printex))
+            raise e
+    
+    def ping_vm(self, virtual_machine, guest_ip_address, count=1, interval=15, thread_name="Thread-None"):
+        
+        try:
+            self.debug("{4} : Check whether VM with ID: {0} with Public IP: {1} is able to ping Guest VM with IP: {2} - {3} Times !!!".format(virtual_machine.id, virtual_machine.public_ip, guest_ip_address, count, thread_name))
+            iteration = 1
+            total_times = count
+            
+            while count > 0:
+                self.debug("{4} : Test whether VM with ID: {0} with Public IP: {1} is able to ping Guest VM with IP: {2} for {3} iteration".format(virtual_machine.id, virtual_machine.public_ip, guest_ip_address, iteration, thread_name))
+                self.exec_script_on_user_vm(
+                    virtual_machine,
+                    'ping -c 1 {0}'.format(guest_ip_address),
+                    "| grep -oP \'\d+(?=% packet loss)\'",
+                    "[u'0']",
+                    negative_test=False
+                )
+                self.debug("{4} : Verified Successfully that VM with ID: {0} with Public IP: {1} is able to ping Guest VM with IP: {2} for {3} iteration".format(virtual_machine.id, virtual_machine.public_ip, guest_ip_address, iteration, thread_name))
+                count = count-1
+                iteration = iteration + 1
+                
+                self.debug("{1} : Wait for {0} seconds before next ping".format(interval,thread_name))
+                time.sleep(interval)
+                self.debug("Still {0} iterations left for Thread {1}".format(count,thread_name))
+                
+            if count == 0:
+                self.debug("Ping {0} Times is Completed for Thread {1} ".format(total_times,thread_name))
+            else:
+                raise Exception("Count value is still at {0}".format(count))
+            
+        except Exception as e:
+        
+            printex = traceback.format_exc()
+            self.debug("Exception Occurred : {0}".format(printex))
+            raise Exception("Warning: Exception during pinging VM : %s" % e)
+        
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.hypervisor = self.testClient.getHypervisorInfo()
+        self.cleanup=None
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            self.debug("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags=["advanced", "intervlan"],required_hardware="true")
+    def test_01_Multiple_RemoteAccessVPN_Connections_To_VPC_Ping_Guest_VM_Multiple_Times(self):
+        """ Test case no : Test Multiple VPN Connections to a VPN Server on VPC
+
+
+        # Validate the following for Each VPN VM Client
+        # 1. Create VPN User on the VPC
+        # 2. Configure the VPN Client VM with the required Information
+        # 3. Initialize the VPN Client Services on the VPN Client
+        # 4. Start the VPN Client Services on the VPN Client
+        # 5. Wait for 30 seconds before attempting to ping
+        # 6. Conduct the Ping Test on the VM
+        
+        # After the deployment VPN Client VMs and the post deployment steps, do the following steps: 
+        # 7. Wait for 60 seconds
+        # 8. Check Routers pppX NICs Information
+        """        
+        
+        for vm in xrange(0,int(TestMultipleVPNAccessonVPC.services["vpnclient_count"])):
+                
+            vpn_user_name = ''.join((str(vm),"-user"))
+            vpn_password = ''.join((str(vm),"-pass"))
+                
+            self.debug("VPN User Name created with %s " % vpn_user_name)
+            self.debug("VPN Password created with %s " % vpn_password)
+            
+            self.debug("Create new VPN User to use the Remote Access Service enabled on the VPC") 
+            newVPNUser = VpnUser.create(
+                TestMultipleVPNAccessonVPC.api_client_vpn_server_reg_user, 
+                vpn_user_name, 
+                vpn_password, 
+                rand_name=False
+            )
+            self.debug("VPN User %s got created Successfully " % vpn_user_name)
+
+            self.debug("Configure the VPN Client Services on the VM deployed for VPN client purpose.")
+            TestMultipleVPNAccessonVPC.configureVPNClientServicesFile(
+                TestMultipleVPNAccessonVPC.vpnclientvms[vm],
+                "/tmp/vpnclient_services.sh",
+                TestMultipleVPNAccessonVPC.listFirstVPCPublicIpAddress[0].ipaddress,
+                TestMultipleVPNAccessonVPC.listfirstNetworkTier[0].cidr,
+                TestMultipleVPNAccessonVPC.FirstVPNonFirstVPC.presharedkey,
+                vpn_user_name,
+                vpn_password
+            )        
+            self.debug("Configuration of VPN Client VM %d Done " % (vm))
+                
+            self.debug("Initialize the VPN Client Services on the VPN Client")
+            TestMultipleVPNAccessonVPC.vpnClientServicesInit(
+                TestMultipleVPNAccessonVPC.vpnclientvms[vm],
+                "/tmp/vpnclient_services.sh"
+            )
+            self.debug("Initiation of VPN Client Services on VM %d Done " % (vm))
+            
+            self.debug("Start the VPN Client Services on the VPN Client")
+            TestMultipleVPNAccessonVPC.vpnClientServicesStart(
+                TestMultipleVPNAccessonVPC.vpnclientvms[vm],
+                "/tmp/vpnclient_services.sh"
+            )
+            self.debug("VPN Client Services on VM %d Started Successfully " % (vm))
+            
+            self.debug("Wait for 30 seconds before attempting to ping")
+            time.sleep(30)
+            
+            self.debug("Conduct the Ping Test on the VM %d" % (vm))
+            thread.start_new_thread(self.ping_vm,(
+                TestMultipleVPNAccessonVPC.vpnclientvms[vm], 
+                TestMultipleVPNAccessonVPC.vm1.nic[0].ipaddress,
+                25000,
+                15,
+                "Thread-{0}".format(vm)
+            ))
+            
+        self.debug("Waiting for 60 seconds.........")
+        time.sleep(60)
+        self.debug("End of 60 seconds.........")
+        
+        # Find router associated with user account
+        list_router_response = list_routers(
+            self.apiclient,
+            vpcid= TestMultipleVPNAccessonVPC.firstvpc.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 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"
+        )
+
+        if self.hypervisor.lower() == 'vmware':
+           result = get_process_status(
+                self.apiclient.connection.mgtSvr,
+                22,
+                self.apiclient.connection.user,
+                self.apiclient.connection.passwd,
+                router.linklocalip,
+                "ifconfig | grep ppp",
+                hypervisor=self.hypervisor
+            )
+        else:
+            try:
+                host.user, host.passwd = get_host_credentials(self.config, host.ipaddress)
+                result = get_process_status(
+                    host.ipaddress,
+                    22,
+                    host.user,
+                    host.passwd,
+                    router.linklocalip,
+                    "ifconfig | grep ppp"
+                )
+                self.debug("Routers pppX NICs Information : %s" % str(result))
+            except KeyError:
+                self.skipTest("Marvin configuration has no host credentials to check router services")
+        

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32a9ab6c/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index d870c98..4ff5b84 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -956,6 +956,54 @@ test_data = {
             #Migrate VM to hostid
             "ostype": 'Windows 7 (32-bit)',
             # CentOS 5.3 (64-bit)
-    }
+    },
+    "vpc_remote_vpn": {
 
+        "name": "TestVPC",
+        "displaytext": "TestVPC",
+        "cidr": "192.168.1.1/16"
+    },
+        "vpn_template":{
+                        "name":"VPNClient_Template",
+                        "displaytext":"VPNClient_Template",
+                        "format":"VHD",
+                        "ostype":"CentOS 5.6 (64-bit)",
+                        "url":"http://nfs1.lab.vmops.com/templates/vpnclient-template-xen-centos56-64bit-with-connection-scripts.vhd",
+                        "isfeatured":"True",
+                        "ispublic":"True",
+                        "isextractable":"True"
+    	},
+    	"all_rule":{
+        	"protocol":"ALL",
+        	"cidrlist":"0.0.0.0/0"
+    	},
+        "vpc_network_offering":{
+        	"name":"NET_OFF-RemoteAccessVPNTest",
+        	"displaytext":"NET_OFF-RemoteAccessVPNTest",
+        	"guestiptype":"Isolated",
+        	"supportedservices":"Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL",
+        	"traffictype":"GUEST",
+        	"availability":"Optional",
+        	"useVpc":"on",
+        	"serviceProviderList":{
+            		"Vpn":"VpcVirtualRouter",
+            		"Dhcp":"VpcVirtualRouter",
+            		"Dns":"VpcVirtualRouter",
+            		"SourceNat":"VpcVirtualRouter",
+            		"PortForwarding":"VpcVirtualRouter",
+            		"Lb":"VpcVirtualRouter",
+            		"UserData":"VpcVirtualRouter",
+            		"StaticNat":"VpcVirtualRouter",
+            		"NetworkACL":"VpcVirtualRouter"
+        	}
+	},
+    	"firstnetwork_tier":{
+        	"gateway":"192.168.10.1",
+		"netmask":"255.255.255.0"
+    	},
+	"zone_vpn":{
+		"name":"Adv-Xen-Zone1"
+	},
+	"vpnclient_count": 50,
+	"config_path":"/hudson/scripts3/auto_xen.cfg"
 }


[06/50] [abbrv] CLOUDSTACK-6282 - Divided test_escalations.py into individual files based on functionality and added automed tests for Public IP Addresses

Posted by da...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b38fcfee/test/integration/component/test_escalations_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_escalations_volumes.py b/test/integration/component/test_escalations_volumes.py
new file mode 100644
index 0000000..d1dae12
--- /dev/null
+++ b/test/integration/component/test_escalations_volumes.py
@@ -0,0 +1,1703 @@
+# 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.
+
+#Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import *
+from marvin.cloudstackAPI import *
+from marvin.sshClient import SshClient
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.utils import checkVolumeSize
+from marvin.codes import SUCCESS
+from nose.plugins.attrib import attr
+from time import sleep
+
+class TestVolumes(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        try:
+            cls._cleanup = []
+            cls.testClient = super(TestVolumes, cls).getClsTestClient()
+            cls.api_client = cls.testClient.getApiClient()
+            cls.services = cls.testClient.getParsedTestDataConfig()
+            # Get Domain, Zone, Template
+            cls.domain = get_domain(cls.api_client)
+            cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+            cls.template = get_template(
+                                cls.api_client,
+                                cls.zone.id,
+                                cls.services["ostype"]
+                                )
+            if cls.zone.localstorageenabled:
+                cls.storagetype = 'local'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
+                cls.services["disk_offering"]["storagetype"] = 'local'
+            else:
+                cls.storagetype = 'shared'
+                cls.services["service_offerings"]["tiny"]["storagetype"] = 'shared'
+                cls.services["disk_offering"]["storagetype"] = 'shared'
+
+            cls.services['mode'] = cls.zone.networktype
+            cls.services["virtual_machine"]["hypervisor"] = cls.testClient.getHypervisorInfo()
+            cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+            cls.services["virtual_machine"]["template"] = cls.template.id
+            cls.services["custom_volume"]["zoneid"] = cls.zone.id
+            # Creating Disk offering, Service Offering and Account
+            cls.disk_offering = DiskOffering.create(
+                                        cls.api_client,
+                                        cls.services["disk_offering"]
+                                        )
+            cls.service_offering = ServiceOffering.create(
+                                                cls.api_client,
+                                                cls.services["service_offerings"]["tiny"]
+                                                )
+            cls.account = Account.create(
+                                cls.api_client,
+                                cls.services["account"],
+                                domainid=cls.domain.id
+                                )
+            # Getting authentication for user in newly created Account
+            cls.user = cls.account.user[0]
+            cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name)
+            # Creating Virtual Machine
+            cls.virtual_machine = VirtualMachine.create(
+                                        cls.userapiclient,
+                                        cls.services["virtual_machine"],
+                                        accountid=cls.account.name,
+                                        domainid=cls.account.domainid,
+                                        serviceofferingid=cls.service_offering.id,
+                                    )
+            cls._cleanup.append(cls.virtual_machine)
+            cls._cleanup.append(cls.disk_offering)
+            cls._cleanup.append(cls.service_offering)
+            cls._cleanup.append(cls.account)
+        except Exception as e:
+            cls.tearDownClass()
+            raise Exception("Warning: Exception in setup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiClient = self.testClient.getApiClient()
+        self.cleanup = []
+
+    def tearDown(self):
+        #Clean up, terminate the created volumes
+        cleanup_resources(self.apiClient, self.cleanup)
+        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 __verify_values(self, expected_vals, actual_vals):
+        """
+        @summary: Function to verify expected and actual values
+        Step1: Initializing return flag to True
+        Step1: Verifying length of expected and actual dictionaries is matching.
+               If not matching returning false
+        Step2: Listing all the keys from expected dictionary
+        Step3: Looping through each key from step2 and verifying expected and actual dictionaries have same value
+               If not making return flag to False
+        Step4: returning the return flag after all the values are verified
+        """
+        return_flag = True
+
+        if len(expected_vals) != len(actual_vals):
+            return False
+
+        keys = expected_vals.keys()
+        for i in range(0, len(expected_vals)):
+            exp_val = expected_vals[keys[i]]
+            act_val = actual_vals[keys[i]]
+            if exp_val == act_val:
+                return_flag = return_flag and True
+            else:
+                return_flag = return_flag and False
+                self.debug("expected Value: %s, is not matching with actual value: %s" % (
+                                                                                          exp_val,
+                                                                                          act_val
+                                                                                          ))
+        return return_flag
+
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_01_list_volumes_pagination(self):
+        """  
+        @summary: Test List Volumes pagination
+        
+        Step1: Listing all the volumes for a user
+        Step2: Verifying listed volumes for account created at class level
+        Step3: If number of volumes is less than (page size + 1), then creating them
+        Step4: Listing all the volumes again after creation of volumes
+        Step5: Verifying the length of the volumes is (page size + 1)
+        Step6: Listing all the volumes in page1
+        Step7: Verifying that the length of the volumes in page 1 is (page size)
+        Step8: Listing all the volumes in page2
+        Step9: Verifying that the length of the volumes in page 2 is 1
+        Step10: Deleting the volume present in page 2
+        Step11: Listing for the volumes on page 2
+        Step12: Verifying that there are no volumes present in page 2
+        """
+        # Listing all the volumes for a user
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+
+        # Verifying listed volumes for account created at class level
+        self.assertIsNotNone(
+                             list_volumes_before,
+                             "create volume from VM failed at class setup method"
+                             )
+        self.assertEqual(
+                         len(list_volumes_before),
+                         1,
+                         "more than 1 volume created from VM at class level"
+                         )
+
+        # If number of volumes is less than (pagesize + 1), then creating them    
+        for i in range(0, (self.services["pagesize"])):
+            volume_created = Volume.create(
+                                   self.userapiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+            self.assertIsNotNone(
+                                 volume_created,
+                                 "Volume is not created"
+                                 )
+            if(i < (self.services["pagesize"] - 1)):
+                self.cleanup.append(volume_created)
+                
+            self.assertEqual(
+                             self.services["volume"]["diskname"],
+                             volume_created.name,
+                             "Newly created volume name and the test data volume name are not matching"
+                             )
+
+        # Listing all the volumes again after creation of volumes        
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"]) 
+
+        # Verifying the length of the volumes is (page size + 1)
+        self.assertEqual(
+                         len(list_volumes_after),
+                         (self.services["pagesize"] + 1),
+                         "Number of volumes created is not matching expected"
+                         )
+
+        # Listing all the volumes in page1
+        list_volumes_page1 = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         page=1,
+                                         pagesize=self.services["pagesize"]
+                                         )
+        self.assertIsNotNone(
+                             list_volumes_page1,
+                             "No volumes found in Page 1"
+                             )
+        # Verifying that the length of the volumes in page 1 is (page size)
+        self.assertEqual(
+                         len(list_volumes_page1),
+                         self.services["pagesize"],
+                         "List Volume response is not matching with the page size length for page 1"
+                         )
+
+        # Listing all the volumes in page2
+        list_volumes_page2 = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         page=2,
+                                         pagesize=self.services["pagesize"]
+                                         )
+        self.assertIsNotNone(
+                             list_volumes_page2,
+                             "No volumes found in Page 2"
+                             )
+        # Verifying that the length of the volumes in page 2 is 1
+        self.assertEqual(
+                         len(list_volumes_page2),
+                         1,
+                         "List Volume response is not matching with the page size length for page 2"
+                         )
+        volume_page2 = list_volumes_page2[0]
+
+        # Verifying that the volume on page 2 is not present in page1
+        for i in range(0, len(list_volumes_page1)):
+            volume_page1 = list_volumes_page1[i]
+            self.assertNotEquals(
+                                 volume_page2.id,
+                                 volume_page1.id,
+                                 "Volume listed in page 2 is also listed in page 1"
+                                 )
+
+        # Deleting a single volume
+        Volume.delete(volume_created, self.userapiclient)
+
+        # Listing the volumes in page 2
+        list_volume_response = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         page=2,
+                                         pagesize=self.services["pagesize"]
+                                         )
+        # verifying that volume does not exists on page 2
+        self.assertEqual(
+                        list_volume_response,
+                        None,
+                        "Volume was not deleted"
+                    )
+        return
+
+    @attr(tags=["advanced", "basic", "provisioning"]) 
+    def test_02_list_volume_byid(self):
+        """       
+        @summary: Test List Volumes with Id
+        
+        Step1: Listing all the volumes for a user before creating a data volume
+        Step2: Verifying the length of the list as 1
+        Step3: Creating a data volume
+        Step4: Listing all the volumes for a user after creating a data volume
+        Step5: Verifying the list volume size is increased by 1
+        Step6: List the volumes by specifying root volume Id
+        Step7: Verifying the details of the root volume
+        Step8: List the volumes by specifying data volume Id
+        Step9: Verifying the details of the data volume
+        """
+        # Listing all the volumes for a user before creating a data volume
+        list_volumes_before = Volume.list(
+                                          self.userapiclient,
+                                          listall=self.services["listall"]
+                                          )
+        self.assertIsNotNone(
+                             list_volumes_before,
+                             "create volume from VM failed at class setup method")
+        # Verifying the length of the list as 1
+        self.assertEqual(
+                         len(list_volumes_before),
+                         1,
+                         "more than 1 volume created at class level"
+                         )
+        root_volume = list_volumes_before[0]
+ 
+        # Creating a data volume
+        volume_created = Volume.create(
+                                   self.userapiclient,
+                                   self.services["volume"],
+                                   zoneid=self.zone.id,
+                                   diskofferingid=self.disk_offering.id
+                                   )
+        self.assertIsNotNone(
+                             volume_created,
+                             "Volume is not created"
+                             )
+        self.cleanup.append(volume_created)
+         
+        self.assertEqual(
+                         self.services["volume"]["diskname"],
+                         volume_created.name,
+                         "Newly created volume name and the test data volume name are not matching"
+                         )
+        # Listing all the volumes for a user after creating a data volume
+        list_volumes_after = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"]
+                                         )
+        self.assertIsNotNone(
+                             list_volumes_after,
+                             "Volume creation failed"
+                             )
+        # Verifying the list volume size is increased by 1
+        self.assertEqual(
+                         len(list_volumes_before) + 1,
+                         len(list_volumes_after),
+                         "list volume is not matching with Number of volumes created"
+                         )
+ 
+        # Listing a Root Volume by Id and verifying the volume details
+        list_volumes_by_id = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         id=root_volume.id
+                                         )  
+        self.assertIsNotNone(
+                             list_volumes_by_id,
+                             "Root volume is not listed"
+                             ) 
+        self.assertEqual(
+                         1,
+                         len(list_volumes_by_id),
+                         "list volume is not matching with Number of volumes created"
+                         )
+        obtained_volume = list_volumes_by_id[0]
+ 
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                           "id":root_volume.id,
+                           "name":root_volume.name,
+                           "vmname":self.virtual_machine.name,
+                           "state":"Ready",
+                           "type":"ROOT",
+                           "zoneid":self.zone.id,
+                           "account":self.account.name,
+                           "storagetype":self.storagetype,
+                           "size":self.template.size
+                           }
+        actual_dict = {
+                           "id":obtained_volume.id,
+                           "name":obtained_volume.name,
+                           "vmname":obtained_volume.vmname,
+                           "state":obtained_volume.state,
+                           "type":obtained_volume.type,
+                           "zoneid":obtained_volume.zoneid,
+                           "account":obtained_volume.account,
+                           "storagetype":obtained_volume.storagetype,
+                           "size":obtained_volume.size,
+                           }
+        root_volume_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         root_volume_status,
+                         "Listed Root Volume details are not as expected"
+                         )
+        # Listing a Data Volume by Id and verifying the volume details
+        list_volumes_by_id = Volume.list(
+                                         self.userapiclient,
+                                         listall=self.services["listall"],
+                                         id=volume_created.id
+                                         )  
+        self.assertIsNotNone(
+                             list_volumes_by_id,
+                             "Data volume is not listed"
+                             ) 
+        self.assertEqual(
+                         len(list_volumes_by_id),
+                         1,
+                         "list volume is not matching with Number of volumes created"
+                         )
+        obtained_volume = list_volumes_by_id[0]
+ 
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                           "id":volume_created.id,
+                           "name":volume_created.name,
+                           "state":"Allocated",
+                           "type":"DATADISK",
+                           "zoneid":self.zone.id,
+                           "account":self.account.name,
+                           "storagetype":self.storagetype,
+                           "size":self.disk_offering.disksize
+                           }
+        actual_dict = {
+                           "id":obtained_volume.id,
+                           "name":obtained_volume.name,
+                           "state":obtained_volume.state,
+                           "type":obtained_volume.type,
+                           "zoneid":obtained_volume.zoneid,
+                           "account":obtained_volume.account,
+                           "storagetype":obtained_volume.storagetype,
+                           "size":obtained_volume.size/(1024*1024*1024),
+                           }
+        root_volume_status = self.__verify_values(
+                                                  expected_dict,
+                                                  actual_dict
+                                                  )
+        self.assertEqual(
+                         True,
+                         root_volume_status,
+                         "Listed Data Volume details are not as expected"
+                         )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_03_data_volume_resize(self):
+        """  
+        @summary: Test to verify creation and resize of data volume
+          
+        Step1: Listing the volumes for a user before creating data volume
+        Step2: Creating a data volume
+        Step3: Listing the volumes for a user after creating data volume
+        Step4: Attaching and Detaching data volume created to Virtual Machine
+        Step5: Verifying if there exists a disk offering with higher size
+                If not present creating it
+        Step6: Resizing data volume
+        """
+        # Listing volumes for a user before creating a volume
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        # Creating a data volume
+        volume_created = Volume.create(
+                                       self.userapiclient,
+                                       self.services["volume"],
+                                       zoneid=self.zone.id,
+                                       diskofferingid=self.disk_offering.id
+                                       )
+        self.assertIsNotNone(volume_created, "Data volume creation failed")
+ 
+        self.cleanup.append(volume_created)
+ 
+        # Listing volumes for a user after creating data volume
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Data volume creation failed"
+                          )
+ 
+        # Attaching data volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+ 
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+ 
+        # Detaching data volume from Virtual Machine
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+ 
+        # Verifying if there exists a disk offering with higher size. If not present creating it
+        list_disk_offerings = DiskOffering.list(self.apiClient)
+ 
+        large_disk_offering_exists = False
+        # Converting disk_size in bytes to GB
+        current_disk_size = volume_created.size/(1024*1024*1024)
+ 
+        for disk_offering in list_disk_offerings:
+            if ((disk_offering.disksize > current_disk_size) and (not disk_offering.iscustomized) and disk_offering.storagetype == self.storagetype):
+                new_disk_offering = disk_offering
+                large_disk_offering_exists = True
+                break
+ 
+        if large_disk_offering_exists == False:
+            new_size = (volume_created.size/(1024*1024*1024)) + 1
+            self.services["disk_offering"]["disksize"] = new_size
+            new_disk_offering = DiskOffering.create(
+                                                    self.apiClient,
+                                                    self.services["disk_offering"]
+                                                    )
+            if new_disk_offering is not None:
+                self.cleanup.append(new_disk_offering)
+        else:
+            new_size = new_disk_offering.disksize
+ 
+        # Resizing data volume
+        resized_volume = volume_created.resize(
+                                               self.userapiclient,
+                                               diskofferingid=new_disk_offering.id,
+                                               shrinkok='false',
+                                               )
+        self.assertIsNotNone(resized_volume, "Resize Volume failed")
+        # Verifying data volume size is increased
+        self.assertEquals(
+                          new_size,
+                          (resized_volume.size/(1024*1024*1024)),
+                          "volume not resized to expected value"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_04_custom_volume_resize(self):
+        """  
+        @summary: Test to verify creation and resize of custom volume
+          
+        Step1: Checking if Custom disk offering already exists.
+               If not present then creating custom Disk Offering
+        Step2: Listing the volumes for a user before creating custom volume
+        Step3: Creating a custom volume
+        Step4: Listing the volumes for a user after creating custom volume
+        Step5: Attaching and Detaching custom volume created to Virtual Machine
+        Step6: Resizing custom volume
+        """
+        # Listing all the disk offerings
+        list_disk_offerings = DiskOffering.list(self.apiClient)
+ 
+        custom_disk_offering_exists = False
+ 
+        # Verifying if a custom disk offering already exists
+        if list_disk_offerings is not None:
+            for disk_offering in list_disk_offerings:
+                if (disk_offering.iscustomized and disk_offering.storagetype == self.storagetype):
+                    custom_disk_offering = disk_offering
+                    custom_disk_offering_exists = True
+                    break
+ 
+        # If a custom disk offering does not exists, then creating a custom disk offering
+        if custom_disk_offering_exists == False:
+            custom_disk_offering = DiskOffering.create(
+                                    self.apiClient,
+                                    self.services["disk_offering"],
+                                    custom=True
+                                    )
+            if custom_disk_offering is not None:
+                self.cleanup.append(custom_disk_offering)
+ 
+        # Listing the volumes for a user before creating custom volume
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        # Creating a custom volume
+        volume_created = Volume.create_custom_disk(
+                                    self.userapiclient,
+                                    self.services["custom_volume"],
+                                    account=self.account.name,
+                                    domainid=self.account.domainid,
+                                    diskofferingid=custom_disk_offering.id
+                                    )
+        self.assertIsNotNone(
+                             volume_created,
+                             "Custom volume did not get created"
+                             )
+ 
+        self.cleanup.append(volume_created)
+ 
+        # Listing the volumes for a user after creating custom volume
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        # Verifyign that volume list is increased by 1 after creation of custion volume
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Custom volume did not get created"
+                          )
+ 
+        # Attaching custom volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+ 
+        # Detaching custom volume from Virtual Machine
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+ 
+        # Resizing custom volume
+        # Increasing custom disk size by 1
+        new_size = self.services["custom_volume"]["customdisksize"] + 1
+        resized_volume = volume_created.resize(
+                                               self.userapiclient,
+                                               diskofferingid=custom_disk_offering.id,
+                                               shrinkok='false',
+                                               size=new_size)
+        self.assertIsNotNone(resized_volume, "Resize Volume failed")
+        # Verifying that custom disk size is increased
+        self.assertEquals(
+                          new_size,
+                          (resized_volume.size/(1024*1024*1024)),
+                          "volume not resized to expected value"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_05_volume_snapshot(self):
+        """  
+        @summary: Test to verify creation of snapshot from volume and creation of template, volume from snapshot
+          
+        Step1: Creating a volume
+        Step2: Attaching and Detaching custom volume created to Virtual Machine
+        Step3: Creating Snapshot from volume
+        Step4: Creating Volume from snapshot
+        Step5: Creating Template from Snapshot
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+ 
+        self.assertIsNotNone(volume_created, "Volume not created")
+ 
+        if volume_created is not None:
+            self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+        # Attaching and Detaching custom volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+ 
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+        # Creating Snapshot from volume
+        snapshot_created = Snapshot.create(
+                                           self.userapiclient,
+                                           volume_created.id,
+                                           )
+ 
+        self.assertIsNotNone(snapshot_created, "Snapshot not created")
+ 
+        self.cleanup.append(snapshot_created)
+ 
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                           "id":volume_created.id,
+                           "intervaltype":"MANUAL",
+                           "snapshottype":"MANUAL",
+                           "volumetype":volume_created.type,
+                           "domain":self.domain.id
+                           }
+        actual_dict = {
+                           "id":snapshot_created.volumeid,
+                           "intervaltype":snapshot_created.intervaltype,
+                           "snapshottype":snapshot_created.snapshottype,
+                           "volumetype":snapshot_created.volumetype,
+                           "domain":snapshot_created.domainid,
+                           }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Snapshot created from Volume details are not as expected"
+                         )
+        # Creating Volume from snapshot
+        cmd = createVolume.createVolumeCmd()
+        cmd.name = "-".join([self.services["volume"]["diskname"], random_gen()])
+        cmd.snapshotid = snapshot_created.id
+ 
+        volume_from_snapshot = Volume(self.userapiclient.createVolume(cmd).__dict__)
+ 
+        self.assertIsNotNone(
+                             volume_from_snapshot,
+                             "Volume creation failed from snapshot"
+                             )
+        self.cleanup.append(volume_from_snapshot)
+ 
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                           "snapshotid":snapshot_created.id,
+                           "volumetype":snapshot_created.volumetype,
+                           "size":self.disk_offering.disksize,
+                           "accounr":self.account.name,
+                           "domain":self.domain.id,
+                           "storagetype":self.storagetype,
+                           "zone":self.zone.id
+                           }
+        actual_dict = {
+                           "snapshotid":volume_from_snapshot.snapshotid,
+                           "volumetype":volume_from_snapshot.type,
+                           "size":volume_from_snapshot.size/(1024*1024*1024),
+                           "accounr":volume_from_snapshot.account,
+                           "domain":volume_from_snapshot.domainid,
+                           "storagetype":volume_from_snapshot.storagetype,
+                           "zone":volume_from_snapshot.zoneid,
+                           }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Volume created from Snapshot details are not as expected"
+                         )
+        # Creating Template from Snapshot
+        list_templates_before = Template.list(self.userapiclient, templatefilter='self')
+ 
+        if list_templates_before is None:
+            templates_before_size = 0
+        else:
+            templates_before_size = len(list_templates_before)
+ 
+        cmd = createTemplate.createTemplateCmd()
+        cmd.name = self.services["ostype"]
+        cmd.displaytext = self.services["ostype"]
+        cmd.ostypeid = self.template.ostypeid
+        cmd.snapshotid = snapshot_created.id
+        cmd.ispublic = False
+        cmd.passwordenabled = False
+ 
+        template_from_snapshot = Template(self.userapiclient.createTemplate(cmd).__dict__)
+ 
+        self.assertIsNotNone(
+                             template_from_snapshot,
+                             "Template creation failed from snapshot"
+                             )
+ 
+        self.cleanup.append(template_from_snapshot)
+ 
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                           "name":self.services["ostype"],
+                           "ostypeid":self.template.ostypeid,
+                           "type":"USER",
+                           "zone":self.zone.id,
+                           "domain":self.domain.id,
+                           "account":self.account.name,
+                           "passwordenabled":False,
+                           "ispublic":False,
+                           "size":self.disk_offering.disksize
+                           }
+        actual_dict = {
+                           "name":template_from_snapshot.name,
+                           "ostypeid":template_from_snapshot.ostypeid,
+                           "type":template_from_snapshot.templatetype,
+                           "zone":template_from_snapshot.zoneid,
+                           "domain":template_from_snapshot.domainid,
+                           "account":template_from_snapshot.account,
+                           "passwordenabled":template_from_snapshot.passwordenabled,
+                           "ispublic":template_from_snapshot.ispublic,
+                           "size":template_from_snapshot.size/(1024*1024*1024)
+                           }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Template created from Snapshot details are not as expected"
+                         )
+ 
+        list_templates_after = Template.list(self.userapiclient, templatefilter='self')
+ 
+        self.assertEquals(
+                          templates_before_size + 1,
+                          len(list_templates_after),
+                          "Template creation failed from snapshot"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_06_volume_snapshot_policy_hourly(self):
+        """  
+        @summary: Test to verify creation of Hourly Snapshot policies from volume
+          
+        Step1: Creating a Volume.
+        Step2: Attaching volume created in Step2 to virtual machine
+        Step3: Detaching the volume created in step2 from virtual machine
+        Step4: Listing snapshot policies for a volume created in step1
+        Step5: Creating Hourly snapshot policy
+        Step6: Listing snapshot policies for a volume created in step1 again
+        Step7: Verifyign that the list snapshot policy length is increased by 1
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+ 
+        self.assertIsNotNone(volume_created, "Volume not created")
+        self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+ 
+        # Attaching volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+ 
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        # Detaching volume created from Virtual Machine
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+        # Creating Hourly Snapshot Policy from volume
+        self.services["recurring_snapshot"]["intervaltype"] = 'hourly'
+        self.services["recurring_snapshot"]["schedule"] = '1'
+ 
+        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        snapshot_policy_before_size = 0
+ 
+        if list_snapshot_policy_before is not None:
+            snapshot_policy_before_size = len(list_snapshot_policy_before)
+ 
+        snapshot_policy_hourly = SnapshotPolicy.create(
+                                                       self.userapiclient,
+                                                       volume_created.id,
+                                                       self.services["recurring_snapshot"]
+                                                       )
+        self.assertIsNotNone(
+                             snapshot_policy_hourly,
+                             "Hourly Snapshot policy creation failed"
+                             )
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "schedule":self.services["recurring_snapshot"]["schedule"],
+                         "intervaltype":0,
+                         "volumeid":volume_created.id
+                         }
+        actual_dict = {
+                       "schedule":snapshot_policy_hourly.schedule,
+                       "intervaltype":snapshot_policy_hourly.intervaltype,
+                       "volumeid":snapshot_policy_hourly.volumeid
+                       }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Hourly Snapshot Policy details are not as expected"
+                         )
+ 
+        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        self.assertIsNotNone(
+                             list_snapshot_policy_after,
+                             "Hourly Snapshot policy creation failed"
+                             ) 
+        self.assertEquals(
+                          snapshot_policy_before_size + 1,
+                          len(list_snapshot_policy_after),
+                          "Hourly Snapshot policy creation failed"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_07_volume_snapshot_policy_daily(self):
+        """  
+        @summary: Test to verify creation of Daily Snapshot policies from volume
+          
+        Step1: Creating a Volume.
+        Step2: Attaching volume created in Step2 to virtual machine
+        Step3: Detaching the volume created in step2 from virtual machine
+        Step4: Listing snapshot policies for a volume created in step1
+        Step5: Creating Daily snapshot policy
+        Step6: Listing snapshot policies for a volume created in step1 again
+        Step7: Verifyign that the list snapshot policy length is increased by 1
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+ 
+        self.assertIsNotNone(volume_created, "Volume not created")
+        self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+        # Attaching volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+ 
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        # Detaching volume created from Virtual Machine
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+        # Creating Daily Snapshot Policy from volume
+        self.services["recurring_snapshot"]["intervaltype"] = 'daily'
+        self.services["recurring_snapshot"]["schedule"] = '00:00'
+ 
+        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        snapshot_policy_before_size = 0
+ 
+        if list_snapshot_policy_before is not None:
+            snapshot_policy_before_size = len(list_snapshot_policy_before)
+ 
+        snapshot_policy_daily = SnapshotPolicy.create(
+                                                       self.userapiclient,
+                                                       volume_created.id,
+                                                       self.services["recurring_snapshot"]
+                                                       )
+        self.assertIsNotNone(
+                             snapshot_policy_daily,
+                             "Daily Snapshot policy creation failed"
+                             )
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "schedule":self.services["recurring_snapshot"]["schedule"],
+                         "intervaltype":1,
+                         "volumeid":volume_created.id
+                         }
+        actual_dict = {
+                       "schedule":snapshot_policy_daily.schedule,
+                       "intervaltype":snapshot_policy_daily.intervaltype,
+                       "volumeid":snapshot_policy_daily.volumeid
+                       }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Daily Snapshot Policy details are not as expected"
+                         )
+ 
+        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        self.assertIsNotNone(
+                             list_snapshot_policy_after,
+                             "Daily Snapshot policy creation failed"
+                             )
+        self.assertEquals(
+                          snapshot_policy_before_size + 1,
+                          len(list_snapshot_policy_after),
+                          "Daily Snapshot policy creation failed"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_08_volume_snapshot_policy_weekly(self):
+        """  
+        @summary: Test to verify creation of Weekly Snapshot policies from volume
+          
+        Step1: Creating a Volume.
+        Step2: Attaching volume created in Step2 to virtual machine
+        Step3: Detaching the volume created in step2 from virtual machine
+        Step4: Listing snapshot policies for a volume created in step1
+        Step5: Creating Weekly snapshot policy
+        Step6: Listing snapshot policies for a volume created in step1 again
+        Step7: Verifyign that the list snapshot policy length is increased by 1
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+ 
+        self.assertIsNotNone(volume_created, "Volume not created")
+        self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+ 
+        # Attaching volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        # Detaching volume created to Virtual Machine
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+        # Creating Weekly Snapshot Policy from volume
+        self.services["recurring_snapshot"]["intervaltype"] = 'weekly'
+        self.services["recurring_snapshot"]["schedule"] = '00:00:1'
+ 
+        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        snapshot_policy_before_size = 0
+ 
+        if list_snapshot_policy_before is not None:
+            snapshot_policy_before_size = len(list_snapshot_policy_before)
+ 
+        snapshot_policy_weekly = SnapshotPolicy.create(
+                                                       self.userapiclient,
+                                                       volume_created.id,
+                                                       self.services["recurring_snapshot"]
+                                                       )
+        self.assertIsNotNone(
+                             snapshot_policy_weekly,
+                             "Weekly Snapshot policy creation failed"
+                             )
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "schedule":self.services["recurring_snapshot"]["schedule"],
+                         "intervaltype":2,
+                         "volumeid":volume_created.id
+                         }
+        actual_dict = {
+                       "schedule":snapshot_policy_weekly.schedule,
+                       "intervaltype":snapshot_policy_weekly.intervaltype,
+                       "volumeid":snapshot_policy_weekly.volumeid
+                       }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Weekly Snapshot Policy details are not as expected"
+                         )
+ 
+        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        self.assertIsNotNone(
+                             list_snapshot_policy_after,
+                             "Weekly Snapshot policy creation failed"
+                             )
+        self.assertEquals(
+                          snapshot_policy_before_size + 1,
+                          len(list_snapshot_policy_after),
+                          "Weekly Snapshot policy creation failed"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_09_volume_snapshot_policy_monthly(self):
+        """  
+        @summary: Test to verify creation of Monthly Snapshot policies from volume
+          
+        Step1: Creating a Volume.
+        Step2: Attaching volume created in Step2 to virtual machine
+        Step3: Detaching the volume created in step2 from virtual machine
+        Step4: Listing snapshot policies for a volume created in step1
+        Step5: Creating Monthly snapshot policy
+        Step6: Listing snapshot policies for a volume created in step1 again
+        Step7: Verifyign that the list snapshot policy length is increased by 1
+        Step8: Deleting monthly snapshot policy created in step5
+        Step9: List snapshot policies for a volume again
+        Step10: Verifying that the list snapshot policy length is decreased by 1
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+        self.assertIsNotNone(volume_created, "Volume not created")
+        self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+        # Attaching and Detaching custom volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+        # Creating Monthly Snapshot Policy from volume
+        self.services["recurring_snapshot"]["intervaltype"] = 'monthly'
+        self.services["recurring_snapshot"]["schedule"] = '00:00:1'
+ 
+        list_snapshot_policy_before = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        snapshot_policy_before_size = 0
+ 
+        if list_snapshot_policy_before is not None:
+            snapshot_policy_before_size = len(list_snapshot_policy_before)
+ 
+        snapshot_policy_monthly = SnapshotPolicy.create(
+                                                       self.userapiclient,
+                                                       volume_created.id,
+                                                       self.services["recurring_snapshot"])
+        self.assertIsNotNone(
+                             snapshot_policy_monthly,
+                             "Monthly Snapshot policy creation failed"
+                             )
+        #Creating expected and actual values dictionaries
+        expected_dict = {
+                         "schedule":self.services["recurring_snapshot"]["schedule"],
+                         "intervaltype":3,
+                         "volumeid":volume_created.id
+                         }
+        actual_dict = {
+                       "schedule":snapshot_policy_monthly.schedule,
+                       "intervaltype":snapshot_policy_monthly.intervaltype,
+                       "volumeid":snapshot_policy_monthly.volumeid
+                       }
+        status = self.__verify_values(
+                                      expected_dict,
+                                      actual_dict
+                                      )
+        self.assertEqual(
+                         True,
+                         status,
+                         "Monthly Snapshot Policy details are not as expected"
+                         )
+ 
+        list_snapshot_policy_after = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        self.assertIsNotNone(
+                             list_snapshot_policy_after,
+                             "Monthly Snapshot policy creation failed"
+                             )
+        self.assertEquals(
+                          snapshot_policy_before_size + 1,
+                          len(list_snapshot_policy_after),
+                          "Monthly Snapshot policy creation failed"
+                          )
+        # Deleting monthly snapshot policy 
+        SnapshotPolicy.delete(snapshot_policy_monthly, self.userapiclient)
+ 
+        list_snapshot_policies = SnapshotPolicy.list(self.userapiclient, volumeid=volume_created.id)
+ 
+        self.assertIsNone(
+                          list_snapshot_policies, 
+                          "Deletion of Monthly Snapshot policy failed"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_10_volume_snapshots_pagination(self):
+        """  
+        @summary: Test to verify pagination of snapshots for Volume
+          
+        Step1: Creating a Volume.
+        Step2: Attaching volume created in Step2 to virtual machine
+        Step3: Detaching the volume created in step2 from virtual machine
+        Step4: Listing all the snapshots for a volume
+        Step5: Creating Pagesize + 1 number of snapshots for a volume
+        Step6: Listing all the snapshots for a volume
+        Step7: Verifying that there are pagesize + 1 number of snapshots listsed
+        Step8: Listing all the snapshots in page 1
+        Step9: Listing all the snapshots in page 2
+        Step10: Deleting the snapshot present in page 2
+        Step11: Listign the snapshots from page 2 again and verifyign that list returns none
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        # Creating a Volume 
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+        self.assertIsNotNone(volume_created, "Volume not created")
+        self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+        #Attaching volume to virtual machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        #Detaching volume from virtual machine
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+ 
+        #Creating 3 Snapshots from volume
+        list_snapshot_before = Snapshot.list(
+                                             self.userapiclient,
+                                             volumeid=volume_created.id,
+                                             listall=self.services["listall"]
+                                             )
+        self.assertIsNone(
+                          list_snapshot_before,
+                          "Newly created volume is already having snapshots"
+                          )
+ 
+        list_snapshot_before_size = 0
+        for i in range(0, 3):
+            snapshot_created = Snapshot.create(
+                                       self.userapiclient,
+                                       volume_created.id,
+                                       )
+            self.assertIsNotNone(snapshot_created, "Snapshot not created")
+            self.cleanup.append(snapshot_created)
+      
+            self.assertEquals(
+                              volume_created.id,
+                              snapshot_created.volumeid,
+                              "Snapshot not created for given volume"
+                              )
+ 
+        list_snapshot_after = Snapshot.list(
+                                            self.userapiclient,
+                                            volumeid=volume_created.id,
+                                            listall=self.services["listall"]
+                                            )
+        self.assertEqual(
+                         list_snapshot_before_size+3,
+                         len(list_snapshot_after),
+                         "Number of snapshots created is not matching expected"
+                         )
+        #Listing all the snapshots in page1
+        list_snapshots_page1 = Snapshot.list(
+                                             self.userapiclient,
+                                             volumeid=volume_created.id,
+                                             listall=self.services["listall"],
+                                             page=1,
+                                             pagesize=2
+                                             )
+        self.assertEqual(
+                         2,
+                         len(list_snapshots_page1),
+                         "List snapshots response is not matching with the page size length for page 1"
+                         )
+ 
+        #Listing all the snapshots in page2 and ensuring only 1 snapshot is present 
+        list_snapshots_page2 = Snapshot.list(
+                                             self.userapiclient,
+                                             volumeid=volume_created.id,
+                                             listall=self.services["listall"],
+                                             page=2,
+                                             pagesize=2
+                                             )
+        self.assertEqual(
+                         len(list_snapshots_page2),
+                         1,
+                         "List snapshots response is not matching with the page size length for page 2"
+                         )
+        snapshot_page2 = list_snapshots_page2[0]
+ 
+        # Verifying that the snapshot on page 2 is not present in page1
+        for i in range(0, len(list_snapshots_page1)):
+            snapshot_page1 = list_snapshots_page1[i]
+            self.assertNotEquals(
+                                 snapshot_page2.id,
+                                 snapshot_page1.id,
+                                 "Snapshot listed in page 2 is also listed in page 1"
+                                 )
+        # Deleting a single snapshot and verifying that snapshot does not exists on page 2
+        Snapshot.delete(snapshot_created, self.userapiclient)
+ 
+        list_snapshot_page2 = Snapshot.list(
+                                            self.userapiclient,
+                                            volumeid=volume_created.id,
+                                            listall=self.services["listall"],
+                                            page=2,
+                                            pagesize=2
+                                            )
+        self.assertEqual(
+                         None,
+                         list_snapshot_page2,
+                         "Snapshot was not deleted"
+                         )
+        list_snapshot_page1 = Snapshot.list(
+                                            self.userapiclient,
+                                            volumeid=volume_created.id,
+                                            listall=self.services["listall"],
+                                            page=1,
+                                            pagesize=2
+                                            )
+        self.assertEqual(
+                         2,
+                         len(list_snapshot_page1),
+                         "Snapshots on page 1 are not matching"
+                         )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_11_volume_extract(self):
+        """  
+        @summary: Test to verify extract/download a Volume
+          
+        Step1: Listing Volumes before creating a Volume
+        Step2: Creating a Volume.
+        Step3: Verifying that created volume is not none and adding to clean up
+        Step4: Listing the volumes after creation
+        Step5: Verifying that the list volume size is increased by 1
+        Step6: Attaching volume created in Step2 to virtual machine
+        Step7: Detaching the volume created in step2 from virtual machine
+        Step8: Extracting/Downloadign the volume
+        Step9: Verifyign that a download URL is created for volume download
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertIsNotNone(
+                             list_volumes_before,
+                             "volume not created for the vm launched at class level"
+                             )
+        volume_created = Volume.create(
+                                    self.userapiclient,
+                                    self.services["volume"],
+                                    zoneid=self.zone.id,
+                                    diskofferingid=self.disk_offering.id
+                                    )
+ 
+        self.assertIsNotNone(volume_created, "Volume not created")
+        self.cleanup.append(volume_created)
+ 
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertIsNotNone(
+                             list_volumes_after,
+                             "volume creation failed"
+                             )
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "Volume not created"
+                          )
+        #Attaching and Detaching volume created to Virtual Machine
+        self.virtual_machine.attach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        attached_volume = list_volumes[0]
+ 
+        self.assertIsNotNone(
+                             attached_volume.vmname,
+                             "VM is not attached to Volume"
+                             )
+        self.assertEquals(
+                          self.virtual_machine.name,
+                          attached_volume.vmname,
+                          "VM Name is not matching with attached vm"
+                          )
+        self.virtual_machine.detach_volume(
+                                           self.userapiclient,
+                                           volume_created
+                                           )
+        list_volumes = Volume.list(
+                                   self.userapiclient,
+                                   listall=self.services["listall"],
+                                   id=volume_created.id
+                                   )
+        detached_volume = list_volumes[0]
+        self.assertIsNone(
+                          detached_volume.vmname,
+                          "VM is not detached from volume"
+                          )
+        #Extract/Download the volume
+        self.services["mode"] = "HTTP_DOWNLOAD"
+ 
+        extract_volume_response = Volume.extract(
+                                                 self.userapiclient,
+                                                 volume_created.id,
+                                                 self.zone.id,
+                                                 self.services["mode"]
+                                                 )
+        self.assertIsNotNone(extract_volume_response, "Extract/Download volume failed")
+ 
+        self.assertEquals(
+                          "DOWNLOAD_URL_CREATED",
+                          extract_volume_response.state,
+                          "Failed to create Download URL"
+                          )
+        self.assertIsNotNone(
+                             extract_volume_response.url,
+                             "Extract/Download volume URL is NULL"
+                             )
+        self.assertTrue(
+                        (extract_volume_response.url.find("http")!=-1),
+                        "Extract/Download volume URL doesnot contain http"
+                        )
+        self.assertEquals(
+                          volume_created.id,
+                          extract_volume_response.id,
+                          "Extracted/Downloaded volume is not matching with original volume"
+                          )
+        return
+ 
+    @attr(tags=["advanced", "basic", "provisioning"])
+    def test_12_volume_upload(self):
+        """  
+        @summary: Test to verify upload volume
+         
+        Step1: Listing the volumes for a user before uploading volume
+        Step2: Uploading a volume
+        Step3: Listing the volumes for a user after uploading data volume
+        Step4: Verifying that the list volume length after upload is increased by 1
+        """
+        list_volumes_before = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertIsNotNone(
+                             list_volumes_before,
+                             "volume not created for the vm launched at class level"
+                             )
+        #Uploading a Volume
+        volume_uploaded = Volume.upload(
+                                       self.userapiclient,
+                                       self.services["upload_volume"],
+                                       self.zone.id
+                                       )
+        self.assertIsNotNone(volume_uploaded, "volume uploading failed")
+ 
+        self.assertEquals(
+                          self.services["upload_volume"]["diskname"],
+                          volume_uploaded.name,
+                          "Uploaded volume name is not matching with name provided while uploading")
+ 
+        #Listing the volumes for a user after uploading data volume
+        list_volumes_after = Volume.list(self.userapiclient, listall=self.services["listall"])
+ 
+        self.assertIsNotNone(
+                             list_volumes_after,
+                             "volume not created for the vm launched at class level"
+                             )
+        #Asserting that the list volume length after upload is increased by 1
+        self.assertEquals(
+                          len(list_volumes_before) + 1,
+                          len(list_volumes_after),
+                          "upload volume failed"
+                          )
+        return
\ No newline at end of file


[12/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6736: Added version informatoin, fixed data corruption, regression issues.

Signed-off-by: Jayapal <ja...@apache.org>
(cherry picked from commit e5de1cb7c2ad98307edf4983ffe7b23be5f12d3b)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e75b1acf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e75b1acf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e75b1acf

Branch: refs/heads/4.4
Commit: e75b1acf0528987052684e40e9351646b51ec528
Parents: b38fcfe
Author: santhosh <sa...@gmail.com>
Authored: Wed May 21 19:59:44 2014 +1000
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:42 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_deploy_vm.py        |  3 +-
 test/integration/smoke/test_guest_vlan_range.py |  8 +--
 test/integration/smoke/test_hosts.py            |  2 +-
 test/integration/smoke/test_vm_life_cycle.py    | 52 +++++++-------------
 tools/marvin/marvin/cloudstackTestClient.py     |  4 +-
 tools/marvin/setup.py                           |  8 +--
 6 files changed, 30 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e75b1acf/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
index c872558..8d0a0ed 100644
--- a/test/integration/smoke/test_deploy_vm.py
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -85,7 +85,8 @@ class TestDeployVM(cloudstackTestCase):
             serviceofferingid=self.service_offering.id,
             templateid=self.template.id
         )
-
+        if not self.virtual_machine:
+            self.fail("Deploying a Virtual Machine Failed")
         list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
         self.debug(
             "Verify listVirtualMachines response for virtual machine: %s"\

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e75b1acf/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index bfef4a8..f5bcdf4 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -31,7 +31,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
     @classmethod
     def setUpClass(cls):
         testClient = super(TestDedicateGuestVlanRange, cls).getClsTestClient()
-        cls.apiclient = testClient.getApiClient() 
+        cls.apiclient = testClient.getApiClient()
         cls.services = testClient.getParsedTestDataConfig()
 
         # Get Zone, Domain
@@ -78,7 +78,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["simulator", "advanced", "guestvlanrange", "dedicate", "release", "selfservice"])
+    @attr(tags=["simulator", "advanced", "guestvlanrange", "dedicate", "release", "selfservice"],BugId="CLOUDSTACK-6738")
     def test_dedicateGuestVlanRange(self):
         """Test guest vlan range dedication
         """
@@ -97,11 +97,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
         """
         self.debug("Adding guest vlan range")
 
-
-        print "existing vlna = %s" %self.physical_network.vlan
-        print "free vlan = %s" %self.free_vlan
         new_vlan = self.physical_network.vlan + "," + self.free_vlan["partial_range"][0]
-        print "new vlan = %s" % new_vlan
         #new_vlan = self.free_vlan["partial_range"][0]
         addGuestVlanRangeResponse = self.physical_network.update(self.apiclient,
                 id=self.physical_network.id, vlan=new_vlan)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e75b1acf/test/integration/smoke/test_hosts.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py
index 7798c8e..952f160 100644
--- a/test/integration/smoke/test_hosts.py
+++ b/test/integration/smoke/test_hosts.py
@@ -53,7 +53,7 @@ class TestHosts(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["selfservice"])
+    #@attr(tags=["selfservice"])
     def test_01_clusters(self):
         """Test Add clusters & hosts - simulator
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e75b1acf/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 85033c5..1e56571 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -531,34 +531,24 @@ class TestVMLifeCycle(cloudstackTestCase):
 
         self.vm_to_migrate.migrate(self.apiclient, migrate_host.id)
 
-        list_vm_response = VirtualMachine.list(
-                                            self.apiclient,
-                                            id=self.vm_to_migrate.id
-                                            )
-        self.assertNotEqual(
-                            list_vm_response,
-                            None,
-                            "Check virtual machine is listed"
-                        )
-
-        vm_response = list_vm_response[0]
-
-        self.assertEqual(
-                            vm_response.id,
-                            self.vm_to_migrate.id,
-                            "Check virtual machine ID of migrated VM"
-                        )
-
-        self.assertEqual(
-                            vm_response.hostid,
-                            migrate_host.id,
-                            "Check destination hostID of migrated VM"
-                        )
+        retries_cnt = 3
+        while retries_cnt >=0:
+            list_vm_response = VirtualMachine.list(self.apiclient,
+                                                   id=self.vm_to_migrate.id)
+            self.assertNotEqual(
+                                list_vm_response,
+                                None,
+                                "Check virtual machine is listed"
+                               )
+            vm_response = list_vm_response[0]
+            self.assertEqual(vm_response.id,self.vm_to_migrate.id,"Check virtual machine ID of migrated VM")
+            self.assertEqual(vm_response.hostid,migrate_host.id,"Check destination hostID of migrated VM")
+            retries_cnt = retries_cnt - 1
         return
 
     @attr(configuration = "expunge.interval")
     @attr(configuration = "expunge.delay")
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"],BugId="CLOUDSTACK-6708")
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"],BugId="CLOUDSTACK-6738")
     def test_09_expunge_vm(self):
         """Test destroy(expunge) Virtual Machine
         """
@@ -592,19 +582,15 @@ class TestVMLifeCycle(cloudstackTestCase):
                                                 self.apiclient,
                                                 id=self.small_virtual_machine.id
                                                 )
-            if list_vm_response:
-                time.sleep(expunge_cycle)
-                wait_time = wait_time - expunge_cycle
-            else:
+            if not list_vm_response:
                 break
+            self.debug("Waiting for VM to expunge")
+            time.sleep(expunge_cycle)
+            wait_time = wait_time - expunge_cycle
 
         self.debug("listVirtualMachines response: %s" % list_vm_response)
 
-        self.assertEqual(
-                        list_vm_response,
-                        None,
-                        "Check Expunged virtual machine is in listVirtualMachines response"
-                    )
+        self.assertEqual(list_vm_response,None,"Check Expunged virtual machine is in listVirtualMachines response")
         return
 
     @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e75b1acf/tools/marvin/marvin/cloudstackTestClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py
index 29a298b..1ca79ee 100644
--- a/tools/marvin/marvin/cloudstackTestClient.py
+++ b/tools/marvin/marvin/cloudstackTestClient.py
@@ -25,6 +25,7 @@ from marvin.configGenerator import ConfigManager
 from marvin.cloudstackException import GetDetailExceptionInfo
 from marvin.lib.utils import (random_gen, validateList)
 from marvin.cloudstackAPI.cloudstackAPIClient import CloudStackAPIClient
+import copy
 
 class CSTestClient(object):
 
@@ -82,8 +83,7 @@ class CSTestClient(object):
                 Tests are to Run
         @Output : Returns the Parsed Test Data Dictionary
         '''
-        out = self.__parsedTestDataConfig
-        return out
+        return copy.deepcopy(self.__parsedTestDataConfig)
 
     def getZoneForTests(self):
         '''

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e75b1acf/tools/marvin/setup.py
----------------------------------------------------------------------
diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py
index 4c775ad..b7a927e 100644
--- a/tools/marvin/setup.py
+++ b/tools/marvin/setup.py
@@ -52,10 +52,10 @@ setup(name="Marvin",
                 "marvin.sandbox.basic"],
       license="LICENSE.txt",
       install_requires=[
-          "mysql-connector-python",
-          "requests",
-          "paramiko",
-          "nose",
+          "mysql-connector-python >= 1.1.6",
+          "requests >= 2.2.1",
+          "paramiko >= 1.13.0",
+          "nose >= 1.3.3",
           "ddt >= 0.4.0"
       ],
       py_modules=['marvin.marvinPlugin'],


[19/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-6914: Fixed the Issue

Signed-off-by: Abhinandan Prateek <ap...@apache.org>
(cherry picked from commit 54e4c075287957821e57368f1baf401761f7bda2)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/45db2348
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/45db2348
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/45db2348

Branch: refs/heads/4.4
Commit: 45db2348ded7eaea4e45f17784cacafc7a9d9d64
Parents: 63feb45
Author: Santhosh Edukulla <sa...@gmail.com>
Authored: Mon Jun 16 16:06:59 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:47 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_affinity_groups.py  |   2 +-
 .../smoke/test_deploy_vgpu_enabled_vm.py        | 129 +++++--------------
 test/integration/smoke/test_deploy_vm.py        |   8 +-
 .../smoke/test_deploy_vm_root_resize.py         |   6 +-
 .../smoke/test_deploy_vm_with_userdata.py       |   4 +-
 ...deploy_vms_with_varied_deploymentplanners.py |   6 +-
 test/integration/smoke/test_disk_offerings.py   |   6 +-
 test/integration/smoke/test_global_settings.py  |   2 +-
 test/integration/smoke/test_guest_vlan_range.py |   2 +-
 test/integration/smoke/test_internal_lb.py      |   2 +-
 test/integration/smoke/test_iso.py              |   2 +-
 test/integration/smoke/test_loadbalance.py      |   6 +-
 .../smoke/test_multipleips_per_nic.py           |   2 +-
 test/integration/smoke/test_network.py          |  14 +-
 test/integration/smoke/test_network_acl.py      |   2 +-
 test/integration/smoke/test_nic.py              |   2 +-
 .../smoke/test_non_contigiousvlan.py            |   4 +-
 .../integration/smoke/test_over_provisioning.py |   2 +-
 .../integration/smoke/test_portable_publicip.py |   4 +-
 test/integration/smoke/test_primary_storage.py  |   4 +-
 test/integration/smoke/test_privategw_acl.py    |   2 +-
 test/integration/smoke/test_public_ip_range.py  |   2 +-
 test/integration/smoke/test_pvlan.py            |   2 +-
 test/integration/smoke/test_regions.py          |   2 +-
 .../smoke/test_reset_vm_on_reboot.py            |   2 +-
 test/integration/smoke/test_resource_detail.py  |   2 +-
 test/integration/smoke/test_routers.py          |  18 +--
 test/integration/smoke/test_scale_vm.py         |   2 +-
 .../integration/smoke/test_secondary_storage.py |   4 +-
 .../integration/smoke/test_service_offerings.py |   8 +-
 test/integration/smoke/test_snapshots.py        |   3 +-
 test/integration/smoke/test_ssvm.py             |  20 +--
 test/integration/smoke/test_templates.py        |  16 +--
 test/integration/smoke/test_vm_ha.py            |   2 +-
 test/integration/smoke/test_vm_life_cycle.py    |  24 ++--
 test/integration/smoke/test_vm_snapshots.py     |   6 +-
 test/integration/smoke/test_volumes.py          |  18 +--
 test/integration/smoke/test_vpc_vpn.py          |   4 +-
 tools/marvin/marvin/config/test_data.py         |  68 ++++++++++
 39 files changed, 208 insertions(+), 206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index bb0a524..c1c5d5b 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -75,7 +75,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
         ]
         return
 
-    @attr(tags=["simulator", "basic", "advanced", "multihost", "selfservice"])
+    @attr(tags=["basic", "advanced", "multihost"], required_hardware="false")
     def test_DeployVmAntiAffinityGroup(self):
         """
         test DeployVM in anti-affinity groups

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
index fa33bdc..13c1e5e 100644
--- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
+++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
@@ -18,7 +18,7 @@
 #Test from the Marvin - Testing in Python wiki
 
 #All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase, unittest
 
 #Import Integration Libraries
 
@@ -29,121 +29,56 @@ from marvin.lib.base import Account, VirtualMachine, ServiceOffering
 from marvin.lib.utils import cleanup_resources
 
 #common - commonly used methods for all tests are listed here
-from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.lib.common import get_zone, get_domain, get_template, list_hosts
 
-from marvin.codes import FAILED
+from marvin.sshClient import SshClient
 
-from nose.plugins.attrib import attr
-
-
-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",
-                },
-                "vgpu260q":   # Create a virtual machine instance with vgpu type as 260q
-                {
-                    "displayname": "testserver",
-                    "username": "root", # VM creds for SSH
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-                "vgpu140q":   # Create a virtual machine instance with vgpu type as 140q
-                {
-                    "displayname": "testserver",
-                    "username": "root",
-                    "password": "password",
-                    "ssh_port": 22,
-                    "hypervisor": 'XenServer',
-                    "privateport": 22,
-                    "publicport": 22,
-                    "protocol": 'TCP',
-                },
-                "service_offerings":
-                {
-                 "vgpu260qwin":
-                   {
-                        "name": "Windows Instance with vGPU260Q",
-                        "displaytext": "Windows Instance with vGPU260Q",
-                        "cpunumber": 2,
-                        "cpuspeed": 1600, # in MHz
-                        "memory": 3072, # In MBs
-                    },
-                 "vgpu140qwin":
-                    {
-                     # Small service offering ID to for change VM
-                     # service offering from medium to small
-                        "name": "Windows Instance with vGPU140Q",
-                        "displaytext": "Windows Instance with vGPU140Q",
-                        "cpunumber": 2,
-                        "cpuspeed": 1600,
-                        "memory": 3072,
-                    }
-                },
-            "diskdevice": ['/dev/vdc',  '/dev/vdb', '/dev/hdb', '/dev/hdc', '/dev/xvdd', '/dev/cdrom', '/dev/sr0', '/dev/cdrom1' ],
-            # Disk device where ISO is attached to instance
-            "mount_dir": "/mnt/tmp",
-            "sleep": 60,
-            "timeout": 10,
-            #Migrate VM to hostid
-            "ostype": 'Windows 7 (32-bit)',
-            # CentOS 5.3 (64-bit)
-        }
+from marvin.codes import FAILED, XEN_SERVER
 
+from nose.plugins.attrib import attr
 
 class TestDeployvGPUenabledVM(cloudstackTestCase):
-    """Test deploy a vGPU enabled VM into a user account
     """
+    Test deploy a vGPU enabled VM into a user account
+    """
+    @classmethod
+    def setUpClass(cls):
+        testClient = super(TestDeployvGPUenabledVM, cls).getClsTestClient()
+        #Need to add check whether zone containing the xen hypervisor or not as well
+        hypervisor = testClient.getHypervisorInfo()
+        if hypervisor.lower() != XEN_SERVER.lower():
+            raise unittest.skipTest("GPU feature is supported only on XenServer")
+
 
     def setUp(self):
-        self.services = Services().services
+        self.testdata = self.testClient.getParsedTestDataConfig()["vgpu"]
         self.apiclient = self.testClient.getApiClient()
 
         # Get Zone, Domain and Default Built-in template
         self.domain = get_domain(self.apiclient)
         self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
-        self.services["mode"] = self.zone.networktype
+        self.testdata["mode"] = self.zone.networktype
         # Before running this test, register a windows template with ostype as 'Windows 7 (32-bit)'
-        self.services["ostype"] = 'Windows 7 (32-bit)'
-        self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"])
+        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
 
         if self.template == FAILED:
-            assert False, "get_template() failed to return template with description %s" % self.services["ostype"]
+            assert False, "get_template() failed to return template with description %s" % self.testdata["ostype"]
         #create a user account
         self.account = Account.create(
             self.apiclient,
-            self.services["account"],
+            self.testdata["account"],
             domainid=self.domain.id
         )
 
-        self.services["vgpu260q"]["zoneid"] = self.zone.id
-        self.services["vgpu260q"]["template"] = self.template.id
+        self.testdata["vgpu260q"]["zoneid"] = self.zone.id
+        self.testdata["vgpu260q"]["template"] = self.template.id
 
-        self.services["vgpu140q"]["zoneid"] = self.zone.id
-        self.services["vgpu140q"]["template"] = self.template.id
+        self.testdata["vgpu140q"]["zoneid"] = self.zone.id
+        self.testdata["vgpu140q"]["template"] = self.template.id
         #create a service offering
         self.service_offering = ServiceOffering.create(
                 self.apiclient,
-                self.services["service_offerings"]["vgpu260qwin"],
+                self.testdata["service_offerings"]["vgpu260qwin"],
                 serviceofferingdetails={'pciDevice': 'VGPU'}
         )
         #build cleanup list
@@ -152,7 +87,7 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
             self.account
         ]
 
-        @attr(tags = ['advanced', 'simulator', 'basic', 'vgpu', 'provisioning'], BugId="CLOUDSTACK-6876")
+    @attr(tags = ['advanced', 'basic', 'vgpu'], required_hardware="true",  BugId="CLOUDSTACK-6876")
     def test_deploy_vgpu_enabled_vm(self):
         """Test Deploy Virtual Machine
 
@@ -163,11 +98,11 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
         """
         self.virtual_machine = VirtualMachine.create(
             self.apiclient,
-            self.services["vgpu260q"],
+            self.testdata["vgpu260q"],
             accountid=self.account.name,
             domainid=self.account.domainid,
             serviceofferingid=self.service_offering.id,
-            mode=self.services['mode']
+            mode=self.testdata['mode']
         )
 
         list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
@@ -204,13 +139,13 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
             "Running",
             msg="VM is not in Running state"
         )
-        list_hosts = list_hosts(
+        hosts = list_hosts(
                self.apiclient,
                id=vm.hostid
                )
-        hostip = list_hosts[0].ipaddress
+        hostip = hosts[0].ipaddress
         try:
-            sshClient = SshClient(host=hostip, port=22, user='root',passwd=self.services["host_password"])
+            sshClient = SshClient(host=hostip, port=22, user='root',passwd=self.testdata["host_password"])
             res = sshClient.execute("xe vgpu-list vm-name-label=%s params=type-uuid %s" % (
                                    vm.instancename
                                  ))
@@ -230,4 +165,4 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
         try:
             cleanup_resources(self.apiclient, self.cleanup)
         except Exception as e:
-            self.debug("Warning! Exception in tearDown: %s" % e)
\ No newline at end of file
+            self.debug("Warning! Exception in tearDown: %s" % e)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
index 8d0a0ed..ed5dfaf 100644
--- a/test/integration/smoke/test_deploy_vm.py
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -68,7 +68,7 @@ class TestDeployVM(cloudstackTestCase):
             self.account
         ]
 
-    @attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'selfservice'])
+    @attr(tags = ['advanced','basic', 'sg'], required_hardware="false")
     def test_deploy_vm(self):
         """Test Deploy Virtual Machine
 
@@ -111,7 +111,7 @@ class TestDeployVM(cloudstackTestCase):
             msg="VM is not in Running state"
         )
 
-    @attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'selfservice'])
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="false")
     def test_deploy_vm_multiple(self):
         """Test Multiple Deploy Virtual Machine
 
@@ -206,7 +206,7 @@ class TestDeployVMVolumeCreationFailure(cloudstackTestCase):
             self.mock_volume_failure
         ]
 
-    @attr(tags = ['selfservice'],BugId="CLOUDSTACK-6873")
+    @attr(tags = ['advanced'], BugId="CLOUDSTACK-6873", required_hardware="false")
     def test_deploy_vm_volume_creation_failure(self):
         """Test Deploy Virtual Machine - volume creation failure and retry
 
@@ -317,7 +317,7 @@ class TestDeployVMStartFailure(cloudstackTestCase):
             self.mock_start_failure
         ]
 
-    @attr(tags = ['selfservice'],BugId="CLOUDSTACK-6873")
+    @attr(tags = ['advanced'], BugId="CLOUDSTACK-6873", required_hardware="false")
     def test_deploy_vm_start_failure(self):
         """Test Deploy Virtual Machine - start operation failure and retry
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_deploy_vm_root_resize.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index 5d73876..0f0ddcc 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -103,7 +103,7 @@ class TestDeployVM(cloudstackTestCase):
             self.account
         ]
 
-    @attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'provisioning'])
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true")
     def test_00_deploy_vm_root_resize(self):
         """Test deploy virtual machine with root resize
 
@@ -204,7 +204,7 @@ class TestDeployVM(cloudstackTestCase):
 
             self.assertEqual(success, True, "Check if unsupported hypervisor %s fails appropriately" % self.hypervisor)
 
-    @attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'provisioning'])
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true")
     def test_01_deploy_vm_root_resize(self):
         """Test proper failure to deploy virtual machine with rootdisksize of 0 
         """
@@ -233,7 +233,7 @@ class TestDeployVM(cloudstackTestCase):
         else:
             self.debug("test 01 does not support hypervisor type " + self.hypervisor);
 
-    @attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'provisioning'])
+    @attr(tags = ['advanced', 'basic', 'sg'], required_hardware="true")
     def test_02_deploy_vm_root_resize(self):
         """Test proper failure to deploy virtual machine with rootdisksize less than template size
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_deploy_vm_with_userdata.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 7616b82..c98b38a 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -70,7 +70,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
     def setup(self):
             self.hypervisor = self.testClient.getHypervisorInfo()
 
-    @attr(tags=["simulator", "devcloud", "basic", "advanced", "post", "provisioning"])
+    @attr(tags=["devcloud", "basic", "advanced", "post"], required_hardware="true")
     def test_deployvm_userdata_post(self):
         """Test userdata as POST, size > 2k
         """
@@ -95,7 +95,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
         self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
         self.assert_(vm.state == "Running", "VM is not in Running state")
 
-    @attr(tags=["simulator", "devcloud", "basic", "advanced", "provisioning"])
+    @attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
     def test_deployvm_userdata(self):
         """Test userdata as GET, size > 2k
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index 420925e..9fcb643 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -60,7 +60,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
             cls.account
         ]
 
-    @attr(tags=["simulator", "advanced", "basic", "sg", "selfservice"])
+    @attr(tags=["advanced", "basic", "sg"], required_hardware="false")
     def test_deployvm_firstfit(self):
         """Test to deploy vm with a first fit offering
         """
@@ -104,7 +104,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
             msg="VM is not in Running state"
         )
 
-    @attr(tags=["simulator", "advanced", "basic", "sg", "selfservice"])
+    @attr(tags=["advanced", "basic", "sg"], required_hardware="false")
     def test_deployvm_userdispersing(self):
         """Test deploy VMs using user dispersion planner
         """
@@ -163,7 +163,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
             self.debug("VMs (%s, %s) meant to be dispersed are deployed in the same cluster %s" % (
             vm1.id, vm2.id, vm1clusterid))
 
-    @attr(tags=["simulator", "advanced", "basic", "sg", "selfservice"])
+    @attr(tags=["advanced", "basic", "sg"], required_hardware="false")
     def test_deployvm_userconcentrated(self):
         """Test deploy VMs using user concentrated planner
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_disk_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_disk_offerings.py b/test/integration/smoke/test_disk_offerings.py
index 45f438f..69a252b 100644
--- a/test/integration/smoke/test_disk_offerings.py
+++ b/test/integration/smoke/test_disk_offerings.py
@@ -45,7 +45,7 @@ class TestCreateDiskOffering(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false")
     def test_01_create_disk_offering(self):
         """Test to create disk offering
 
@@ -132,7 +132,7 @@ class TestDiskOfferings(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke", "selfservice"])
+    @attr(tags=["advanced", "basic", "eip", "sg", "advancedns",  "smoke"], required_hardware="false")
     def test_02_edit_disk_offering(self):
         """Test to update existing disk offering
 
@@ -184,7 +184,7 @@ class TestDiskOfferings(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke", "selfservice"])
+    @attr(tags=["advanced", "basic", "eip", "sg", "advancedns", "smoke"], required_hardware="false")
     def test_03_delete_disk_offering(self):
         """Test to delete disk offering
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_global_settings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_global_settings.py b/test/integration/smoke/test_global_settings.py
index ace2db3..4920421 100644
--- a/test/integration/smoke/test_global_settings.py
+++ b/test/integration/smoke/test_global_settings.py
@@ -32,7 +32,7 @@ class TestUpdateConfigWithScope(cloudstackTestCase):
     def setUp(self):
         self.apiClient = self.testClient.getApiClient()
 
-    @attr(tags=["simulator", "devcloud", "basic", "advanced", "selfservice"])
+    @attr(tags=["devcloud", "basic", "advanced"], required_hardware="false")
     def test_UpdateConfigParamWithScope(self):
         """
         test update configuration setting at zone level scope

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index f5bcdf4..000d71e 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -78,7 +78,7 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["simulator", "advanced", "guestvlanrange", "dedicate", "release", "selfservice"],BugId="CLOUDSTACK-6738")
+    @attr(tags=["advanced", "guestvlanrange", "dedicate", "release"], BugId="CLOUDSTACK-6738", required_hardware="false")
     def test_dedicateGuestVlanRange(self):
         """Test guest vlan range dedication
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_internal_lb.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index d6f3477..d2e6364 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -56,7 +56,7 @@ class TestInternalLb(cloudstackTestCase):
                           cls.account.id))
         cls.cleanup = [cls.account]
 
-    @attr(tags=["smoke", "advanced", "provisioning"])
+    @attr(tags=["smoke", "advanced"], required_hardware="true")
     def test_internallb(self):
         """Test create, delete, assign, remove of internal loadbalancer
         """   

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index d394c27..7c4bf02 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -75,7 +75,7 @@ class TestCreateIso(cloudstackTestCase):
 
         return
 
-    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke", "selfservice"], BugId="CLOUDSTACK-6769, CLOUDSTACK-6774")
+    @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "smoke"], BugId="CLOUDSTACK-6769, CLOUDSTACK-6774", required_hardware="false")
     def test_01_create_iso(self):
         """Test create public & private ISO
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_loadbalance.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py
index daa5fee..f662974 100644
--- a/test/integration/smoke/test_loadbalance.py
+++ b/test/integration/smoke/test_loadbalance.py
@@ -143,7 +143,7 @@ class TestLoadBalance(cloudstackTestCase):
         time.sleep(10)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_01_create_lb_rule_src_nat(self):
         """Test to create Load balancing rule with source NAT"""
 
@@ -303,7 +303,7 @@ class TestLoadBalance(cloudstackTestCase):
             self.try_ssh(src_nat_ip_addr.ipaddress, hostnames)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_02_create_lb_rule_non_nat(self):
         """Test to create Load balancing rule with non source NAT"""
 
@@ -421,7 +421,7 @@ class TestLoadBalance(cloudstackTestCase):
             self.try_ssh(self.non_src_nat_ip.ipaddress.ipaddress, hostnames)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_assign_and_removal_lb(self):
         """Test for assign & removing load balancing rule"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_multipleips_per_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_multipleips_per_nic.py b/test/integration/smoke/test_multipleips_per_nic.py
index ad3a3cf..4093356 100644
--- a/test/integration/smoke/test_multipleips_per_nic.py
+++ b/test/integration/smoke/test_multipleips_per_nic.py
@@ -122,7 +122,7 @@ class TestDeployVM(cloudstackTestCase):
             msg="VM is not in Running state"
         )
 
-    @attr(tags = ['advanced', 'simulator', 'basic', "provisioning"])
+    @attr(tags = ['advanced',  'basic'], required_hardware="false")
     def test_nic_secondaryip_add_remove(self):
     #TODO: SIMENH: add verification
         list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 4100878..cfe9c18 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -115,7 +115,7 @@ class TestPublicIP(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_public_ip_admin_account(self):
         """Test for Associate/Disassociate public IP address for admin account"""
 
@@ -165,7 +165,7 @@ class TestPublicIP(cloudstackTestCase):
             self.fail("list public ip response is not empty")
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_public_ip_user_account(self):
         """Test for Associate/Disassociate public IP address for user account"""
 
@@ -278,7 +278,7 @@ class TestPortForwarding(cloudstackTestCase):
         cleanup_resources(self.apiclient, self.cleanup)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_01_port_fwd_on_src_nat(self):
         """Test for port forwarding on source NAT"""
 
@@ -405,7 +405,7 @@ class TestPortForwarding(cloudstackTestCase):
                                             )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_02_port_fwd_on_non_src_nat(self):
         """Test for port forwarding on non source NAT"""
 
@@ -617,7 +617,7 @@ class TestRebootRouter(cloudstackTestCase):
                         ]
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_reboot_router(self):
         """Test for reboot router"""
 
@@ -773,7 +773,7 @@ class TestReleaseIP(cloudstackTestCase):
     def tearDown(self):
         cleanup_resources(self.apiclient, self.cleanup)
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_releaseIP(self):
         """Test for release public IP address"""
 
@@ -898,7 +898,7 @@ class TestDeleteAccount(cloudstackTestCase):
         self.cleanup = []
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_delete_account(self):
         """Test for delete account"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_network_acl.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py
index 68e5067..015ebab 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -54,7 +54,7 @@ class TestNetworkACL(cloudstackTestCase):
                           cls.account.id))
         cls.cleanup = [cls.account]
 
-    @attr(tags=["advanced", "provisioning"])
+    @attr(tags=["advanced"], required_hardware="true")
     def test_network_acl(self):
         #TODO: SIMENH: add actual verification Logic for rules.
         """Test network ACL lists and items in VPC"""

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index 592a839..dd6de96 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -119,7 +119,7 @@ class TestNic(cloudstackTestCase):
         except Exception as ex:
             self.debug("Exception during NIC test SETUP!: " + str(ex))
 
-    @attr(tags = ["devcloud",  "smoke", "advanced", "advancedns", "provisioning"])
+    @attr(tags = ["devcloud",  "smoke", "advanced", "advancedns"], required_hardware="true")
     def test_01_nic(self):
         #TODO: SIMENH: add validation
         """Test to add and update added nic to a virtual machine"""

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_non_contigiousvlan.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py
index 50b48d0..7469829 100644
--- a/test/integration/smoke/test_non_contigiousvlan.py
+++ b/test/integration/smoke/test_non_contigiousvlan.py
@@ -21,7 +21,7 @@ from marvin.lib.base import PhysicalNetwork
 from marvin.lib.common import setNonContiguousVlanIds, get_zone
 from nose.plugins.attrib import attr
 
-@attr(tags = ["simulator", "advanced", "selfservice"], BugId="CLOUDSTACK-6776")
+
 class TestUpdatePhysicalNetwork(cloudstackTestCase):
     """
     Test to extend physical network vlan range
@@ -38,7 +38,7 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
             raise Exception("Failed to set non contiguous vlan ids to test. Free some ids from \
                         from existing physical networks at ends")
 
-
+    @attr(tags = ["advanced"], BugId="CLOUDSTACK-6776", required_hardware="false")
     def test_extendPhysicalNetworkVlan(self):
         """
         Test to update a physical network and extend its vlan

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_over_provisioning.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_over_provisioning.py b/test/integration/smoke/test_over_provisioning.py
index 1c5d8a5..43d558e 100644
--- a/test/integration/smoke/test_over_provisioning.py
+++ b/test/integration/smoke/test_over_provisioning.py
@@ -32,7 +32,7 @@ class TestUpdateOverProvision(cloudstackTestCase):
     def setUp(self):
         self.apiClient = self.testClient.getApiClient()
 
-    @attr(tags=["simulator", "devcloud", "basic", "advanced", "selfservice"])
+    @attr(tags=["devcloud", "basic", "advanced"], required_hardware="false")
     def test_UpdateStorageOverProvisioningFactor(self):
         """
         test update configuration setting at storage scope

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_portable_publicip.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py
index 2d02a71..be37773 100644
--- a/test/integration/smoke/test_portable_publicip.py
+++ b/test/integration/smoke/test_portable_publicip.py
@@ -75,7 +75,7 @@ class TestPortablePublicIPRange(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["simulator", "basic", "advanced",  "portablepublicip", "selfservice"])
+    @attr(tags = ["basic", "advanced",  "portablepublicip"], required_hardware="false")
     def test_createPortablePublicIPRange(self):
         """ Test to create a portable public ip range
         """
@@ -161,7 +161,7 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["simulator", "advanced",  "portablepublicip", "selfservice"])
+    @attr(tags = ["advanced",  "portablepublicip"], required_hardware="false")
     def test_createPortablePublicIPAcquire(self):
         """ Test to acquire a provisioned public ip range
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 3c1aa62..f5a666e 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -51,7 +51,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"], BugId="CLOUDSTACK-6770")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], BugId="CLOUDSTACK-6770", required_hardware="false")
     def test_01_primary_storage_nfs(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """
@@ -144,7 +144,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             return
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"], BugId="CLOUDSTACK-6770")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], BugId="CLOUDSTACK-6770", required_hardware="false")
     def test_01_primary_storage_iscsi(self):
         """Test primary storage pools - XEN, KVM, VMWare
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_privategw_acl.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index c86beb1..cf0f8e3 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -39,7 +39,7 @@ class TestPrivateGwACL(cloudstackTestCase):
         self.privateGwId = None
 
 
-    @attr(tags=["advanced", "selfservice"])
+    @attr(tags=["advanced"], required_hardware="false")
     def test_privategw_acl(self):
         #TODO: SIMENH: add a new test to verification of ACL rules
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_public_ip_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py
index b961dc3..e09f7b4 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -72,7 +72,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["simulator", "advanced", "publiciprange", "dedicate", "release", "selfservice"])
+    @attr(tags = ["advanced", "publiciprange", "dedicate", "release"], required_hardware="false")
     def test_dedicatePublicIpRange(self):
         """Test public IP range dedication
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_pvlan.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_pvlan.py b/test/integration/smoke/test_pvlan.py
index 9178e62..6e187b9 100644
--- a/test/integration/smoke/test_pvlan.py
+++ b/test/integration/smoke/test_pvlan.py
@@ -45,7 +45,7 @@ class TestPVLAN(cloudstackTestCase):
         cls.zone = get_zone(cls.apiClient, cls.testClient.getZoneForTests())
         cls.zoneId = cls.zone.id
 
-    @attr(tags = ["advanced", "selfservice"])
+    @attr(tags = ["advanced"], required_hardware="false")
     def test_create_pvlan_network(self):
         self.debug("Test create pvlan network")
         createNetworkCmd = createNetwork.createNetworkCmd()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_regions.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py
index 389f878..7b0dec3 100644
--- a/test/integration/smoke/test_regions.py
+++ b/test/integration/smoke/test_regions.py
@@ -35,7 +35,7 @@ class TestRegions(cloudstackTestCase):
         cls.domain = get_domain(cls.apiclient)
         cls.cleanup = []
 
-    @attr(tags=["simulator", "basic", "advanced", "selfservice"])
+    @attr(tags=["basic", "advanced"], required_hardware="false")
     def test_createRegion(self):
         """ Test for create region
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_reset_vm_on_reboot.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_reset_vm_on_reboot.py b/test/integration/smoke/test_reset_vm_on_reboot.py
index 4709df4..668c77f 100644
--- a/test/integration/smoke/test_reset_vm_on_reboot.py
+++ b/test/integration/smoke/test_reset_vm_on_reboot.py
@@ -96,7 +96,7 @@ class TestResetVmOnReboot(cloudstackTestCase):
         return
 
     @attr(hypervisor="xenserver")
-    @attr(tags=["advanced", "basic", "selfservice"])
+    @attr(tags=["advanced", "basic"], required_hardware="false")
     def test_01_reset_vm_on_reboot(self):
     #TODO: SIMENH: add new test to check volume contents
         """Test reset virtual machine on reboot

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_resource_detail.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_resource_detail.py b/test/integration/smoke/test_resource_detail.py
index 7f4a6e7..7103c65 100644
--- a/test/integration/smoke/test_resource_detail.py
+++ b/test/integration/smoke/test_resource_detail.py
@@ -89,7 +89,7 @@ class TestResourceDetail(cloudstackTestCase):
         cleanup_resources(self.apiclient, self.cleanup)
         return
 
-    @attr(tags = ["advanced", "xenserver", "selfservice"])
+    @attr(tags = ["advanced", "xenserver"], required_hardware="false")
     def test_01_updatevolumedetail(self):
         """Test volume detail 
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index d503af1..cb878a0 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -98,7 +98,7 @@ class TestRouterServices(cloudstackTestCase):
         self.hypervisor = self.testClient.getHypervisorInfo()
         return
 
-    @attr(tags = ["advanced", "basic", "sg", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "basic", "sg", "smoke"], required_hardware="true")
     def test_01_router_internal_basic(self):
         """Test router internal basic zone
         """
@@ -184,7 +184,7 @@ class TestRouterServices(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["advanced", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "smoke"], required_hardware="true")
     def test_02_router_internal_adv(self):
         """Test router internal advanced zone
         """
@@ -291,7 +291,7 @@ class TestRouterServices(cloudstackTestCase):
         self.debug("Haproxy process status: %s" % res)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_03_restart_network_cleanup(self):
         """Test restart network
         """
@@ -371,7 +371,7 @@ class TestRouterServices(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_04_restart_network_wo_cleanup(self):
         """Test restart network without cleanup
         """
@@ -487,7 +487,7 @@ class TestRouterServices(cloudstackTestCase):
                                 )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_05_router_basic(self):
         """Test router basic setup
         """
@@ -554,7 +554,7 @@ class TestRouterServices(cloudstackTestCase):
                             )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_06_router_advanced(self):
         """Test router advanced setup
         """
@@ -638,7 +638,7 @@ class TestRouterServices(cloudstackTestCase):
                             )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_07_stop_router(self):
         """Test stop router
         """
@@ -683,7 +683,7 @@ class TestRouterServices(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_08_start_router(self):
         """Test start router
         """
@@ -737,7 +737,7 @@ class TestRouterServices(cloudstackTestCase):
                return True
             return False
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_09_reboot_router(self):
         """Test reboot router
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_scale_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index 261fe93..d77946c 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -103,7 +103,7 @@ class TestScaleVm(cloudstackTestCase):
         return
 
     @attr(hypervisor="xenserver")
-    @attr(tags=["advanced", "basic", "provisioning"], BugId="CLOUDSTACK-6768")
+    @attr(tags=["advanced", "basic"], BugId="CLOUDSTACK-6768", required_hardware="true")
     def test_01_scale_vm(self):
         """Test scale virtual machine 
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_secondary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_secondary_storage.py b/test/integration/smoke/test_secondary_storage.py
index ac80956..2e20421 100644
--- a/test/integration/smoke/test_secondary_storage.py
+++ b/test/integration/smoke/test_secondary_storage.py
@@ -81,7 +81,7 @@ class TestSecStorageServices(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg", "selfservice"],BugId="CLOUDSTACK-6877")
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false",BugId="CLOUDSTACK-6877")
     def test_01_sys_vm_start(self):
         """Test system VM start
         """
@@ -160,7 +160,7 @@ class TestSecStorageServices(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "eip", "sg"], BugId="CLOUDSTACK-6773", required_hardware="false")
     def test_02_sys_template_ready(self):
         """Test system templates are ready
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_service_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_service_offerings.py b/test/integration/smoke/test_service_offerings.py
index 980e110..e390f75 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -54,7 +54,7 @@ class TestCreateServiceOffering(cloudstackTestCase):
 
         return
 
-    @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg", "selfservice"])
+    @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false")
     def test_01_create_service_offering(self):
         """Test to create service offering"""
 
@@ -205,7 +205,7 @@ class TestServiceOfferings(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg", "selfservice"])
+    @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false")
     def test_02_edit_service_offering(self):
         """Test to update existing service offering"""
 
@@ -256,7 +256,7 @@ class TestServiceOfferings(cloudstackTestCase):
 
         return
 
-    @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg", "selfservice"])
+    @attr(tags=["advanced", "advancedns", "smoke", "basic", "eip", "sg"], required_hardware="false")
     def test_03_delete_service_offering(self):
         """Test to delete service offering"""
 
@@ -282,7 +282,7 @@ class TestServiceOfferings(cloudstackTestCase):
 
         return
 
-    @attr(tags=["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_04_change_offering_small(self):
         """Test to change service to a small capacity
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_snapshots.py b/test/integration/smoke/test_snapshots.py
index a9be4e2..2bb1a89 100644
--- a/test/integration/smoke/test_snapshots.py
+++ b/test/integration/smoke/test_snapshots.py
@@ -98,8 +98,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(speed = "slow")
-    @attr(tags = ["advanced", "advancedns", "smoke", "provisioning"], BugId="CLOUDSTACK-6878")
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="true",BugId="CLOUDSTACK-6878")
     def test_01_snapshot_root_disk(self):
         """Test Snapshot Root Disk
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_ssvm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index ffa620b..9b8d19d 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -50,7 +50,7 @@ class TestSSVMs(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_01_list_sec_storage_vm(self):
         """Test List secondary storage VMs
         """
@@ -168,7 +168,7 @@ class TestSSVMs(cloudstackTestCase):
                             )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_02_list_cpvm_vm(self):
         """Test List console proxy VMs
         """
@@ -280,7 +280,7 @@ class TestSSVMs(cloudstackTestCase):
                             )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_03_ssvm_internals(self):
         """Test SSVM Internals"""
 
@@ -393,7 +393,7 @@ class TestSSVMs(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_04_cpvm_internals(self):
         """Test CPVM Internals"""
 
@@ -476,7 +476,7 @@ class TestSSVMs(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_05_stop_ssvm(self):
         """Test stop SSVM
         """
@@ -552,7 +552,7 @@ class TestSSVMs(cloudstackTestCase):
         self.test_03_ssvm_internals()
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_06_stop_cpvm(self):
         """Test stop CPVM
         """
@@ -625,7 +625,7 @@ class TestSSVMs(cloudstackTestCase):
         self.test_04_cpvm_internals()
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_07_reboot_ssvm(self):
         """Test reboot SSVM
         """
@@ -711,7 +711,7 @@ class TestSSVMs(cloudstackTestCase):
         self.test_03_ssvm_internals()
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_08_reboot_cpvm(self):
         """Test reboot CPVM
         """
@@ -798,7 +798,7 @@ class TestSSVMs(cloudstackTestCase):
         self.test_04_cpvm_internals()
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_09_destroy_ssvm(self):
         """Test destroy SSVM
         """
@@ -880,7 +880,7 @@ class TestSSVMs(cloudstackTestCase):
         self.test_03_ssvm_internals()
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_10_destroy_cpvm(self):
         """Test destroy CPVM
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index c7594bb..a757c2a 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -144,7 +144,7 @@ class TestCreateTemplate(cloudstackTestCase):
 
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke"], required_hardware="false")
     def test_01_create_template(self):
         """Test create public & private template
         """
@@ -340,7 +340,7 @@ class TestTemplates(cloudstackTestCase):
 
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice", "test"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_02_edit_template(self):
         """Test Edit template
         """
@@ -423,7 +423,7 @@ class TestTemplates(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_03_delete_template(self):
         """Test delete template
         """
@@ -452,7 +452,7 @@ class TestTemplates(cloudstackTestCase):
                          )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_04_extract_template(self):
         "Test for extract template"
 
@@ -503,7 +503,7 @@ class TestTemplates(cloudstackTestCase):
                          )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_05_template_permissions(self):
         """Update & Test for template permissions"""
 
@@ -556,7 +556,7 @@ class TestTemplates(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multizone", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multizone"], required_hardware="true")
     def test_06_copy_template(self):
         """Test for copy template from one zone to another"""
 
@@ -647,7 +647,7 @@ class TestTemplates(cloudstackTestCase):
         self.apiclient.deleteTemplate(cmd)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_07_list_public_templates(self):
         """Test only public templates are visible to normal user"""
 
@@ -679,7 +679,7 @@ class TestTemplates(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_08_list_system_templates(self):
         """Test System templates are not visible to normal user"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_vm_ha.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_ha.py b/test/integration/smoke/test_vm_ha.py
index 1fc6960..1d9021c 100644
--- a/test/integration/smoke/test_vm_ha.py
+++ b/test/integration/smoke/test_vm_ha.py
@@ -145,7 +145,7 @@ class TestDeployVMHA(cloudstackTestCase):
         ]
         self.cleanup = self.cleanup + self.mock_checkonhost_list
 
-    @attr(tags = ['selfservice'],BugId="CLOUDSTACK-6873")
+    @attr(tags = ['advanced'], required_hardware="false", BugId="CLOUDSTACK-6873")
     def test_vm_ha(self):
         """Test VM HA
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 1e56571..ce7cac7 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -115,7 +115,7 @@ class TestDeployVM(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
 
 
-    @attr(tags = ["simulator", "devcloud", "advanced", "advancedns", "smoke", "basic", "sg"])
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_deploy_vm(self):
         """Test Deploy Virtual Machine
         """
@@ -161,7 +161,7 @@ class TestDeployVM(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["simulator", "advanced"])
+    @attr(tags = ["advanced"], required_hardware="false")
     def test_advZoneVirtualRouter(self):
         #TODO: SIMENH: duplicate test, remove it
         """
@@ -183,8 +183,8 @@ class TestDeployVM(cloudstackTestCase):
         self.assertIsNotNone(router.publicip, msg="Router has no public ip")
         self.assertIsNotNone(router.guestipaddress, msg="Router has no guest ip")
 
-    @attr(hypervisor = ["simulator"])
-    @attr(mode = ["basic"])
+
+    @attr(mode = ["basic"], required_hardware="false")
     def test_basicZoneVirtualRouter(self):
         #TODO: SIMENH: duplicate test, remove it
         """
@@ -304,7 +304,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_01_stop_vm(self):
         """Test Stop Virtual Machine
         """
@@ -319,7 +319,7 @@ class TestVMLifeCycle(cloudstackTestCase):
             self.fail("Failed to stop VM: %s" % e)
         return
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_02_start_vm(self):
         """Test Start Virtual Machine
         """
@@ -357,7 +357,7 @@ class TestVMLifeCycle(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_03_reboot_vm(self):
         """Test Reboot Virtual Machine
         """
@@ -394,7 +394,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         return
 
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_06_destroy_vm(self):
         """Test destroy Virtual Machine
         """
@@ -430,7 +430,7 @@ class TestVMLifeCycle(cloudstackTestCase):
                         )
         return
 
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"])
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
     def test_07_restore_vm(self):
         #TODO: SIMENH: add another test the data on the restored VM.
         """Test recover Virtual Machine
@@ -471,7 +471,7 @@ class TestVMLifeCycle(cloudstackTestCase):
 
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multihost", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "multihost"], required_hardware="false")
     def test_08_migrate_vm(self):
         """Test migrate VM
         """
@@ -548,7 +548,7 @@ class TestVMLifeCycle(cloudstackTestCase):
 
     @attr(configuration = "expunge.interval")
     @attr(configuration = "expunge.delay")
-    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "selfservice"],BugId="CLOUDSTACK-6738")
+    @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], BugId="CLOUDSTACK-6738", required_hardware="false")
     def test_09_expunge_vm(self):
         """Test destroy(expunge) Virtual Machine
         """
@@ -593,7 +593,7 @@ class TestVMLifeCycle(cloudstackTestCase):
         self.assertEqual(list_vm_response,None,"Check Expunged virtual machine is in listVirtualMachines response")
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="true")
     def test_10_attachAndDetach_iso(self):
         """Test for attach and detach ISO to virtual machine"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_vm_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py
index c324afa..01626f5 100644
--- a/test/integration/smoke/test_vm_snapshots.py
+++ b/test/integration/smoke/test_vm_snapshots.py
@@ -112,7 +112,7 @@ class TestVmSnapshot(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_01_create_vm_snapshots(self):
         """Test to create VM snapshots
         """
@@ -156,7 +156,7 @@ class TestVmSnapshot(cloudstackTestCase):
         )
         return
 
-    @attr(tags=["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_02_revert_vm_snapshots(self):
         """Test to revert VM snapshots
         """
@@ -243,7 +243,7 @@ class TestVmSnapshot(cloudstackTestCase):
             "Check the random data is equal with the ramdom file!"
         )
 
-    @attr(tags=["advanced", "advancedns", "smoke", "provisioning"])
+    @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
     def test_03_delete_vm_snapshots(self):
         """Test to delete vm snapshots
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 2d3bd91..3a30768 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -109,7 +109,7 @@ class TestCreateVolume(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
         self.cleanup = []
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
     def test_01_create_volume(self):
         """Test Volume creation for all Disk Offerings (incl. custom)
         """
@@ -314,7 +314,7 @@ class TestVolumes(cloudstackTestCase):
         cleanup_resources(self.apiClient, self.cleanup)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
     def test_02_attach_volume(self):
         """Attach a created Volume to a Running VM
         """
@@ -360,7 +360,7 @@ class TestVolumes(cloudstackTestCase):
                                     (self.virtual_machine.ipaddress, e))
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
     def test_03_download_attached_volume(self):
         """Download a Volume attached to a VM
         """
@@ -382,7 +382,7 @@ class TestVolumes(cloudstackTestCase):
         with self.assertRaises(Exception):
             self.apiClient.extractVolume(cmd)
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
     def test_04_delete_attached_volume(self):
         """Delete a Volume attached to a VM
         """
@@ -403,7 +403,7 @@ class TestVolumes(cloudstackTestCase):
         with self.assertRaises(Exception):
             self.apiClient.deleteVolume(cmd)
         
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "selfservice"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="false")
     def test_05_detach_volume(self):
         """Detach a Volume attached to a VM
         """
@@ -445,7 +445,7 @@ class TestVolumes(cloudstackTestCase):
                          )
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
     def test_06_download_detached_volume(self):
         """Download a Volume unattached to an VM
         """
@@ -482,7 +482,7 @@ class TestVolumes(cloudstackTestCase):
                 % (extract_vol.url, self.volume.id)
             )
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
     def test_07_resize_fail(self):
         """Test resize (negative) non-existent volume"""
         # Verify the size is the new size is what we wanted it to be.
@@ -596,7 +596,7 @@ class TestVolumes(cloudstackTestCase):
         return 
 
 
-    @attr(tags = ["advanced", "advancedns", "smoke", "basic", "provisioning"])
+    @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
     def test_08_resize_volume(self):
         """Test resize a volume"""
         # Verify the size is the new size is what we wanted it to be.
@@ -699,7 +699,7 @@ class TestVolumes(cloudstackTestCase):
             time.sleep(30)
         return
 
-    @attr(tags = ["advanced", "advancedns", "smoke","basic", "selfservice"], BugId="CLOUDSTACK-6875")
+    @attr(tags = ["advanced", "advancedns", "smoke","basic"], required_hardware="false", BugId="CLOUDSTACK-6875")
     def test_09_delete_detached_volume(self):
         """Delete a Volume unattached to an VM
         """

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/test/integration/smoke/test_vpc_vpn.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 1b28447..f0a2027 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -52,7 +52,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
 
         cls.cleanup = [cls.account]
 
-    @attr(tags=["advanced", "selfservice"])
+    @attr(tags=["advanced"], required_hardware="false")
     def test_vpc_remote_access_vpn(self):
         """Test VPN in VPC"""
 
@@ -159,7 +159,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
 
         cls.cleanup = [cls.account]
 
-    @attr(tags=["advanced", "selfservice"], BugId="CLOUDSTACK-6879")
+    @attr(tags=["advanced"], required_hardware="false",BugId="CLOUDSTACK-6879")
     def test_vpc_site2site_vpn(self):
         """Test VPN in VPC"""
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/45db2348/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 801c549..d870c98 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -890,4 +890,72 @@ test_data = {
         "name": "hostantiaffinity",
         "type": "host anti-affinity",
     },
+    "vgpu":{
+        "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",
+        },
+        "vgpu260q":   # Create a virtual machine instance with vgpu type as 260q
+        {
+                    "displayname": "testserver",
+                    "username": "root", # VM creds for SSH
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                },
+                "vgpu140q":   # Create a virtual machine instance with vgpu type as 140q
+                {
+                    "displayname": "testserver",
+                    "username": "root",
+                    "password": "password",
+                    "ssh_port": 22,
+                    "hypervisor": 'XenServer',
+                    "privateport": 22,
+                    "publicport": 22,
+                    "protocol": 'TCP',
+                },
+                "service_offerings":
+                {
+                 "vgpu260qwin":
+                   {
+                        "name": "Windows Instance with vGPU260Q",
+                        "displaytext": "Windows Instance with vGPU260Q",
+                        "cpunumber": 2,
+                        "cpuspeed": 1600, # in MHz
+                        "memory": 3072, # In MBs
+                    },
+                 "vgpu140qwin":
+                    {
+                     # Small service offering ID to for change VM
+                     # service offering from medium to small
+                        "name": "Windows Instance with vGPU140Q",
+                        "displaytext": "Windows Instance with vGPU140Q",
+                        "cpunumber": 2,
+                        "cpuspeed": 1600,
+                        "memory": 3072,
+                    }
+                },
+            "diskdevice": ['/dev/vdc',  '/dev/vdb', '/dev/hdb', '/dev/hdc', '/dev/xvdd', '/dev/cdrom', '/dev/sr0', '/dev/cdrom1' ],
+            # Disk device where ISO is attached to instance
+            "mount_dir": "/mnt/tmp",
+            "sleep": 60,
+            "timeout": 10,
+            #Migrate VM to hostid
+            "ostype": 'Windows 7 (32-bit)',
+            # CentOS 5.3 (64-bit)
+    }
+
 }


[39/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35

Posted by da...@apache.org.
CLOUDSTACK-7009: add ability to handle serviceofferingdetails to base.py
to support creation of service offering upon passing details in the  following format
            serviceofferingdetails[1].key=pciDevice
            serviceofferingdetails[1].value=Group of NVIDIA Corporation GK107GL [GRID K1] GPUs
            serviceofferingdetails[2].key=vgpuType
            serviceofferingdetails[2].value=GRID K120Q

(cherry picked from commit a34faae919b280fe6009e2608c95f59eafdfac48)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/16d50b89
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/16d50b89
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/16d50b89

Branch: refs/heads/4.4
Commit: 16d50b895663d36eacd049d120d2801d4e795a26
Parents: 8663fb0
Author: SrikanteswaraRao Talluri <ta...@apache.org>
Authored: Mon Jun 30 19:20:07 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:54 2014 +0200

----------------------------------------------------------------------
 test/integration/smoke/test_deploy_vgpu_enabled_vm.py | 3 ++-
 tools/marvin/marvin/lib/base.py                       | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16d50b89/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
index 13c1e5e..2188c7f 100644
--- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
+++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
@@ -75,11 +75,12 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
 
         self.testdata["vgpu140q"]["zoneid"] = self.zone.id
         self.testdata["vgpu140q"]["template"] = self.template.id
+        self.testdata["service_offerings"]["vgpu260qwin"]["serviceofferingdetails"] = [{'pciDevice': 'VGPU'},
+                                                                                       {'vgpuType':'GRID K120Q'}]
         #create a service offering
         self.service_offering = ServiceOffering.create(
                 self.apiclient,
                 self.testdata["service_offerings"]["vgpu260qwin"],
-                serviceofferingdetails={'pciDevice': 'VGPU'}
         )
         #build cleanup list
         self.cleanup = [

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/16d50b89/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 1ed8c72..b216bca 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1883,8 +1883,12 @@ class ServiceOffering:
             cmd.deploymentplanner = services["deploymentplanner"]
 
         if "serviceofferingdetails" in services:
-            cmd.serviceofferingdetails.append(
-                {services['serviceofferingdetails']})
+            count = 1
+            for i in services["serviceofferingdetails"]:
+                for key, value in i.items():
+                    setattr(cmd, "serviceofferingdetails[%d].key" % count, key)
+                    setattr(cmd, "serviceofferingdetails[%d].value" % count, value)
+                count = count + 1
 
         if "isvolatile" in services:
             cmd.isvolatile = services["isvolatile"]