You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gi...@apache.org on 2014/05/06 12:00:45 UTC
[11/32] Marvin + test changes from master Signed-off-by:
SrikanteswaraRao Talluri
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 4c8a34c..780c154 100644
--- a/test/integration/smoke/test_disk_offerings.py
+++ b/test/integration/smoke/test_disk_offerings.py
@@ -20,30 +20,17 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
_multiprocess_shared_ = True
-class Services:
- """Test Disk offerings Services
- """
-
- def __init__(self):
- self.services = {
- "off": {
- "name": "Disk offering",
- "displaytext": "Disk offering",
- "disksize": 1 # in GB
- },
- }
-
class TestCreateDiskOffering(cloudstackTestCase):
def setUp(self):
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
@@ -68,7 +55,7 @@ class TestCreateDiskOffering(cloudstackTestCase):
"""
disk_offering = DiskOffering.create(
self.apiclient,
- self.services["off"]
+ self.services["disk_offering"]
)
self.cleanup.append(disk_offering)
@@ -92,16 +79,96 @@ class TestCreateDiskOffering(cloudstackTestCase):
self.assertEqual(
disk_response.displaytext,
- self.services["off"]["displaytext"],
+ self.services["disk_offering"]["displaytext"],
"Check server id in createServiceOffering"
)
self.assertEqual(
disk_response.name,
- self.services["off"]["name"],
+ self.services["disk_offering"]["name"],
"Check name in createServiceOffering"
)
return
+ @attr(hypervisor="kvm")
+ @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+ def test_02_create_sparse_type_disk_offering(self):
+ """Test to create a sparse type disk offering"""
+
+ # Validate the following:
+ # 1. createDiskOfferings should return valid info for new offering
+ # 2. The Cloud Database contains the valid information
+
+ disk_offering = DiskOffering.create(
+ self.apiclient,
+ self.services["sparse"]
+ )
+ self.cleanup.append(disk_offering)
+
+ self.debug("Created Disk offering with ID: %s" % disk_offering.id)
+
+ list_disk_response = list_disk_offering(
+ self.apiclient,
+ id=disk_offering.id
+ )
+ self.assertEqual(
+ isinstance(list_disk_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ self.assertNotEqual(
+ len(list_disk_response),
+ 0,
+ "Check Disk offering is created"
+ )
+ disk_response = list_disk_response[0]
+
+ self.assertEqual(
+ disk_response.provisioningtype,
+ self.services["sparse"]["provisioningtype"],
+ "Check provisionig type in createServiceOffering"
+ )
+ return
+
+
+ @attr(hypervisor="kvm")
+ @attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
+ def test_04_create_fat_type_disk_offering(self):
+ """Test to create a sparse type disk offering"""
+
+ # Validate the following:
+ # 1. createDiskOfferings should return valid info for new offering
+ # 2. The Cloud Database contains the valid information
+
+ disk_offering = DiskOffering.create(
+ self.apiclient,
+ self.services["fat"]
+ )
+ self.cleanup.append(disk_offering)
+
+ self.debug("Created Disk offering with ID: %s" % disk_offering.id)
+
+ list_disk_response = list_disk_offering(
+ self.apiclient,
+ id=disk_offering.id
+ )
+ self.assertEqual(
+ isinstance(list_disk_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ self.assertNotEqual(
+ len(list_disk_response),
+ 0,
+ "Check Disk offering is created"
+ )
+ disk_response = list_disk_response[0]
+
+ self.assertEqual(
+ disk_response.provisioningtype,
+ self.services["fat"]["provisioningtype"],
+ "Check provisionig type in createServiceOffering"
+ )
+ return
class TestDiskOfferings(cloudstackTestCase):
@@ -122,15 +189,17 @@ class TestDiskOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.services = Services().services
- cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
+ testClient = super(TestDiskOfferings, cls).getClsTestClient()
+ cls.apiclient = cls.testClient.getApiClient()
+ cls.services = cls.testClient.getParsedTestDataConfig()
+
cls.disk_offering_1 = DiskOffering.create(
- cls.api_client,
- cls.services["off"]
+ cls.apiclient,
+ cls.services["disk_offering"]
)
cls.disk_offering_2 = DiskOffering.create(
- cls.api_client,
- cls.services["off"]
+ cls.apiclient,
+ cls.services["disk_offering"]
)
cls._cleanup = [cls.disk_offering_1]
return
@@ -138,8 +207,8 @@ class TestDiskOfferings(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
- cleanup_resources(cls.api_client, cls._cleanup)
+ cls.apiclient = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 f94cf94..ace2db3 100644
--- a/test/integration/smoke/test_global_settings.py
+++ b/test/integration/smoke/test_global_settings.py
@@ -19,9 +19,9 @@
#Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 27225a5..bfef4a8 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -21,43 +21,22 @@ import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
import datetime
-
-class Services:
- """Test Dedicating Guest Vlan Ranges
- """
-
- def __init__(self):
- self.services = {
- "domain": {
- "name": "Domain",
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- "password": "password",
- },
- "name": "testphysicalnetwork",
-
- "vlan": "2118-2120",
- }
-
-
class TestDedicateGuestVlanRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.apiclient = super(TestDedicateGuestVlanRange, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestDedicateGuestVlanRange, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain
- cls.domain = get_domain(cls.apiclient, cls.services)
- cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
# Create Account
cls.account = Account.create(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/test/integration/smoke/test_hosts.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_hosts.py b/test/integration/smoke/test_hosts.py
index 0810bac..52827aa 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 marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
@@ -30,81 +30,15 @@ import time
_multiprocess_shared_ = True
-class Services:
- """Test Hosts & Clusters Services
- """
-
- def __init__(self):
- self.services = {
- "clusters": {
- 0: {
- "clustername": "Xen Cluster",
- "clustertype": "CloudManaged",
- # CloudManaged or ExternalManaged"
- "hypervisor": "XenServer",
- # Hypervisor type
- },
- 1: {
- "clustername": "KVM Cluster",
- "clustertype": "CloudManaged",
- # CloudManaged or ExternalManaged"
- "hypervisor": "KVM",
- # Hypervisor type
- },
- 2: {
- "hypervisor": 'VMware',
- # Hypervisor type
- "clustertype": 'ExternalManaged',
- # CloudManaged or ExternalManaged"
- "username": 'administrator',
- "password": 'fr3sca',
- "url": 'http://192.168.100.17/CloudStack-Clogeny-Pune/Pune-1',
- # Format:http://vCenter Host/Datacenter/Cluster
- "clustername": 'VMWare Cluster',
- },
- },
- "hosts": {
- "xenserver": {
- # Must be name of corresponding Hypervisor type
- # in cluster in small letters
- "hypervisor": 'XenServer',
- # Hypervisor type
- "clustertype": 'CloudManaged',
- # CloudManaged or ExternalManaged"
- "url": 'http://192.168.100.211',
- "username": "root",
- "password": "fr3sca",
- },
- "kvm": {
- "hypervisor": 'KVM',
- # Hypervisor type
- "clustertype": 'CloudManaged',
- # CloudManaged or ExternalManaged"
- "url": 'http://192.168.100.212',
- "username": "root",
- "password": "fr3sca",
- },
- "vmware": {
- "hypervisor": 'VMware',
- # Hypervisor type
- "clustertype": 'ExternalManaged',
- # CloudManaged or ExternalManaged"
- "url": 'http://192.168.100.203',
- "username": "administrator",
- "password": "fr3sca",
- },
- },
- }
-
class TestHosts(cloudstackTestCase):
def setUp(self):
-
self.apiclient = self.testClient.getApiClient()
+ self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
- self.services = Services().services
- self.zone = get_zone(self.apiclient, self.services)
- self.pod = get_pod(self.apiclient, self.zone.id, self.services)
+ self.services = self.testClient.getParsedTestDataConfig()
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
+ self.pod = get_pod(self.apiclient, self.zone.id)
self.cleanup = []
return
@@ -136,7 +70,8 @@ class TestHosts(cloudstackTestCase):
self.apiclient,
v,
zoneid=self.zone.id,
- podid=self.pod.id
+ podid=self.pod.id,
+ hypervisor=self.hypervisor
)
self.debug(
"Created Cluster for hypervisor type %s & ID: %s" %(
@@ -167,8 +102,11 @@ class TestHosts(cloudstackTestCase):
cluster,
self.services["hosts"][hypervisor_type],
zoneid=self.zone.id,
- podid=self.pod.id
+ podid=self.pod.id,
+ hypervisor=self.hypervisor
)
+ if host == FAILED:
+ self.fail("Host Creation Failed")
self.debug(
"Created host (ID: %s) in cluster ID %s" %(
host.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 875df04..d6f3477 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -17,80 +17,29 @@
""" Tests for configuring Internal Load Balancing Rules.
"""
#Import Local Modules
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
-
-class Services:
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- "password": "password",
- },
- "virtual_machine": {
- "displayname": "Test VM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- },
- "network_offering": {
- "name": "Network offering for internal lb service",
- "displaytext": "Network offering for internal lb service",
- "guestiptype": "Isolated",
- "traffictype": "Guest",
- "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL",
- "serviceProviderList": {
- "Dhcp": "VpcVirtualRouter",
- "Dns": "VpcVirtualRouter",
- "Vpn": "VpcVirtualRouter",
- "UserData": "VpcVirtualRouter",
- "Lb": "InternalLbVM",
- "SourceNat": "VpcVirtualRouter",
- "StaticNat": "VpcVirtualRouter",
- "PortForwarding": "VpcVirtualRouter",
- "NetworkACL": "VpcVirtualRouter",
- },
- "serviceCapabilityList": {
- "SourceNat": {"SupportedSourceNatTypes": "peraccount"},
- "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
- }
- }
- }
-
-
class TestInternalLb(cloudstackTestCase):
"""Test Internal LB
"""
@classmethod
def setUpClass(cls):
- cls.apiclient = super(TestInternalLb, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- cls.zone = get_zone(cls.apiclient, cls.services)
+ testClient = super(TestInternalLb, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
- cls.services["service_offering"]
+ cls.services["service_offerings"]
)
cls.account = Account.create(cls.apiclient, services=cls.services["account"])
cls.template = get_template(
@@ -98,6 +47,10 @@ class TestInternalLb(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
+
+ if cls.template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
cls.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,\
cls.account.id))
@@ -106,10 +59,10 @@ class TestInternalLb(cloudstackTestCase):
@attr(tags=["smoke", "advanced", "provisioning"])
def test_internallb(self):
"""Test create, delete, assign, remove of internal loadbalancer
+ """
#1) Create and enable network offering with Internal Lb vm service
- """
+ self.networkOffering = NetworkOffering.create(self.apiclient, self.services["network_offering_internal_lb"], conservemode=False)
#TODO: SIMENH:modify this test to verify lb rules by sending request from another tier
- self.networkOffering = NetworkOffering.create(self.apiclient, self.services["network_offering"], conservemode=False)
self.networkOffering.update(self.apiclient, state="Enabled")
#2) Create VPC and network in it
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 5312d71..6741633 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 marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
import urllib
from random import random
@@ -31,70 +31,19 @@ import time
_multiprocess_shared_ = True
-class Services:
- """Test ISO Services
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended in create account to
- # ensure unique username generated each time
- "password": "password",
- },
- "iso_1":
- {
- "displaytext": "Test ISO 1",
- "name": "ISO 1",
- "url": "http://people.apache.org/~tsp/dummy.iso",
- # Source URL where ISO is located
- "isextractable": True,
- "isfeatured": True,
- "ispublic": True,
- "ostype": "CentOS 5.3 (64-bit)",
- },
- "iso_2":
- {
- "displaytext": "Test ISO 2",
- "name": "ISO 2",
- "url": "http://people.apache.org/~tsp/dummy.iso",
- # Source URL where ISO is located
- "isextractable": True,
- "isfeatured": True,
- "ispublic": True,
- "ostype": "CentOS 5.3 (64-bit)",
- "mode": 'HTTP_DOWNLOAD',
- # Used in Extract template, value must be HTTP_DOWNLOAD
- },
- "isfeatured": True,
- "ispublic": True,
- "isextractable": True,
- "bootable": True, # For edit template
- "passwordenabled": True,
- "sleep": 60,
- "timeout": 10,
- "ostype": "CentOS 5.3 (64-bit)",
- # CentOS 5.3 (64 bit)
- }
-
-
class TestCreateIso(cloudstackTestCase):
#TODO: SIMENH: check the existence of registered of ISO in secondary deploy a VM with registered ISO. can be added \
# as another test
def setUp(self):
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
# Get Zone, Domain and templates
- self.domain = get_domain(self.apiclient, self.services)
- self.zone = get_zone(self.apiclient, self.services)
+ self.domain = get_domain(self.apiclient)
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.services['mode'] = self.zone.networktype
self.services["domainid"] = self.domain.id
- self.services["iso_2"]["zoneid"] = self.zone.id
+ self.services["iso2"]["zoneid"] = self.zone.id
self.account = Account.create(
self.apiclient,
@@ -109,8 +58,8 @@ class TestCreateIso(cloudstackTestCase):
if not isinstance(ostypes, list):
raise unittest.SkipTest("OSTypeId for given description not found")
- self.services["iso_1"]["ostypeid"] = ostypes[0].id
- self.services["iso_2"]["ostypeid"] = ostypes[0].id
+ self.services["iso1"]["ostypeid"] = ostypes[0].id
+ self.services["iso2"]["ostypeid"] = ostypes[0].id
self.services["ostypeid"] = ostypes[0].id
self.cleanup = [self.account]
@@ -139,7 +88,7 @@ class TestCreateIso(cloudstackTestCase):
iso = Iso.create(
self.apiclient,
- self.services["iso_2"],
+ self.services["iso2"],
account=self.account.name,
domainid=self.account.domainid
)
@@ -170,17 +119,17 @@ class TestCreateIso(cloudstackTestCase):
self.assertEqual(
iso_response.displaytext,
- self.services["iso_2"]["displaytext"],
+ self.services["iso2"]["displaytext"],
"Check display text of newly created ISO"
)
self.assertEqual(
iso_response.name,
- self.services["iso_2"]["name"],
+ self.services["iso2"]["name"],
"Check name of newly created ISO"
)
self.assertEqual(
iso_response.zoneid,
- self.services["iso_2"]["zoneid"],
+ self.services["iso2"]["zoneid"],
"Check zone ID of newly created ISO"
)
return
@@ -190,62 +139,62 @@ class TestISO(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.services = Services().services
- cls.api_client = super(TestISO, cls).getClsTestClient().getApiClient()
+ testClient = super(TestISO, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services["domainid"] = cls.domain.id
- cls.services["iso_1"]["zoneid"] = cls.zone.id
- cls.services["iso_2"]["zoneid"] = cls.zone.id
+ cls.services["iso1"]["zoneid"] = cls.zone.id
+ cls.services["iso2"]["zoneid"] = cls.zone.id
cls.services["sourcezoneid"] = cls.zone.id
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
- cls.zones = cls.api_client.listZones(cmd)
+ cls.zones = cls.apiclient.listZones(cmd)
if not isinstance(cls.zones, list):
raise Exception("Failed to find zones.")
#Create an account, ISOs etc.
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
- cls.services["account"] = cls.account.name
# Finding the OsTypeId from Ostype
ostypes = list_os_types(
- cls.api_client,
+ cls.apiclient,
description=cls.services["ostype"]
)
if not isinstance(ostypes, list):
raise unittest.SkipTest("OSTypeId for given description not found")
- cls.services["iso_1"]["ostypeid"] = ostypes[0].id
- cls.services["iso_2"]["ostypeid"] = ostypes[0].id
+ cls.services["iso1"]["ostypeid"] = ostypes[0].id
+ cls.services["iso2"]["ostypeid"] = ostypes[0].id
cls.services["ostypeid"] = ostypes[0].id
cls.iso_1 = Iso.create(
- cls.api_client,
- cls.services["iso_1"],
+ cls.apiclient,
+ cls.services["iso1"],
account=cls.account.name,
domainid=cls.account.domainid
)
try:
- cls.iso_1.download(cls.api_client)
+ cls.iso_1.download(cls.apiclient)
except Exception as e:
raise Exception("Exception while downloading ISO %s: %s"\
% (cls.iso_1.id, e))
cls.iso_2 = Iso.create(
- cls.api_client,
- cls.services["iso_2"],
+ cls.apiclient,
+ cls.services["iso2"],
account=cls.account.name,
domainid=cls.account.domainid
)
try:
- cls.iso_2.download(cls.api_client)
+ cls.iso_2.download(cls.apiclient)
except Exception as e:
raise Exception("Exception while downloading ISO %s: %s"\
% (cls.iso_2.id, e))
@@ -256,9 +205,9 @@ class TestISO(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(TestISO, cls).getClsTestClient().getApiClient()
+ cls.apiclient = super(TestISO, cls).getClsTestClient().getApiClient()
#Clean up, terminate the created templates
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -387,8 +336,8 @@ class TestISO(cloudstackTestCase):
cmd = extractIso.extractIsoCmd()
cmd.id = self.iso_2.id
- cmd.mode = self.services["iso_2"]["mode"]
- cmd.zoneid = self.services["iso_2"]["zoneid"]
+ cmd.mode = self.services["iso2"]["mode"]
+ cmd.zoneid = self.services["iso2"]["zoneid"]
list_extract_response = self.apiclient.extractIso(cmd)
try:
@@ -409,12 +358,12 @@ class TestISO(cloudstackTestCase):
)
self.assertEqual(
list_extract_response.extractMode,
- self.services["iso_2"]["mode"],
+ self.services["iso2"]["mode"],
"Check mode of extraction"
)
self.assertEqual(
list_extract_response.zoneid,
- self.services["iso_2"]["zoneid"],
+ self.services["iso2"]["zoneid"],
"Check zone ID of extraction"
)
self.assertEqual(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/test/integration/smoke/test_loadbalance.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_loadbalance.py b/test/integration/smoke/test_loadbalance.py
index 46eb7d4..daa5fee 100644
--- a/test/integration/smoke/test_loadbalance.py
+++ b/test/integration/smoke/test_loadbalance.py
@@ -15,154 +15,86 @@
# specific language governing permissions and limitations
# under the License.
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
_multiprocess_shared_ = True
-class Services:
- """Test Network Services
- """
-
- def __init__(self):
- self.services = {
- "ostype": "CentOS 5.3 (64-bit)",
- # Cent OS 5.3 (64 bit)
- "lb_switch_wait": 10,
- # Time interval after which LB switches the requests
- "sleep": 60,
- "timeout":10,
- "network_offering": {
- "name": 'Test Network offering',
- "displaytext": 'Test Network offering',
- "guestiptype": 'Isolated',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
- "traffictype": 'GUEST',
- "availability": 'Optional',
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "SourceNat": 'VirtualRouter',
- "PortForwarding": 'VirtualRouter',
- },
- },
- "network": {
- "name": "Test Network",
- "displaytext": "Test Network",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- # in MHz
- "memory": 256,
- # In MBs
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- "password": "password",
- },
- "server":
- {
- "displayname": "Small Instance",
- "username": "root",
- "password": "password",
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "ssh_port": 22,
- "protocol": 'TCP',
- },
- "natrule":
- {
- "privateport": 22,
- "publicport": 2222,
- "protocol": "TCP"
- },
- "lbrule":
- {
- "name": "SSH",
- "alg": "roundrobin",
- # Algorithm used for load balancing
- "privateport": 22,
- "publicport": 2222,
- "protocol": 'TCP'
- }
- }
-
class TestLoadBalance(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestLoadBalance, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestLoadBalance, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
- cls.services["server"]["zoneid"] = cls.zone.id
+ if template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
#Create an account, network, VM and IP addresses
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
cls.vm_1 = VirtualMachine.create(
- cls.api_client,
- cls.services["server"],
+ cls.apiclient,
+ cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id
)
cls.vm_2 = VirtualMachine.create(
- cls.api_client,
- cls.services["server"],
+ cls.apiclient,
+ cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id
)
cls.vm_3 = VirtualMachine.create(
- cls.api_client,
- cls.services["server"],
+ cls.apiclient,
+ cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id
)
cls.non_src_nat_ip = PublicIPAddress.create(
- cls.api_client,
+ cls.apiclient,
cls.account.name,
cls.zone.id,
cls.account.domainid,
- cls.services["server"]
+ cls.services["virtual_machine"]
)
# Open up firewall port for SSH
cls.fw_rule = FireWallRule.create(
- cls.api_client,
+ cls.apiclient,
ipaddressid=cls.non_src_nat_ip.ipaddress.id,
protocol=cls.services["lbrule"]["protocol"],
cidrlist=['0.0.0.0/0'],
@@ -185,7 +117,7 @@ class TestLoadBalance(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
return
def try_ssh(self, ip_addr, hostnames):
@@ -208,7 +140,7 @@ class TestLoadBalance(cloudstackTestCase):
except Exception as e:
self.fail("%s: SSH failed for VM with IP Address: %s" %
(e, ip_addr))
- time.sleep(self.services["lb_switch_wait"])
+ time.sleep(10)
return
@attr(tags = ["advanced", "advancedns", "smoke", "provisioning"])
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 0c6c02a..ad3a3cf 100644
--- a/test/integration/smoke/test_multipleips_per_nic.py
+++ b/test/integration/smoke/test_multipleips_per_nic.py
@@ -16,6 +16,7 @@
# under the License.
#Test from the Marvin - Testing in Python wiki
+from marvin.codes import FAILED
#All tests inherit from cloudstackTestCase
from marvin.cloudstackTestCase import cloudstackTestCase
@@ -23,13 +24,13 @@ 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
+from marvin.lib.base import Account, VirtualMachine, ServiceOffering
#utils - utility classes for common cleanup, external library wrappers etc
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.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
+from marvin.lib.common import get_zone, get_domain, get_template
from marvin.cloudstackAPI.addIpToNic import addIpToNicCmd
from marvin.cloudstackAPI.removeIpFromNic import removeIpFromNicCmd
@@ -38,52 +39,23 @@ from marvin.cloudstackAPI.listNics import listNicsCmd
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": {
- "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.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"])
+ if self.template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % self.testdata["ostype"]
+
#create a user account
self.account = Account.create(
self.apiclient,
@@ -93,7 +65,7 @@ class TestDeployVM(cloudstackTestCase):
#create a service offering
self.service_offering = ServiceOffering.create(
self.apiclient,
- self.testdata["service_offering"]["small"]
+ self.testdata["service_offerings"]["small"]
)
#build cleanup list
self.cleanup = [
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 2cdcfa2..a9e0c25 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -18,139 +18,67 @@
"""
#Import Local Modules
import marvin
-from marvin.cloudstackException import cloudstackAPIException
+from marvin.codes import FAILED
+from marvin.cloudstackException import CloudstackAPIException
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
_multiprocess_shared_ = True
-class Services:
- """Test Network Services
- """
-
- def __init__(self):
- self.services = {
- "ostype": "CentOS 5.3 (64-bit)",
- # Cent OS 5.3 (64 bit)
- "lb_switch_wait": 10,
- # Time interval after which LB switches the requests
- "sleep": 60,
- "timeout":10,
- "network_offering": {
- "name": 'Test Network offering',
- "displaytext": 'Test Network offering',
- "guestiptype": 'Isolated',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
- "traffictype": 'GUEST',
- "availability": 'Optional',
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "SourceNat": 'VirtualRouter',
- "PortForwarding": 'VirtualRouter',
- },
- },
- "network": {
- "name": "Test Network",
- "displaytext": "Test Network",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- # in MHz
- "memory": 256,
- # In MBs
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- "password": "password",
- },
- "server":
- {
- "displayname": "Small Instance",
- "username": "root",
- "password": "password",
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "ssh_port": 22,
- "protocol": 'TCP',
- },
- "natrule":
- {
- "privateport": 22,
- "publicport": 22,
- "protocol": "TCP"
- },
- "lbrule":
- {
- "name": "SSH",
- "alg": "roundrobin",
- # Algorithm used for load balancing
- "privateport": 22,
- "publicport": 2222,
- "protocol": 'TCP'
- }
- }
-
class TestPublicIP(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
- self.services = Services().services
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestPublicIP, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestPublicIP, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create Accounts & networks
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
cls.user = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
cls.services["network"]["zoneid"] = cls.zone.id
cls.network_offering = NetworkOffering.create(
- cls.api_client,
+ cls.apiclient,
cls.services["network_offering"],
)
# Enable Network offering
- cls.network_offering.update(cls.api_client, state='Enabled')
+ cls.network_offering.update(cls.apiclient, state='Enabled')
cls.services["network"]["networkoffering"] = cls.network_offering.id
cls.account_network = Network.create(
- cls.api_client,
+ cls.apiclient,
cls.services["network"],
cls.account.name,
cls.account.domainid
)
cls.user_network = Network.create(
- cls.api_client,
+ cls.apiclient,
cls.services["network"],
cls.user.name,
cls.user.domainid
@@ -158,13 +86,13 @@ class TestPublicIP(cloudstackTestCase):
# Create Source NAT IP addresses
account_src_nat_ip = PublicIPAddress.create(
- cls.api_client,
+ cls.apiclient,
cls.account.name,
cls.zone.id,
cls.account.domainid
)
user_src_nat_ip = PublicIPAddress.create(
- cls.api_client,
+ cls.apiclient,
cls.user.name,
cls.zone.id,
cls.user.domainid
@@ -182,7 +110,7 @@ class TestPublicIP(cloudstackTestCase):
def tearDownClass(cls):
try:
#Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -223,6 +151,7 @@ class TestPublicIP(cloudstackTestCase):
)
ip_address.delete(self.apiclient)
+ time.sleep(30)
# Validate the following:
# 1.listPublicIpAddresses should no more return the released address
@@ -231,10 +160,15 @@ class TestPublicIP(cloudstackTestCase):
id=ip_address.ipaddress.id
)
self.assertEqual(
- list_pub_ip_addr_resp,
- None,
- "Check if disassociated IP Address is no longer available"
- )
+ isinstance(list_pub_ip_addr_resp, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ self.assertEqual(
+ len(list_pub_ip_addr_resp),
+ 0,
+ "Check if the list public ip api response is not zero"
+ )
return
@attr(tags = ["advanced", "advancedns", "smoke", "selfservice"])
@@ -293,32 +227,35 @@ class TestPortForwarding(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestPortForwarding, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
-
+ testClient = super(TestPortForwarding, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
template = get_template(
- cls.api_client,
+ cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
+ if template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
#Create an account, network, VM and IP addresses
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
admin=True,
domainid=cls.domain.id
)
- cls.services["server"]["zoneid"] = cls.zone.id
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
- cls.services["server"],
+ cls.apiclient,
+ cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -338,8 +275,8 @@ class TestPortForwarding(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
- cls.api_client = super(TestPortForwarding, cls).getClsTestClient().getApiClient()
- cleanup_resources(cls.api_client, cls._cleanup)
+ cls.apiclient = super(TestPortForwarding, cls).getClsTestClient().getApiClient()
+ cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -437,22 +374,27 @@ class TestPortForwarding(cloudstackTestCase):
))
self.virtual_machine.get_ssh_client(src_nat_ip_addr.ipaddress)
-
+ vm_response = VirtualMachine.list(
+ self.apiclient,
+ id=self.virtual_machine.id
+ )
+ if vm_response[0].state != 'Running':
+ self.fail("State of VM : %s is not found to be Running" % str(self.virtual_machine.ipaddress))
+
except Exception as e:
self.fail(
"SSH Access failed for %s: %s" % \
(self.virtual_machine.ipaddress, e)
)
- nat_rule.delete(self.apiclient)
-
try:
+ nat_rule.delete(self.apiclient)
list_nat_rule_response = list_nat_rules(
self.apiclient,
id=nat_rule.id
)
- except cloudstackAPIException:
- self.debug("Nat Rule is deleted")
+ except CloudstackAPIException:
+ self.fail("Nat Rule Deletion or Listing Failed")
# Check if the Public SSH port is inaccessible
with self.assertRaises(Exception):
@@ -464,9 +406,7 @@ class TestPortForwarding(cloudstackTestCase):
src_nat_ip_addr.ipaddress,
self.virtual_machine.ssh_port,
self.virtual_machine.username,
- self.virtual_machine.password,
- retries=2,
- delay=0
+ self.virtual_machine.password
)
return
@@ -483,7 +423,7 @@ class TestPortForwarding(cloudstackTestCase):
self.account.name,
self.zone.id,
self.account.domainid,
- self.services["server"]
+ self.services["virtual_machine"]
)
self.cleanup.append(ip_address)
@@ -569,7 +509,7 @@ class TestPortForwarding(cloudstackTestCase):
self.apiclient,
id=nat_rule.id
)
- except cloudstackAPIException:
+ except CloudstackAPIException:
self.debug("Nat Rule is deleted")
# Check if the Public SSH port is inaccessible
@@ -596,17 +536,19 @@ class TestRebootRouter(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- self.domain = get_domain(self.apiclient, self.services)
- self.zone = get_zone(self.apiclient, self.services)
+ self.domain = get_domain(self.apiclient)
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,
self.services["ostype"]
)
- self.services["server"]["zoneid"] = self.zone.id
+ if template == FAILED:
+ self.fail("get_template() failed to return template with description %s" % self.services["ostype"])
+ self.services["virtual_machine"]["zoneid"] = self.zone.id
#Create an account, network, VM and IP addresses
self.account = Account.create(
@@ -617,11 +559,11 @@ class TestRebootRouter(cloudstackTestCase):
)
self.service_offering = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"]
+ self.services["service_offerings"]
)
self.vm_1 = VirtualMachine.create(
self.apiclient,
- self.services["server"],
+ self.services["virtual_machine"],
templateid=template.id,
accountid=self.account.name,
domainid=self.account.domainid,
@@ -646,7 +588,7 @@ class TestRebootRouter(cloudstackTestCase):
self.vm_1.account,
self.vm_1.zoneid,
self.vm_1.domainid,
- self.services["server"]
+ self.services["virtual_machine"]
)
#Open up firewall port for SSH
fw_rule = FireWallRule.create(
@@ -762,17 +704,17 @@ class TestReleaseIP(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- self.domain = get_domain(self.apiclient, self.services)
- self.zone = get_zone(self.apiclient, self.services)
+ self.domain = get_domain(self.apiclient)
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,
self.services["ostype"]
)
- self.services["server"]["zoneid"] = self.zone.id
+ self.services["virtual_machine"]["zoneid"] = self.zone.id
#Create an account, network, VM, Port forwarding rule, LB rules
self.account = Account.create(
@@ -784,12 +726,12 @@ class TestReleaseIP(cloudstackTestCase):
self.service_offering = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"]
+ self.services["service_offerings"]
)
self.virtual_machine = VirtualMachine.create(
self.apiclient,
- self.services["server"],
+ self.services["virtual_machine"],
templateid=template.id,
accountid=self.account.name,
domainid=self.account.domainid,
@@ -867,7 +809,7 @@ class TestReleaseIP(cloudstackTestCase):
id=self.nat_rule.id
)
self.debug("List NAT Rule response" + str(list_nat_rule))
- except cloudstackAPIException:
+ except CloudstackAPIException:
self.debug("Port Forwarding Rule is deleted")
# listLoadBalancerRules should not list
@@ -878,7 +820,7 @@ class TestReleaseIP(cloudstackTestCase):
id=self.lb_rule.id
)
self.debug("List LB Rule response" + str(list_lb_rule))
- except cloudstackAPIException:
+ except CloudstackAPIException:
self.debug("Port Forwarding Rule is deleted")
# SSH Attempt though public IP should fail
@@ -899,17 +841,17 @@ class TestDeleteAccount(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- self.domain = get_domain(self.apiclient, self.services)
- self.zone = get_zone(self.apiclient, self.services)
+ self.domain = get_domain(self.apiclient)
+ self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,
self.services["ostype"]
)
- self.services["server"]["zoneid"] = self.zone.id
+ self.services["virtual_machine"]["zoneid"] = self.zone.id
#Create an account, network, VM and IP addresses
self.account = Account.create(
@@ -920,11 +862,11 @@ class TestDeleteAccount(cloudstackTestCase):
)
self.service_offering = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"]
+ self.services["service_offerings"]
)
self.vm_1 = VirtualMachine.create(
self.apiclient,
- self.services["server"],
+ self.services["virtual_machine"],
templateid=template.id,
accountid=self.account.name,
domainid=self.account.domainid,
@@ -993,7 +935,7 @@ class TestDeleteAccount(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid
)
- except cloudstackAPIException:
+ except CloudstackAPIException:
self.debug("Port Forwarding Rule is deleted")
# ListPortForwardingRules should not
@@ -1004,7 +946,7 @@ class TestDeleteAccount(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid
)
- except cloudstackAPIException:
+ except CloudstackAPIException:
self.debug("NATRule is deleted")
#Retrieve router for the user account
@@ -1019,7 +961,7 @@ class TestDeleteAccount(cloudstackTestCase):
None,
"Check routers are properly deleted."
)
- except cloudstackAPIException:
+ except CloudstackAPIException:
self.debug("Router is deleted")
except Exception as e:
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 69134e5..68e5067 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -17,77 +17,27 @@
""" Tests for Network ACLs in VPC
"""
#Import Local Modules
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
-class Services:
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- "password": "password",
- },
- "virtual_machine": {
- "displayname": "Test VM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 256,
- },
- "network_offering": {
- "name": "Network offering for internal lb service",
- "displaytext": "Network offering for internal lb service",
- "guestiptype": "Isolated",
- "traffictype": "Guest",
- "supportedservices": "Vpn,Dhcp,Dns,Lb,UserData,SourceNat,StaticNat,PortForwarding,NetworkACL",
- "serviceProviderList": {
- "Dhcp": "VpcVirtualRouter",
- "Dns": "VpcVirtualRouter",
- "Vpn": "VpcVirtualRouter",
- "UserData": "VpcVirtualRouter",
- "Lb": "InternalLbVM",
- "SourceNat": "VpcVirtualRouter",
- "StaticNat": "VpcVirtualRouter",
- "PortForwarding": "VpcVirtualRouter",
- "NetworkACL": "VpcVirtualRouter",
- },
- "serviceCapabilityList": {
- "SourceNat": {"SupportedSourceNatTypes": "peraccount"},
- "Lb": {"lbSchemes": "internal", "SupportedLbIsolation": "dedicated"}
- }
- }
- }
-
-
class TestNetworkACL(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.apiclient = super(TestNetworkACL, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- cls.zone = get_zone(cls.apiclient, cls.services)
+ testClient = super(TestNetworkACL, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
- cls.services["service_offering"]
+ cls.services["service_offerings"]
)
cls.account = Account.create(cls.apiclient, services=cls.services["account"])
cls.template = get_template(
@@ -95,6 +45,10 @@ class TestNetworkACL(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
+
+ if cls.template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
+
cls.debug("Successfully created account: %s, id: \
%s" % (cls.account.name,\
cls.account.id))
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/test/integration/smoke/test_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index 4ba905a..abfe443 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -16,119 +16,19 @@
# under the License.
""" NIC tests for VM """
import marvin
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
import signal
import sys
import time
-class 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",
- },
- # Create a small virtual machine instance with disk offering
- "small": {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "service_offerings": {
- "tiny": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- },
- },
- "network_offering": {
- "name": 'Test Network offering',
- "displaytext": 'Test Network offering',
- "guestiptype": 'Isolated',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
- "traffictype": 'GUEST',
- "availability": 'Optional',
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "SourceNat": 'VirtualRouter',
- "PortForwarding": 'VirtualRouter',
- },
- },
- "network_offering_shared": {
- "name": 'Test Network offering shared',
- "displaytext": 'Test Network offering Shared',
- "guestiptype": 'Shared',
- "supportedservices": 'Dhcp,Dns,UserData',
- "traffictype": 'GUEST',
- "specifyVlan" : "True",
- "specifyIpRanges" : "True",
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "UserData": 'VirtualRouter',
- },
- },
- "network": {
- "name": "Test Network",
- "displaytext": "Test Network",
- "acltype": "Account",
- },
- "network2": {
- "name": "Test Network Shared",
- "displaytext": "Test Network Shared",
- "vlan" :1201,
- "gateway" :"172.16.15.1",
- "netmask" :"255.255.255.0",
- "startip" :"172.16.15.21",
- "endip" :"172.16.15.41",
- "acltype": "Account",
- },
- # ISO settings for Attach/Detach ISO tests
- "iso": {
- "displaytext": "Test ISO",
- "name": "testISO",
- "url": "http://people.apache.org/~tsp/dummy.iso",
- # Source URL where ISO is located
- "ostype": 'CentOS 5.3 (64-bit)',
- "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO
- },
- "template": {
- "displaytext": "Cent OS Template",
- "name": "Cent OS Template",
- "passwordenabled": True,
- },
- "sleep": 60,
- "timeout": 10,
- #Migrate VM to hostid
- "ostype": 'CentOS 5.3 (64-bit)',
- # CentOS 5.3 (64-bit)
- }
-
class TestNic(cloudstackTestCase):
def setUp(self):
@@ -145,11 +45,11 @@ class TestNic(cloudstackTestCase):
try:
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- self.services = Services().services
+ self.services = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
- domain = get_domain(self.apiclient, self.services)
- zone = get_zone(self.apiclient, self.services)
+ domain = get_domain(self.apiclient)
+ zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.services['mode'] = zone.networktype
if zone.networktype != 'Advanced':
@@ -169,7 +69,7 @@ class TestNic(cloudstackTestCase):
self.services["small"]["zoneid"] = zone.id
self.services["small"]["template"] = template.id
- self.services["iso"]["zoneid"] = zone.id
+ self.services["iso1"]["zoneid"] = zone.id
self.services["network"]["zoneid"] = zone.id
# Create Account, VMs, NAT Rules etc
@@ -224,7 +124,7 @@ class TestNic(cloudstackTestCase):
except Exception as ex:
self.debug("Exception during NIC test SETUP!: " + str(ex))
- @attr(tags = ["devcloud", "advanced", "advancedns", "smoke", "basic", "sg", "provisioning"])
+ @attr(tags = ["devcloud", "smoke", "basic", "sg", "provisioning"])
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/404ac549/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 2f23add..a84e62f 100644
--- a/test/integration/smoke/test_non_contigiousvlan.py
+++ b/test/integration/smoke/test_non_contigiousvlan.py
@@ -18,8 +18,8 @@
from marvin import cloudstackTestCase
from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.integration.lib.base import Account
-from marvin.integration.lib.base import PhysicalNetwork
+from marvin.lib.base import Account
+from marvin.lib.base import PhysicalNetwork
from nose.plugins.attrib import attr
class Services():
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/404ac549/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 7d10fc7..1c5d8a5 100644
--- a/test/integration/smoke/test_over_provisioning.py
+++ b/test/integration/smoke/test_over_provisioning.py
@@ -19,9 +19,9 @@
#Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.base import *
+from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
@@ -67,7 +67,11 @@ class TestUpdateOverProvision(cloudstackTestCase):
self.poolId = pool.id
""" list overprovisioning factor for storage pool """
- factorOld = float(pool.overprovisionfactor)
+ failed = 0
+ if pool.overprovisionfactor is None:
+ failed = 1
+ self.assertNotEqual(failed,1,"pool.overprovisionfactor is none")
+ factorOld = float(str(pool.overprovisionfactor))
factorNew = str(factorOld + 1.0)
""" update setting for the pool"""
@@ -85,7 +89,11 @@ class TestUpdateOverProvision(cloudstackTestCase):
id = self.poolId
)
pool = storage_pools[0]
- factorNew = float(pool.overprovisionfactor)
+ failed = 0
+ if pool.overprovisionfactor is None:
+ failed = 1
+ self.assertNotEqual(failed,1,"pool.overprovisionfactor is none")
+ factorNew = float(str(pool.overprovisionfactor))
self.assertNotEqual(int(factorNew), int(factorOld)," Check if overprovision factor of storage pool has changed")
self.assertEqual(int(factorNew), int(factorOld + 1.0)," Check if overprovision factor of storage pool has increased by 1")
@@ -100,8 +108,11 @@ class TestUpdateOverProvision(cloudstackTestCase):
pool = storage_pools[0]
updateConfigurationCmd = updateConfiguration.updateConfigurationCmd()
updateConfigurationCmd.name = "storage.overprovisioning.factor"
- factorOld = float(pool.overprovisionfactor)
+ factorOld = 0
+ if pool.overprovisionfactor is not None:
+ factorOld = float(str(pool.overprovisionfactor))
factorNew = str(factorOld - 1.0)
- updateConfigurationCmd.value = factorNew
- updateConfigurationCmd.storageid = pool.id
- updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
+ if factorNew > 0:
+ updateConfigurationCmd.value = factorNew
+ updateConfigurationCmd.storageid = pool.id
+ updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)