http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/test/integration/lib/utils.py b/test/integration/lib/utils.py
deleted file mode 100644
index 05aed79..0000000
--- a/test/integration/lib/utils.py
+++ /dev/null
@@ -1,179 +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.
-"""Utilities functions
-"""
-
-import marvin
-import time
-from marvin.remoteSSHClient import remoteSSHClient
-from marvin.cloudstackAPI import *
-from marvin import cloudstackConnection
-#from cloudstackConnection import cloudConnection
-from marvin import configGenerator
-import logging
-import string
-import random
-import imaplib
-import email
-import datetime
-
-
-def restart_mgmt_server(server):
-    """Restarts the management server"""
-
-    try:
-        # Get the SSH client
-        ssh = is_server_ssh_ready(
-                                  server["ipaddress"],
-                                  server["port"],
-                                  server["username"],
-                                  server["password"],
-                                )
-        result = ssh.execute("/etc/init.d/cloud-management restart")
-        res = str(result)
-        # Server Stop - OK
-        # Server Start - OK
-        if res.count("OK") != 2:
-            raise ("ErrorInReboot!")
-    except Exception as e:
-        raise e
-    return
-
-
-def fetch_latest_mail(services, from_mail):
-    """Fetch mail"""
-
-    # Login to mail server to verify email
-    mail = imaplib.IMAP4_SSL(services["server"])
-    mail.login(
-                   services["email"],
-                   services["password"]
-                   )
-    mail.list()
-    mail.select(services["folder"])
-    date = (datetime.date.today() - datetime.timedelta(1)).strftime("%d-%b-%Y")
-
-    result, data = mail.uid(
-            'search',
-            None,
-            '(SENTSINCE {date} HEADER FROM "{mail}")'.format(
-                                                             date=date,
-                                                             mail=from_mail
-                                                             )
-            )
-    # Return False if email is not present
-    if data == []:
-        return False
-
-    latest_email_uid = data[0].split()[-1]
-    result, data = mail.uid('fetch', latest_email_uid, '(RFC822)')
-    raw_email = data[0][1]
-    email_message = email.message_from_string(raw_email)
-    result = get_first_text_block(email_message)
-    return result
-
-
-def get_first_text_block(email_message_instance):
-    """fetches first text block from the mail"""
-    maintype = email_message_instance.get_content_maintype()
-    if maintype == 'multipart':
-        for part in email_message_instance.get_payload():
-            if part.get_content_maintype() == 'text':
-                return part.get_payload()
-    elif maintype == 'text':
-        return email_message_instance.get_payload()
-
-
-def random_gen(size=6, chars=string.ascii_uppercase + string.digits):
-    """Generate Random Strings of variable length"""
-    return ''.join(random.choice(chars) for x in range(size))
-
-
-def cleanup_resources(api_client, resources):
-    """Delete resources"""
-    for obj in resources:
-        obj.delete(api_client)
-
-
-def is_server_ssh_ready(ipaddress, port, username, password, retries=50):
-    """Return ssh handle else wait till sshd is running"""
-    loop_cnt = retries
-    while True:
-        try:
-            ssh = remoteSSHClient(ipaddress, port, username, password)
-        except Exception as e:
-            if loop_cnt == 0:
-                raise e
-            loop_cnt = loop_cnt - 1
-            time.sleep(30)
-        else:
-            return ssh
-
-
-def format_volume_to_ext3(ssh_client, device="/dev/sda"):
-    """Format attached storage to ext3 fs"""
-    cmds = [
-            "echo -e 'n\np\n1\n\n\nw' | fdisk %s" % device,
-            "mkfs.ext3 %s1" % device,
-           ]
-    for c in cmds:
-        ssh_client.execute(c)
-
-
-def fetch_api_client(config_file='datacenterCfg'):
-    """Fetch the Cloudstack API Client"""
-    config = configGenerator.get_setup_config(config_file)
-    mgt = config.mgtSvr[0]
-    testClientLogger = logging.getLogger("testClient")
-    asyncTimeout = 3600
-    return cloudstackAPIClient.CloudStackAPIClient(
-            cloudstackConnection.cloudConnection(
-                                                mgt.mgtSvrIp,
-                                                mgt.port,
-                                                mgt.apiKey,
-                                                mgt.securityKey,
-                                                asyncTimeout,
-                                                testClientLogger
-                                                )
-                                            )
-
-
-def get_process_status(hostip, port, username, password, linklocalip, process):
-    """Double hop and returns a process status"""
-
-    #SSH to the machine
-    ssh = remoteSSHClient(hostip, port, username, password)
-    ssh_command = "ssh -i ~/.ssh/id_rsa.cloud -ostricthostkeychecking=no "
-    ssh_command = ssh_command + \
-                    "-oUserKnownHostsFile=/dev/null -p 3922 %s %s" % (
-                                                                linklocalip,
-                                                                process)
-
-    # Double hop into router
-    timeout = 5
-    # Ensure the SSH login is successful
-    while True:
-        res = ssh.execute(ssh_command)
-
-        if res[0] != "Host key verification failed.":
-            break
-        elif timeout == 0:
-            break
-
-        time.sleep(5)
-        timeout = timeout - 1
-    return res

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/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 147904e..ce77b9a 100644
--- a/test/integration/smoke/test_disk_offerings.py
+++ b/test/integration/smoke/test_disk_offerings.py
@@ -20,9 +20,9 @@
 import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
 class Services:

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_hosts.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_hosts.py 
b/test/integration/smoke/test_hosts.py
index 260ca9f..cedf43c 100644
--- a/test/integration/smoke/test_hosts.py
+++ b/test/integration/smoke/test_hosts.py
@@ -20,9 +20,9 @@
 import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
 #Import System modules

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py 
b/test/integration/smoke/test_iso.py
index 6ed0a18..7ed2c1b 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -20,9 +20,9 @@
 import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 import urllib
 from random import random

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py 
b/test/integration/smoke/test_network.py
index b0a793c..c1277f5 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -21,9 +21,9 @@ import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin import remoteSSHClient
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 #Import System modules
 import time

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/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 5c804f7..7daf3ca 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -20,10 +20,10 @@
 import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
-from integration.lib.utils import *
-from integration.lib.base import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
-from integration.lib.common import *
 
 #Import System modules
 import time
@@ -240,4 +240,4 @@ class TestPrimaryStorageServices(cloudstackTestCase):
             # Call cleanup for reusing primary storage
             cleanup_resources(self.apiclient, self.cleanup)
             self.cleanup = []
-        return
\ No newline at end of file
+        return

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py 
b/test/integration/smoke/test_routers.py
index e5f4735..346ba61 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -21,9 +21,9 @@ import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin import remoteSSHClient
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 #Import System modules
 import time

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/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 d59e779..d345bcb 100644
--- a/test/integration/smoke/test_secondary_storage.py
+++ b/test/integration/smoke/test_secondary_storage.py
@@ -20,9 +20,9 @@
 import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
 #Import System modules

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/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 e697911..a4188b6 100644
--- a/test/integration/smoke/test_service_offerings.py
+++ b/test/integration/smoke/test_service_offerings.py
@@ -20,9 +20,9 @@
 import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_ssvm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ssvm.py 
b/test/integration/smoke/test_ssvm.py
index 5c9d030..e864463 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -21,9 +21,9 @@ import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin import remoteSSHClient
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from 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
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py 
b/test/integration/smoke/test_templates.py
index 9fefa90..62b9237 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -21,9 +21,9 @@ import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 import urllib
 from random import random

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/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 b47c164..15ffb26 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -21,9 +21,9 @@ import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 #Import System modules
 import time

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py 
b/test/integration/smoke/test_volumes.py
index ed5cbaf..1707187 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -21,9 +21,9 @@ import marvin
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
-from integration.lib.utils import *
-from integration.lib.base import *
-from integration.lib.common import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
 from nose.plugins.attrib import attr
 #Import System modules
 import os

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/test/setup-test-data.sh
----------------------------------------------------------------------
diff --git a/test/setup-test-data.sh b/test/setup-test-data.sh
index 584a04f..f7bad10 100755
--- a/test/setup-test-data.sh
+++ b/test/setup-test-data.sh
@@ -20,6 +20,7 @@ usage() {
   printf "Usage: %s:\n
        [-t path to tests ]  \n
        [-m mgmt-server ] \n
+    [-h hypervisor (xen|kvm) ] \n
        [-p hypervisor root password ] \n
        [-d db node url ]\n" $(basename $0) >&2
 }
@@ -34,7 +35,7 @@ MGMT_SVR="localhost"
 DB_SVR="localhost"
 HV_PASSWD="password"
 
-while getopts 't:d:m:p:' OPTION
+while getopts 't:d:m:p:h:' OPTION
 do
   case $OPTION in
   d)    dflag=1
@@ -46,6 +47,9 @@ do
   m)    mflag=1
                MGMT_SVR="$OPTARG"
                ;;
+  h)    hflag=1
+               HV="$OPTARG"
+               ;;
   p)    pflag=1
                HV_PASSWD="$OPTARG"
                ;;
@@ -56,7 +60,11 @@ do
 done
 
 #Damn Small Linux ISO type
-ostypeid=$(mysql -ucloud -Dcloud -pcloud -h$DB_SVR -s -N -r -e"select uuid 
from guest_os where display_name='CentOS 5.5 (64-bit)'")
+if [[ $HV == "kvm" ]]; then
+    ostypeid=$(mysql -ucloud -Dcloud -pcloud -h$DB_SVR -s -N -r -e"select uuid 
from guest_os where display_name='CentOS 5.5 (64-bit)'")
+else:
+    ostypeid=$(mysql -ucloud -Dcloud -pcloud -h$DB_SVR -s -N -r -e"select uuid 
from guest_os where display_name='CentOS 5.3 (64-bit)'")
+fi
 if [[ $ostypeid == "" ]]; then
     echo "Unable to contact DB server @ $DB_SVR"
     exit 2

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py 
b/tools/marvin/marvin/deployDataCenter.py
index f9d837f..bdf08cc 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -350,7 +350,7 @@ class deployDataCenters():
         return apiKey, securityKey
 
     def getCfg(self):
-        if self.config:
+        if self.config is not None:
             return self.config
         return None
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/tools/marvin/marvin/integration/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/__init__.py 
b/tools/marvin/marvin/integration/__init__.py
new file mode 100644
index 0000000..57823fc
--- /dev/null
+++ b/tools/marvin/marvin/integration/__init__.py
@@ -0,0 +1,18 @@
+# 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.
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/802ddd43/tools/marvin/marvin/integration/lib/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/__init__.py 
b/tools/marvin/marvin/integration/lib/__init__.py
new file mode 100644
index 0000000..978b68a
--- /dev/null
+++ b/tools/marvin/marvin/integration/lib/__init__.py
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.

Reply via email to