cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prachida...@apache.org
Subject [01/68] [abbrv] Marvin IP cleared tests for various cloudstack components
Date Thu, 16 May 2013 18:21:26 GMT
Updated Branches:
  refs/heads/planner_reserve eb3911678 -> ed8ff40f7


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/894413e3/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
new file mode 100644
index 0000000..5c8e063
--- /dev/null
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -0,0 +1,153 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+#Test from the Marvin - Testing in Python wiki
+
+#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.integration.lib.base import Account, VirtualMachine, ServiceOffering
+
+#utils - utility classes for common cleanup, external library wrappers etc
+from marvin.integration.lib.utils import cleanup_resources
+
+#common - commonly used methods for all tests are listed here
+from marvin.integration.lib.common import get_zone, get_domain, get_template
+
+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": {
+                "small": {
+                    "name": "Small Instance",
+                    "displaytext": "Small Instance",
+                    "cpunumber": 1,
+                    "cpuspeed": 100,
+                    "memory": 256,
+                },
+            },
+            "ostype": 'CentOS 5.3 (64-bit)',
+        }
+
+
+class TestDeployVM(cloudstackTestCase):
+    """Test deploy a VM into a user account
+    """
+
+    def setUp(self):
+        self.testdata = TestData().testdata
+        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.testdata["mode"] = self.zone.networktype
+        self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
+
+        #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_offering"]["small"]
+        )
+        #build cleanup list
+        self.cleanup = [
+            self.service_offering,
+            self.account
+        ]
+
+    def test_deploy_vm(self):
+        """Test Deploy Virtual Machine
+
+        # Validate the following:
+        # 1. Virtual Machine is accessible via SSH
+        # 2. listVirtualMachines returns accurate information
+        """
+        self.virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.testdata["virtual_machine"],
+            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, id=self.virtual_machine.id)
+
+        self.debug(
+            "Verify listVirtualMachines response for virtual machine: %s"\
+            % self.virtual_machine.id
+        )
+
+        self.assertEqual(
+            isinstance(list_vms, list),
+            True,
+            "List VM response was not a valid list"
+        )
+        self.assertNotEqual(
+            len(list_vms),
+            0,
+            "List VM response was empty"
+        )
+
+        vm = list_vms[0]
+        self.assertEqual(
+            vm.id,
+            self.virtual_machine.id,
+            "Virtual Machine ids do not match"
+        )
+        self.assertEqual(
+            vm.name,
+            self.virtual_machine.name,
+            "Virtual Machine names do not match"
+        )
+        self.assertEqual(
+            vm.state,
+            "Running",
+            msg="VM is not in Running state"
+        )
+
+    def tearDown(self):
+        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

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/894413e3/tools/marvin/marvin/sandbox/advanced/sandbox.cfg
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/advanced/sandbox.cfg b/tools/marvin/marvin/sandbox/advanced/sandbox.cfg
deleted file mode 100644
index 01a8473..0000000
--- a/tools/marvin/marvin/sandbox/advanced/sandbox.cfg
+++ /dev/null
@@ -1,209 +0,0 @@
-{
-    "zones": [
-        {
-            "name": "Sandbox-Simulator", 
-            "guestcidraddress": "10.1.1.0/24", 
-            "dns1": "10.147.28.6", 
-            "physical_networks": [
-                {
-                    "providers": [
-                        {
-                            "broadcastdomainrange": "ZONE", 
-                            "name": "VirtualRouter"
-                        }, 
-                        {
-                            "broadcastdomainrange": "ZONE", 
-                            "name": "VpcVirtualRouter"
-                        }, 
-                        {
-                            "broadcastdomainrange": "ZONE", 
-                            "name": "InternalLb"
-                        }
-                    ], 
-                    "name": "Sandbox-pnet", 
-                    "tags": [
-                        "cloud-simulator-public"
-                    ], 
-                    "broadcastdomainrange": "Zone", 
-                    "vlan": "675-679", 
-                    "traffictypes": [
-                        {
-                            "typ": "Guest"
-                        }, 
-                        {
-                            "typ": "Management", 
-                            "simulator": "cloud-simulator-mgmt"
-                        }, 
-                        {
-                            "typ": "Public", 
-                            "simulator": "cloud-simulator-public"
-                        }
-                    ], 
-                    "isolationmethods": [
-                        "VLAN"
-                    ]
-                }, 
-                {
-                    "providers": [
-                        {
-                            "broadcastdomainrange": "ZONE", 
-                            "name": "VirtualRouter"
-                        }, 
-                        {
-                            "broadcastdomainrange": "ZONE", 
-                            "name": "VpcVirtualRouter"
-                        }, 
-                        {
-                            "broadcastdomainrange": "ZONE", 
-                            "name": "InternalLb"
-                        }
-                    ], 
-                    "name": "Sandbox-pnet2", 
-                    "tags": [
-                        "cloud-simulator-guest"
-                    ], 
-                    "broadcastdomainrange": "Zone", 
-                    "vlan": "800-1000", 
-                    "traffictypes": [
-                        {
-                            "typ": "Guest", 
-                            "simulator": "cloud-simulator-guest"
-                        }
-                    ], 
-                    "isolationmethods": [
-                        "VLAN"
-                    ]
-                }
-            ], 
-            "securitygroupenabled": "false", 
-            "ipranges": [
-                {
-                    "startip": "10.147.31.150", 
-                    "endip": "10.147.31.159", 
-                    "netmask": "255.255.255.0", 
-                    "vlan": "31", 
-                    "gateway": "10.147.31.1"
-                }
-            ], 
-            "networktype": "Advanced", 
-            "pods": [
-                {
-                    "endip": "10.147.29.159", 
-                    "name": "POD0", 
-                    "startip": "10.147.29.150", 
-                    "netmask": "255.255.255.0", 
-                    "clusters": [
-                        {
-                            "clustername": "C0", 
-                            "hypervisor": "Simulator", 
-                            "hosts": [
-                                {
-                                    "username": "root", 
-                                    "url": "http://simulator0", 
-                                    "password": "password"
-                                }
-                            ], 
-                            "clustertype": "CloudManaged", 
-                            "primaryStorages": [
-                                {
-                                    "url": "nfs://10.147.28.6:/export/home/sandbox/primary",

-                                    "name": "PS0"
-                                }
-                            ]
-                        }
-                    ], 
-                    "gateway": "10.147.29.1"
-                }
-            ], 
-            "internaldns1": "10.147.28.6", 
-            "secondaryStorages": [
-                {
-                    "url": "nfs://10.147.28.6:/export/home/sandbox/sstor"
-                }
-            ]
-        }
-    ], 
-    "dbSvr": {
-        "dbSvr": "localhost", 
-        "passwd": "cloud", 
-        "db": "cloud", 
-        "port": 3306, 
-        "user": "cloud"
-    }, 
-    "logger": [
-        {
-            "name": "TestClient", 
-            "file": "testclient.log"
-        }, 
-        {
-            "name": "TestCase", 
-            "file": "testcase.log"
-        }
-    ], 
-    "globalConfig": [
-        {
-            "name": "storage.cleanup.interval", 
-            "value": "300"
-        }, 
-        {
-            "name": "direct.agent.load.size", 
-            "value": "1000"
-        }, 
-        {
-            "name": "default.page.size", 
-            "value": "10000"
-        }, 
-        {
-            "name": "instance.name", 
-            "value": "QA"
-        }, 
-        {
-            "name": "workers", 
-            "value": "10"
-        }, 
-        {
-            "name": "vm.op.wait.interval", 
-            "value": "5"
-        }, 
-        {
-            "name": "account.cleanup.interval", 
-            "value": "600"
-        }, 
-        {
-            "name": "guest.domain.suffix", 
-            "value": "sandbox.simulator"
-        }, 
-        {
-            "name": "expunge.delay", 
-            "value": "60"
-        }, 
-        {
-            "name": "vm.allocation.algorithm", 
-            "value": "random"
-        }, 
-        {
-            "name": "expunge.interval", 
-            "value": "60"
-        }, 
-        {
-            "name": "expunge.workers", 
-            "value": "3"
-        }, 
-        {
-            "name": "secstorage.allowed.internal.sites", 
-            "value": "10.147.28.0/24"
-        }, 
-        {
-            "name": "check.pod.cidrs", 
-            "value": "true"
-        }
-    ], 
-    "mgtSvr": [
-        {
-            "mgtSvrIp": "localhost", 
-            "passwd": "password", 
-            "user": "root", 
-            "port": 8096
-        }
-    ]
-}
\ No newline at end of file


Mime
View raw message