Marvin + test changes from master Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
(cherry picked from commit 404ac549bf)

Conflicts:
	test/integration/smoke/test_vm_iam.py
	tools/marvin/marvin/deployDataCenter.py
	tools/marvin/marvin/lib/base.py
This commit is contained in:
SrikanteswaraRao Talluri 2014-04-28 14:55:11 +05:30 committed by Daan Hoogland
parent 8fb89cdc8e
commit 798a6aa2e3
161 changed files with 16493 additions and 5941 deletions

View File

@ -23,9 +23,9 @@ from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
#Import System modules
import time
@ -100,19 +100,17 @@ class TestEgressAfterHostMaintenance(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestEgressAfterHostMaintenance,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestEgressAfterHostMaintenance, 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
cls.pod = get_pod(
cls.api_client,
zoneid=cls.zone.id
zone_id=cls.zone.id
)
template = get_template(

View File

@ -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
@ -107,24 +107,16 @@ class TestHighAvailability(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestHighAvailability,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestHighAvailability, 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.pod = get_pod(
cls.api_client,
zoneid=cls.zone.id,
services=cls.services
zone_id=cls.zone.id
)
cls.template = get_template(
cls.api_client,

View File

@ -21,9 +21,10 @@
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 time
class Services:
@ -76,20 +77,13 @@ class TestHostHighAvailability(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestHostHighAvailability,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestHostHighAvailability, 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,
@ -626,11 +620,7 @@ class TestHostHighAvailability(cloudstackTestCase):
#verify the VM live migration happened to another running host
self.debug("Waiting for VM to come up")
wait_for_vm(
self.apiclient,
virtualmachineid=vm_with_ha_enabled.id,
interval=timeout
)
time.sleep(timeout)
vms = VirtualMachine.list(
self.apiclient,
@ -758,11 +748,7 @@ class TestHostHighAvailability(cloudstackTestCase):
#verify the VM live migration happened to another running host
self.debug("Waiting for VM to come up")
wait_for_vm(
self.apiclient,
virtualmachineid=vm_with_ha_disabled.id,
interval=timeout
)
time.sleep(timeout)
vms = VirtualMachine.list(
self.apiclient,

View File

@ -18,10 +18,10 @@
"""
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.cloudstackException import cloudstackAPIException
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
# from netaddr import *
import netaddr
from nose.plugins.attrib import attr
@ -87,13 +87,15 @@ class TestMultipleIpRanges(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMultipleIpRanges, cls).getClsTestClient().getApiClient()
cls.dbclient = super(TestMultipleIpRanges, cls).getClsTestClient().getDbConnection()
cls.testClient = super(TestEgressAfterHostMaintenance, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.dbclient = cls.testClient.getDbConnection()
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.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id

View File

@ -16,9 +16,9 @@
# under the License.
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
#Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@ -137,14 +137,13 @@ class TestCreateRvRNetworkOffering(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestCreateRvRNetworkOffering,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateRvRNetworkOffering, 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._cleanup = []
return
@ -231,14 +230,13 @@ class TestCreateRvRNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestCreateRvRNetwork,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateRvRNetwork, 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,
@ -433,14 +431,13 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestCreateRvRNetworkNonDefaultGuestCidr,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateRvRNetworkNonDefaultGuestCidr, 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,
@ -642,14 +639,13 @@ class TestRVRInternals(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRVRInternals,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRVRInternals, 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,
@ -685,6 +681,7 @@ class TestRVRInternals(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
self.apiclient,
@ -846,7 +843,7 @@ class TestRVRInternals(cloudstackTestCase):
self.debug(master_router.linklocalip)
# Check eth2 port for master router
if self.apiclient.hypervisor.lower() == 'vmware':
if self.hypervisor.lower() == 'vmware':
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@ -854,7 +851,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient.connection.passwd,
master_router.linklocalip,
'ip addr show eth2',
hypervisor=self.apiclient.hypervisor
hypervisor=self.hypervisor
)
else:
result = get_process_status(
@ -882,7 +879,7 @@ class TestRVRInternals(cloudstackTestCase):
)
# Check eth2 port for backup router
if self.apiclient.hypervisor.lower() == 'vmware':
if self.hypervisor.lower() == 'vmware':
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@ -890,7 +887,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient.connction.passwd,
backup_router.linklocalip,
'ip addr show eth2',
hypervisor=self.apiclient.hypervisor
hypervisor=self.hypervisor
)
else:
result = get_process_status(
@ -945,14 +942,13 @@ class TestRvRRedundancy(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRvRRedundancy,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRvRRedundancy, 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,

View File

@ -16,9 +16,9 @@
# under the License.
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
#Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@ -136,14 +136,13 @@ class TestRvRDeploymentPlanning(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRvRDeploymentPlanning,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRvRDeploymentPlanning, 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,

View File

@ -16,9 +16,9 @@
# under the License.
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
#Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@ -137,14 +137,13 @@ class TestRedundantRouterRulesLifeCycle(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRedundantRouterRulesLifeCycle,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRedundantRouterRulesLifeCycle, 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,

View File

@ -22,11 +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.sshClient import SshClient
import datetime
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
class Services:
@ -190,14 +188,13 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVMLifeCycleHostmaintenance,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVMLifeCycleHostmaintenance, 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,
@ -554,4 +551,4 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
"Router state should be running"
)
# TODO: Check for the network connectivity
return
return

View File

@ -18,9 +18,9 @@
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 *
class Services:
@ -77,14 +77,13 @@ class TestVPCHostMaintenance(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVPCHostMaintenance,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVPCHostMaintenance, 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,

View File

@ -20,10 +20,11 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
from marvin.codes import FAILED
import time
@ -96,12 +97,13 @@ class Services:
class TestVRServiceFailureAlerting(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVRServiceFailureAlerting, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestVRServiceFailureAlerting, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
template = get_template(
@ -109,6 +111,9 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
assert False, "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
@ -148,6 +153,7 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.hypervisor = self.testClient.getHypervisorInfo()
self.cleanup = []
def tearDown(self):
@ -202,7 +208,7 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
alertSubject = "Monitoring Service on VR " + router.name
if self.apiclient.hypervisor.lower() == 'vmware':
if self.hypervisor.lower() == 'vmware':
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@ -210,7 +216,7 @@ class TestVRServiceFailureAlerting(cloudstackTestCase):
self.apiclient.connection.passwd,
router.linklocalip,
"service dnsmasq status",
hypervisor=self.apiclient.hypervisor
hypervisor=self.hypervisor
)
else:
try:

View File

@ -17,14 +17,32 @@
""" P1 tests for Account
"""
#Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.sshClient import SshClient
from marvin.cloudstackTestCase import cloudstackTestCase
#from marvin.cloudstackAPI import *
from marvin.lib.utils import (random_gen,
cleanup_resources)
from marvin.lib.base import (Domain,
Account,
ServiceOffering,
VirtualMachine,
Network,
User,
NATRule,
Template,
PublicIPAddress)
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_accounts,
list_virtual_machines,
list_service_offering,
list_templates,
list_users,
get_builtin_template_info,
wait_for_cleanup)
from nose.plugins.attrib import attr
from marvin.cloudstackException import cloudstackAPIException
from marvin.cloudstackException import CloudstackAPIException
import time
class Services:
"""Test Account Services
@ -102,13 +120,11 @@ class TestAccounts(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAccounts,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAccounts, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
@ -232,13 +248,11 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRemoveUserFromAccount,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRemoveUserFromAccount, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
@ -392,13 +406,11 @@ class TestNonRootAdminsPrivileges(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNonRootAdminsPrivileges,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNonRootAdminsPrivileges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone settings
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create an account, domain etc
cls.domain = Domain.create(
@ -726,12 +738,12 @@ class TestTemplateHierarchy(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestTemplateHierarchy,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplateHierarchy, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
cls.services = Services().services
# Get Zone settings
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create domains, accounts and template
@ -772,7 +784,8 @@ class TestTemplateHierarchy(cloudstackTestCase):
cls.services["template"],
zoneid=cls.zone.id,
account=cls.account_1.name,
domainid=cls.domain_1.id
domainid=cls.domain_1.id,
hypervisor=cls.hypervisor
)
# Wait for template to download
@ -879,21 +892,12 @@ class TestAddVmToSubDomain(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAddVmToSubDomain,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestAddVmToSubDomain, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Setup working Environment- Create domain, zone, pod cluster etc.
cls.domain = get_domain(
cls.api_client,
cls.services
)
cls.zone = get_zone(
cls.api_client,
cls.services,
)
cls.services = Services().services
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.sub_domain = Domain.create(
cls.api_client,
@ -1031,14 +1035,12 @@ class TestUserDetails(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestUserDetails,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestUserDetails, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain etc
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
cls._cleanup = []
return
@ -1331,14 +1333,12 @@ class TestUserLogin(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestUserLogin,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestUserLogin, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain etc
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
cls._cleanup = []
return
@ -1482,21 +1482,12 @@ class TestDomainForceRemove(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDomainForceRemove,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestDomainForceRemove, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Setup working Environment- Create domain, zone, pod cluster etc.
cls.domain = get_domain(
cls.api_client,
cls.services
)
cls.zone = get_zone(
cls.api_client,
cls.services,
)
cls.services = Services().services
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
@ -1681,7 +1672,7 @@ class TestDomainForceRemove(cloudstackTestCase):
" to cleanup any remaining resouces")
# Sleep 3*account.gc to ensure that all resources are deleted
wait_for_cleanup(self.apiclient, ["account.cleanup.interval"]*3)
with self.assertRaises(cloudstackAPIException):
with self.assertRaises(CloudstackAPIException):
Domain.list(
self.apiclient,
id=domain.id,
@ -1689,7 +1680,7 @@ class TestDomainForceRemove(cloudstackTestCase):
)
self.debug("Checking if the resources in domain are deleted")
with self.assertRaises(cloudstackAPIException):
with self.assertRaises(CloudstackAPIException):
Account.list(
self.apiclient,
name=self.account_1.name,

View File

@ -29,7 +29,7 @@
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from ddt import ddt, data
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
Domain,
ServiceOffering,
@ -39,7 +39,7 @@ from marvin.integration.lib.base import (
VpcOffering,
VPC
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_virtual_machines,
@ -49,7 +49,7 @@ from marvin.integration.lib.common import (get_domain,
update_resource_limit
)
from marvin.integration.lib.utils import (validateList,
from marvin.lib.utils import (validateList,
random_gen,
get_hypervisor_type,
cleanup_resources)
@ -60,6 +60,7 @@ from marvin.cloudstackAPI import (addNicToVirtualMachine,
from marvin.codes import PASS
import random
import time
class Services:
"""Test Add Remove Network Services
@ -67,7 +68,7 @@ class Services:
def __init__(self):
self.services = {
"sleep": 60,
"ostype": "CentOS 5.3 (64-bit)",
# Cent OS 5.3 (64 bit)
@ -173,7 +174,10 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAddNetworkToVirtualMachine, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestAddNetworkToVirtualMachine, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
if hypervisor.lower() not in ["xenserver","kvm"]:
@ -181,8 +185,8 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
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())
template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
# Set Zones and disk offerings
@ -394,8 +398,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
# Trying to add same network to vm for the second time
with self.assertRaises(Exception) as e:
self.addNetworkToVm(network, self.virtual_machine)
self.debug("Adding same network again failed with exception: %s" % e.exception)
self.debug("Adding same network again failed with exception: %s" % e.exception)
return
@ -517,7 +520,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
with self.assertRaises(Exception) as e:
self.addNetworkToVm(self.shared_network, self.virtual_machine,
ipaddress = ipaddress)
self.debug("API failed with exception: %s" % e.exception)
self.debug("API failed with exception: %s" % e.exception)
return
@ -554,9 +557,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
with self.assertRaises(Exception) as e:
self.virtual_machine.add_nic(self.apiclient, network.id)
network.delete(self.apiclient)
self.debug("Operation failed with exception %s" % e.exception)
self.debug("Operation failed with exception %s" % e.exception)
return
@ -608,15 +609,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
domainid=self.child_do_admin_2.domainid, serviceofferingid=self.service_offering.id,
mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Trying to %s network in domain %s to a vm in domain %s, This should fail" %
(network.type, self.child_domain_1.name, self.child_domain_2.name))
with self.assertRaises(Exception) as e:
virtual_machine.add_nic(self.apiclient, network.id)
self.debug("Operation failed with exception %s" % e.exception)
network.delete(self.apiclient)
self.debug("Operation failed with exception %s" % e.exception)
return
@attr(tags = ["advanced"])
@ -688,7 +687,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
with self.assertRaises(Exception) as e:
virtual_machine.add_nic(self.apiclient, network_2.id)
self.debug("Operation failed with exception %s" % e.exception)
self.debug("Operation failed with exception %s" % e.exception)
return
@ -696,16 +695,18 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRemoveNetworkFromVirtualMachine, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRemoveNetworkFromVirtualMachine, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
if hypervisor.lower() not in ["xenserver","kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
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())
template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
# Set Zones and disk offerings
@ -838,7 +839,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
self.virtual_machine.id)
with self.assertRaises(Exception):
self.virtual_machine.remove_nic(self.apiclient, vm_list[0].nic[0].id)
self.debug("Removing default nic of vm failed")
self.debug("Removing default nic of vm failed")
return
@attr(tags = ["advanced"])
@ -869,23 +870,25 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
operation should fail")
with self.assertRaises(Exception) as e:
self.virtual_machine.remove_nic(self.apiclient, virtual_machine.nic[0].id)
self.debug("Operation failed with exception: %s" % e.exception)
self.debug("Operation failed with exception: %s" % e.exception)
return
class TestUpdateVirtualMachineNIC(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestUpdateVirtualMachineNIC, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestUpdateVirtualMachineNIC, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
if hypervisor.lower() not in ["xenserver","kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
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())
template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
# Set Zones and disk offerings
@ -1047,7 +1050,7 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
self.debug("Trying to set default nic again as default nic, This should fail")
with self.assertRaises(Exception) as e:
self.virtual_machine.update_default_nic(self.apiclient, nicId = defaultNicId)
self.debug("updateDefaultNic operation failed as expected with exception: %s" %
self.debug("updateDefaultNic operation failed as expected with exception: %s" %
e.exception)
return
@ -1072,15 +1075,16 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
accountid=account.name,domainid=account.domainid,
serviceofferingid=self.service_offering.id,mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Deployed virtual machine: %s" % virtual_machine.id)
foreignNicId = virtual_machine.nic[0].id
self.debug("Trying to set nic of new virtual machine as default nic of existing virtual machine, This \
operation should fail")
with self.assertRaises(Exception) as e:
self.virtual_machine.update_default_nic(self.apiclient, nicId = foreignNicId)
self.debug("updateDefaultNic operation failed as expected with exception: %s" %
self.debug("updateDefaultNic operation failed as expected with exception: %s" %
e.exception)
return
@ -1089,16 +1093,18 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestFailureScenariosAddNetworkToVM, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestFailureScenariosAddNetworkToVM, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
if hypervisor.lower() not in ["xenserver","kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
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())
template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
# Set Zones and disk offerings
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@ -1226,6 +1232,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
cmd.networkid = isolated_network.id
with self.assertRaises(Exception) as e:
time.sleep(5)
self.apiclient.addNicToVirtualMachine(cmd)
self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
@ -1267,6 +1274,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
serviceofferingid=self.service_offering.id,
mode=basicZone.networktype)
time.sleep(self.services["sleep"])
self.debug("Deployed virtual machine %s: " % virtual_machine.id)
cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd()
@ -1276,6 +1284,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
self.dedbug("Trying to add isolated network to VM (both in basic zone,\
this operation should fail")
with self.assertRaises(Exception) as e:
time.sleep(5)
self.apiclient.addNicToVirtualMachine(cmd)
self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
@ -1302,12 +1311,13 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
self.debug("Created account %s" % account.name)
self.debug("creating user api client for account: %s" % account.name)
api_client = self.testClient.createUserApiClient(UserName=account.name, DomainName=self.account.domain)
api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
self.debug("Trying to add network to vm with this api client, this should fail due to \
insufficient permission")
with self.assertRaises(Exception) as e:
time.sleep(5)
api_client.addNicToVirtualMachine(cmd)
self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
@ -1317,16 +1327,18 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestFailureScenariosRemoveNicFromVM, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestFailureScenariosRemoveNicFromVM, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
if hypervisor.lower() not in ["xenserver","kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
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())
template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
# Set Zones and disk offerings
@ -1374,7 +1386,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
def tearDownClass(cls):
try:
# Disable Network Offerings
#cls.isolated_network_offering.update(cls.api_client, state='Disabled')
cls.isolated_network_offering.update(cls.api_client, state='Disabled')
# Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
@ -1480,7 +1492,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
self.debug("Created account %s" % account.name)
self.debug("creating user api client for account: %s" % account.name)
api_client = self.testClient.createUserApiClient(UserName=account.name, DomainName=self.account.domain)
api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
self.debug("Trying to add network to vm with this api client, this should fail due to \
insufficient permission")
@ -1495,16 +1507,18 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestFailureScenariosUpdateVirtualMachineNIC, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestFailureScenariosUpdateVirtualMachineNIC, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
if hypervisor.lower() not in ["xenserver","kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
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())
template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
# Set Zones and disk offerings
@ -1603,7 +1617,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
with self.assertRaises(Exception) as e:
self.apiclient.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
e.exception)
return
@ -1649,7 +1663,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
with self.assertRaises(Exception) as e:
self.apiclient.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
e.exception)
return
@ -1678,7 +1692,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
accountid=account.name,domainid=account.domainid,
serviceofferingid=self.service_offering.id,
mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Created virtual machine %s" % virtual_machine.id)
self.debug("Creating isolated network in account %s" % account.name)
@ -1731,7 +1745,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
with self.assertRaises(Exception) as e:
self.apiclient.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
e.exception)
return
@ -1751,7 +1765,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
self.debug("Created account %s" % account.name)
self.debug("creating user api client for account: %s" % account.name)
api_client = self.testClient.createUserApiClient(UserName=account.name, DomainName=self.account.domain)
api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
self.debug("Listing virtual machine so that to retrive the list of non-default and default nic")
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
@ -1781,7 +1795,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
with self.assertRaises(Exception) as e:
api_client.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
e.exception)
return

View File

@ -19,7 +19,7 @@
"""
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from ddt import ddt, data
from marvin.integration.lib.base import (Zone,
from marvin.lib.base import (Zone,
ServiceOffering,
Account,
NetworkOffering,
@ -31,14 +31,14 @@ from marvin.integration.lib.base import (Zone,
SecurityGroup,
Host)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
get_free_vlan,
list_virtual_machines,
wait_for_cleanup)
from marvin.integration.lib.utils import (cleanup_resources,
from marvin.lib.utils import (cleanup_resources,
random_gen,
validateList)
from marvin.cloudstackAPI import (authorizeSecurityGroupIngress,
@ -54,14 +54,12 @@ class TestCreateZoneSG(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestCreateZoneSG,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestCreateZoneSG, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client)
cls._cleanup = []
return
@ -154,14 +152,13 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestNetworksInAdvancedSG,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestNetworksInAdvancedSG, cls).getClsTestClient()
cls.api_client = 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.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,
cls.services["ostype"])
@ -1102,14 +1099,13 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestNetworksInAdvancedSG_VmOperations,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestNetworksInAdvancedSG_VmOperations, cls).getClsTestClient()
cls.api_client = 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.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,cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@ -2086,14 +2082,13 @@ class TestSecurityGroups_BasicSanity(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestSecurityGroups_BasicSanity,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestSecurityGroups_BasicSanity, cls).getClsTestClient()
cls.api_client = 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.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,cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@ -2548,14 +2543,13 @@ class TestSharedNetworkOperations(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestSharedNetworkOperations,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestSharedNetworkOperations, cls).getClsTestClient()
cls.api_client = 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.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,cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@ -2815,14 +2809,13 @@ class TestAccountBasedIngressRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestAccountBasedIngressRules,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.services = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestAccountBasedIngressRules, cls).getClsTestClient()
cls.api_client = 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.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,cls.services["ostype"])
cls.services["virtual_machine"]["zoneid"] = cls.zone.id

View File

@ -15,12 +15,20 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
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.sshClient import SshClient
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources,
random_gen)
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
AffinityGroup,
Domain)
from marvin.lib.common import (get_zone,
get_domain,
get_template,
list_virtual_machines,
wait_for_cleanup)
from nose.plugins.attrib import attr
class Services:
@ -89,12 +97,12 @@ class TestCreateAffinityGroup(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestCreateAffinityGroup, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateAffinityGroup, 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,
@ -197,7 +205,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
self.cleanup.append(self.do_admin)
self.cleanup.append(self.new_domain)
domainapiclient = self.testClient.createUserApiClient(self.do_admin.name, self.new_domain.name, 2)
domainapiclient = self.testClient.getUserApiClient(self.do_admin.name, self.new_domain.name, 2)
aff_grp = self.create_aff_grp(api_client=domainapiclient, aff_grp=self.services["host_anti_affinity"],
acc=self.do_admin.name, domainid=self.new_domain.id)
@ -214,7 +222,7 @@ class TestCreateAffinityGroup(cloudstackTestCase):
self.user = Account.create(self.api_client, self.services["new_account"],
domainid=self.domain.id)
userapiclient = self.testClient.createUserApiClient(self.user.name, self.domain.name)
userapiclient = self.testClient.getUserApiClient(self.user.name, self.domain.name)
self.cleanup.append(self.user)
aff_grp = self.create_aff_grp(api_client=userapiclient, aff_grp=self.services["host_anti_affinity"],
@ -283,12 +291,14 @@ class TestListAffinityGroups(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.testClient = super(TestListAffinityGroups, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.api_client = super(TestListAffinityGroups, 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.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
@ -530,11 +540,14 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDeleteAffinityGroups, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDeleteAffinityGroups, 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,
@ -704,10 +717,10 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
self.user2 = Account.create(self.apiclient, self.services["new_account1"])
self.cleanup.append(self.user2)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user2.name,
DomainName=self.user2.domain,
acctType=0)
type=0)
aff_1 = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -740,10 +753,10 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
self.user2 = Account.create(self.apiclient, self.services["new_account1"])
self.cleanup.append(self.user2)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user2.name,
DomainName=self.user2.domain,
acctType=0)
type=0)
aff_1 = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -781,10 +794,10 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
self.services["new_account"])
self.cleanup.append(self.user1)
user1apiclient = self.testClient.createUserApiClient(
user1apiclient = self.testClient.getUserApiClient(
UserName=self.user1.name,
DomainName=self.user1.domain,
acctType=0)
type=0)
aff_grp = self.create_aff_grp(api_client=user1apiclient,
aff_grp=self.services["host_anti_affinity"])
@ -800,11 +813,14 @@ class TestUpdateVMAffinityGroups(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestUpdateVMAffinityGroups, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestUpdateVMAffinityGroups, 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,
@ -1084,11 +1100,14 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDeployVMAffinityGroups, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployVMAffinityGroups, 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,
@ -1294,10 +1313,10 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
self.user2 = Account.create(self.apiclient, self.services["new_account1"])
self.cleanup.append(self.user2)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user2.name,
DomainName=self.user2.domain,
acctType=0)
type=0)
self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -1327,10 +1346,10 @@ class TestDeployVMAffinityGroups(cloudstackTestCase):
self.user2 = Account.create(self.apiclient, self.services["new_account1"])
self.cleanup.append(self.user2)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user2.name,
DomainName=self.user2.domain,
acctType=0)
type=0)
self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -1432,11 +1451,13 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAffinityGroupsAdminUser, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestAffinityGroupsAdminUser, 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,
@ -1549,10 +1570,10 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
self.services["new_account"])
self.cleanup.append(self.user1)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user1.name,
DomainName=self.user1.domain,
acctType=0)
type=0)
aff_grp = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -1588,10 +1609,10 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
self.services["new_account"])
self.cleanup.append(self.user1)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user1.name,
DomainName=self.user1.domain,
acctType=0)
type=0)
aff_grp = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -1638,10 +1659,10 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
self.services["new_account"])
self.cleanup.append(self.user1)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user1.name,
DomainName=self.user1.domain,
acctType=0)
type=0)
aff_grp1 = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -1674,10 +1695,10 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
self.services["new_account"])
self.cleanup.append(self.user1)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user1.name,
DomainName=self.user1.domain,
acctType=0)
type=0)
aff_grp = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])
@ -1706,10 +1727,10 @@ class TestAffinityGroupsAdminUser(cloudstackTestCase):
self.services["new_account"])
self.cleanup.append(self.user1)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=self.user1.name,
DomainName=self.user1.domain,
acctType=0)
type=0)
aff_grp = self.create_aff_grp(api_client=userapiclient,
aff_grp=self.services["host_anti_affinity"])

View File

@ -15,17 +15,16 @@
# specific language governing permissions and limitations
# under the License.
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 nose.plugins.attrib import attr
import datetime
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Host,
Pod,
Zone,
Cluster,
StoragePool)
from marvin.lib.common import get_zone, get_template
from marvin.codes import FAILED
class Services:
"""Test Resource Limits Services
"""
@ -86,13 +85,23 @@ class TestAllocationState(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAllocationState,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAllocationState, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
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['mode'] = cls.zone.networktype
cls._cleanup = []
return

View File

@ -18,15 +18,15 @@
""" Cisco ASA1000v external firewall
"""
#Import Local Modules
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.sshClient import SshClient
import datetime
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (NetworkOffering,
PhysicalNetwork,
VNMC,
ASA1000V,
Cluster)
from marvin.lib.common import get_zone
class Services:
@ -101,7 +101,7 @@ class TestASASetup(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.zone = get_zone(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.physicalnetworks = PhysicalNetwork.list(self.apiclient, zoneid=self.zone.id)
self.assertNotEqual(len(self.physicalnetworks), 0, "Check if the list physical network API returns a non-empty response")
self.clusters = Cluster.list(self.apiclient, hypervisor='VMware')

View File

@ -20,7 +20,7 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import (Account,
from marvin.lib.base import (Account,
Domain,
User,
Project,
@ -29,7 +29,7 @@ from marvin.integration.lib.base import (Account,
DiskOffering,
ServiceOffering,
VirtualMachine)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_volumes,
@ -37,7 +37,7 @@ from marvin.integration.lib.common import (get_domain,
list_networks,
list_snapshots,
list_virtual_machines)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
def log_test_exceptions(func):
def test_wrap_exception_log(self, *args, **kwargs):
@ -98,12 +98,13 @@ class TestVMOwnership(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(TestVMOwnership,
cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone Domain and create Domains and sub Domains.
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.testClient = super(TestVMOwnership, 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.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Get and set template id for VM creation.
cls.template = get_template(cls.api_client,
@ -353,8 +354,8 @@ class TestVMOwnership(cloudstackTestCase):
# 1. deploy VM in sub subdomain1
# 2. stop VM in sub subdomain1
# 3. assignVirtualMachine to subdomain2
userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
domain=self.sdomain_account_user1['domain'].name,
userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name,
DomainName=self.sdomain_account_user1['domain'].name,
type=2)
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'])
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
@ -389,8 +390,8 @@ class TestVMOwnership(cloudstackTestCase):
# Validate the following:
# 1. deploy VM in sub subdomain1 with volumes.
# 3. assignVirtualMachine to subdomain2
userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
domain=self.sdomain_account_user1['domain'].name,
userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name,
DomainName=self.sdomain_account_user1['domain'].name,
type=2)
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'],volume=self.sdomain_account_user1['volume'])
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
@ -431,8 +432,8 @@ class TestVMOwnership(cloudstackTestCase):
# Validate the following:
# 1. deploy VM in sub subdomain1 with snapshot.
# 3. assignVirtualMachine to subdomain2
userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
domain=self.sdomain_account_user1['domain'].name,
userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name,
DomainName=self.sdomain_account_user1['domain'].name,
type=2)
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], project=self.sdomain_account_user1['project'])
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
@ -450,8 +451,8 @@ class TestVMOwnership(cloudstackTestCase):
account=self.sdomain_account_user2['account'].name,
domainid=self.sdomain_account_user2['domain'].id,
max=0)
userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
domain=self.sdomain_account_user1['domain'].name,
userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name,
DomainName=self.sdomain_account_user1['domain'].name,
type=2)
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True)
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)
@ -470,8 +471,8 @@ class TestVMOwnership(cloudstackTestCase):
account=self.sdomain_account_user2['account'].name,
domainid=self.sdomain_account_user2['domain'].id,
max=0)
userapiclient = self.testClient.getUserApiClient(account=self.sdomain_account_user1['account'].name,
domain=self.sdomain_account_user1['domain'].name,
userapiclient = self.testClient.getUserApiClient(UserName=self.sdomain_account_user1['account'].name,
DomainName=self.sdomain_account_user1['domain'].name,
type=2)
self.create_vm(self.sdomain_account_user1['account'], self.sdomain_account_user1['domain'], snapshot=True, volume=self.sdomain_account_user1['volume'])
self.assertRaises(Exception, self.virtual_machine.assign_virtual_machine, userapiclient, self.sdomain_account_user2['account'].name ,self.sdomain_account_user2['domain'].id)

View File

@ -17,18 +17,18 @@
""" Test for baremetal
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.cloudstackAPI import createVlanIpRange
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (NetworkOffering,
NetworkServiceProvider,
PhysicalNetwork,
Network,
Pod)
#from marvin.lib.common import *
from nose.plugins.attrib import attr
import telnetlib
#Import System modules
import time
_multiprocess_shared_ = True
class Services:
@ -89,19 +89,19 @@ class TestBaremetal(cloudstackTestCase):
physical_network = PhysicalNetwork.list(self.apiclient, zoneid=self.zoneid)[0];
dhcp_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalDhcpProvider", physical_network_id=physical_network.id)[0]
response = NetworkServiceProvider.update(
NetworkServiceProvider.update(
self.apiclient,
id=dhcp_provider.id,
state='Enabled'
)
pxe_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalPxeProvider", physical_network_id=physical_network.id)[0]
response = NetworkServiceProvider.update(
NetworkServiceProvider.update(
self.apiclient,
id=pxe_provider.id,
state='Enabled'
)
userdata_provider = NetworkServiceProvider.list(self.apiclient, name="BaremetalUserdataProvider", physical_network_id=physical_network.id)[0]
response = NetworkServiceProvider.update(
NetworkServiceProvider.update(
self.apiclient,
id=userdata_provider.id,
state='Enabled'
@ -119,5 +119,5 @@ class TestBaremetal(cloudstackTestCase):
cmd.startip = "10.1.1.20"
cmd.endip = "10.1.1.40"
cmd.forVirtualNetwork="false"
response = self.apiclient.createVlanIpRange(cmd)
self.apiclient.createVlanIpRange(cmd)

View File

@ -31,7 +31,7 @@ from marvin.codes import (PASS,
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import (ServiceOffering,
from marvin.lib.base import (ServiceOffering,
Account,
VirtualMachine,
Volume,
@ -41,13 +41,13 @@ from marvin.integration.lib.base import (ServiceOffering,
Template
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_templates
)
from marvin.integration.lib.utils import (validateList,
from marvin.lib.utils import (validateList,
cleanup_resources)
import time
@ -161,14 +161,14 @@ class TestBaseImageUpdate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestBaseImageUpdate,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestBaseImageUpdate, 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,
@ -238,6 +238,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
@ -427,7 +428,8 @@ class TestBaseImageUpdate(cloudstackTestCase):
v,
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
domainid=self.account.domainid,
hypervisor=self.hypervisor
)
self.debug(
"Registered a template of format: %s with ID: %s" % (

View File

@ -16,15 +16,29 @@
# under the License.
""" Tests for Blocker bugs
"""
import marvin
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import (Snapshot,
Template,
Domain,
Account,
ServiceOffering,
Network,
VirtualMachine,
PublicIPAddress,
StaticNATRule,
FireWallRule,
Volume)
from marvin.lib.utils import cleanup_resources
from marvin.lib.common import (get_zone,
get_domain,
get_template,
list_routers,
get_builtin_template_info)
#Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.cloudstackAPI import restartNetwork
import time
class Services:
@ -95,8 +109,8 @@ class Services:
class TestTemplate(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
return
@ -110,12 +124,13 @@ class TestTemplate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestTemplate, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplate, 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
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["template"]["zoneid"] = cls.zone.id
@ -173,7 +188,8 @@ class TestTemplate(cloudstackTestCase):
self.services["template"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
domainid=self.account.domainid,
hypervisor=self.hypervisor
)
self.debug(
"Registered a template of format: %s with ID: %s" % (
@ -242,12 +258,14 @@ class TestNATRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestNATRules, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestNATRules, 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
template = get_template(
cls.api_client,
@ -448,10 +466,12 @@ class TestRouters(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRouters, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRouters, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
@ -573,11 +593,13 @@ class TestRouterRestart(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRouterRestart, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRouterRestart, 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.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
template = get_template(
cls.api_client,
@ -706,12 +728,14 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplates, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
# Get Zone, templates etc
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services['mode'] = cls.zone.networktype
template = get_template(

View File

@ -19,21 +19,21 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Resources,
Domain
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
findSuitableHostForMigration,
get_resource_type
)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
class Services:
@ -91,12 +91,13 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDomainCPULimitsUpdateResources,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDomainCPULimitsUpdateResources, 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
cls.template = get_template(
cls.api_client,
@ -237,7 +238,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -310,7 +311,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -371,7 +372,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -435,7 +436,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -505,12 +506,13 @@ class TestMultipleChildDomains(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMultipleChildDomains,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleChildDomains, 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
cls.template = get_template(
cls.api_client,
@ -689,11 +691,11 @@ class TestMultipleChildDomains(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts()
api_client_cadmin_1 = self.testClient.createUserApiClient(
api_client_cadmin_1 = self.testClient.getUserApiClient(
UserName=self.cadmin_1.name,
DomainName=self.cadmin_1.domain)
api_client_cadmin_2 = self.testClient.createUserApiClient(
api_client_cadmin_2 = self.testClient.getUserApiClient(
UserName=self.cadmin_2.name,
DomainName=self.cadmin_2.domain)

View File

@ -19,21 +19,21 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Domain,
Resources
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
findSuitableHostForMigration,
get_resource_type
)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
@ -92,12 +92,13 @@ class TestCPULimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestCPULimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestCPULimits, 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
cls.template = get_template(
@ -352,12 +353,14 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDomainCPULimitsConfiguration,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDomainCPULimitsConfiguration, 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
cls.template = get_template(
cls.api_client,
@ -481,7 +484,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -553,7 +556,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -613,7 +616,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -685,7 +688,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
if cpu_account_gc[0].max != 16:
self.skipTest("This test case requires configuration value max.account.cpus to be 16")
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)

View File

@ -19,8 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
@ -28,11 +28,11 @@ from marvin.integration.lib.base import (
Domain,
Project
)
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:
"""Test resource limit services
@ -89,12 +89,13 @@ class TestMaxCPULimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMaxCPULimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestMaxCPULimits, 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
cls.template = get_template(
cls.api_client,
@ -251,7 +252,7 @@ class TestMaxCPULimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=4, domain_limit=2)
api_client_admin = self.testClient.createUserApiClient(
api_client_admin = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)
@ -284,7 +285,7 @@ class TestMaxCPULimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=6, domain_limit=8)
api_client_admin = self.testClient.createUserApiClient(
api_client_admin = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)
@ -325,7 +326,7 @@ class TestMaxCPULimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=4, domain_limit=4, project_limit=2)
api_client_admin = self.testClient.createUserApiClient(
api_client_admin = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)
@ -360,7 +361,7 @@ class TestMaxCPULimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=6, domain_limit=6, project_limit=6)
api_client_admin = self.testClient.createUserApiClient(
api_client_admin = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)

View File

@ -20,20 +20,20 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Domain,
Project
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
findSuitableHostForMigration,
get_resource_type
)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
class Services:
@ -91,12 +91,13 @@ class TestProjectsCPULimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestProjectsCPULimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectsCPULimits, 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
cls.template = get_template(
cls.api_client,
@ -137,7 +138,7 @@ class TestProjectsCPULimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupProjectAccounts()
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.admin.name,
DomainName=self.admin.domain)

View File

@ -20,9 +20,9 @@
import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase 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 *
class Services:
@ -94,13 +94,13 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestInstanceNameFlagTrue,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestInstanceNameFlagTrue, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, default template
cls.zone = get_zone(cls.api_client, cls.services)
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services["mode"] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
@ -108,12 +108,7 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
cls.services["ostype"]
)
# Create domains, account etc.
cls.domain = get_domain(
cls.api_client,
cls.services
)
# Create account
cls.account = Account.create(
cls.api_client,
cls.services["account"],
@ -561,13 +556,13 @@ class TestInstanceNameFlagFalse(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestInstanceNameFlagFalse,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestInstanceNameFlagFalse, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, default template
cls.zone = get_zone(cls.api_client, cls.services)
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
@ -575,12 +570,7 @@ class TestInstanceNameFlagFalse(cloudstackTestCase):
cls.services["ostype"]
)
# Create domains, account etc.
cls.domain = get_domain(
cls.api_client,
cls.services
)
# Create account
cls.account = Account.create(
cls.api_client,
cls.services["account"],

View File

@ -19,9 +19,9 @@
# this script will cover VMdeployment with Userdata tests
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
from marvin.sshClient import SshClient
import unittest
@ -71,9 +71,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.apiClient = super(TestDeployVmWithUserData, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployVmWithUserData, cls).getClsTestClient()
cls.apiClient = cls.testClient.getApiClient()
cls.services = Services().services
cls.zone = get_zone(cls.apiClient, cls.services)
cls.zone = get_zone(cls.apiClient, cls.testClient.getZoneForTests())
if cls.zone.localstorageenabled:
#For devcloud since localstroage is enabled
cls.services["service_offering"]["storagetype"] = "local"
@ -99,6 +100,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
cls.user_data_2kl = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(1900))
def setUp(self):
self.apiClient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
@attr(tags=["simulator", "devcloud", "basic", "advanced", "provisioning"])
def test_deployvm_userdata_post(self):
@ -174,7 +179,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
host.passwd="password"
cmd="cat /var/www/html/userdata/"+deployVmResponse.ipaddress+"/user-data"
if self.apiClient.hypervisor.lower() == 'vmware':
if self.hypervisor.lower() == 'vmware':
try:
result = get_process_status(
@ -184,7 +189,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
self.apiClient.connection.passwd,
router.linklocalip,
cmd,
hypervisor=self.apiClient.hypervisor
hypervisor=self.hypervisor
)
res = str(result)
self.assertEqual(res.__contains__(self.userdata),True,"Userdata Not applied Check the failures")

View File

@ -24,24 +24,13 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Compute+Offering+FS
"""
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.utils import (cleanup_resources,
validateList,
random_gen)
from marvin.integration.lib.base import (ServiceOffering,
VirtualMachine,
Account,
Resources,
AffinityGroup,
Host)
from marvin.integration.lib.common import (get_domain,
get_zone,
get_template,
verifyComputeOfferingCreation)
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
from marvin.codes import PASS, ADMIN_ACCOUNT, USER_ACCOUNT
from ddt import ddt, data
import time
@ddt
class TestDynamicServiceOffering(cloudstackTestCase):
@ -50,21 +39,22 @@ class TestDynamicServiceOffering(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestDynamicServiceOffering,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
testClient = super(TestDynamicServiceOffering, 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.mode = str(cls.zone.networktype).lower()
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(
cls.apiclient,
cls.zone.id,
cls.services["ostype"]
)
if template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.services["ostype"]
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls._cleanup = []

View File

@ -21,7 +21,7 @@
import unittest
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import (Account,
from marvin.lib.base import (Account,
Domain,
Router,
Network,
@ -31,14 +31,14 @@ from marvin.integration.lib.base import (Account,
FireWallRule,
NATRule,
PublicIPAddress)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_routers,
wait_for_cleanup,
list_virtual_machines
)
from marvin.integration.lib.utils import cleanup_resources, validateList
from marvin.lib.utils import cleanup_resources, validateList
from marvin.cloudstackAPI import rebootRouter
from marvin.cloudstackAPI.createEgressFirewallRule import createEgressFirewallRuleCmd
from marvin.cloudstackAPI.deleteEgressFirewallRule import deleteEgressFirewallRuleCmd
@ -132,12 +132,13 @@ class TestEgressFWRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(TestEgressFWRules,
cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone Domain and create Domains and sub Domains.
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.testClient = super(TestEgressFWRules, 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.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Get and set template id for VM creation.
cls.template = get_template(cls.api_client,

View File

@ -20,13 +20,13 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.utils import (random_gen,
from marvin.lib.utils import (random_gen,
cleanup_resources)
from marvin.integration.lib.base import (SecurityGroup,
from marvin.lib.base import (SecurityGroup,
VirtualMachine,
Account,
ServiceOffering)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_virtual_machines)
@ -149,15 +149,13 @@ class TestDefaultSecurityGroupEgress(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestDefaultSecurityGroupEgress,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDefaultSecurityGroupEgress, 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
template = get_template(
@ -307,15 +305,13 @@ class TestAuthorizeIngressRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestAuthorizeIngressRule,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAuthorizeIngressRule, 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
template = get_template(
@ -465,15 +461,13 @@ class TestDefaultGroupEgress(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestDefaultGroupEgress,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDefaultGroupEgress, 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
template = get_template(
@ -663,15 +657,13 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestDefaultGroupEgressAfterDeploy,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDefaultGroupEgressAfterDeploy, 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
template = get_template(
@ -842,15 +834,13 @@ class TestRevokeEgressRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestRevokeEgressRule,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRevokeEgressRule, 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
template = get_template(
@ -1125,15 +1115,13 @@ class TestInvalidAccountAuthroize(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestInvalidAccountAuthroize,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestInvalidAccountAuthroize, 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
template = get_template(
@ -1246,15 +1234,13 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestMultipleAccountsEgressRuleNeg,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleAccountsEgressRuleNeg, 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
template = get_template(
@ -1495,15 +1481,13 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestMultipleAccountsEgressRule,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleAccountsEgressRule, 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
template = get_template(
@ -1786,15 +1770,13 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestStartStopVMWithEgressRule,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestStartStopVMWithEgressRule, 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
template = get_template(
@ -1993,15 +1975,13 @@ class TestInvalidParametersForEgress(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestInvalidParametersForEgress,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestInvalidParametersForEgress, 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
template = get_template(

View File

@ -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 *
from marvin.sshClient import SshClient
import datetime
@ -91,11 +91,13 @@ class TestEIP(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestEIP, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestEIP, 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
cls.template = get_template(
cls.api_client,
@ -909,11 +911,13 @@ class TestELB(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestELB, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestELB, 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
cls.template = get_template(
cls.api_client,

File diff suppressed because it is too large Load Diff

View File

@ -21,9 +21,9 @@ import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
@ -96,12 +96,13 @@ class TestExplicitDedication(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestExplicitDedication, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestExplicitDedication, 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
cls.template = get_template(

View File

@ -19,7 +19,7 @@
# Import Local Modules
from nose.plugins.attrib import attr
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 (
Vpn,
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,
random_gen)
from marvin.cloudstackAPI import createLBStickinessPolicy
from marvin.sshClient import SshClient
@ -118,12 +118,13 @@ class TestHAProxyStickyness(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestHAProxyStickyness,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestHAProxyStickyness, 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,

View File

@ -21,9 +21,9 @@ import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
@ -91,12 +91,13 @@ class TestImplicitPlanner(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestImplicitPlanner, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestImplicitPlanner, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# 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.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(

View File

@ -23,31 +23,10 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network
"""
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.utils import (cleanup_resources,
validateList,
verifyRouterState)
from marvin.integration.lib.base import (Network,
Account,
ServiceOffering,
VirtualMachine,
Router,
NetworkOffering,
VpcOffering,
VPC)
from marvin.integration.lib.common import (get_domain,
get_zone,
get_template,
createEnabledNetworkOffering,
get_free_vlan,
wait_for_cleanup,
createNetworkRulesForVM)
from marvin.codes import (PASS,
NAT_RULE,
STATIC_NAT_RULE,
FAIL,
UNKNOWN,
FAULT,
MASTER)
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
import netaddr
import random
@ -101,18 +80,22 @@ class TestIpReservation(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestIpReservation, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill test data from the external config file
cls.testData = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestIpReservation, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.testData = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.testData)
cls.zone = get_zone(cls.api_client, cls.testData)
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,
cls.testData["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.testData["ostype"]
cls.testData["domainid"] = cls.domain.id
cls.testData["zoneid"] = cls.zone.id
cls.testData["virtual_machine"]["zoneid"] = cls.zone.id
@ -545,18 +528,22 @@ class TestRestartNetwork(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestRestartNetwork, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill test data from the external config file
cls.testData = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestRestartNetwork, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.testData = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.testData)
cls.zone = get_zone(cls.api_client, cls.testData)
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,
cls.testData["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.testData["ostype"]
cls.testData["domainid"] = cls.domain.id
cls.testData["zoneid"] = cls.zone.id
cls.testData["virtual_machine"]["zoneid"] = cls.zone.id
@ -666,18 +653,22 @@ class TestUpdateIPReservation(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestUpdateIPReservation, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill test data from the external config file
cls.testData = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestUpdateIPReservation, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.testData = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.testData)
cls.zone = get_zone(cls.api_client, cls.testData)
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,
cls.testData["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.testData["ostype"]
cls.testData["domainid"] = cls.domain.id
cls.testData["zoneid"] = cls.zone.id
cls.testData["virtual_machine"]["zoneid"] = cls.zone.id
@ -812,18 +803,22 @@ class TestRouterOperations(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestRouterOperations, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill test data from the external config file
cls.testData = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestRouterOperations, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.testData = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.testData)
cls.zone = get_zone(cls.api_client, cls.testData)
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,
cls.testData["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.testData["ostype"]
cls.testData["domainid"] = cls.domain.id
cls.testData["zoneid"] = cls.zone.id
cls.testData["virtual_machine"]["zoneid"] = cls.zone.id
@ -978,18 +973,22 @@ class TestFailureScnarios(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestFailureScnarios, cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
# Fill test data from the external config file
cls.testData = cloudstackTestClient.getConfigParser().parsedDict
cls.testClient = super(TestFailureScnarios, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.testData = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.testData)
cls.zone = get_zone(cls.api_client, cls.testData)
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,
cls.testData["ostype"]
)
if cls.template == FAILED:
assert False, "get_template() failed to return template with description %s" % cls.testData["ostype"]
cls.testData["domainid"] = cls.domain.id
cls.testData["zoneid"] = cls.zone.id
cls.testData["virtual_machine"]["zoneid"] = cls.zone.id

View File

@ -29,9 +29,9 @@ import hashlib
import random
from marvin.cloudstackAPI import *
from marvin.cloudstackAPI import login
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
import urllib

View File

@ -19,21 +19,21 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Resources,
Domain
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
findSuitableHostForMigration,
get_resource_type
)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
class Services:
@ -91,12 +91,13 @@ class TestMemoryLimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMemoryLimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestMemoryLimits, 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
@ -370,12 +371,13 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDomainMemoryLimitsConfiguration,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDomainMemoryLimitsConfiguration, 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
cls.template = get_template(
@ -498,7 +500,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -570,7 +572,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -630,7 +632,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.account = admin
self.domain = domain
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -703,7 +705,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
if memory_account_gc[0].max != 8192:
self.skipTest("This test case requires configuration value max.account.memory to be 8192")
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)

View File

@ -19,14 +19,14 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Resources,
Domain
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
@ -34,7 +34,7 @@ from marvin.integration.lib.common import (get_domain,
get_resource_type,
update_resource_count
)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
class Services:
@ -92,12 +92,13 @@ class TestDomainMemoryLimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDomainMemoryLimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDomainMemoryLimits, 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
cls.template = get_template(
@ -234,7 +235,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
self.debug("Creating an instance with service offering: %s" %
self.service_offering.name)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -371,7 +372,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
self.debug("Creating an instance with service offering: %s" %
self.service_offering.name)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -432,7 +433,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
self.debug("Creating an instance with service offering: %s" %
self.service_offering.name)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -492,7 +493,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
self.debug("Creating an instance with service offering: %s" %
self.service_offering.name)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain)
@ -524,12 +525,13 @@ class TestMultipleChildDomainsMemory(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMultipleChildDomainsMemory,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleChildDomainsMemory, 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
cls.template = get_template(
@ -709,11 +711,11 @@ class TestMultipleChildDomainsMemory(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts()
api_client_cadmin_1 = self.testClient.createUserApiClient(
api_client_cadmin_1 = self.testClient.getUserApiClient(
UserName=self.cadmin_1.name,
DomainName=self.cadmin_1.domain)
api_client_cadmin_2 = self.testClient.createUserApiClient(
api_client_cadmin_2 = self.testClient.getUserApiClient(
UserName=self.cadmin_2.name,
DomainName=self.cadmin_2.domain)

View File

@ -19,7 +19,7 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
@ -27,11 +27,11 @@ from marvin.integration.lib.base import (
Domain,
Project
)
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:
"""Test memory resource limit services
@ -88,12 +88,13 @@ class TestMaxMemoryLimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMaxMemoryLimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestMaxMemoryLimits, 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
cls.template = get_template(
@ -253,7 +254,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=8, domain_limit=4)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)
@ -280,7 +281,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=7, domain_limit=14)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)
@ -310,7 +311,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=8,domain_limit=8, project_limit=4)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)
@ -334,7 +335,7 @@ class TestMaxMemoryLimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupAccounts(account_limit=6, project_limit=12, domain_limit=12)
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.child_do_admin.name,
DomainName=self.child_do_admin.domain)

View File

@ -19,21 +19,21 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Domain,
Project
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
findSuitableHostForMigration,
get_resource_type
)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
class Services:
@ -91,12 +91,13 @@ class TestProjectsMemoryLimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestProjectsMemoryLimits,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectsMemoryLimits, 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
cls.template = get_template(
@ -137,7 +138,7 @@ class TestProjectsMemoryLimits(cloudstackTestCase):
self.debug("Setting up account and domain hierarchy")
self.setupProjectAccounts()
api_client = self.testClient.createUserApiClient(
api_client = self.testClient.getUserApiClient(
UserName=self.admin.name,
DomainName=self.admin.domain)

View File

@ -18,10 +18,10 @@
"""
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.cloudstackException import cloudstackAPIException
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from netaddr import *
from nose.plugins.attrib import attr
@ -78,12 +78,14 @@ class TestMultipleIpRanges(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestMultipleIpRanges, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleIpRanges, 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.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -296,7 +298,7 @@ class TestMultipleIpRanges(cloudstackTestCase):
#listing vlan ip ranges with the id should through exception , if not mark the test case as failed
try:
new_vlan.list(self.apiclient, id=new_vlan.vlan.id)
except cloudstackAPIException as cs:
except CloudstackAPIException as cs:
self.debug(cs.errorMsg)
self.assertTrue(cs.errorMsg.find("entity does not exist")>0, msg="Failed to delete IP range")
return
@ -387,7 +389,7 @@ class TestMultipleIpRanges(cloudstackTestCase):
self.debug("Adding overlapped ip range")
try:
new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
except cloudstackAPIException as cs:
except CloudstackAPIException as cs:
self.debug(cs.errorMsg)
self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr")
return
@ -443,7 +445,7 @@ class TestMultipleIpRanges(cloudstackTestCase):
self.debug("Adding ip range overlapped with two cidrs")
try:
new_vlan3 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
except cloudstackAPIException as cs:
except CloudstackAPIException as cs:
self.debug(cs.errorMsg)
self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr")
return
@ -496,7 +498,7 @@ class TestMultipleIpRanges(cloudstackTestCase):
self.debug("Adding IP range super set to existing CIDR")
try:
new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
except cloudstackAPIException as cs:
except CloudstackAPIException as cs:
self.debug(cs.errorMsg)
self.assertTrue(cs.errorMsg.find("superset")>0, msg="Fail: CS allowed adding ip range superset to existing CIDR")
return
@ -549,7 +551,7 @@ class TestMultipleIpRanges(cloudstackTestCase):
self.debug("Adding ip range subset to existing cidr")
try:
new_vlan2 = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
except cloudstackAPIException as cs:
except CloudstackAPIException as cs:
self.debug(cs.errorMsg)
self.assertTrue(cs.errorMsg.find("subset")>0, msg="Fail: CS allowed adding ip range subset to existing CIDR")
return

View File

@ -23,32 +23,14 @@
Design Document: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Multiple+IP+address+per+NIC
"""
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.utils import (cleanup_resources,
validateList,
random_gen)
from marvin.integration.lib.base import (Account,
ServiceOffering,
Network,
VirtualMachine,
VpcOffering,
VPC,
NIC,
Domain,
PublicIPAddress,
StaticNATRule,
FireWallRule,
NATRule)
from marvin.integration.lib.common import (get_domain,
get_zone,
get_template,
get_free_vlan,
setSharedNetworkParams,
createEnabledNetworkOffering,
shouldTestBeSkipped)
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
from marvin.codes import PASS, ISOLATED_NETWORK, VPC_NETWORK, SHARED_NETWORK, FAIL
from ddt import ddt, data
import time
def createNetwork(self, networkType):
"""Create a network of given type (isolated/shared/isolated in VPC)"""
@ -137,21 +119,23 @@ class TestBasicOperations(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestBasicOperations,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestBasicOperations, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.mode = str(cls.zone.networktype).lower()
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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -486,21 +470,23 @@ class TestNetworkRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestNetworkRules,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestNetworkRules, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.mode = str(cls.zone.networktype).lower()
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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -851,3 +837,439 @@ class TestNetworkRules(cloudstackTestCase):
public_ip.delete(self.apiclient)
return
@ddt
class TestVmNetworkOperations(cloudstackTestCase):
"""Test VM and Network operations with network rules created on secondary IP
"""
@classmethod
def setUpClass(cls):
cls.testClient = super(TestVmNetworkOperations, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [cls.service_offering]
cls.services["shared_network_offering"]["specifyVlan"] = "True"
cls.services["shared_network_offering"]["specifyIpRanges"] = "True"
cls.shared_network_offering = CreateEnabledNetworkOffering(cls.api_client, cls.services["shared_network_offering"])
cls._cleanup.append(cls.shared_network_offering)
if cls.mode == "advanced":
cls.isolated_network_offering = CreateEnabledNetworkOffering(cls.api_client, cls.services["isolated_network_offering"])
cls._cleanup.append(cls.isolated_network_offering)
cls.isolated_network_offering_vpc = CreateEnabledNetworkOffering(cls.api_client, cls.services["nw_offering_isolated_vpc"])
cls._cleanup.append(cls.isolated_network_offering_vpc)
cls.vpc_off = VpcOffering.create(cls.api_client, cls.services["vpc_offering"])
cls.vpc_off.update(cls.api_client, state='Enabled')
cls._cleanup.append(cls.vpc_off)
return
@classmethod
def tearDownClass(cls):
try:
# Cleanup resources used
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.dbclient = self.testClient.getDbConnection()
self.cleanup = [ ]
return
def tearDown(self):
try:
# Clean up, terminate the resources created
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def VerifyStaticNatForPublicIp(self, ipaddressid, natrulestatus):
""" List public IP and verify that NAT rule status for the IP is as desired """
publiciplist = PublicIPAddress.list(self.apiclient, id=ipaddressid, listall=True)
self.assertEqual(validateList(publiciplist)[0], PASS, "Public IP list validation failed")
self.assertEqual(publiciplist[0].isstaticnat, natrulestatus, "isstaticnat should be %s, it is %s" %
(natrulestatus, publiciplist[0].isstaticnat))
return
@data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK)
@attr(tags=["advanced"])
def test_delete_vm(self, value):
""" Test delete VM and verify network rules are cleaned up"""
# Steps:
# 1. Create Account and create network in it (isoalted/ shared/ vpc)
# 2. Deploy a VM in this network and account
# 3. Add 2 secondary IPs to the default nic of VM
# 4. Acquire 2 public IPs in the network
# 5. For 1st public IP create nat rule to 1st private IP, for 2nd public IP, create
# static nat rule to 2nd private IP
# 6. Destroy the virtual machine
# 7. Verify that nat rule does not exist and static nat is not enabled for
# secondary IP
self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id)
self.cleanup.append(self.account)
network = createNetwork(self, value)
try:
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
networkids=[network.id],serviceofferingid=self.service_offering.id,
accountid=self.account.name,domainid=self.account.domainid)
except Exception as e:
self.fail("vm creation failed: %s" % e)
# Add secondary IPs to default NIC of VM
try:
ipaddress_1 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
ipaddress_2 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
except Exception as e:
self.fail("Failed while adding secondary IP to NIC of vm %s" % virtual_machine.id)
# Acquire public IP addresses in the network
try:
public_ip_1 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
public_ip_2 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
except Exception as e:
self.fail("Exception while acquiring public ip address: %s" % e)
# Create Firewall and natrule for 1st IP and static nat rule for 2nd IP
if value != VPC_NETWORK:
FireWallRule.create(self.apiclient,ipaddressid=public_ip_1.ipaddress.id,
protocol='TCP', cidrlist=[self.services["fwrule"]["cidr"]],
startport=self.services["fwrule"]["startport"],endport=self.services["fwrule"]["endport"])
natrule = NATRule.create(self.api_client, virtual_machine,
self.services["natrule"],ipaddressid=public_ip_1.ipaddress.id,
networkid=network.id, vmguestip = ipaddress_1.ipaddress)
StaticNATRule.enable(self.apiclient, public_ip_2.ipaddress.id, virtual_machine.id,
network.id, vmguestip=ipaddress_2.ipaddress)
# Delete VM
virtual_machine.delete(self.apiclient)
# Wait for VMs to expunge
wait_for_cleanup(self.api_client, ["expunge.delay", "expunge.interval"])
# Make sure the VM is expunged
retriesCount = 20
while True:
vms = VirtualMachine.list(self.apiclient, id=virtual_machine.id)
if vms is None:
break
elif retriesCount == 0:
self.fail("Failed to expunge vm even after 20 minutes")
time.sleep(60)
retriesCount -= 1
# Try to list nat rule
with self.assertRaises(Exception):
NATRule.list(self.apiclient, id=natrule.id, listall=True)
# Verify static nat rule is no longer enabled
self.VerifyStaticNatForPublicIp(public_ip_2.ipaddress.id, False)
return
@data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK)
@attr(tags=["advanced"])
def test_recover_vm(self, value):
""" Test recover VM operation with VM having secondary IPs"""
# Steps:
# 1. Create Account and create network in it (isoalted/ shared/ vpc)
# 2. Deploy a VM in this network and account
# 3. Add 2 secondary IPs to the default nic of VM
# 4. Acquire 2 public IPs in the network
# 5. For 1st public IP create nat rule to 1st private IP, for 2nd public IP, create
# static nat rule to 2nd private IP
# 6. Destroy the virtual machine and recover it
# 7. Verify that nat and static nat rules exist
self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id)
self.cleanup.append(self.account)
network = createNetwork(self, value)
try:
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
networkids=[network.id],serviceofferingid=self.service_offering.id,
accountid=self.account.name,domainid=self.account.domainid)
except Exception as e:
self.fail("vm creation failed: %s" % e)
try:
ipaddress_1 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
ipaddress_2 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
except Exception as e:
self.fail("Failed while adding secondary IP to NIC of vm %s" % virtual_machine.id)
try:
public_ip_1 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
public_ip_2 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
except Exception as e:
self.fail("Exception while acquiring public ip address: %s" % e)
if value != VPC_NETWORK:
FireWallRule.create(self.apiclient,ipaddressid=public_ip_1.ipaddress.id,
protocol='TCP', cidrlist=[self.services["fwrule"]["cidr"]],
startport=self.services["fwrule"]["startport"],endport=self.services["fwrule"]["endport"])
natrule = NATRule.create(self.api_client, virtual_machine,
self.services["natrule"],ipaddressid=public_ip_1.ipaddress.id,
networkid=network.id, vmguestip = ipaddress_1.ipaddress)
StaticNATRule.enable(self.apiclient, public_ip_2.ipaddress.id, virtual_machine.id,
network.id, vmguestip=ipaddress_2.ipaddress)
virtual_machine.delete(self.apiclient)
virtual_machine.recover(self.apiclient)
retriesCount = 10
while True:
vms = VirtualMachine.list(self.apiclient, id=virtual_machine.id)
self.assertEqual(validateList(vms)[0], PASS, "vms list validation failed")
if str(vms[0].state).lower() == "stopped":
break
elif retriesCount == 0:
self.fail("Failed to recover vm even after 10 mins")
time.sleep(60)
retriesCount -= 1
natrules = NATRule.list(self.apiclient, id=natrule.id, listall=True)
self.assertEqual(validateList(natrules)[0], PASS, "nat rules validation failed")
self.VerifyStaticNatForPublicIp(public_ip_2.ipaddress.id, True)
return
@data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK)
@attr(tags=["advanced"])
def test_network_restart_cleanup_true(self, value):
"""Test network restart (cleanup True) with VM having secondary IPs and related network rules"""
# Steps:
# 1. Create Account and create network in it (isoalted/ shared/ vpc)
# 2. Deploy a VM in this network and account
# 3. Add 2 secondary IPs to the default nic of VM
# 4. Acquire 2 public IPs in the network
# 5. For 1st public IP create nat rule to 1st private IP, for 2nd public IP, create
# static nat rule to 2nd private IP
# 6. Restart the network with cleanup option True
# 7. Verify that nat and static nat rules exist after network restart
self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id)
self.cleanup.append(self.account)
network = createNetwork(self, value)
try:
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
networkids=[network.id],serviceofferingid=self.service_offering.id,
accountid=self.account.name,domainid=self.account.domainid)
except Exception as e:
self.fail("vm creation failed: %s" % e)
try:
ipaddress_1 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
ipaddress_2 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
except Exception as e:
self.fail("Failed while adding secondary IP to NIC of vm %s" % virtual_machine.id)
try:
public_ip_1 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
public_ip_2 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
except Exception as e:
self.fail("Exception while acquiring public ip address: %s" % e)
if value != VPC_NETWORK:
FireWallRule.create(self.apiclient,ipaddressid=public_ip_1.ipaddress.id,
protocol='TCP', cidrlist=[self.services["fwrule"]["cidr"]],
startport=self.services["fwrule"]["startport"],endport=self.services["fwrule"]["endport"])
natrule = NATRule.create(self.api_client, virtual_machine,
self.services["natrule"],ipaddressid=public_ip_1.ipaddress.id,
networkid=network.id, vmguestip = ipaddress_1.ipaddress)
StaticNATRule.enable(self.apiclient, public_ip_2.ipaddress.id, virtual_machine.id,
network.id, vmguestip=ipaddress_2.ipaddress)
network.restart(self.apiclient, cleanup=True)
natrulelist = NATRule.list(self.apiclient, id=natrule.id, listall=True)
self.assertEqual(validateList(natrulelist)[0], PASS, "nat rules list validation failed")
self.VerifyStaticNatForPublicIp(public_ip_2.ipaddress.id, True)
return
@data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK)
@attr(tags=["advanced"])
def test_network_restart_cleanup_false(self, value):
"""Test network restart (cleanup True) with VM having secondary IPs and related network rules"""
# Steps:
# 1. Create Account and create network in it (isoalted/ shared/ vpc)
# 2. Deploy a VM in this network and account
# 3. Add 2 secondary IPs to the default nic of VM
# 4. Acquire 2 public IPs in the network
# 5. For 1st public IP create nat rule to 1st private IP, for 2nd public IP, create
# static nat rule to 2nd private IP
# 6. Restart the network with cleanup option False
# 7. Verify that nat and static nat rules exist after network restart
self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id)
self.cleanup.append(self.account)
network = createNetwork(self, value)
try:
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
networkids=[network.id],serviceofferingid=self.service_offering.id,
accountid=self.account.name,domainid=self.account.domainid)
except Exception as e:
self.fail("vm creation failed: %s" % e)
try:
ipaddress_1 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
ipaddress_2 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
except Exception as e:
self.fail("Failed while adding secondary IP to NIC of vm %s" % virtual_machine.id)
try:
public_ip_1 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
public_ip_2 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
except Exception as e:
self.fail("Exception while acquiring public ip address: %s" % e)
if value != VPC_NETWORK:
FireWallRule.create(self.apiclient,ipaddressid=public_ip_1.ipaddress.id,
protocol='TCP', cidrlist=[self.services["fwrule"]["cidr"]],
startport=self.services["fwrule"]["startport"],endport=self.services["fwrule"]["endport"])
natrule = NATRule.create(self.api_client, virtual_machine,
self.services["natrule"],ipaddressid=public_ip_1.ipaddress.id,
networkid=network.id, vmguestip = ipaddress_1.ipaddress)
StaticNATRule.enable(self.apiclient, public_ip_2.ipaddress.id, virtual_machine.id,
network.id, vmguestip=ipaddress_2.ipaddress)
network.restart(self.apiclient, cleanup=False)
natrulelist = NATRule.list(self.apiclient, id=natrule.id, listall=True)
self.assertEqual(validateList(natrulelist)[0], PASS, "nat rules list validation failed")
self.VerifyStaticNatForPublicIp(public_ip_2.ipaddress.id, True)
return
@data(ISOLATED_NETWORK, SHARED_NETWORK, VPC_NETWORK)
@attr(tags=["advanced"])
def test_reboot_router_VM(self, value):
""" Test reboot router and persistence of network rules"""
# Steps:
# 1. Create Account and create network in it (isoalted/ shared/ vpc)
# 2. Deploy a VM in this network and account
# 3. Add 2 secondary IPs to the default nic of VM
# 4. Acquire 2 public IPs in the network
# 5. For 1st public IP create nat rule to 1st private IP, for 2nd public IP, create
# static nat rule to 2nd private IP
# 6. Reboot router VM
# 7. Verify that nat and static nat rules exist after router restart
self.account = Account.create(self.apiclient,self.services["account"],domainid=self.domain.id)
self.cleanup.append(self.account)
network = createNetwork(self, value)
try:
virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
networkids=[network.id],serviceofferingid=self.service_offering.id,
accountid=self.account.name,domainid=self.account.domainid)
except Exception as e:
self.fail("vm creation failed: %s" % e)
try:
ipaddress_1 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
ipaddress_2 = NIC.addIp(self.apiclient, id=virtual_machine.nic[0].id)
except Exception as e:
self.fail("Failed while adding secondary IP to NIC of vm %s" % virtual_machine.id)
try:
public_ip_1 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
public_ip_2 = PublicIPAddress.create(self.api_client,accountid=self.account.name,
zoneid=self.zone.id,domainid=self.account.domainid,
networkid=network.id, vpcid = network.vpcid if value == VPC_NETWORK else None)
except Exception as e:
self.fail("Exception while acquiring public ip address: %s" % e)
if value != VPC_NETWORK:
FireWallRule.create(self.apiclient,ipaddressid=public_ip_1.ipaddress.id,
protocol='TCP', cidrlist=[self.services["fwrule"]["cidr"]],
startport=self.services["fwrule"]["startport"],endport=self.services["fwrule"]["endport"])
natrule = NATRule.create(self.api_client, virtual_machine,
self.services["natrule"],ipaddressid=public_ip_1.ipaddress.id,
networkid=network.id, vmguestip = ipaddress_1.ipaddress)
StaticNATRule.enable(self.apiclient, public_ip_2.ipaddress.id, virtual_machine.id,
network.id, vmguestip=ipaddress_2.ipaddress)
routers = Router.list(self.apiclient, networkid=network.id, listall=True)
self.assertEqual(validateList(routers)[0], PASS, "routers list validation failed")
Router.reboot(self.apiclient, id=routers[0].id)
natrulelist = NATRule.list(self.apiclient, id=natrule.id, listall=True)
self.assertEqual(validateList(natrulelist)[0], PASS, "nat rules list validation failed")
self.VerifyStaticNatForPublicIp(public_ip_2.ipaddress.id, True)
return

View File

@ -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 *
from marvin.sshClient import SshClient
import datetime
@ -156,14 +156,13 @@ class TestAddNetScaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAddNetScaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAddNetScaler, 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._cleanup = []
return
@ -282,14 +281,13 @@ class TestInvalidParametersNetscaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestInvalidParametersNetscaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestInvalidParametersNetscaler, 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._cleanup = []
return
@ -526,14 +524,13 @@ class TestNetScalerDedicated(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetScalerDedicated,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetScalerDedicated, 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,
@ -749,14 +746,13 @@ class TestNetScalerShared(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetScalerShared,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetScalerShared, 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,
@ -992,14 +988,13 @@ class TestNetScalerCustomCapacity(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetScalerCustomCapacity,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetScalerCustomCapacity, 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,
@ -1265,14 +1260,13 @@ class TestNetScalerNoCapacity(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetScalerNoCapacity,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetScalerNoCapacity, 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,
@ -1539,14 +1533,13 @@ class TestGuestNetworkWithNetScaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestGuestNetworkWithNetScaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestGuestNetworkWithNetScaler, 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,
@ -2096,14 +2089,13 @@ class TestGuestNetworkShutDown(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestGuestNetworkShutDown,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestGuestNetworkShutDown, 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,
@ -2502,14 +2494,13 @@ class TestServiceProvider(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestServiceProvider,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestServiceProvider, 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,
@ -2817,14 +2808,13 @@ class TestDeleteNetscaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeleteNetscaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeleteNetscaler, 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,

View File

@ -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 *
from marvin.sshClient import SshClient
import datetime
@ -150,14 +150,13 @@ class TestLbSourceNat(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbSourceNat,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbSourceNat, 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,
@ -359,14 +358,13 @@ class TestLbOnIpWithPf(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbOnIpWithPf,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbOnIpWithPf, 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,
@ -572,14 +570,13 @@ class TestPfOnIpWithLb(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestPfOnIpWithLb,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestPfOnIpWithLb, 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,
@ -786,14 +783,13 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbOnNonSourceNat,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbOnNonSourceNat, 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,
@ -1003,14 +999,13 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestAddMultipleVmsLb,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAddMultipleVmsLb, 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,
@ -1282,14 +1277,13 @@ class TestMultipleLbRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestMultipleLbRules,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleLbRules, 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,
@ -1601,14 +1595,13 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestMultipleLbRulesSameIp,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestMultipleLbRulesSameIp, 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,
@ -1926,14 +1919,13 @@ class TestLoadBalancingRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLoadBalancingRule,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLoadBalancingRule, 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,
@ -2140,14 +2132,13 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestDeleteCreateLBRule,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeleteCreateLBRule, 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,
@ -2269,14 +2260,13 @@ class TestVmWithLb(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestVmWithLb,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVmWithLb, 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,

View File

@ -22,11 +22,10 @@ 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
class Services:
@ -117,14 +116,13 @@ class TestLbWithRoundRobin(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbWithRoundRobin,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbWithRoundRobin, 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,
@ -330,14 +328,13 @@ class TestLbWithLeastConn(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbWithLeastConn,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbWithLeastConn, 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,
@ -552,14 +549,13 @@ class TestLbWithSourceIp(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestLbWithSourceIp,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbWithSourceIp, 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,
@ -768,14 +764,13 @@ class TestLbAlgoRrLc(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbAlgoRrLc,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbAlgoRrLc, 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,
@ -973,14 +968,13 @@ class TestLbAlgoLcRr(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbAlgoLcRr,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbAlgoLcRr, 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,
@ -1175,14 +1169,13 @@ class TestLbAlgoRrSb(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbAlgoRrSb,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbAlgoRrSb, 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,
@ -1380,14 +1373,13 @@ class TestLbAlgoSbRr(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbAlgoSbRr,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbAlgoSbRr, 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,
@ -1588,14 +1580,13 @@ class TestLbAlgoSbLc(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbAlgoSbLc,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbAlgoSbLc, 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,
@ -1795,14 +1786,13 @@ class TestLbAlgoLcSb(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbAlgoLcSb,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbAlgoLcSb, 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,

View File

@ -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 *
from marvin.sshClient import SshClient
import datetime
@ -117,14 +117,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls._cleanup = []
cls.api_client = super(
TestLbStickyPolicy,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLbStickyPolicy, 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,

View File

@ -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 *
from marvin.sshClient import SshClient
import datetime
@ -191,14 +191,13 @@ class TestAddMultipleNetScaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAddMultipleNetScaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAddMultipleNetScaler, 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._cleanup = []
return
@ -506,14 +505,13 @@ class TestNetScalerSharedMode(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetScalerSharedMode,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetScalerSharedMode, 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,
@ -1051,14 +1049,13 @@ class TestNwOffDedicatedNetscaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNwOffDedicatedNetscaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNwOffDedicatedNetscaler, 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,
@ -1217,14 +1214,13 @@ class TestNwOffNetscaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNwOffNetscaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNwOffNetscaler, 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,
@ -1525,14 +1521,13 @@ class TestNwOffSToDUpgrade(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNwOffSToDUpgrade,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNwOffSToDUpgrade, 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,
@ -1940,14 +1935,13 @@ class TestNwOffDToSUpgrade(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNwOffDToSUpgrade,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNwOffDToSUpgrade, 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,
@ -2341,15 +2335,13 @@ class TestNOWithNetscaler(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNOWithNetscaler,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNOWithNetscaler, 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
cls.template = get_template(
cls.api_client,

View File

@ -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
@ -160,14 +160,13 @@ class TestNOVirtualRouter(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNOVirtualRouter,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNOVirtualRouter, 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
cls.template = get_template(
cls.api_client,
@ -733,14 +732,13 @@ class TestNetworkUpgrade(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetworkUpgrade,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetworkUpgrade, 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
cls.template = get_template(
cls.api_client,
@ -1181,14 +1179,13 @@ class TestNetworkUpgrade(cloudstackTestCase):
class TestNOWithOnlySourceNAT(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.apiclient = super(
TestNOWithOnlySourceNAT,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNOWithOnlySourceNAT, cls).getClsTestClient()
cls.apiclient = 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.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.apiclient,

View File

@ -28,17 +28,17 @@
from marvin.cloudstackTestCase import (cloudstackTestCase,unittest)
from marvin.integration.lib.base import (Account,
from marvin.lib.base import (Account,
ServiceOffering,
PhysicalNetwork,
VirtualMachine,
)
from marvin.integration.lib.common import (get_zone,
from marvin.lib.common import (get_zone,
get_pod,
get_domain,
get_template,
setNonContiguousVlanIds)
from marvin.integration.lib.utils import (cleanup_resources,
from marvin.lib.utils import (cleanup_resources,
xsplit)
from nose.plugins.attrib import attr
@ -47,7 +47,7 @@ class Services():
def __init__(self):
self.services = {
"vlan": {
"vlan_nc": {
"partial_range": ["",""],
"full_range": "",
},
@ -89,12 +89,14 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cls.api_client = super(TestNonContiguousVLANRanges, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestNonContiguousVLANRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, pod, domain
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.domain = get_domain(cls.api_client)
cls.service_offering = ServiceOffering.create(
cls.api_client,
@ -123,7 +125,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.vlan = self.services["vlan"]
self.vlan = self.services["vlan_nc"]
self.apiClient = self.testClient.getApiClient()
self.physicalnetwork, self.vlan = setNonContiguousVlanIds(self.apiclient, self.zone.id)

View File

@ -14,64 +14,35 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
""" Tests for Persistent Networks without running VMs feature
Test Plan: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Persistent+Networks+without+a+running+VM
Issue Link: https://issues.apache.org/jira/browse/CLOUDSTACK-2232
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+Persistent+Networks
"""
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.utils import (cleanup_resources,
validateList,
get_hypervisor_type)
from marvin.integration.lib.base import (Account,
ServiceOffering,
NetworkOffering,
Network,
VirtualMachine,
PublicIPAddress,
FireWallRule,
Router,
Host,
NATRule,
Project,
LoadBalancerRule,
VpcOffering,
VPC,
Domain,
StaticNATRule,
NetworkACL)
from marvin.integration.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
add_netscaler,
verifyNetworkState)
""" Tests for Persistent Networks without running VMs feature"""
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
import netaddr
from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL
from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from ddt import ddt, data
import time
@ddt
class TestPersistentNetworks(cloudstackTestCase):
"""Test Persistent Networks without running VMs
"""
'''
Test Persistent Networks without running VMs
'''
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestPersistentNetworks,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestPersistentNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.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,
@ -1005,20 +976,22 @@ class TestAssignVirtualMachine(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestAssignVirtualMachine,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestAssignVirtualMachine, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -1165,20 +1138,22 @@ class TestProjectAccountOperations(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestProjectAccountOperations,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestProjectAccountOperations, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -1338,20 +1313,22 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestRestartPersistentNetwork,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestRestartPersistentNetwork, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
@ -1618,25 +1595,28 @@ class TestVPCNetworkOperations(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestVPCNetworkOperations,cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.testClient = super(TestVPCNetworkOperations, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Fill services from the external config file
cls.services = cloudstackTestClient.getConfigParser().parsedDict
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.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,
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
cls.services["service_offerings"]["small"]
)
cls.persistent_network_offering_NoLB = NetworkOffering.create(cls.api_client, cls.services["nw_off_persistent_VPCVR_NoLB"],
conservemode=False)

View File

@ -21,25 +21,11 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/portable+public+IP
"""
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.utils import cleanup_resources
from marvin.integration.lib.base import (Account,
NetworkOffering,
ServiceOffering,
Network,
VirtualMachine,
PublicIPAddress,
FireWallRule,
NATRule,
PortablePublicIpRange,
StaticNATRule)
from marvin.integration.lib.common import (get_zone,
get_pod,
get_domain,
get_region,
get_template,
get_portable_ip_range_services,
is_public_ip_in_correct_state)
from netaddr import IPAddress
from marvin.cloudstackException import CloudstackAPIException
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from netaddr import *
from marvin.sshClient import SshClient
from nose.plugins.attrib import attr
@ -144,6 +130,14 @@ class Services:
"protocol": 'TCP',
},
"ostype": 'CentOS 5.3 (64-bit)',
"portableIpRange": {
"gateway" : "10.223.252.195",
"netmask" : "255.255.255.192",
"startip" : "10.223.252.196",
"endip" : "10.223.252.197",
"vlan" : "1001"
}
}
class TestCreatePortablePublicIpRanges(cloudstackTestCase):
@ -153,13 +147,15 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestCreatePortablePublicIpRanges, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestCreatePortablePublicIpRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -199,7 +195,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
# 1. Create new portable ip range with root admin api
# 2. Portable ip range should be created successfully
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
self.debug(portable_ip_range_services)
@ -238,12 +234,12 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
domainid=self.domain.id
)
self.api_client_user = self.testClient.createUserApiClient(
self.api_client_user = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain
)
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
if portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -265,7 +261,7 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
# 1. Try to create new portable ip range with invalid region id
# 2. Portable ip range creation should fail
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
if portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -289,13 +285,15 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDeletePortablePublicIpRanges, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDeletePortablePublicIpRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -317,7 +315,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
if portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -378,7 +376,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
self.cleanup.append(self.account)
self.api_client_user = self.testClient.createUserApiClient(
self.api_client_user = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain
)
@ -461,13 +459,15 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestListPortablePublicIpRanges, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestListPortablePublicIpRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -490,7 +490,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
#create new portable ip range
self.portable_ip_range_services = get_portable_ip_range_services(self.config)
self.portable_ip_range_services = self.services["portableIpRange"]
if self.portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -569,7 +569,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
self.cleanup.append(self.account)
self.api_client_user = self.testClient.createUserApiClient(
self.api_client_user = self.testClient.getUserApiClient(
UserName=self.account.name,
DomainName=self.account.domain
)
@ -585,13 +585,15 @@ class TestAssociatePublicIp(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAssociatePublicIp, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestAssociatePublicIp, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -651,7 +653,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.cleanup = []
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
if portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -909,13 +911,15 @@ class TestDisassociatePublicIp(cloudstackTestCase):
"""
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDisassociatePublicIp, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDisassociatePublicIp, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -993,7 +997,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
if portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -1144,7 +1148,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
domainid=self.domain.id
)
self.api_client_user = self.testClient.createUserApiClient(
self.api_client_user = self.testClient.getUserApiClient(
UserName=self.user_account.name,
DomainName=self.user_account.domain
)
@ -1168,14 +1172,16 @@ class TestDeleteAccount(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestDeleteAccount, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDeleteAccount, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -1213,7 +1219,7 @@ class TestDeleteAccount(cloudstackTestCase):
)
self.cleanup = []
portable_ip_range_services = get_portable_ip_range_services(self.config)
portable_ip_range_services = self.services["portableIpRange"]
if portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')
@ -1393,13 +1399,15 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestPortableIpTransferAcrossNetworks, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestPortableIpTransferAcrossNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.services["domainid"] = cls.domain.id
cls.services["zoneid"] = cls.zone.id
@ -1488,7 +1496,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
#create new portable ip range
self.portable_ip_range_services = get_portable_ip_range_services(self.config)
self.portable_ip_range_services = self.services["portableIpRange"]
if self.portable_ip_range_services is None:
self.skipTest('Failed to read config values related to portable ip range')

View File

@ -21,9 +21,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
@ -109,13 +109,11 @@ class TestUserProjectCreation(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestUserProjectCreation,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestUserProjectCreation, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
configs = Configurations.list(
@ -275,13 +273,11 @@ class TestProjectCreationNegative(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectCreationNegative,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectCreationNegative, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Checking for prereqisits - global configs
@ -420,17 +416,15 @@ class TestProjectInviteRequired(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectInviteRequired,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectInviteRequired, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create domains, account etc.
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client)
# Verify 'project.invite.required' is set to false
configs = Configurations.list(
@ -572,17 +566,15 @@ class TestProjectInviteRequiredTrue(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectInviteRequiredTrue,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectInviteRequiredTrue, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create domains, account etc.
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client)
# Verify 'project.invite.required' is set to true
configs = Configurations.list(
@ -725,17 +717,15 @@ class TestProjectInviteTimeout(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectInviteTimeout,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectInviteTimeout, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create domains, account etc.
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client)
# Verify 'project.invite.required' is set to true
configs = Configurations.list(

View File

@ -21,9 +21,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.codes import PASS
import datetime
@ -124,13 +124,11 @@ class TestProjectLimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectLimits,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectLimits, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Create domains, account etc.
@ -502,10 +500,11 @@ class TestResourceLimitsProject(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestResourceLimitsProject, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
@ -945,14 +944,12 @@ class TestMaxProjectNetworks(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestMaxProjectNetworks,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestMaxProjectNetworks, 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.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,

View File

@ -19,7 +19,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,
Account,
Project,
NATRule,
@ -35,7 +35,7 @@ from marvin.integration.lib.base import (VirtualMachine,
DiskOffering,
LoadBalancerRule)
from marvin.integration.lib.common import (get_zone,
from marvin.lib.common import (get_zone,
get_template,
get_domain,
list_volumes,
@ -44,7 +44,7 @@ from marvin.integration.lib.common import (get_zone,
get_free_vlan,
wait_for_cleanup)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
import random
@ -161,13 +161,11 @@ class TestOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestOfferings,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestOfferings, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone and template
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
@ -342,13 +340,11 @@ class TestNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNetwork,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNetwork, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone and template
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
@ -550,13 +546,11 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestTemplates,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplates, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
@ -780,13 +774,11 @@ class TestSnapshots(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestSnapshots,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshots, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
@ -928,13 +920,11 @@ class TestPublicIpAddress(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestPublicIpAddress,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestPublicIpAddress, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
@ -1213,15 +1203,12 @@ class TestSecurityGroup(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(
TestSecurityGroup,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestSecurityGroup, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services = Services().services
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
template = get_template(

View File

@ -21,9 +21,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
@ -116,14 +116,13 @@ class TestVmUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVmUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVmUsage, 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
template = get_template(
@ -311,14 +310,13 @@ class TestPublicIPUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestPublicIPUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestPublicIPUsage, 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
cls.template = get_template(
@ -483,14 +481,13 @@ class TestVolumeUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVolumeUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVolumeUsage, 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
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -668,14 +665,13 @@ class TestTemplateUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestTemplateUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplateUsage, 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
cls.services["server"]["zoneid"] = cls.zone.id
template = get_template(
@ -844,11 +840,13 @@ class TestISOUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestISOUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestISOUsage, 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
cls.services["server"]["zoneid"] = cls.zone.id
cls.services["iso"]["zoneid"] = cls.zone.id
@ -990,14 +988,13 @@ class TestLBRuleUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestLBRuleUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestLBRuleUsage, 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
template = get_template(
cls.api_client,
@ -1173,14 +1170,13 @@ class TestSnapshotUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestSnapshotUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshotUsage, 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
template = get_template(
@ -1351,14 +1347,13 @@ class TestNatRuleUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestNatRuleUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestNatRuleUsage, 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
template = get_template(
cls.api_client,
@ -1534,14 +1529,13 @@ class TestVpnUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVpnUsage,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVpnUsage, 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
template = get_template(
cls.api_client,

View File

@ -21,9 +21,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
@ -103,20 +103,14 @@ class TestMultipleProjectCreation(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestMultipleProjectCreation,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.services['mode'] = cls.zone.networktype
cls.testClient = super(TestMultipleProjectCreation, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Create domains, account etc.
cls.domain = get_domain(
cls.api_client,
cls.services
)
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
configs = Configurations.list(
cls.api_client,
@ -320,18 +314,14 @@ class TestCrossDomainAccountAdd(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestCrossDomainAccountAdd,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestCrossDomainAccountAdd, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.domain = get_domain(
cls.api_client,
cls.services
)
configs = Configurations.list(
cls.api_client,
@ -454,18 +444,14 @@ class TestDeleteAccountWithProject(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeleteAccountWithProject,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeleteAccountWithProject, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.domain = get_domain(
cls.api_client,
cls.services
)
configs = Configurations.list(
cls.api_client,
@ -567,13 +553,12 @@ class TestDeleteDomainWithProject(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeleteDomainWithProject,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeleteDomainWithProject, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
configs = Configurations.list(
@ -708,17 +693,13 @@ class TestProjectOwners(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectOwners,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectOwners, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.domain = get_domain(
cls.api_client,
cls.services
)
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
configs = Configurations.list(
@ -1136,18 +1117,14 @@ class TestProjectResources(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectResources,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectResources, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
cls.domain = get_domain(
cls.api_client,
cls.services
)
configs = Configurations.list(
cls.api_client,
@ -1440,18 +1417,14 @@ class TestProjectSuspendActivate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestProjectSuspendActivate,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestProjectSuspendActivate, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, domain, template etc
cls.zone = get_zone(cls.api_client, cls.services)
# Get Zone
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
cls.domain = get_domain(
cls.api_client,
cls.services
)
cls.template = get_template(
cls.api_client,
cls.zone.id,

View File

@ -18,9 +18,9 @@
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 *
class Services:
"""Test Snapshots Services
@ -126,11 +126,13 @@ class TestRecurringSnapshots(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRecurringSnapshots, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRecurringSnapshots, 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
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -402,4 +404,4 @@ class TestRecurringSnapshots(cloudstackTestCase):
self.services["recurring_snapshot"]["maxsnaps"],
"Check maximum number of recurring snapshots retained"
)
return
return

View File

@ -16,9 +16,9 @@
# under the License.
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
#Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@ -137,14 +137,13 @@ class TestRedundantRouterNetworkCleanups(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRedundantRouterNetworkCleanups,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRedundantRouterNetworkCleanups, 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,

View File

@ -17,9 +17,9 @@
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
#Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@ -138,14 +138,13 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestEnableVPNOverRvR,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestEnableVPNOverRvR, 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,

View File

@ -17,9 +17,9 @@
from nose.plugins.attrib import attr
from marvin.integration.lib.base import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.common import *
from marvin.lib.base import *
from marvin.lib.utils import *
from marvin.lib.common import *
#Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@ -137,14 +137,13 @@ class TestRvRUpgradeDowngrade(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRvRUpgradeDowngrade,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRvRUpgradeDowngrade, 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,

View File

@ -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
@ -159,24 +159,30 @@ class TestRegionVpcOffering(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRegionVpcOffering,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
testClient = super(TestRegionVpcOffering, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offering"]
)
cls._cleanup = [
@ -188,7 +194,7 @@ class TestRegionVpcOffering(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,9 +17,9 @@
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
from random import choice
@ -41,7 +41,7 @@ class TestRegions(cloudstackTestCase):
def setUpClass(cls):
cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client)
cls.cleanup = []
return

View File

@ -17,9 +17,9 @@
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
class Services:
@ -57,7 +57,7 @@ class TestRegionsAccounts(cloudstackTestCase):
def setUpClass(cls):
cls.api_client = super(TestRegionsAccounts, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.domain = get_domain(cls.api_client, cls.services)
cls.domain = get_domain(cls.api_client)
cls.cleanup = []
return

View File

@ -19,18 +19,18 @@
"""
#Import Local Modules
from marvin.integration.lib.base import (VirtualMachine,
from marvin.lib.base import (VirtualMachine,
SSHKeyPair,
Account,
Template,
ServiceOffering,
EgressFireWallRule)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_virtual_machines,
list_volumes)
from marvin.integration.lib.utils import (cleanup_resources,
from marvin.lib.utils import (cleanup_resources,
random_gen,
validateList)
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
@ -114,14 +114,13 @@ class TestResetSSHKeypair(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestResetSSHKeypair,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestResetSSHKeypair, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# 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.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
# Set Zones and disk offerings
@ -955,14 +954,13 @@ class TestResetSSHKeyUserRights(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestResetSSHKeyUserRights,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestResetSSHKeyUserRights, 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
# Set Zones and disk offerings

View File

@ -19,7 +19,7 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import (VirtualMachine,
from marvin.lib.base import (VirtualMachine,
Snapshot,
Template,
PublicIPAddress,
@ -31,14 +31,14 @@ from marvin.integration.lib.base import (VirtualMachine,
NetworkOffering,
ServiceOffering,
Configurations)
from marvin.integration.lib.common import (list_volumes,
from marvin.lib.common import (list_volumes,
get_domain,
get_zone,
get_template,
update_resource_limit,
list_configurations,
wait_for_cleanup)
from marvin.integration.lib.utils import cleanup_resources
from marvin.lib.utils import cleanup_resources
import time
@ -127,11 +127,13 @@ class TestResourceLimitsAccount(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestResourceLimitsAccount, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestResourceLimitsAccount, 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
cls.template = get_template(
@ -897,10 +899,11 @@ class TestResourceLimitsDomain(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestResourceLimitsDomain, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestResourceLimitsDomain, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
@ -1354,14 +1357,12 @@ class TestMaxAccountNetworks(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestMaxAccountNetworks,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestMaxAccountNetworks, 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.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,

View File

@ -21,9 +21,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 System modules
import time
@ -98,11 +98,13 @@ class TestRouterServices(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRouterServices, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRouterServices, 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
cls.template = get_template(
cls.api_client,
@ -641,11 +643,13 @@ class TestRouterStopCreatePF(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRouterStopCreatePF, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRouterStopCreatePF, 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
template = get_template(
cls.api_client,
@ -853,11 +857,13 @@ class TestRouterStopCreateLB(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRouterStopCreateLB, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRouterStopCreateLB, 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
template = get_template(
cls.api_client,
@ -1065,11 +1071,13 @@ class TestRouterStopCreateFW(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRouterStopCreateFW, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRouterStopCreateFW, 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
template = get_template(
cls.api_client,
@ -1122,6 +1130,7 @@ class TestRouterStopCreateFW(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.cleanup = []
return
@ -1255,8 +1264,8 @@ class TestRouterStopCreateFW(cloudstackTestCase):
"Check end port of firewall rule"
)
# For DNS and DHCP check 'dnsmasq' process status
if (self.apiclient.hypervisor.lower() == 'vmware'
or self.apiclient.hypervisor.lower() == 'hyperv'):
if (self.hypervisor.lower() == 'vmware'
or self.hypervisor.lower() == 'hyperv'):
result = get_process_status(
self.apiclient.connection.mgtSvr,
22,
@ -1264,7 +1273,7 @@ class TestRouterStopCreateFW(cloudstackTestCase):
self.apiclient.connection.passwd,
router.linklocalip,
'iptables -t nat -L',
hypervisor=self.apiclient.hypervisor
hypervisor=self.hypervisor
)
else:
hosts = list_hosts(

View File

@ -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 *
from marvin.sshClient import SshClient
#Import System modules
@ -117,12 +117,13 @@ class TestDefaultSecurityGroup(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestDefaultSecurityGroup, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDefaultSecurityGroup, 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
template = get_template(
@ -390,12 +391,13 @@ class TestAuthorizeIngressRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestAuthorizeIngressRule, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestAuthorizeIngressRule, 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
template = get_template(
@ -526,12 +528,13 @@ class TestRevokeIngressRule(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestRevokeIngressRule, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestRevokeIngressRule, 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
template = get_template(
@ -684,12 +687,13 @@ class TestDhcpOnlyRouter(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestDhcpOnlyRouter, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestDhcpOnlyRouter, 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
template = get_template(
@ -821,12 +825,13 @@ class TestdeployVMWithUserData(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestdeployVMWithUserData, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestdeployVMWithUserData, 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
template = get_template(
@ -985,8 +990,8 @@ class TestDeleteSecurityGroup(cloudstackTestCase):
self.services = Services().services
# Get Zone, Domain and templates
self.domain = get_domain(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.services)
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.services['mode'] = self.zone.networktype
template = get_template(
@ -1232,8 +1237,8 @@ class TestIngressRule(cloudstackTestCase):
self.services = Services().services
# Get Zone, Domain and templates
self.domain = get_domain(self.apiclient, self.services)
self.zone = get_zone(self.apiclient, self.services)
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.services['mode'] = self.zone.networktype
template = get_template(

View File

@ -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 (Account,
from marvin.lib.base import (Account,
Network,
NetworkOffering,
VirtualMachine,
@ -31,9 +31,9 @@ from marvin.integration.lib.base import (Account,
FireWallRule,
ServiceOffering,
PublicIPAddress)
from marvin.integration.lib.utils import (cleanup_resources,
from marvin.lib.utils import (cleanup_resources,
xsplit)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
@ -154,16 +154,13 @@ class TestSharedNetworks(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestSharedNetworks,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestSharedNetworks, 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,

View File

@ -18,10 +18,10 @@
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.integration.lib.utils import is_snapshot_on_nfs
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import is_snapshot_on_nfs
class Services:
@ -122,11 +122,13 @@ class TestAccountSnapshotClean(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAccountSnapshotClean, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestAccountSnapshotClean, 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
template = get_template(

View File

@ -18,10 +18,10 @@
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.integration.lib.utils import is_snapshot_on_nfs
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import is_snapshot_on_nfs
import os
@ -123,11 +123,13 @@ class TestSnapshotLimit(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestSnapshotLimit, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshotLimit, 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
cls._cleanup = []

View File

@ -20,7 +20,7 @@
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.base import (Snapshot,
from marvin.lib.base import (Snapshot,
Template,
VirtualMachine,
Account,
@ -28,7 +28,7 @@ from marvin.integration.lib.base import (Snapshot,
DiskOffering,
Volume)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_events,
@ -38,7 +38,7 @@ from marvin.integration.lib.common import (get_domain,
list_virtual_machines,
)
from marvin.integration.lib.utils import (cleanup_resources,
from marvin.lib.utils import (cleanup_resources,
format_volume_to_ext3,
random_gen,
is_snapshot_on_nfs,
@ -158,11 +158,13 @@ class TestSnapshots(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestSnapshots, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshots, 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
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -229,6 +231,7 @@ class TestSnapshots(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
return
@ -910,11 +913,13 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestCreateVMSnapshotTemplate, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateVMSnapshotTemplate, 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
cls.template = get_template(
@ -956,6 +961,7 @@ class TestCreateVMSnapshotTemplate(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
return
@ -1108,11 +1114,14 @@ class TestSnapshotEvents(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestSnapshotEvents, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshotEvents, 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
template = get_template(
@ -1163,6 +1172,7 @@ class TestSnapshotEvents(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
return

View File

@ -20,10 +20,10 @@
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.integration.lib.utils import (random_gen,
from marvin.lib.utils import (random_gen,
is_snapshot_on_nfs,
cleanup_resources)
from marvin.integration.lib.base import (
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
@ -32,7 +32,7 @@ from marvin.integration.lib.base import (
Volume,
DiskOffering
)
from marvin.integration.lib.common import (get_domain,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
list_snapshots
@ -126,11 +126,13 @@ class TestSnapshotOnRootVolume(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestSnapshotOnRootVolume,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshotOnRootVolume, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
# Get Zone, Domain and templates
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,
@ -299,13 +301,13 @@ class TestCreateSnapshot(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestCreateSnapshot,
cls).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateSnapshot, 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,

View File

@ -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 System modules
import time
@ -108,14 +108,13 @@ class TestDeployVM(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployVM,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployVM, 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,
@ -962,14 +961,13 @@ class TestDeployHaEnabledVM(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployHaEnabledVM,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployHaEnabledVM, 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,
@ -1194,14 +1192,13 @@ class TestRouterStateAfterDeploy(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestRouterStateAfterDeploy,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestRouterStateAfterDeploy, 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,
@ -1409,14 +1406,13 @@ class TestDeployVMBasicZone(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployVMBasicZone,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployVMBasicZone, 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,
@ -1477,14 +1473,13 @@ class TestDeployVMFromTemplate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployVMFromTemplate,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployVMFromTemplate, 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())
# Create service, disk offerings etc
cls.service_offering = ServiceOffering.create(
@ -1511,8 +1506,8 @@ class TestDeployVMFromTemplate(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.services = Services().services
self.services["virtual_machine"]["zoneid"] = self.zone.id
@ -1533,7 +1528,8 @@ class TestDeployVMFromTemplate(cloudstackTestCase):
self.services["template"],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
domainid=self.account.domainid,
hypervisor=self.hypervisor
)
self.debug(
"Registered a template of format: %s with ID: %s" % (
@ -1638,14 +1634,13 @@ class TestVMAccountLimit(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVMAccountLimit,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVMAccountLimit, 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,
@ -1754,14 +1749,13 @@ class TestUploadAttachVolume(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestUploadAttachVolume,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestUploadAttachVolume, 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,
@ -1864,14 +1858,13 @@ class TestDeployOnSpecificHost(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployOnSpecificHost,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployOnSpecificHost, 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,

View File

@ -20,9 +20,9 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules
import time
@ -89,12 +89,13 @@ class TestStorageMotion(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestStorageMotion, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestStorageMotion, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# 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.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
template = get_template(

View File

@ -21,9 +21,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
@ -174,30 +174,28 @@ class TestResourceTags(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestResourceTags,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone
cls.zone = get_zone(cls.api_client, cls.services)
cls.testClient = super(TestResourceTags, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Create domains, account etc.
cls.domain = get_domain(cls.api_client, cls.services)
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.domain = get_domain(cls.api_client)
cls.template = get_template(
cls.api_client,
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.account = Account.create(
cls.api_client,
cls.services["account"],
admin=True,
)
cls.zone = get_zone(cls.api_client, cls.services)
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
# Create service offerings, disk offerings etc
cls.service_offering = ServiceOffering.create(
cls.api_client,

View File

@ -21,9 +21,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 urllib
from random import random
#Import System modules
@ -101,8 +101,8 @@ class Services:
class TestCreateTemplate(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.hypervisor = self.testClient.getHypervisorInfo()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
return
@ -118,12 +118,13 @@ class TestCreateTemplate(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestCreateTemplate, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestCreateTemplate, 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
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
@ -184,7 +185,8 @@ class TestCreateTemplate(cloudstackTestCase):
self.services["templates"][0],
zoneid=self.zone.id,
account=self.account.name,
domainid=self.account.domainid
domainid=self.account.domainid,
hypervisor=self.hypervisor
)
self.debug(
"Registered a template of format: %s with ID: %s" % (
@ -276,12 +278,13 @@ class TestTemplates(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestTemplates, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplates, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
# Get Zone, templates etc
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()

View File

@ -17,9 +17,9 @@
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.integration.lib.base import Account, VirtualMachine, ServiceOffering
from marvin.integration.lib.utils import cleanup_resources
from marvin.integration.lib.common import get_zone, get_domain, get_template
from marvin.lib.base import Account, VirtualMachine, ServiceOffering
from marvin.lib.utils import cleanup_resources
from marvin.lib.common import get_zone, get_domain, get_template
from nose.plugins.attrib import attr
class TestData(object):
@ -61,8 +61,8 @@ class TestUpdateVirtualMachine(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
# Get Zone, Domain and Default Built-in template
self.domain = get_domain(self.apiclient, self.testdata)
self.zone = get_zone(self.apiclient, self.testdata)
self.domain = get_domain(self.apiclient)
self.zone = get_zone(self.apiclient, self.testClient.getZoneForTests())
self.testdata["mode"] = self.zone.networktype
self.template = get_template(self.apiclient, self.zone.id, self.testdata["ostype"])
@ -156,4 +156,4 @@ class TestUpdateVirtualMachine(cloudstackTestCase):
try:
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
self.debug("Warning! Exception in tearDown: %s" % e)
self.debug("Warning! Exception in tearDown: %s" % e)

View File

@ -21,9 +21,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
@ -112,11 +112,13 @@ class TestVmUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVmUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestVmUsage, 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
template = get_template(
@ -296,11 +298,13 @@ class TestPublicIPUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestPublicIPUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestPublicIPUsage, 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
template = get_template(
@ -448,11 +452,13 @@ class TestVolumeUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVolumeUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestVolumeUsage, 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
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -622,11 +628,13 @@ class TestTemplateUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestTemplateUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestTemplateUsage, 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
cls.services["server"]["zoneid"] = cls.zone.id
template = get_template(
@ -787,11 +795,13 @@ class TestISOUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestISOUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestISOUsage, 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
cls.services["server"]["zoneid"] = cls.zone.id
cls.services["iso"]["zoneid"] = cls.zone.id
@ -924,11 +934,13 @@ class TestLBRuleUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestLBRuleUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestLBRuleUsage, 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
template = get_template(
cls.api_client,
@ -1086,11 +1098,13 @@ class TestSnapshotUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestSnapshotUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestSnapshotUsage, 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
template = get_template(
@ -1253,11 +1267,13 @@ class TestNatRuleUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestNatRuleUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestNatRuleUsage, 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
template = get_template(
cls.api_client,
@ -1415,11 +1431,13 @@ class TestVpnUsage(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVpnUsage, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestVpnUsage, 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
template = get_template(
cls.api_client,

View File

@ -18,9 +18,9 @@ import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.sshClient import SshClient
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
@ -92,15 +92,13 @@ class TestVMPasswordEnabled(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVMPasswordEnabled,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestVMPasswordEnabled, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.services = Services().services
# 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.api_client)
zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.services['mode'] = zone.networktype
template = get_template(
cls.api_client,

View File

@ -23,19 +23,19 @@ 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,
AffinityGroup,
Host,
VirtualMachine,
ServiceOffering)
from marvin.integration.lib.common import (get_zone,
from marvin.lib.common import (get_zone,
get_template,
get_domain,
get_pod
)
from marvin.integration.lib.utils import (validateList,
from marvin.lib.utils import (validateList,
cleanup_resources,
random_gen)
@ -111,25 +111,16 @@ class TestVMPlacement(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVMPlacement,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVMPlacement, 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.pod = get_pod(
cls.api_client,
zoneid=cls.zone.id,
services=cls.services
)
zone_id=cls.zone.id)
cls.template = get_template(
cls.api_client,
cls.zone.id,
@ -280,20 +271,13 @@ class TestAntiAffinityRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAntiAffinityRules,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAntiAffinityRules, 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,
@ -515,20 +499,13 @@ class TestAffinityRules(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestAffinityRules,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestAffinityRules, 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,

View File

@ -20,9 +20,9 @@
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 System modules
import time
@ -88,13 +88,14 @@ class TestAttachVolume(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAttachVolume, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestAttachVolume, 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.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -378,13 +379,14 @@ class TestAttachDetachVolume(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAttachDetachVolume, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestAttachDetachVolume, 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.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -641,13 +643,14 @@ class TestAttachVolumeISO(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestAttachVolumeISO, cls).getClsTestClient().getApiClient()
cls.services = Services().services
cls.testClient = super(TestAttachVolumeISO, 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.pod = get_pod(cls.api_client, cls.zone.id, cls.services)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -852,11 +855,13 @@ class TestVolumes(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(TestVolumes, cls).getClsTestClient().getApiClient()
cls.testClient = super(TestVolumes, 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
cls.disk_offering = DiskOffering.create(
cls.api_client,
@ -1105,7 +1110,7 @@ class TestVolumes(cloudstackTestCase):
)
self.assertTrue(domuser is not None)
domapiclient = self.testClient.getUserApiClient(account=domuser.name, domain=dom.name)
domapiclient = self.testClient.getUserApiClient(UserName=domuser.name, DomainName=dom.name)
diskoffering = DiskOffering.list(self.apiclient)
self.assertTrue(isinstance(diskoffering, list), msg="DiskOffering list is not a list?")
@ -1133,15 +1138,12 @@ class TestDeployVmWithCustomDisk(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployVmWithCustomDisk,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestDeployVmWithCustomDisk, 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
cls.disk_offering = DiskOffering.create(
cls.api_client,

View File

@ -20,11 +20,11 @@
#Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackException import cloudstackAPIException
from marvin.cloudstackException import CloudstackAPIException
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 *
class Services:
@ -175,14 +175,13 @@ class TestVPC(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVPC,
cls
).getClsTestClient().getApiClient()
cls.testClient = super(TestVPC, 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,
@ -1934,10 +1933,10 @@ class TestVPC(cloudstackTestCase):
self.debug("creating a VPC network in the account: %s" %
user.name)
userapiclient = self.testClient.createUserApiClient(
userapiclient = self.testClient.getUserApiClient(
UserName=user.name,
DomainName=user.domain,
acctType=0)
type=0)
vpc = VPC.create(
@ -2017,8 +2016,8 @@ class TestVPC(cloudstackTestCase):
#0 - User, 1 - Root Admin, 2 - Domain Admin
userapiclient = self.testClient.getUserApiClient(
account=user.name,
domain=self.services["domain"]["name"],
UserName=user.name,
DomainName=self.services["domain"]["name"],
type=2)
vpc = VPC.create(
@ -2092,8 +2091,8 @@ class TestVPC(cloudstackTestCase):
user.name)
userapiclient = self.testClient.getUserApiClient(
account=user.name,
domain=user.domain,
UserName=user.name,
DomainName=user.domain,
type=0)
vpc = VPC.create(
@ -2171,8 +2170,8 @@ class TestVPC(cloudstackTestCase):
self.debug("Created account: %s" % domain_admin.name)
self.cleanup.append(domain_admin)
da_apiclient = self.testClient.getUserApiClient(
account=domain_admin.name,
domain=domain_admin.domain,
UserName=domain_admin.name,
DomainName=domain_admin.domain,
type=2)
user = Account.create(
@ -2188,11 +2187,11 @@ class TestVPC(cloudstackTestCase):
#0 - User, 1 - Root Admin, 2 - Domain Admin
userapiclient = self.testClient.getUserApiClient(
account=user.name,
domain=user.domain,
UserName=user.name,
DomainName=user.domain,
type=0)
with self.assertRaises(cloudstackAPIException):
with self.assertRaises(CloudstackAPIException):
vpc = VPC.create(
da_apiclient,
self.services["vpc"],
@ -2222,8 +2221,8 @@ class TestVPC(cloudstackTestCase):
self.debug("Created account: %s" % domain_admin.name)
self.cleanup.append(domain_admin)
da_apiclient = self.testClient.getUserApiClient(
account=domain_admin.name,
domain=self.services["domain"]["name"],
UserName=domain_admin.name,
DomainName=self.services["domain"]["name"],
type=2)
user = Account.create(
@ -2239,8 +2238,8 @@ class TestVPC(cloudstackTestCase):
#0 - User, 1 - Root Admin, 2 - Domain Admin
userapiclient = self.testClient.getUserApiClient(
account=user.name,
domain=user.domain,
UserName=user.name,
DomainName=user.domain,
type=0)
vpc = VPC.create(

View File

@ -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
@ -154,24 +154,27 @@ class TestVPCDistributedRouterOffering(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestVPCDistributedRouterOffering,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
testClient = super(TestVPCDistributedRouterOffering, cls).getClsTestClient()
cls.apiclient = testClient.getApiClient()
cls.services = testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.services['mode'] = cls.zone.networktype
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostype"]
)
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["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.apiclient,
cls.services["service_offering"]
)
cls._cleanup = [
@ -183,7 +186,7 @@ class TestVPCDistributedRouterOffering(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

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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,

View File

@ -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 = [

View File

@ -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:

View File

@ -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
"""

View File

@ -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'
)

View File

@ -20,30 +20,17 @@
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
_multiprocess_shared_ = True
class Services:
"""Test Disk offerings Services
"""
def __init__(self):
self.services = {
"off": {
"name": "Disk offering",
"displaytext": "Disk offering",
"disksize": 1 # in GB
},
}
class TestCreateDiskOffering(cloudstackTestCase):
def setUp(self):
self.services = Services().services
self.services = self.testClient.getParsedTestDataConfig()
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
@ -68,7 +55,7 @@ class TestCreateDiskOffering(cloudstackTestCase):
"""
disk_offering = DiskOffering.create(
self.apiclient,
self.services["off"]
self.services["disk_offering"]
)
self.cleanup.append(disk_offering)
@ -92,16 +79,96 @@ class TestCreateDiskOffering(cloudstackTestCase):
self.assertEqual(
disk_response.displaytext,
self.services["off"]["displaytext"],
self.services["disk_offering"]["displaytext"],
"Check server id in createServiceOffering"
)
self.assertEqual(
disk_response.name,
self.services["off"]["name"],
self.services["disk_offering"]["name"],
"Check name in createServiceOffering"
)
return
@attr(hypervisor="kvm")
@attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
def test_02_create_sparse_type_disk_offering(self):
"""Test to create a sparse type disk offering"""
# Validate the following:
# 1. createDiskOfferings should return valid info for new offering
# 2. The Cloud Database contains the valid information
disk_offering = DiskOffering.create(
self.apiclient,
self.services["sparse"]
)
self.cleanup.append(disk_offering)
self.debug("Created Disk offering with ID: %s" % disk_offering.id)
list_disk_response = list_disk_offering(
self.apiclient,
id=disk_offering.id
)
self.assertEqual(
isinstance(list_disk_response, list),
True,
"Check list response returns a valid list"
)
self.assertNotEqual(
len(list_disk_response),
0,
"Check Disk offering is created"
)
disk_response = list_disk_response[0]
self.assertEqual(
disk_response.provisioningtype,
self.services["sparse"]["provisioningtype"],
"Check provisionig type in createServiceOffering"
)
return
@attr(hypervisor="kvm")
@attr(tags = ["advanced", "basic", "eip", "sg", "advancedns", "simulator", "smoke"])
def test_04_create_fat_type_disk_offering(self):
"""Test to create a sparse type disk offering"""
# Validate the following:
# 1. createDiskOfferings should return valid info for new offering
# 2. The Cloud Database contains the valid information
disk_offering = DiskOffering.create(
self.apiclient,
self.services["fat"]
)
self.cleanup.append(disk_offering)
self.debug("Created Disk offering with ID: %s" % disk_offering.id)
list_disk_response = list_disk_offering(
self.apiclient,
id=disk_offering.id
)
self.assertEqual(
isinstance(list_disk_response, list),
True,
"Check list response returns a valid list"
)
self.assertNotEqual(
len(list_disk_response),
0,
"Check Disk offering is created"
)
disk_response = list_disk_response[0]
self.assertEqual(
disk_response.provisioningtype,
self.services["fat"]["provisioningtype"],
"Check provisionig type in createServiceOffering"
)
return
class TestDiskOfferings(cloudstackTestCase):
@ -122,15 +189,17 @@ class TestDiskOfferings(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.services = Services().services
cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
testClient = super(TestDiskOfferings, cls).getClsTestClient()
cls.apiclient = cls.testClient.getApiClient()
cls.services = cls.testClient.getParsedTestDataConfig()
cls.disk_offering_1 = DiskOffering.create(
cls.api_client,
cls.services["off"]
cls.apiclient,
cls.services["disk_offering"]
)
cls.disk_offering_2 = DiskOffering.create(
cls.api_client,
cls.services["off"]
cls.apiclient,
cls.services["disk_offering"]
)
cls._cleanup = [cls.disk_offering_1]
return
@ -138,8 +207,8 @@ class TestDiskOfferings(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
try:
cls.api_client = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.api_client, cls._cleanup)
cls.apiclient = super(TestDiskOfferings, cls).getClsTestClient().getApiClient()
cleanup_resources(cls.apiclient, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return

View File

@ -19,9 +19,9 @@
#Import Local Modules
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
#Import System modules

Some files were not shown because too many files have changed in this diff Show More