You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 17:41:29 UTC
[12/18] Marvin + test changes from master Signed-off-by:
SrikanteswaraRao Talluri
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index 6f280b8..2924b72 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -21,8 +21,8 @@
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.cloudstackAPI import startVirtualMachine, stopVirtualMachine
-from marvin.integration.lib.utils import cleanup_resources, validateList
-from marvin.integration.lib.base import (VirtualMachine,
+from marvin.lib.utils import cleanup_resources, validateList
+from marvin.lib.base import (VirtualMachine,
ServiceOffering,
Account,
NATRule,
@@ -35,7 +35,7 @@ from marvin.integration.lib.base import (VirtualMachine,
StaticNATRule,
NetworkACL,
PublicIPAddress)
-from marvin.integration.lib.common import (get_zone,
+from marvin.lib.common import (get_zone,
get_domain,
get_template,
wait_for_cleanup,
@@ -239,17 +239,17 @@ class TestVPCNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVPCNetwork,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetwork, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
+
# Added an attribute to track if Netscaler addition was successful.
# Value is checked in tests and if not configured, Netscaler tests will be skipped
cls.ns_configured = False
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -1003,17 +1003,17 @@ class TestVPCNetworkRanges(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVPCNetworkRanges,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetworkRanges, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
+
# Added an attribute to track if Netscaler addition was successful.
# Value is checked in tests and if not configured, Netscaler tests will be skipped
cls.ns_configured = False
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -1541,14 +1541,14 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVPCNetworkUpgrade,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetworkUpgrade, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
+
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -2123,14 +2123,14 @@ class TestVPCNetworkGc(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVPCNetworkGc,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetworkGc, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
+
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_network_lbrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index 9d75550..a5625e7 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -20,7 +20,7 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
-from marvin.integration.lib.base import (stopRouter,
+from marvin.lib.base import (stopRouter,
startRouter,
Account,
VpcOffering,
@@ -34,11 +34,11 @@ from marvin.integration.lib.base import (stopRouter,
VirtualMachine,
LoadBalancerRule,
StaticNATRule)
-from marvin.integration.lib.common import (get_domain,
+from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_routers)
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.utils import cleanup_resources
import socket
import time
@@ -181,14 +181,13 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
- cls.api_client = super(
- TestVPCNetworkLBRules,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetworkLBRules, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index e5bb158..31e7320 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -19,7 +19,7 @@
"""
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
-from marvin.integration.lib.base import (stopRouter,
+from marvin.lib.base import (stopRouter,
startRouter,
Account,
VpcOffering,
@@ -32,11 +32,11 @@ from marvin.integration.lib.base import (stopRouter,
Network,
VirtualMachine,
LoadBalancerRule)
-from marvin.integration.lib.common import (get_domain,
+from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_routers)
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.utils import cleanup_resources
import socket
import time
@@ -182,14 +182,13 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
- cls.api_client = super(
- TestVPCNetworkPFRules,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetworkPFRules, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_network_staticnatrule.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_staticnatrule.py b/test/integration/component/test_vpc_network_staticnatrule.py
index ddc3c4c..65cb044 100644
--- a/test/integration/component/test_vpc_network_staticnatrule.py
+++ b/test/integration/component/test_vpc_network_staticnatrule.py
@@ -19,7 +19,7 @@
"""
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
-from marvin.integration.lib.base import (Account,
+from marvin.lib.base import (Account,
VpcOffering,
VPC,
ServiceOffering,
@@ -32,11 +32,11 @@ from marvin.integration.lib.base import (Account,
StaticNATRule)
from marvin.cloudstackAPI import (stopRouter,
startRouter)
-from marvin.integration.lib.common import (get_domain,
+from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_routers)
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.utils import cleanup_resources
import socket
import time
@@ -182,14 +182,13 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
# We want to fail quicker if it's failure
socket.setdefaulttimeout(60)
- cls.api_client = super(
- TestVPCNetworkPFRules,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCNetworkPFRules, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_offerings.py b/test/integration/component/test_vpc_offerings.py
index 9e3064b..f190773 100644
--- a/test/integration/component/test_vpc_offerings.py
+++ b/test/integration/component/test_vpc_offerings.py
@@ -23,9 +23,9 @@ 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 *
from marvin.sshClient import SshClient
import datetime
@@ -137,14 +137,13 @@ class TestVPCOffering(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVPCOffering,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCOffering, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_routers.py b/test/integration/component/test_vpc_routers.py
index fb5aed5..3cf537a 100644
--- a/test/integration/component/test_vpc_routers.py
+++ b/test/integration/component/test_vpc_routers.py
@@ -22,9 +22,9 @@ 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
@@ -169,16 +169,15 @@ class TestVPCRoutersBasic(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.apiclient = super(
- TestVPCRoutersBasic,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPCRoutersBasic, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.apiclient, cls.services)
- cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.domain = get_domain(cls.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
- cls.apiclient,
+ cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
@@ -186,16 +185,16 @@ class TestVPCRoutersBasic(cloudstackTestCase):
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
+ cls.api_client,
cls.services["service_offering"]
)
cls.vpc_off = VpcOffering.create(
- cls.apiclient,
+ cls.api_client,
cls.services["vpc_offering"]
)
- cls.vpc_off.update(cls.apiclient, state='Enabled')
+ cls.vpc_off.update(cls.api_client, state='Enabled')
cls.account = Account.create(
- cls.apiclient,
+ cls.api_client,
cls.services["account"],
admin=True,
domainid=cls.domain.id
@@ -203,13 +202,13 @@ class TestVPCRoutersBasic(cloudstackTestCase):
cls._cleanup = [cls.account]
cls._cleanup.append(cls.vpc_off)
#cls.debug("Enabling the VPC offering created")
- cls.vpc_off.update(cls.apiclient, state='Enabled')
+ cls.vpc_off.update(cls.api_client, state='Enabled')
#cls.debug("creating a VPC network in the account: %s" %
# cls.account.name)
cls.services["vpc"]["cidr"] = '10.1.1.1/16'
cls.vpc = VPC.create(
- cls.apiclient,
+ cls.api_client,
cls.services["vpc"],
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
@@ -224,13 +223,13 @@ class TestVPCRoutersBasic(cloudstackTestCase):
def tearDownClass(cls):
try:
#Cleanup resources used
- cleanup_resources(cls.apiclient, cls._cleanup)
+ cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self):
- self.apiclient = self.testClient.getApiClient()
+ self.api_client = self.testClient.getApiClient()
return
@@ -242,7 +241,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.debug("Check if the VPC offering is created successfully?")
vpc_offs = VpcOffering.list(
- self.apiclient,
+ self.api_client,
id=vpc_offering.id
)
self.assertEqual(
@@ -265,7 +264,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.debug("Check if the VPC network is created successfully?")
vpc_networks = VPC.list(
- self.apiclient,
+ self.api_client,
id=network.id
)
self.assertEqual(
@@ -291,7 +290,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
""" Migrate the router """
self.debug("Checking if the host is available for migration?")
- hosts = Host.list(self.apiclient, zoneid=self.zone.id, type='Routing')
+ hosts = Host.list(self.api_client, zoneid=self.zone.id, type='Routing')
self.assertEqual(
isinstance(hosts, list),
@@ -319,7 +318,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
cmd.isAsync = "false"
cmd.hostid = host.id
cmd.virtualmachineid = router.id
- self.apiclient.migrateSystemVm(cmd)
+ self.api_client.migrateSystemVm(cmd)
except Exception as e:
self.fail("Failed to migrate instance, %s" % e)
@@ -329,7 +328,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -358,7 +357,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
# Stop the VPC Router
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -374,11 +373,11 @@ class TestVPCRoutersBasic(cloudstackTestCase):
#Stop the router
cmd = stopRouter.stopRouterCmd()
cmd.id = router.id
- self.apiclient.stopRouter(cmd)
+ self.api_client.stopRouter(cmd)
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -399,11 +398,11 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.debug("Starting the router with ID: %s" % router.id)
cmd = startRouter.startRouterCmd()
cmd.id = router.id
- self.apiclient.startRouter(cmd)
+ self.api_client.startRouter(cmd)
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -433,7 +432,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.validate_vpc_offering(self.vpc_off)
self.validate_vpc_network(self.vpc)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -449,11 +448,11 @@ class TestVPCRoutersBasic(cloudstackTestCase):
#Reboot the router
cmd = rebootRouter.rebootRouterCmd()
cmd.id = router.id
- self.apiclient.rebootRouter(cmd)
+ self.api_client.rebootRouter(cmd)
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -478,7 +477,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.validate_vpc_network(self.vpc)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -505,7 +504,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.validate_vpc_network(self.vpc)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -521,15 +520,15 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.debug("Stopping the router with ID: %s" % router.id)
cmd = stopRouter.stopRouterCmd()
cmd.id = router.id
- self.apiclient.stopRouter(cmd)
+ self.api_client.stopRouter(cmd)
service_offering = ServiceOffering.create(
- self.apiclient,
+ self.api_client,
self.services["service_offering_new"]
)
self.debug("Changing service offering for the Router %s" % router.id)
try:
- router = Router.change_service_offering(self.apiclient,
+ router = Router.change_service_offering(self.api_client,
router.id,
service_offering.id
)
@@ -538,7 +537,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.debug("Router %s" % router)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -562,7 +561,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
self.validate_vpc_offering(self.vpc_off)
self.validate_vpc_network(self.vpc)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -573,12 +572,12 @@ class TestVPCRoutersBasic(cloudstackTestCase):
"List Routers should return a valid list"
)
- Router.destroy( self.apiclient,
+ Router.destroy( self.api_client,
id=routers[0].id
)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -594,17 +593,16 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.apiclient = super(
- TestVPCRouterOneNetwork,
- cls
- ).getClsTestClient().getApiClient()
cls._cleanup = []
+ cls.testClient = super(TestVPCRouterOneNetwork, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# Get Zone, Domain and templates
- cls.domain = get_domain(cls.apiclient, cls.services)
- cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.domain = get_domain(cls.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
- cls.apiclient,
+ cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
@@ -612,19 +610,19 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
+ cls.api_client,
cls.services["service_offering"]
)
cls._cleanup.append(cls.service_offering)
cls.vpc_off = VpcOffering.create(
- cls.apiclient,
+ cls.api_client,
cls.services["vpc_offering"]
)
- cls.vpc_off.update(cls.apiclient, state='Enabled')
+ cls.vpc_off.update(cls.api_client, state='Enabled')
cls._cleanup.append(cls.vpc_off)
cls.account = Account.create(
- cls.apiclient,
+ cls.api_client,
cls.services["account"],
admin=True,
domainid=cls.domain.id
@@ -633,7 +631,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.services["vpc"]["cidr"] = '10.1.1.1/16'
cls.vpc = VPC.create(
- cls.apiclient,
+ cls.api_client,
cls.services["vpc"],
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
@@ -642,7 +640,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
private_gateway = PrivateGateway.create(
- cls.apiclient,
+ cls.api_client,
gateway='10.1.3.1',
ipaddress='10.1.3.100',
netmask='255.255.255.0',
@@ -650,34 +648,34 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
vpcid=cls.vpc.id
)
cls.gateways = PrivateGateway.list(
- cls.apiclient,
+ cls.api_client,
id=private_gateway.id,
listall=True
)
static_route = StaticRoute.create(
- cls.apiclient,
+ cls.api_client,
cidr='11.1.1.1/24',
gatewayid=private_gateway.id
)
cls.static_routes = StaticRoute.list(
- cls.apiclient,
+ cls.api_client,
id=static_route.id,
listall=True
)
cls.nw_off = NetworkOffering.create(
- cls.apiclient,
+ cls.api_client,
cls.services["network_offering"],
conservemode=False
)
# Enable Network offering
- cls.nw_off.update(cls.apiclient, state='Enabled')
+ cls.nw_off.update(cls.api_client, state='Enabled')
cls._cleanup.append(cls.nw_off)
# Creating network using the network offering created
cls.network_1 = Network.create(
- cls.apiclient,
+ cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -689,7 +687,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
# Spawn an instance in that network
vm_1 = VirtualMachine.create(
- cls.apiclient,
+ cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -697,7 +695,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
networkids=[str(cls.network_1.id)]
)
vm_2 = VirtualMachine.create(
- cls.apiclient,
+ cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -707,7 +705,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
# Spawn an instance in that network
vm_3 = VirtualMachine.create(
- cls.apiclient,
+ cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@@ -716,14 +714,14 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
vms = VirtualMachine.list(
- cls.apiclient,
+ cls.api_client,
account=cls.account.name,
domainid=cls.account.domainid,
listall=True
)
public_ip_1 = PublicIPAddress.create(
- cls.apiclient,
+ cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.domainid,
@@ -732,7 +730,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
nat_rule = NATRule.create(
- cls.apiclient,
+ cls.api_client,
vm_1,
cls.services["natrule"],
ipaddressid=public_ip_1.ipaddress.id,
@@ -742,14 +740,14 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
nwacl_nat = NetworkACL.create(
- cls.apiclient,
+ cls.api_client,
networkid=cls.network_1.id,
services=cls.services["natrule"],
traffictype='Ingress'
)
public_ip_2 = PublicIPAddress.create(
- cls.apiclient,
+ cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.domainid,
@@ -758,7 +756,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
try:
StaticNATRule.enable(
- cls.apiclient,
+ cls.api_client,
ipaddressid=public_ip_2.ipaddress.id,
virtualmachineid=vm_2.id,
networkid=cls.network_1.id
@@ -768,7 +766,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
public_ip_2.ipaddress.ipaddress, e))
public_ips = PublicIPAddress.list(
- cls.apiclient,
+ cls.api_client,
networkid=cls.network_1.id,
listall=True,
isstaticnat=True,
@@ -776,7 +774,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
domainid=cls.account.domainid
)
public_ip_3 = PublicIPAddress.create(
- cls.apiclient,
+ cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.domainid,
@@ -785,7 +783,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
lb_rule = LoadBalancerRule.create(
- cls.apiclient,
+ cls.api_client,
cls.services["lbrule"],
ipaddressid=public_ip_3.ipaddress.id,
accountid=cls.account.name,
@@ -794,17 +792,17 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
domainid=cls.account.domainid
)
- lb_rule.assign(cls.apiclient, [vm_3])
+ lb_rule.assign(cls.api_client, [vm_3])
nwacl_lb = NetworkACL.create(
- cls.apiclient,
+ cls.api_client,
networkid=cls.network_1.id,
services=cls.services["lbrule"],
traffictype='Ingress'
)
nwacl_internet_1 = NetworkACL.create(
- cls.apiclient,
+ cls.api_client,
networkid=cls.network_1.id,
services=cls.services["http_rule"],
traffictype='Egress'
@@ -814,20 +812,20 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
def tearDownClass(cls):
try:
#Cleanup resources used
- cleanup_resources(cls.apiclient, cls._cleanup)
+ cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self):
- self.apiclient = self.testClient.getApiClient()
+ self.api_client = self.testClient.getApiClient()
self.cleanup = []
return
def tearDown(self):
try:
#Clean up, terminate the created network offerings
- cleanup_resources(self.apiclient, self.cleanup)
+ cleanup_resources(self.api_client, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -838,7 +836,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
self.debug("Check if the VPC offering is created successfully?")
vpc_offs = VpcOffering.list(
- self.apiclient,
+ self.api_client,
id=vpc_offering.id
)
self.assertEqual(
@@ -861,7 +859,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
self.debug("Check if the VPC network is created successfully?")
vpc_networks = VPC.list(
- self.apiclient,
+ self.api_client,
id=network.id
)
self.assertEqual(
@@ -887,13 +885,13 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
""" Validate network rules
"""
vms = VirtualMachine.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
)
public_ips = PublicIPAddress.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -927,7 +925,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
""" Migrate the router """
self.debug("Checking if the host is available for migration?")
- hosts = Host.list(self.apiclient, zoneid=self.zone.id, type='Routing')
+ hosts = Host.list(self.api_client, zoneid=self.zone.id, type='Routing')
self.assertEqual(
isinstance(hosts, list),
@@ -955,7 +953,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cmd.isAsync = "false"
cmd.hostid = host.id
cmd.virtualmachineid = router.id
- self.apiclient.migrateSystemVm(cmd)
+ self.api_client.migrateSystemVm(cmd)
except Exception as e:
self.fail("Failed to migrate instance, %s" % e)
@@ -965,7 +963,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -1012,7 +1010,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
# Stop the VPC Router
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -1028,11 +1026,11 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
#Stop the router
cmd = stopRouter.stopRouterCmd()
cmd.id = router.id
- self.apiclient.stopRouter(cmd)
+ self.api_client.stopRouter(cmd)
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -1053,11 +1051,11 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
self.debug("Starting the router with ID: %s" % router.id)
cmd = startRouter.startRouterCmd()
cmd.id = router.id
- self.apiclient.startRouter(cmd)
+ self.api_client.startRouter(cmd)
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -1106,7 +1104,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -1122,11 +1120,11 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
#Reboot the router
cmd = rebootRouter.rebootRouterCmd()
cmd.id = router.id
- self.apiclient.rebootRouter(cmd)
+ self.api_client.rebootRouter(cmd)
#List routers to check state of router
router_response = list_routers(
- self.apiclient,
+ self.api_client,
id=router.id
)
self.assertEqual(
@@ -1172,7 +1170,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
"List static route should return a valid response"
)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -1216,7 +1214,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -1232,15 +1230,15 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
self.debug("Stopping the router with ID: %s" % router.id)
cmd = stopRouter.stopRouterCmd()
cmd.id = router.id
- self.apiclient.stopRouter(cmd)
+ self.api_client.stopRouter(cmd)
service_offering = ServiceOffering.create(
- self.apiclient,
+ self.api_client,
self.services["service_offering_new"]
)
self.debug("Changing service offering for the Router %s" % router.id)
try:
- router = Router.change_service_offering(self.apiclient,
+ router = Router.change_service_offering(self.api_client,
router.id,
service_offering.id
)
@@ -1249,7 +1247,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
self.debug("Router %s" % router)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -1294,7 +1292,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
@@ -1305,12 +1303,12 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
"List Routers should return a valid list"
)
- Router.destroy( self.apiclient,
+ Router.destroy( self.api_client,
id=routers[0].id
)
routers = Router.list(
- self.apiclient,
+ self.api_client,
account=self.account.name,
domainid=self.account.domainid,
listall=True
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index e40067e..95f46d0 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -20,8 +20,8 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
-from marvin.integration.lib.utils import cleanup_resources, validateList
-from marvin.integration.lib.base import (VirtualMachine,
+from marvin.lib.utils import cleanup_resources, validateList
+from marvin.lib.base import (VirtualMachine,
NATRule,
LoadBalancerRule,
StaticNATRule,
@@ -35,7 +35,7 @@ from marvin.integration.lib.base import (VirtualMachine,
Account,
ServiceOffering,
Host)
-from marvin.integration.lib.common import (get_domain,
+from marvin.lib.common import (get_domain,
get_zone,
get_template,
get_free_vlan,
@@ -212,14 +212,13 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVMLifeCycleVPC,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVMLifeCycleVPC, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -873,14 +872,13 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVMLifeCycleSharedNwVPC,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVMLifeCycleSharedNwVPC, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -1660,14 +1658,13 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVMLifeCycleBothIsolated,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVMLifeCycleBothIsolated, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -1995,14 +1992,13 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVMLifeCycleStoppedVPCVR,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVMLifeCycleStoppedVPCVR, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@@ -2681,14 +2677,13 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
def setUpClass(cls):
try:
- cls.api_client = super(
- TestVMLifeCycleDiffHosts,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVMLifeCycleDiffHosts, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpc_vms_deployment.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index 0ef51b4..1c1f93d 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -20,7 +20,7 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
-from marvin.integration.lib.base import (VirtualMachine,
+from marvin.lib.base import (VirtualMachine,
NetworkOffering,
VpcOffering,
VPC,
@@ -36,13 +36,13 @@ from marvin.integration.lib.base import (VirtualMachine,
StaticNATRule,
Configurations)
-from marvin.integration.lib.common import (get_domain,
+from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
get_free_vlan)
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.utils import cleanup_resources
from marvin.cloudstackAPI import rebootRouter
@@ -166,14 +166,13 @@ class TestVMDeployVPC(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(
- TestVMDeployVPC,
- cls
- ).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVMDeployVPC, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/component/test_vpn_users.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpn_users.py b/test/integration/component/test_vpn_users.py
index 710055a..c8b3a2d 100644
--- a/test/integration/component/test_vpn_users.py
+++ b/test/integration/component/test_vpn_users.py
@@ -19,9 +19,9 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackException import cloudstackAPIException
+from marvin.cloudstackException import CloudstackAPIException
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.integration.lib.base import (
+from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
@@ -31,11 +31,11 @@ from marvin.integration.lib.base import (
Configurations,
NATRule
)
-from marvin.integration.lib.common import (get_domain,
+from marvin.lib.common import (get_domain,
get_zone,
get_template
)
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.utils import cleanup_resources
class Services:
@@ -94,12 +94,13 @@ class Services:
class TestVPNUsers(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestVPNUsers,
- cls).getClsTestClient().getApiClient()
+ cls.testClient = super(TestVPNUsers, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
cls.services = Services().services
# 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.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services["mode"] = cls.zone.networktype
@@ -155,7 +156,7 @@ class TestVPNUsers(cloudstackTestCase):
services=self.services["virtual_machine"]
)
return
- except cloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.tearDown()
raise e
@@ -396,7 +397,7 @@ class TestVPNUsers(cloudstackTestCase):
domainid=self.account.domainid)
self.cleanup.append(admin)
self.debug("Creating API client for newly created user")
- api_client = self.testClient.createUserApiClient(
+ api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@@ -438,7 +439,7 @@ class TestVPNUsers(cloudstackTestCase):
domainid=self.account.domainid)
self.cleanup.append(admin)
self.debug("Creating API client for newly created user")
- api_client = self.testClient.createUserApiClient(
+ api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index b118364..4f3f9ec 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -16,52 +16,15 @@
# specific language governing permissions and limitations
# under the License.
+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 marvin.sshClient import SshClient
from nose.plugins.attrib import attr
-class Services:
- """Test Account Services
- """
-
- def __init__(self):
- self.services = {
- "domain": {
- "name": "Domain",
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- # in MHz
- "memory": 128,
- # In MBs
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "virtual_machine" : {
- "affinity": {
- "name": "webvms",
- "type": "host anti-affinity",
- },
- "hypervisor" : "XenServer",
- }
- }
-
-
class TestDeployVmWithAffinityGroup(cloudstackTestCase):
"""
This test deploys a virtual machine into a user account
@@ -70,36 +33,40 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ cls.testClient = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
+ zone_name = cls.testClient.getZoneForTests()
+ cls.apiclient = cls.testClient.getApiClient()
+ cls.domain = get_domain(cls.apiclient)
+ cls.services = cls.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.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+
cls.template = get_template(
- cls.api_client,
+ cls.apiclient,
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.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
cls.account = Account.create(
- cls.api_client,
+ cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
-
- cls.services["account"] = cls.account.name
-
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
+ cls.apiclient,
+ cls.services["service_offerings"]
)
- cls.ag = AffinityGroup.create(cls.api_client, cls.services["virtual_machine"]["affinity"],
- account=cls.services["account"], domainid=cls.domain.id)
+ cls.ag = AffinityGroup.create(cls.apiclient, cls.services["virtual_machine"]["affinity"],
+ account=cls.account.name, domainid=cls.domain.id)
cls._cleanup = [
cls.service_offering,
@@ -118,7 +85,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
"""
#deploy VM1 in affinity group created in setUp
vm1 = VirtualMachine.create(
- self.api_client,
+ self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
@@ -128,7 +95,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
)
list_vm1 = list_virtual_machines(
- self.api_client,
+ self.apiclient,
id=vm1.id
)
self.assertEqual(
@@ -151,7 +118,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
#deploy VM2 in affinity group created in setUp
vm2 = VirtualMachine.create(
- self.api_client,
+ self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
@@ -160,7 +127,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
affinitygroupnames=[self.ag.name]
)
list_vm2 = list_virtual_machines(
- self.api_client,
+ self.apiclient,
id=vm2.id
)
self.assertEqual(
@@ -189,6 +156,6 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
def tearDownClass(cls):
try:
#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)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
index 38c6d12..fa33bdc 100644
--- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
+++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
@@ -23,16 +23,19 @@ 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.codes import FAILED
from nose.plugins.attrib import attr
+
class Services:
"""Test VM Life Cycle Services
"""
@@ -116,12 +119,15 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
# Get Zone, Domain and Default Built-in template
- 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
# Before running this test, register a windows template with ostype as 'Windows 7 (32-bit)'
- self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"], templatetype='USER')
+ self.services["ostype"] = 'Windows 7 (32-bit)'
+ self.template = get_template(self.apiclient, self.zone.id, self.services["ostype"])
+ if self.template == FAILED:
+ assert False, "get_template() failed to return template with description %s" % self.services["ostype"]
#create a user account
self.account = Account.create(
self.apiclient,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
index 6ff7346..ca4891d 100644
--- a/test/integration/smoke/test_deploy_vm.py
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -22,72 +22,36 @@ from marvin.cloudstackTestCase import cloudstackTestCase
#Import Integration Libraries
+from marvin.codes import FAILED
#base - contains all resources as entities and defines create, delete, list operations on them
-from marvin.integration.lib.base import Account, VirtualMachine, ServiceOffering, SimulatorMock
+from marvin.lib.base import Account, VirtualMachine, ServiceOffering, SimulatorMock
#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 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",
- },
- #data reqd for virtual machine creation
- "virtual_machine2" : {
- "name" : "testvm2",
- "displayname" : "Test VM2",
- },
- "virtual_machine3" : {
- "name" : "testvm3",
- "displayname" : "Test VM3",
- },
- #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()
+ self.testdata = self.testClient.getParsedTestDataConfig()
+
# 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:
+ self.fail("get_template() failed to return template with description %s" % self.testdata["ostype"])
+
#create a user account
self.account = Account.create(
self.apiclient,
@@ -97,7 +61,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/798a6aa2/test/integration/smoke/test_deploy_vm_root_resize.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index aa88beb..e758ffd 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -23,13 +23,15 @@ 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, list_volumes
+from marvin.lib.common import get_zone, get_domain, get_template, list_volumes
+
+from marvin.codes import FAILED
from nose.plugins.attrib import attr
@@ -71,12 +73,15 @@ class TestDeployVM(cloudstackTestCase):
def setUp(self):
self.testdata = TestData().testdata
self.apiclient = self.testClient.getApiClient()
+ self.hypervisor = self.testClient.getHypervisorInfo()
# 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.services["ostype"]
# for testing with specific template
# self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"], templatetype='USER', services = {"template":'31f52a4d-5681-43f7-8651-ad4aaf823618'})
@@ -107,7 +112,7 @@ class TestDeployVM(cloudstackTestCase):
# 2. root disk has new size per listVolumes
# 3. Rejects non-supported hypervisor types
"""
- if(self.apiclient.hypervisor == 'kvm'):
+ if(self.hypervisor == 'kvm'):
newrootsize = (self.template.size >> 30) + 2
self.virtual_machine = VirtualMachine.create(
self.apiclient,
@@ -174,7 +179,7 @@ class TestDeployVM(cloudstackTestCase):
"Check if the root volume resized appropriately"
)
else:
- self.debug("hypervisor %s unsupported for test 00, verifying it errors properly" % self.apiclient.hypervisor)
+ self.debug("hypervisor %s unsupported for test 00, verifying it errors properly" % self.hypervisor)
newrootsize = (self.template.size >> 30) + 2
success = False
@@ -195,13 +200,13 @@ class TestDeployVM(cloudstackTestCase):
else:
self.debug("virtual machine create did not fail appropriately. Error was actually : " + str(ex));
- self.assertEqual(success, True, "Check if unsupported hypervisor %s fails appropriately" % self.apiclient.hypervisor)
+ self.assertEqual(success, True, "Check if unsupported hypervisor %s fails appropriately" % self.hypervisor)
@attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'provisioning'])
def test_01_deploy_vm_root_resize(self):
"""Test proper failure to deploy virtual machine with rootdisksize of 0
"""
- if (self.apiclient.hypervisor == 'kvm'):
+ if (self.hypervisor == 'kvm'):
newrootsize = 0
success = False
try:
@@ -223,13 +228,13 @@ class TestDeployVM(cloudstackTestCase):
self.assertEqual(success, True, "Check if passing 0 as rootdisksize fails appropriately")
else:
- self.debug("test 01 does not support hypervisor type " + self.apiclient.hypervisor);
+ self.debug("test 01 does not support hypervisor type " + self.hypervisor);
@attr(tags = ['advanced', 'simulator', 'basic', 'sg', 'provisioning'])
def test_02_deploy_vm_root_resize(self):
"""Test proper failure to deploy virtual machine with rootdisksize less than template size
"""
- if (self.apiclient.hypervisor == 'kvm'):
+ if (self.hypervisor == 'kvm'):
newrootsize = (self.template.size >> 30) - 1
self.assertEqual(newrootsize > 0, True, "Provided template is less than 1G in size, cannot run test")
@@ -254,7 +259,7 @@ class TestDeployVM(cloudstackTestCase):
self.assertEqual(success, True, "Check if passing rootdisksize < templatesize fails appropriately")
else:
- self.debug("test 01 does not support hypervisor type " + self.apiclient.hypervisor);
+ self.debug("test 01 does not support hypervisor type " + self.hypervisor);
def tearDown(self):
try:
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_deploy_vm_with_userdata.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index b8be83a..7616b82 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -16,62 +16,33 @@
# under the License.
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.integration.lib.base import (ServiceOffering,
+from marvin.lib.base import (ServiceOffering,
VirtualMachine,
Account)
-from marvin.integration.lib.common import get_template, get_zone, list_virtual_machines
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.common import get_template, get_zone, list_virtual_machines
+from marvin.lib.utils import cleanup_resources
from nose.plugins.attrib import attr
-
+from marvin.codes import FAILED
import random
import string
-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,
- },
- }
-
-
class TestDeployVmWithUserData(cloudstackTestCase):
"""Tests for UserData
"""
@classmethod
def setUpClass(cls):
- cls.apiClient = super(TestDeployVmWithUserData, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- cls.zone = get_zone(cls.apiClient, cls.services)
+ testClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
+ cls.apiClient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
+ cls.zone = get_zone(cls.apiClient, testClient.getZoneForTests())
if cls.zone.localstorageenabled:
#For devcloud since localstroage is enabled
- cls.services["service_offering"]["storagetype"] = "local"
+ cls.services["service_offerings"]["storagetype"] = "local"
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.cleanup = [cls.account]
@@ -80,6 +51,10 @@ class TestDeployVmWithUserData(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))
@@ -92,7 +67,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
user_data = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(2500))
cls.services["virtual_machine"]["userdata"] = user_data
- @attr(tags=["simulator", "devcloud", "basic", "advanced", "provisioning"])
+ def setup(self):
+ self.hypervisor = self.testClient.getHypervisorInfo()
+
+ @attr(tags=["simulator", "devcloud", "basic", "advanced", "post", "provisioning"])
def test_deployvm_userdata_post(self):
"""Test userdata as POST, size > 2k
"""
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/798a6aa2/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index fc11549..420925e 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -15,40 +15,13 @@
# specific language governing permissions and limitations
# under the License.
+from marvin.codes import FAILED
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.integration.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster
-from marvin.integration.lib.common import get_zone, get_domain, get_template
-from marvin.integration.lib.utils import cleanup_resources
+from marvin.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster
+from marvin.lib.common import get_zone, get_domain, get_template
+from marvin.lib.utils import cleanup_resources
from nose.plugins.attrib import attr
-class Services:
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Planner Service Offering",
- "displaytext": "Planner Service Offering",
- "cpunumber": 1,
- "cpuspeed": 100,
- # in MHz
- "memory": 128,
- # In MBs
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "virtual_machine": {
- "hypervisor": "XenServer",
- }
- }
-
-
class TestDeployVmWithVariedPlanners(cloudstackTestCase):
""" Test to create services offerings for deployment planners
- firstfit, userdispersing
@@ -56,16 +29,22 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.apiclient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
+ testClient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
- 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())
cls.template = get_template(
cls.apiclient,
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.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id
@@ -75,7 +54,6 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
cls.services["account"],
domainid=cls.domain.id
)
- cls.services["account"] = cls.account.name
cls.hosts = Host.list(cls.apiclient, type='Routing')
cls.clusters = Cluster.list(cls.apiclient)
cls.cleanup = [
@@ -89,7 +67,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
#FIXME: How do we know that first fit actually happened?
self.service_offering_firstfit = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"],
+ self.services["service_offerings"],
deploymentplanner='FirstFitPlanner'
)
@@ -132,7 +110,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
"""
self.service_offering_userdispersing = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"],
+ self.services["service_offerings"],
deploymentplanner='UserDispersingPlanner'
)
@@ -191,7 +169,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
"""
self.service_offering_userconcentrated = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"],
+ self.services["service_offerings"],
deploymentplanner='UserConcentratedPodPlanner'
)