You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/06/28 21:22:40 UTC

[19/29] git commit: updated refs/heads/master-6-17-stable to 93712c2

Baremetal: Test cases
(cherry picked from commit b0a3210695a0759cf4fb7110987886dc81cac8b2)


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

Branch: refs/heads/master-6-17-stable
Commit: 77a01f34f1518b2fc4fb42538e28769a0ef2ce2d
Parents: 07f28ae
Author: Sheng Yang <sh...@citrix.com>
Authored: Thu Jun 20 16:44:06 2013 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sat Jun 29 00:52:08 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_baremetal.py | 122 ++++++++++++++++++++++
 1 file changed, 122 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/77a01f34/test/integration/component/test_baremetal.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_baremetal.py b/test/integration/component/test_baremetal.py
new file mode 100644
index 0000000..887010b
--- /dev/null
+++ b/test/integration/component/test_baremetal.py
@@ -0,0 +1,122 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+""" Test for baremetal
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin import remoteSSHClient
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from nose.plugins.attrib import attr
+import telnetlib
+
+#Import System modules
+import time
+_multiprocess_shared_ = True
+
+class Services:
+    """Test Baremetal
+    """
+
+    def __init__(self):
+        self.services = {
+                         "network_offering": {
+                                    "name": 'Baremetal_network_offering',
+                                    "displaytext": 'Baremetal_network_offering',
+                                    "guestiptype": 'Shared',
+                                    "supportedservices": 'Dhcp,UserData,BaremetalPxeService',
+                                    "specifyVlan": "true",
+                                    "specifyIpRanges": "true",
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "conservemode": 'false',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'BaremetalDhcpProvider',
+                                            "UserData": 'BaremetalUserdataProvider',
+                                            "BaremetalPxeService": 'BaremetalPxeProvider',
+                                        },
+                                    },
+                         "network" :{
+                                     "name" : "defaultBaremetalNetwork",
+                                     "displaytext" : "defaultBaremetalNetwork",
+                                     },
+                         "ostype": 'CentOS 5.3 (64-bit)',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                    }
+class TestBaremetal(cloudstackTestCase):
+    zoneid = 1
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.services = Services().services
+        self.cleanup = []
+
+    def tearDown(self):
+        try:
+            self.debug("Cleaning up the resources")
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            self.debug("Cleanup complete!")
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["baremetal", "basic"])
+    def test_baremetal(self):
+        self.debug("Test create baremetal network offering")
+        networkoffering = NetworkOffering.create(self.apiclient, self.services["network_offering"])
+        networkoffering.update(self.apiclient, state="Enabled")
+        self.cleanup.append(networkoffering)
+
+        physical_network = PhysicalNetwork.list(self.apiclient, zoneid=self.zoneid)[0];
+        dhcp_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalDhcpProvider", physical_network_id=physical_network.id)[0]
+        response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=dhcp_provider.id,
+                                          state='Enabled'
+                                          )
+        pxe_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalPxeProvider", physical_network_id=physical_network.id)[0]
+        response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=pxe_provider.id,
+                                          state='Enabled'
+                                          )
+        userdata_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalUserdataProvider", physical_network_id=physical_network.id)[0]
+        response = NetworkServiceProvider.update(
+                                          self.apiclient,
+                                          id=userdata_provider.id,
+                                          state='Enabled'
+                                          )
+
+        network = Network.create(self.apiclient, self.services["network"], zoneid=self.zoneid, networkofferingid=networkoffering.id)
+        self.cleanup.insert(0, network)
+
+        pod = Pod.list(self.apiclient)[0]
+        cmd = createVlanIpRange.createVlanIpRangeCmd()
+        cmd.podid = pod.id
+        cmd.networkid = network.id
+        cmd.gateway = "10.1.1.1"
+        cmd.netmask = "255.255.255.0"
+        cmd.startip = "10.1.1.20"
+        cmd.endip = "10.1.1.40"
+        cmd.forVirtualNetwork="false"
+        response = self.apiclient.createVlanIpRange(cmd)