CLOUDSTACK-5925: get_*() functionality changed in marvin, changed BVT too.

This commit is contained in:
Girish Shilamkar 2014-01-28 11:12:24 +05:30
parent edfd2b6799
commit 7305063fb4
33 changed files with 446 additions and 337 deletions

View File

@ -16,6 +16,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -32,25 +33,30 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.test_client = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
zone_name = cls.test_client.getZoneForTests()
cls.api_client = cls.test_client.getApiClient()
cls.services = cls.test_client.getConfigParser().parsedDict
cls.testClient = super(TestDeployVmWithAffinityGroup, cls).getClsTestClient()
zone_name = cls.testClient.getZoneForTests()
cls.domain = get_domain(cls.apiclient)
cls.apiclient = cls.testClient.getApiClient()
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:
cls.fail("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
)
@ -58,11 +64,11 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
cls.services["account"] = cls.account.name
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
cls.ag = AffinityGroup.create(cls.api_client, cls.services["virtual_machine"]["affinity"],
cls.ag = AffinityGroup.create(cls.apiclient, cls.services["virtual_machine"]["affinity"],
account=cls.services["account"], domainid=cls.domain.id)
cls._cleanup = [
@ -82,7 +88,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,
@ -92,7 +98,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
)
list_vm1 = list_virtual_machines(
self.api_client,
self.apiclient,
id=vm1.id
)
self.assertEqual(
@ -115,7 +121,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,
@ -124,7 +130,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
affinitygroupnames=[self.ag.name]
)
list_vm2 = list_virtual_machines(
self.api_client,
self.apiclient,
id=vm2.id
)
self.assertEqual(
@ -153,6 +159,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)

View File

@ -16,6 +16,7 @@
# under the License.
#Test from the Marvin - Testing in Python wiki
from marvin.cloudstackTestClient import getZoneForTests
#All tests inherit from cloudstackTestCase
from marvin.cloudstackTestCase import cloudstackTestCase
@ -40,14 +41,17 @@ class TestDeployVM(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.testdata = self.testClient.getConfigParser().parsedDict
self.testdata = self.testClient.getParsedTestDataConfig()
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient, self.testdata)
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testdata)
self.testdata["mode"] = self.zone.networktype
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
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,

View File

@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import (ServiceOffering,
VirtualMachine,
@ -32,11 +33,11 @@ class TestDeployVmWithUserData(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
cls.apiClient = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
cls.apiClient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiClient, cls.services)
cls.zone = get_zone(cls.apiClient, cls.getZoneForTests())
if cls.zone.localstorageenabled:
#For devcloud since localstroage is enabled
cls.services["service_offerings"]["storagetype"] = "local"
@ -51,6 +52,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("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))

View File

@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
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
@ -28,18 +29,22 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient()
cls.apiclient = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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, cls.getZoneForTests())
cls.template = get_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("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

View File

@ -30,7 +30,7 @@ _multiprocess_shared_ = True
class TestCreateDiskOffering(cloudstackTestCase):
def setUp(self):
self.services = self.testClient.getConfigParser().parsedDict
self.services = self.testClient.getParsedTestDataConfig()
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
@ -109,16 +109,16 @@ class TestDiskOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestDiskOfferings, cls).getClsTestClient()
self.api_client = self.cloudstackTestClient.getApiClient()
self.services = self.cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestDiskOfferings, cls).getClsTestClient()
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.getParsedTestDataConfig()
cls.disk_offering_1 = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
cls.disk_offering_2 = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
cls._cleanup = [cls.disk_offering_1]
@ -127,8 +127,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

View File

@ -17,6 +17,7 @@
""" P1 tests for Dedicating Guest Vlan Ranges
"""
#Import Local Modules
from marvin.cloudstackTestClient import getZoneForTests
import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
@ -30,13 +31,13 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestDedicateGuestVlanRange, cls).getClsTestClient()
cls.apiclient = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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, cls.getZoneForTests())
# Create Account
cls.account = Account.create(

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -36,9 +37,9 @@ class TestHosts(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.services = self.testClient.getConfigParser().parsedDict
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.getZoneForTests())
self.pod = get_pod(apilcient=self.apiclient, self.zone.id)
self.cleanup = []
return

View File

@ -17,6 +17,7 @@
""" Tests for configuring Internal Load Balancing Rules.
"""
#Import Local Modules
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -30,11 +31,11 @@ class TestInternalLb(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestInternalLb, cls).getClsTestClient()
cls.apiclient = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestInternalLb, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
@ -46,6 +47,10 @@ class TestInternalLb(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("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))

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -34,12 +35,12 @@ _multiprocess_shared_ = True
class TestCreateIso(cloudstackTestCase):
def setUp(self):
self.services = self.testClient.getConfigParser().parsedDict
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.getZoneForTests())
self.services['mode'] = self.zone.networktype
self.services["domainid"] = self.domain.id
self.services["iso_2"]["zoneid"] = self.zone.id
@ -138,13 +139,13 @@ class TestISO(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestISO, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services["domainid"] = cls.domain.id
cls.services["iso_1"]["zoneid"] = cls.zone.id
@ -152,20 +153,20 @@ class TestISO(cloudstackTestCase):
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):
@ -176,25 +177,25 @@ class TestISO(cloudstackTestCase):
cls.services["ostypeid"] = ostypes[0].id
cls.iso_1 = Iso.create(
cls.api_client,
cls.apiclient,
cls.services["iso_1"],
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.apiclient,
cls.services["iso_2"],
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))
@ -205,9 +206,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)

View File

@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
@ -32,33 +33,36 @@ class TestLoadBalance(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestLoadBalance, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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, cls.getZoneForTests())
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["server"]["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.apiclient,
cls.services["service_offerings"]
)
cls.vm_1 = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["server"],
templateid=template.id,
accountid=cls.account.name,
@ -66,7 +70,7 @@ class TestLoadBalance(cloudstackTestCase):
serviceofferingid=cls.service_offering.id
)
cls.vm_2 = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["server"],
templateid=template.id,
accountid=cls.account.name,
@ -74,7 +78,7 @@ class TestLoadBalance(cloudstackTestCase):
serviceofferingid=cls.service_offering.id
)
cls.vm_3 = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["server"],
templateid=template.id,
accountid=cls.account.name,
@ -82,7 +86,7 @@ class TestLoadBalance(cloudstackTestCase):
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,
@ -90,7 +94,7 @@ class TestLoadBalance(cloudstackTestCase):
)
# 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'],
@ -113,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):

View File

@ -31,6 +31,7 @@ from marvin.integration.lib.utils import cleanup_resources
#common - commonly used methods for all tests are listed here
from marvin.integration.lib.common import get_zone, get_domain, get_template
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackAPI.addIpToNic import addIpToNicCmd
from marvin.cloudstackAPI.removeIpFromNic import removeIpFromNicCmd
from marvin.cloudstackAPI.listNics import listNicsCmd
@ -43,15 +44,18 @@ class TestDeployVM(cloudstackTestCase):
"""
def setUp(self):
self.testdata = self.testClient.getConfigParser().parsedDict
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.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,

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackException import cloudstackAPIException
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@ -40,45 +41,45 @@ class TestPublicIP(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestPublicIP, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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, cls.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
@ -86,13 +87,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
@ -110,7 +111,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
@ -221,32 +222,35 @@ class TestPortForwarding(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestPortForwarding, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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, cls.getZoneForTests())
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("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["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@ -267,8 +271,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)
@ -525,16 +529,18 @@ class TestRebootRouter(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.cloudstackTestClient.getConfigParser().parsedDict
self.services = self.testClient.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.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,
self.services["ostype"]
)
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
@ -691,11 +697,11 @@ class TestReleaseIP(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.getConfigParser().parsedDict
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.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,
@ -828,11 +834,11 @@ class TestDeleteAccount(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.getConfigParser().parsedDict
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.getZoneForTests())
template = get_template(
self.apiclient,
self.zone.id,

View File

@ -28,11 +28,11 @@ class TestNetworkACL(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestNetworkACL, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestNetworkACL, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
@ -44,6 +44,10 @@ class TestNetworkACL(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("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))

View File

@ -16,6 +16,7 @@
# under the License.
""" NIC tests for VM """
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
@ -44,11 +45,11 @@ class TestNic(cloudstackTestCase):
try:
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.services = self.testClient.getConfigParser().parsedDict
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.getZoneForTests())
self.services['mode'] = zone.networktype
if zone.networktype != 'Advanced':
@ -64,7 +65,10 @@ class TestNic(cloudstackTestCase):
zone.id,
self.services["ostype"]
)
# Set Zones and disk offerings
if self.template == FAILED:
self.fail("get_template() failed to return template with description %s" % self.services["ostype"])
# Set Zones and disk offerings
self.services["small"]["zoneid"] = zone.id
self.services["small"]["template"] = template.id

View File

@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from marvin import cloudstackTestCase
from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import cloudstackTestCase

View File

@ -16,6 +16,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -33,17 +34,17 @@ class TestPortablePublicIPRange(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestPortablePublicIPRange, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestPortablePublicIPRange, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain
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.getZoneForTests())
# Create Account
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
@ -56,7 +57,7 @@ class TestPortablePublicIPRange(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
@ -81,7 +82,7 @@ class TestPortablePublicIPRange(cloudstackTestCase):
"""
self.debug("attempting to create a portable Public IP range")
self.portable_ip_range = PortablePublicIpRange.create(
self.api_client,
self.apiclient,
self.services
)
self.debug("attempting to verify portable Public IP range is created")
@ -101,31 +102,31 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestPortablePublicIPAcquire, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestPortablePublicIPAcquire, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain
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.getZoneForTests())
# Create Account
cls.account = 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
@ -142,7 +143,7 @@ class TestPortablePublicIPAcquire(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
@ -167,13 +168,13 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
"""
self.debug("attempting to create a portable Public IP range")
self.portable_ip_range = PortablePublicIpRange.create(
self.api_client,
self.apiclient,
self.services
)
ip_address = PublicIPAddress.create(self.api_client, self.account.name,
ip_address = PublicIPAddress.create(self.apiclient, self.account.name,
self.zone.id, self.account.domainid, isportable=True)
ip_address.delete(self.api_client)
ip_address.delete(self.apiclient)
self.portable_ip_range.delete(self.apiclient)
return

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -34,10 +35,10 @@ class TestPrimaryStorageServices(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.services = self.testClient.getConfigParser().parsedDict
self.services = self.testClient.getParsedTestDataConfig()
self.cleanup = []
# Get Zone and pod
self.zone = get_zone(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.getZoneForTests())
self.pod = get_pod(self.apiclient, self.zone.id)
return

View File

@ -17,6 +17,7 @@
""" P1 tests for Dedicating Public IP addresses
"""
#Import Local Modules
from marvin.cloudstackTestClient import getZoneForTests
import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
@ -30,15 +31,15 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDedicatePublicIPRange, cls).getClsTestClient().getApiClient()
cls.apiclient = super(TestDedicatePublicIPRange, cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain
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.getZoneForTests())
# Create Account
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
@ -51,7 +52,7 @@ class TestDedicatePublicIPRange(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
@ -86,7 +87,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
self.debug("Creating Public IP range")
self.public_ip_range = PublicIpRange.create(
self.api_client,
self.apiclient,
self.services
)
list_public_ip_range_response = PublicIpRange.list(

View File

@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -28,22 +29,22 @@ class TestRegions(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestRegions, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestRegions, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.apiclient)
cls.cleanup = []
@attr(tags=["simulator", "basic", "advanced"])
def test_createRegion(self):
""" Test for create region
"""
region = Region.create(self.api_client,
region = Region.create(self.apiclient,
self.services["region"]
)
list_region = Region.list(self.api_client,
list_region = Region.list(self.apiclient,
id=self.services["region"]["regionid"]
)
@ -77,8 +78,8 @@ class TestRegions(cloudstackTestCase):
def tearDownClass(cls):
try:
#Clean up
cleanup_resources(cls.api_client, cls.cleanup)
list_region = Region.list(cls.api_client, id=cls.services["region"]["regionid"])
cleanup_resources(cls.apiclient, cls.cleanup)
list_region = Region.list(cls.apiclient, id=cls.services["region"]["regionid"])
assert list_region is None, "Region deletion fails"
except Exception as e:
raise Exception("Warning: Region cleanup/delete fails with : %s" % e)

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -30,40 +31,43 @@ _multiprocess_shared_ = True
class TestResetVmOnReboot(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestResetVmOnReboot, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestResetVmOnReboot, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
zone = get_zone(cls.api_client, cls.services)
domain = get_domain(cls.apiclient)
zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = zone.networktype
template = get_template(
cls.api_client,
cls.apiclient,
zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
# Set Zones and disk offerings ??
cls.services["small"]["zoneid"] = zone.id
cls.services["small"]["template"] = template.id
# Create account, service offerings, vm.
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["small"],
isvolatile="true"
)
#create a virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -77,8 +81,8 @@ class TestResetVmOnReboot(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
cls.api_client = super(TestResetVmOnReboot, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
cls.apiclient = super(TestResetVmOnReboot, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
@ -34,33 +35,33 @@ class TestResourceDetail(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestResourceDetail, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestResourceDetail, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
zone = get_zone(cls.api_client, cls.services)
domain = get_domain(cls.apiclient)
zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = zone.networktype
# Set Zones and disk offerings ??
# Create account, service offerings, vm.
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
#create a volume
cls.volume = Volume.create(
cls.api_client,
cls.apiclient,
{ "diskname" : "ndm"},
zoneid=zone.id,
account=cls.account.name,
@ -75,8 +76,8 @@ class TestResourceDetail(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
cls.api_client = super(TestResourceDetail, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
cls.apiclient = super(TestResourceDetail, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):
@ -108,7 +109,7 @@ class TestResourceDetail(cloudstackTestCase):
listResourceDetailCmd = listResourceDetails.listResourceDetailsCmd()
listResourceDetailCmd.resourceid = self.volume.id
listResourceDetailCmd.resourcetype = "Volume"
listResourceDetailResponse = self.api_client.listResourceDetails(listResourceDetailCmd)
listResourceDetailResponse = self.apiclient.listResourceDetails(listResourceDetailCmd)
self.assertEqual(listResourceDetailResponse, None, "Check if the list API \
returns an empty response")

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
@ -36,33 +37,36 @@ class TestRouterServices(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestRouterServices, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestRouterServices, 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.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("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"],
domainid=cls.domain.id
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
cls.vm_1 = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@ -78,12 +82,12 @@ class TestRouterServices(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(
cls.apiclient = super(
TestRouterServices,
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)

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -30,44 +31,47 @@ _multiprocess_shared_ = True
class TestScaleVm(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestScaleVm, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestScaleVm, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
zone = get_zone(cls.api_client, cls.services)
domain = get_domain(cls.apiclient)
zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = zone.networktype
template = get_template(
cls.api_client,
cls.apiclient,
zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
# Set Zones and disk offerings ??
cls.services["small"]["zoneid"] = zone.id
cls.services["small"]["template"] = template.id
# Create account, service offerings, vm.
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["small"]
)
cls.big_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["big"]
)
#create a virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -81,8 +85,8 @@ class TestScaleVm(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
cls.api_client = super(TestScaleVm, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
cls.apiclient = super(TestScaleVm, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):

View File

@ -33,7 +33,7 @@ class TestSecStorageServices(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestSecStorageServices, cls).getClsTestClient().getApiClient()
cls.apiclient = super(TestSecStorageServices, cls).getClsTestClient().getApiClient()
cls._cleanup = []
return
@ -41,7 +41,7 @@ class TestSecStorageServices(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

View File

@ -17,6 +17,7 @@
""" BVT tests for Service offerings"""
#Import Local Modules
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.cloudstackAPI import changeServiceForVirtualMachine,updateServiceOffering
from marvin.integration.lib.utils import (isAlmostEqual,
@ -41,7 +42,7 @@ class TestCreateServiceOffering(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
self.services = self.testClient.getConfigParser().parsedDict
self.services = self.testClient.getParsedTestDataConfig()
def tearDown(self):
try:
@ -132,27 +133,30 @@ class TestServiceOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestServiceOfferings, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestServiceOfferings, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.service_offering_1 = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
cls.service_offering_2 = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
@ -162,22 +166,22 @@ class TestServiceOfferings(cloudstackTestCase):
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["small"]
)
cls.medium_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["medium"]
)
cls.medium_virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["medium"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -194,9 +198,9 @@ class TestServiceOfferings(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(TestServiceOfferings, cls).getClsTestClient().getApiClient()
cls.apiclient = super(TestServiceOfferings, 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)

View File

@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from marvin.cloudstackTestClient import getZoneForTests
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@ -26,20 +27,23 @@ class TestSnapshotRootDisk(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestSnapshotRootDisk, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestSnapshotRootDisk, 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.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["domainid"] = cls.domain.id
cls.services["server_without_disk"]["zoneid"] = cls.zone.id
cls.services["templates"]["ostypeid"] = template.ostypeid
@ -47,7 +51,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
@ -55,12 +59,12 @@ class TestSnapshotRootDisk(cloudstackTestCase):
cls.services["account"] = cls.account.name
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
cls.virtual_machine = cls.virtual_machine_with_disk = \
VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["server_without_disk"],
templateid=template.id,
accountid=cls.account.name,
@ -78,7 +82,7 @@ class TestSnapshotRootDisk(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

View File

@ -19,6 +19,7 @@
#Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
from marvin.integration.lib.utils import *
@ -38,7 +39,7 @@ class TestSSVMs(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.cleanup = []
self.services = Services().services
self.zone = get_zone(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.getZoneForTests())
return
def tearDown(self):

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
@ -53,23 +54,26 @@ class TestCreateTemplate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestCreateTemplate, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestCreateTemplate, 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.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["template"]["ostypeid"] = template.ostypeid
cls.services["template_2"]["ostypeid"] = template.ostypeid
cls.services["ostypeid"] = template.ostypeid
@ -80,19 +84,19 @@ class TestCreateTemplate(cloudstackTestCase):
cls.services["sourcezoneid"] = 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.apiclient,
cls.services["service_offerings"]
)
#create virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@ -102,7 +106,7 @@ class TestCreateTemplate(cloudstackTestCase):
)
#Stop virtual machine
cls.virtual_machine.stop(cls.api_client)
cls.virtual_machine.stop(cls.apiclient)
# Poll listVM to ensure VM is stopped properly
timeout = cls.services["timeout"]
@ -111,7 +115,7 @@ class TestCreateTemplate(cloudstackTestCase):
# Ensure that VM is in stopped state
list_vm_response = list_virtual_machines(
cls.api_client,
cls.apiclient,
id=cls.virtual_machine.id
)
@ -129,7 +133,7 @@ class TestCreateTemplate(cloudstackTestCase):
timeout = timeout - 1
list_volume = list_volumes(
cls.api_client,
cls.apiclient,
virtualmachineid=cls.virtual_machine.id,
type='ROOT',
listall=True
@ -146,9 +150,9 @@ class TestCreateTemplate(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
cls.apiclient = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
#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)
@ -222,29 +226,32 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestTemplates, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestTemplates, 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.getZoneForTests())
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#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.")
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["volume"]["diskoffering"] = cls.disk_offering.id
cls.services["volume"]["zoneid"] = cls.zone.id
@ -256,14 +263,14 @@ class TestTemplates(cloudstackTestCase):
cls.services["ostypeid"] = template.ostypeid
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
)
@ -271,12 +278,12 @@ class TestTemplates(cloudstackTestCase):
cls.services["account"] = cls.account.name
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
#create virtual machine
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["virtual_machine"],
templateid=template.id,
accountid=cls.account.name,
@ -285,7 +292,7 @@ class TestTemplates(cloudstackTestCase):
mode=cls.services["mode"]
)
#Stop virtual machine
cls.virtual_machine.stop(cls.api_client)
cls.virtual_machine.stop(cls.apiclient)
# Poll listVM to ensure VM is stopped properly
timeout = cls.services["timeout"]
@ -294,7 +301,7 @@ class TestTemplates(cloudstackTestCase):
# Ensure that VM is in stopped state
list_vm_response = list_virtual_machines(
cls.api_client,
cls.apiclient,
id=cls.virtual_machine.id
)
@ -312,7 +319,7 @@ class TestTemplates(cloudstackTestCase):
timeout = timeout - 1
list_volume = list_volumes(
cls.api_client,
cls.apiclient,
virtualmachineid=cls.virtual_machine.id,
type='ROOT',
listall=True
@ -326,14 +333,14 @@ class TestTemplates(cloudstackTestCase):
#Create templates for Edit, Delete & update permissions testcases
cls.template_1 = Template.create(
cls.api_client,
cls.apiclient,
cls.services["template"],
cls.volume.id,
account=cls.account.name,
domainid=cls.account.domainid
)
cls.template_2 = Template.create(
cls.api_client,
cls.apiclient,
cls.services["template_2"],
cls.volume.id,
account=cls.account.name,
@ -349,9 +356,9 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
cls.apiclient = super(TestTemplates, cls).getClsTestClient().getApiClient()
#Cleanup created resources such as templates and VMs
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)

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -33,13 +34,13 @@ class TestDeployVM(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestDeployVM, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestDeployVM, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
domain = get_domain(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.services)
domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#If local storage is enabled, alter the offerings to use localstorage
@ -54,6 +55,9 @@ class TestDeployVM(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
@ -191,13 +195,13 @@ class TestVMLifeCycle(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestVMLifeCycle, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestVMLifeCycle, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#if local storage is enabled, alter the offerings to use localstorage
@ -208,10 +212,13 @@ class TestVMLifeCycle(cloudstackTestCase):
cls.services["service_offerings"]["medium"]["storagetype"] = 'local'
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
# Set Zones and disk offerings
cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
@ -222,23 +229,23 @@ class TestVMLifeCycle(cloudstackTestCase):
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
cls.small_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["small"]
)
cls.medium_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]["medium"]
)
#create small and large virtual machines
cls.small_virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -246,7 +253,7 @@ class TestVMLifeCycle(cloudstackTestCase):
mode=cls.services["mode"]
)
cls.medium_virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["medium"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -254,7 +261,7 @@ class TestVMLifeCycle(cloudstackTestCase):
mode=cls.services["mode"]
)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -269,8 +276,8 @@ class TestVMLifeCycle(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
cls.api_client = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
cls.apiclient = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.apiclient, cls._cleanup)
return
def setUp(self):
@ -510,7 +517,7 @@ class TestVMLifeCycle(cloudstackTestCase):
#deploy VM on target host
self.vm_to_migrate = VirtualMachine.create(
self.api_client,
self.apiclient,
self.services["small"],
accountid=self.account.name,
domainid=self.account.domainid,
@ -523,7 +530,7 @@ class TestVMLifeCycle(cloudstackTestCase):
migrate_host.id
))
self.vm_to_migrate.migrate(self.api_client, migrate_host.id)
self.vm_to_migrate.migrate(self.apiclient, migrate_host.id)
list_vm_response = list_virtual_machines(
self.apiclient,

View File

@ -17,6 +17,7 @@
# Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@ -28,17 +29,20 @@ class TestVmSnapshot(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVmSnapshot, cls).getClsTestClient().getApiClient()
cls.apiclient = super(TestVmSnapshot, cls).getClsTestClient().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.apiclient)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["domainid"] = cls.domain.id
cls.services["server"]["zoneid"] = cls.zone.id
cls.services["templates"]["ostypeid"] = template.ostypeid
@ -46,7 +50,7 @@ class TestVmSnapshot(cloudstackTestCase):
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.api_client,
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
@ -54,11 +58,11 @@ class TestVmSnapshot(cloudstackTestCase):
cls.services["account"] = cls.account.name
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offerings"]
)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services["server"],
templateid=template.id,
accountid=cls.account.name,
@ -79,7 +83,7 @@ class TestVmSnapshot(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

View File

@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackException import *
from marvin.cloudstackAPI import *
@ -38,28 +39,31 @@ class TestCreateVolume(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestCreateVolume, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestCreateVolume, 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.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
cls.custom_disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"],
custom=True
)
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
cls.services["template"] = template.id
@ -67,18 +71,18 @@ class TestCreateVolume(cloudstackTestCase):
# Create VMs, NAT Rules etc
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.apiclient,
cls.services["service_offerings"]
)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services,
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -218,8 +222,8 @@ class TestCreateVolume(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(TestCreateVolume, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
cls.apiclient = super(TestCreateVolume, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@ -228,33 +232,36 @@ class TestVolumes(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestVolumes, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestVolumes, 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.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["disk_offering"]
)
cls.resized_disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["resized_disk_offering"]
)
cls.custom_resized_disk_offering = DiskOffering.create(
cls.api_client,
cls.apiclient,
cls.services["resized_disk_offering"],
custom=True
)
template = get_template(
cls.api_client,
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
cls.services["template"] = template.id
@ -264,18 +271,18 @@ class TestVolumes(cloudstackTestCase):
# Create VMs, VMs etc
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.apiclient,
cls.services["service_offerings"]
)
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
cls.apiclient,
cls.services,
accountid=cls.account.name,
domainid=cls.account.domainid,
@ -284,7 +291,7 @@ class TestVolumes(cloudstackTestCase):
)
cls.volume = Volume.create(
cls.api_client,
cls.apiclient,
cls.services,
account=cls.account.name,
domainid=cls.account.domainid
@ -301,7 +308,7 @@ class TestVolumes(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
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)
@ -649,7 +656,7 @@ class TestVolumes(cloudstackTestCase):
self.debug("Delete Volume ID: %s" % self.volume.id)
self.volume_1 = Volume.create(
self.api_client,
self.apiclient,
self.services,
account=self.account.name,
domainid=self.account.domainid

View File

@ -17,6 +17,7 @@
""" Tests for VPN in VPC
"""
#Import Local Modules
from marvin.cloudstackTestClient import getZoneForTests
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
@ -30,11 +31,11 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestVpcRemoteAccessVpn, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestVpcRemoteAccessVpn, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
@ -46,6 +47,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.cleanup = [cls.account]
@attr(tags=["advanced"])
@ -134,11 +138,11 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestVpcSite2SiteVpn, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestVpcSite2SiteVpn, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
cls.zone = get_zone(cls.apiclient, cls.services)
cls.zone = get_zone(cls.apiclient, cls.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
@ -150,6 +154,9 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if cls.template == FAILED:
cls.fail("get_template() failed to return template with description %s" % cls.services["ostype"])
cls.cleanup = [cls.account]
@attr(tags=["advanced"])

View File

@ -214,13 +214,13 @@ def get_zone(apiclient, zone_name=None, zone_id=None):
def get_pod(apiclient, pod_id=None, pod_name=None, zone_id=None):
def get_pod(apiclient, zone_id=None, pod_id=None, pod_name=None):
'''
@name : get_pod
@Desc : Returns the Pod Information for a given zone id or Zone Name
@Input : pod_name : Name of the Pod
@Input : zone_id: Id of the Zone
pod_name : Name of the Pod
pod_id : Id of the Pod
zone_id: Id of the Zone
@Output : 1. Pod Information for the pod
2. FAILED In case the cmd failed
'''
@ -239,9 +239,9 @@ def get_pod(apiclient, pod_id=None, pod_name=None, zone_id=None):
return cmd_out
def get_template(apiclient, template_id=None, template_name=None, account=None, template_type='BUILTIN'
domain_id=None, zone_id=None, project_id=None,
hypervisor=None, ostype_desc=None, template_filter="featured"):
def get_template(apiclient, zone_id=None, ostype_desc=None, template_filter="featured", template_type='BUILTIN',
template_id=None, template_name=None, account=None, domain_id=None, project_id=None,
hypervisor=None):
'''
@Name : get_template
@Desc : Retrieves the template Information based upon inputs provided