mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Various fixes to tests
- Configuration fixes in Security groups and Egress rules - Fixing white spaces in component test suite
This commit is contained in:
parent
a725fdc3ab
commit
b433b1afa6
@ -57,8 +57,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"virtual_machine": {
|
||||
"displayname": "Test VM",
|
||||
@ -78,7 +78,7 @@ class Services:
|
||||
"ostypeid": 'aaf6e8c9-b609-441d-9ebd-b4eaa030a275',
|
||||
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
|
||||
"hypervisor": 'XenServer',
|
||||
"format" : 'VHD',
|
||||
"format": 'VHD',
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": True,
|
||||
@ -87,7 +87,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode":'advanced'
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
@ -138,9 +138,9 @@ class TestAccounts(cloudstackTestCase):
|
||||
return
|
||||
|
||||
def test_01_create_account(self):
|
||||
"""Test Create Account and user for that account
|
||||
"""Test Create Account and user for that account
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -273,9 +273,9 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
||||
return
|
||||
|
||||
def test_01_user_remove_VM_running(self):
|
||||
"""Test Remove one user from the account
|
||||
"""Test Remove one user from the account
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -337,8 +337,8 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
||||
id=self.account.account.id
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(accounts_response, list),
|
||||
True,
|
||||
isinstance(accounts_response, list),
|
||||
True,
|
||||
"Check for valid list accounts response"
|
||||
)
|
||||
|
||||
@ -353,8 +353,8 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
||||
domainid=self.account.account.domainid
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(vm_response, list),
|
||||
True,
|
||||
isinstance(vm_response, list),
|
||||
True,
|
||||
"Check for valid list VM response"
|
||||
)
|
||||
|
||||
@ -372,11 +372,12 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
||||
"Check state of VMs associated with account"
|
||||
)
|
||||
return
|
||||
|
||||
@unittest.skip("Open Questions")
|
||||
def test_02_remove_all_users(self):
|
||||
"""Test Remove both users from the account
|
||||
"""Test Remove both users from the account
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -427,12 +428,12 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
||||
domainid=self.account.account.domainid
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(users, list),
|
||||
True,
|
||||
isinstance(users, list),
|
||||
True,
|
||||
"Check for valid list users response"
|
||||
)
|
||||
for user in users:
|
||||
|
||||
|
||||
self.debug("Deleting user: %s" % user.id)
|
||||
cmd = deleteUser.deleteUserCmd()
|
||||
cmd.id = user.id
|
||||
@ -443,12 +444,12 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
||||
name='account.cleanup.interval'
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(interval, list),
|
||||
True,
|
||||
isinstance(interval, list),
|
||||
True,
|
||||
"Check for valid list configurations response"
|
||||
)
|
||||
self.debug("account.cleanup.interval: %s" % interval[0].value)
|
||||
|
||||
|
||||
# Sleep to ensure that all resources are deleted
|
||||
time.sleep(int(interval[0].value))
|
||||
|
||||
@ -534,7 +535,7 @@ class TestNonRootAdminsPrivileges(cloudstackTestCase):
|
||||
|
||||
def test_01_non_root_admin_Privileges(self):
|
||||
"""Test to verify Non Root admin previleges"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -562,11 +563,11 @@ class TestNonRootAdminsPrivileges(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(accounts_response, list),
|
||||
True,
|
||||
isinstance(accounts_response, list),
|
||||
True,
|
||||
"Check list accounts response for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
len(accounts_response),
|
||||
1,
|
||||
@ -653,7 +654,7 @@ class TestServiceOfferingSiblings(cloudstackTestCase):
|
||||
|
||||
def test_01_service_offering_siblings(self):
|
||||
"""Test to verify service offerings at same level in hierarchy"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -665,11 +666,11 @@ class TestServiceOfferingSiblings(cloudstackTestCase):
|
||||
domainid=self.domain_1.id
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(service_offerings, list),
|
||||
True,
|
||||
isinstance(service_offerings, list),
|
||||
True,
|
||||
"Check if valid list service offerings response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(service_offerings),
|
||||
0,
|
||||
@ -695,6 +696,7 @@ class TestServiceOfferingSiblings(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@unittest.skip("Open Questions")
|
||||
class TestServiceOfferingHierarchy(cloudstackTestCase):
|
||||
|
||||
@ -768,7 +770,7 @@ class TestServiceOfferingHierarchy(cloudstackTestCase):
|
||||
|
||||
def test_01_service_offering_hierarchy(self):
|
||||
"""Test to verify service offerings at same level in hierarchy"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -821,6 +823,7 @@ class TestServiceOfferingHierarchy(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@unittest.skip("Open Questions")
|
||||
class TesttemplateHierarchy(cloudstackTestCase):
|
||||
|
||||
@ -899,7 +902,7 @@ class TesttemplateHierarchy(cloudstackTestCase):
|
||||
|
||||
def test_01_template_hierarchy(self):
|
||||
"""Test to verify template at same level in hierarchy"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
@ -959,6 +962,7 @@ class TesttemplateHierarchy(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
class TestAddVmToSubDomain(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -1026,19 +1030,20 @@ class TestAddVmToSubDomain(cloudstackTestCase):
|
||||
serviceofferingid=cls.service_offering.id
|
||||
)
|
||||
cls._cleanup = [
|
||||
cls.account_2,
|
||||
cls.account_1,
|
||||
cls.sub_domain,
|
||||
cls.service_offering
|
||||
]
|
||||
cls.account_2,
|
||||
cls.account_1,
|
||||
cls.sub_domain,
|
||||
cls.service_offering
|
||||
]
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
try:
|
||||
try:
|
||||
#Clean up, terminate the created resources
|
||||
cleanup_resources(cls.api_client,cls._cleanup)
|
||||
except Exception as e:
|
||||
cleanup_resources(cls.api_client, cls._cleanup)
|
||||
except Exception as e:
|
||||
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
@ -1056,11 +1061,10 @@ class TestAddVmToSubDomain(cloudstackTestCase):
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
|
||||
def test_01_add_vm_to_subdomain(self):
|
||||
""" Test Sub domain allowed to launch VM when a Domain level zone is
|
||||
created"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "eip", "advancedns", "sg"]
|
||||
|
||||
# Validate the following
|
||||
|
||||
@ -26,6 +26,7 @@ from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Services
|
||||
"""
|
||||
@ -48,8 +49,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
@ -69,7 +70,7 @@ class Services:
|
||||
"volume": {
|
||||
"diskname": "APP Data Volume",
|
||||
"size": 1, # in GBs
|
||||
"diskdevice": "/dev/xvdb", # Data Disk
|
||||
"diskdevice": "/dev/xvdb", # Data Disk
|
||||
},
|
||||
"templates": {
|
||||
"displaytext": 'Template from snapshot',
|
||||
@ -78,11 +79,11 @@ class Services:
|
||||
"templatefilter": 'self',
|
||||
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
|
||||
"hypervisor": 'XenServer',
|
||||
"format" : 'VHD',
|
||||
"format": 'VHD',
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": True,
|
||||
"passwordenabled":True,
|
||||
"passwordenabled": True,
|
||||
},
|
||||
"paths": {
|
||||
"mount_dir": "/mnt/tmp",
|
||||
@ -97,12 +98,12 @@ class Services:
|
||||
"protocol": "TCP"
|
||||
},
|
||||
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3',
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep":60,
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"mode": 'advanced',
|
||||
# Networking mode, Advanced, Basic
|
||||
}
|
||||
|
||||
|
||||
|
||||
class TestSnapshots(cloudstackTestCase):
|
||||
|
||||
@ -124,10 +125,10 @@ class TestSnapshots(cloudstackTestCase):
|
||||
)
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
cls.services["volume"]["zoneid"] = cls.zone.id
|
||||
|
||||
|
||||
cls.services["template"] = cls.template.id
|
||||
cls.services["zoneid"] = cls.zone.id
|
||||
|
||||
|
||||
# Create VMs, NAT Rules etc
|
||||
cls.account = Account.create(
|
||||
cls.api_client,
|
||||
@ -184,9 +185,9 @@ class TestSnapshots(cloudstackTestCase):
|
||||
def test_01_volume_from_snapshot(self):
|
||||
"""TS_BUG_001-Test Creating snapshot from volume having spaces in name(KVM)
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
|
||||
# Validate the following
|
||||
#1. Create a virtual machine and data volume
|
||||
#2. Attach data volume to VM
|
||||
@ -195,31 +196,31 @@ class TestSnapshots(cloudstackTestCase):
|
||||
#5. Create another Volume from snapshot
|
||||
#6. Mount/Attach volume to another server
|
||||
#7. Compare data
|
||||
|
||||
|
||||
random_data_0 = random_gen(100)
|
||||
random_data_1 = random_gen(100)
|
||||
|
||||
|
||||
volume = Volume.create(
|
||||
self.apiclient,
|
||||
self.services["volume"],
|
||||
zoneid=self.zone.id,
|
||||
account=self.account.account.name,
|
||||
domainid=self.account.account.domainid,
|
||||
self.apiclient,
|
||||
self.services["volume"],
|
||||
zoneid=self.zone.id,
|
||||
account=self.account.account.name,
|
||||
domainid=self.account.account.domainid,
|
||||
diskofferingid=self.disk_offering.id
|
||||
)
|
||||
self.debug("Created volume with ID: %s" % volume.id)
|
||||
self.virtual_machine.attach_volume(
|
||||
self.apiclient,
|
||||
volume
|
||||
)
|
||||
self.debug("Attach volume: %s to VM: %s" %
|
||||
)
|
||||
self.debug("Attach volume: %s to VM: %s" %
|
||||
(volume.id, self.virtual_machine.id))
|
||||
try:
|
||||
ssh_client = self.virtual_machine.get_ssh_client()
|
||||
except Exception as e:
|
||||
self.fail("SSH failed for VM: %s" %
|
||||
self.fail("SSH failed for VM: %s" %
|
||||
self.virtual_machine.ipaddress)
|
||||
|
||||
|
||||
self.debug("Formatting volume: %s to ext3" % volume.id)
|
||||
#Format partition using ext3
|
||||
format_volume_to_ext3(
|
||||
@ -273,8 +274,8 @@ class TestSnapshots(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(list_volume_response, list),
|
||||
True,
|
||||
isinstance(list_volume_response, list),
|
||||
True,
|
||||
"Check list volume response for valid data"
|
||||
)
|
||||
volume_response = list_volume_response[0]
|
||||
@ -295,7 +296,7 @@ class TestSnapshots(cloudstackTestCase):
|
||||
domainid=self.account.account.domainid
|
||||
)
|
||||
self.debug("Created Volume: %s from Snapshot: %s" % (
|
||||
volume_from_snapshot.id,
|
||||
volume_from_snapshot.id,
|
||||
snapshot.id))
|
||||
volumes = Volume.list(
|
||||
self.apiclient,
|
||||
@ -306,13 +307,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
True,
|
||||
"Check list response returns a valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(volumes),
|
||||
None,
|
||||
"Check Volume list Length"
|
||||
)
|
||||
self.assertEqual (
|
||||
self.assertEqual(
|
||||
volumes[0].id,
|
||||
volume_from_snapshot.id,
|
||||
"Check Volume in the List Volumes"
|
||||
@ -334,7 +335,7 @@ class TestSnapshots(cloudstackTestCase):
|
||||
volume_from_snapshot.id,
|
||||
new_virtual_machine.id
|
||||
))
|
||||
|
||||
|
||||
cmd = attachVolume.attachVolumeCmd()
|
||||
cmd.id = volume_from_snapshot.id
|
||||
cmd.virtualmachineid = new_virtual_machine.id
|
||||
@ -343,7 +344,7 @@ class TestSnapshots(cloudstackTestCase):
|
||||
try:
|
||||
#Login to VM to verify test directories and files
|
||||
ssh = new_virtual_machine.get_ssh_client()
|
||||
|
||||
|
||||
cmds = [
|
||||
"mkdir -p %s" % self.services["paths"]["mount_dir"],
|
||||
"mount %s1 %s" % (
|
||||
@ -371,7 +372,7 @@ class TestSnapshots(cloudstackTestCase):
|
||||
self.services["paths"]["random_data"]
|
||||
))
|
||||
except Exception as e:
|
||||
self.fail("SSH access failed for VM: %s" %
|
||||
self.fail("SSH access failed for VM: %s" %
|
||||
new_virtual_machine.ipaddress)
|
||||
#Verify returned data
|
||||
self.assertEqual(
|
||||
@ -423,7 +424,7 @@ class TestTemplate(cloudstackTestCase):
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
cls.services["templates"]["zoneid"] = cls.zone.id
|
||||
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
@ -456,7 +457,7 @@ class TestTemplate(cloudstackTestCase):
|
||||
def test_01_create_template(self):
|
||||
"""TS_BUG_002-Test to create and deploy VM using password enabled template
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns", "basic", "sg"]
|
||||
|
||||
# Validate the following:
|
||||
@ -479,13 +480,13 @@ class TestTemplate(cloudstackTestCase):
|
||||
template.download(self.apiclient)
|
||||
except Exception as e:
|
||||
self.fail("Exception while downloading template %s: %s"\
|
||||
% (template.id, e))
|
||||
|
||||
% (template.id, e))
|
||||
|
||||
self.cleanup.append(template)
|
||||
|
||||
# Wait for template status to be changed across
|
||||
time.sleep(self.services["sleep"])
|
||||
|
||||
|
||||
list_template_response = Template.list(
|
||||
self.apiclient,
|
||||
templatefilter=\
|
||||
@ -493,7 +494,7 @@ class TestTemplate(cloudstackTestCase):
|
||||
id=template.id,
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(list_template_response, list),
|
||||
True,
|
||||
@ -524,7 +525,7 @@ class TestTemplate(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Deployed VM with ID: %s " % virtual_machine.id)
|
||||
self.assertEqual(
|
||||
hasattr(virtual_machine,"password"),
|
||||
hasattr(virtual_machine, "password"),
|
||||
True,
|
||||
"Check if the deployed VM returned a password"
|
||||
)
|
||||
@ -532,7 +533,7 @@ class TestTemplate(cloudstackTestCase):
|
||||
|
||||
|
||||
class TestNATRules(cloudstackTestCase):
|
||||
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
||||
@ -568,10 +569,10 @@ class TestNATRules(cloudstackTestCase):
|
||||
serviceofferingid=cls.service_offering.id
|
||||
)
|
||||
cls.public_ip = PublicIPAddress.create(
|
||||
cls.api_client,
|
||||
accountid=cls.account.account.name,
|
||||
zoneid=cls.zone.id,
|
||||
domainid=cls.account.account.domainid,
|
||||
cls.api_client,
|
||||
accountid=cls.account.account.name,
|
||||
zoneid=cls.zone.id,
|
||||
domainid=cls.account.account.domainid,
|
||||
services=cls.services["virtual_machine"]
|
||||
)
|
||||
cls._cleanup = [
|
||||
@ -600,25 +601,25 @@ class TestNATRules(cloudstackTestCase):
|
||||
|
||||
def test_01_firewall_rules_port_fw(self):
|
||||
""""Checking firewall rules deletion after static NAT disable"""
|
||||
|
||||
|
||||
tags = ["advanced"]
|
||||
|
||||
# Validate the following:
|
||||
#1. Enable static NAT for a VM
|
||||
#2. Open up some ports. At this point there will be new rows in the
|
||||
# firewall_rules table.
|
||||
# firewall_rules table.
|
||||
#3. Disable static NAT for the VM.
|
||||
#4. Check fire wall rules are deleted from firewall_rules table.
|
||||
|
||||
public_ip = self.public_ip.ipaddress
|
||||
|
||||
|
||||
# Enable Static NAT for VM
|
||||
StaticNATRule.enable(
|
||||
self.apiclient,
|
||||
public_ip.id,
|
||||
self.virtual_machine.id
|
||||
)
|
||||
self.debug("Enabled static NAT for public IP ID: %s" %
|
||||
)
|
||||
self.debug("Enabled static NAT for public IP ID: %s" %
|
||||
public_ip.id)
|
||||
#Create Static NAT rule
|
||||
nat_rule = StaticNATRule.create(
|
||||
@ -661,7 +662,7 @@ class TestNATRules(cloudstackTestCase):
|
||||
True,
|
||||
"Check database query returns a valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -683,20 +684,20 @@ class TestNATRules(cloudstackTestCase):
|
||||
True,
|
||||
"Check database query returns a valid data for firewall rules"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
"Check DB Query result set"
|
||||
)
|
||||
|
||||
|
||||
for qresult in qresultset:
|
||||
self.assertEqual(
|
||||
qresult[1],
|
||||
'Active',
|
||||
"Check state of the static NAT rule in database"
|
||||
)
|
||||
|
||||
|
||||
nat_rule.delete(self.apiclient)
|
||||
|
||||
list_rules_repsonse = StaticNATRule.list(
|
||||
@ -709,7 +710,7 @@ class TestNATRules(cloudstackTestCase):
|
||||
None,
|
||||
"Check Port Forwarding Rule is deleted"
|
||||
)
|
||||
|
||||
|
||||
# Verify the entries made in firewall_rules tables
|
||||
self.debug(
|
||||
"select id, state from firewall_rules where ip_address_id = '%s';" \
|
||||
@ -719,7 +720,7 @@ class TestNATRules(cloudstackTestCase):
|
||||
"select id, state from firewall_rules where ip_address_id = '%s';" \
|
||||
% public_ip.id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -741,7 +742,7 @@ class TestRouters(cloudstackTestCase):
|
||||
cls.zone.id,
|
||||
cls.services["ostypeid"]
|
||||
)
|
||||
|
||||
|
||||
# Create an account, domain etc
|
||||
cls.domain = Domain.create(
|
||||
cls.api_client,
|
||||
@ -753,7 +754,7 @@ class TestRouters(cloudstackTestCase):
|
||||
admin=True,
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
|
||||
|
||||
cls.user_account = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["account"],
|
||||
@ -802,13 +803,13 @@ class TestRouters(cloudstackTestCase):
|
||||
def test_01_list_routers_admin(self):
|
||||
"""TS_BUG_007-Check listRouters() using Admin User
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. PreReq: have rounters that are owned by other account
|
||||
# 2. Create domain and create accounts in that domain
|
||||
# 3. Create one VM for each account
|
||||
# 2. Create domain and create accounts in that domain
|
||||
# 3. Create one VM for each account
|
||||
# 4. Using Admin , run listRouters. It should return all the routers
|
||||
|
||||
vm_1 = VirtualMachine.create(
|
||||
@ -909,11 +910,10 @@ class TestRouterRestart(cloudstackTestCase):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
return
|
||||
|
||||
|
||||
def test_01_restart_network_cleanup(self):
|
||||
"""TS_BUG_008-Test restart network
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "basic", "sg", "advancedns", "eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1036,7 +1036,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
cls.volume = list_volume[0]
|
||||
except Exception as e:
|
||||
raise Exception("Warning: Exception during setup : %s" % e)
|
||||
|
||||
|
||||
cls._cleanup = [
|
||||
cls.service_offering,
|
||||
cls.account,
|
||||
@ -1074,13 +1074,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_01_check_template_size(self):
|
||||
"""TS_BUG_009-Test the size of template created from root disk
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns", "basic", "sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
# 1. Deploy new VM using the template created from Volume
|
||||
# 2. VM should be in Up and Running state
|
||||
|
||||
|
||||
#Create template from volume
|
||||
template = Template.create(
|
||||
self.apiclient,
|
||||
@ -1097,11 +1097,11 @@ class TestTemplates(cloudstackTestCase):
|
||||
"Check if size of template and volume are same"
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_02_check_size_snapshotTemplate(self):
|
||||
"""TS_BUG_010-Test check size of snapshot and template
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns", "basic", "sg", "eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1113,7 +1113,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
|
||||
# Create a snapshot from the ROOTDISK
|
||||
snapshot = Snapshot.create(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
self.volume.id,
|
||||
account=self.account.account.name,
|
||||
domainid=self.account.account.domainid
|
||||
@ -1146,7 +1146,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
self.services["templates"]
|
||||
)
|
||||
self.cleanup.append(template)
|
||||
|
||||
|
||||
self.debug("Created template from snapshot with ID: %s" % template.id)
|
||||
templates = Template.list(
|
||||
self.apiclient,
|
||||
@ -1181,7 +1181,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_03_resuse_template_name(self):
|
||||
"""TS_BUG_011-Test Reusing deleted template name
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns", "basic", "sg", "eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1250,15 +1250,15 @@ class TestTemplates(cloudstackTestCase):
|
||||
True,
|
||||
"Check new template state in list templates call"
|
||||
)
|
||||
|
||||
|
||||
self.debug("Deleting template: %s" % template.id)
|
||||
template.delete(self.apiclient)
|
||||
|
||||
# Wait for some time to ensure template state is reflected in other calls
|
||||
|
||||
# Wait for some time to ensure template state is reflected in other calls
|
||||
time.sleep(self.services["sleep"])
|
||||
|
||||
|
||||
# Generate template from the snapshot
|
||||
self.debug("Creating template from snapshot: %s with same name" %
|
||||
self.debug("Creating template from snapshot: %s with same name" %
|
||||
template.id)
|
||||
template = Template.create_from_snapshot(
|
||||
self.apiclient,
|
||||
|
||||
@ -37,7 +37,7 @@ class Services:
|
||||
|
||||
def __init__(self):
|
||||
self.services = {
|
||||
"disk_offering":{
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
"name": "Small",
|
||||
"disksize": 1
|
||||
@ -67,8 +67,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"security_group": {
|
||||
"name": 'SSH',
|
||||
@ -110,8 +110,9 @@ class Services:
|
||||
"protocol": 'TCP',
|
||||
"startport": 22,
|
||||
"endport": 22,
|
||||
"cidrlist": '0.0.0.0/0'
|
||||
},
|
||||
"mgmt_server": {
|
||||
"mgmt_server": {
|
||||
"username": "root",
|
||||
"password": "fr3sca",
|
||||
"ipaddress": "192.168.100.21"
|
||||
@ -120,7 +121,7 @@ class Services:
|
||||
# CentOS 5.3 (64-bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode":'basic',
|
||||
"mode": 'basic',
|
||||
# Networking mode: Basic or Advanced
|
||||
}
|
||||
|
||||
@ -197,7 +198,7 @@ class TestDefaultSecurityGroupEgress(cloudstackTestCase):
|
||||
def test_deployVM_InDefaultSecurityGroup(self):
|
||||
"""Test deploy VM in default security group with no egress rules
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -354,7 +355,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase):
|
||||
def test_authorizeIngressRule(self):
|
||||
"""Test authorize ingress rule
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -512,7 +513,7 @@ class TestDefaultGroupEgress(cloudstackTestCase):
|
||||
def test_01_default_group_with_egress(self):
|
||||
"""Test default group with egress rule before VM deploy and ping, ssh
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -714,7 +715,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
|
||||
""" Test default group with egress rule added after vm deploy and ping,
|
||||
ssh test
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -811,7 +812,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
|
||||
# --- www.l.google.com ping statistics ---
|
||||
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
||||
# rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
|
||||
self.debug("SSH result: %s" % str(res))
|
||||
self.debug("SSH result: %s" % str(res))
|
||||
except Exception as e:
|
||||
self.fail("SSH Access failed for %s: %s" % \
|
||||
(self.virtual_machine.ipaddress, e)
|
||||
@ -896,7 +897,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
|
||||
def test_revoke_egress_rule(self):
|
||||
"""Test revoke security group egress rule
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -997,7 +998,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
|
||||
# --- www.l.google.com ping statistics ---
|
||||
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms
|
||||
# rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
|
||||
self.debug("SSH result: %s" % str(res))
|
||||
self.debug("SSH result: %s" % str(res))
|
||||
except Exception as e:
|
||||
self.fail("SSH Access failed for %s: %s" % \
|
||||
(self.virtual_machine.ipaddress, e)
|
||||
@ -1038,7 +1039,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
|
||||
|
||||
result = security_group.revokeEgress(
|
||||
self.apiclient,
|
||||
id = ssh_egress_rule["ruleid"]
|
||||
id=ssh_egress_rule["ruleid"]
|
||||
)
|
||||
self.debug("Revoke egress rule result: %s" % result)
|
||||
|
||||
@ -1158,7 +1159,7 @@ class TestInvalidAccountAuthroize(cloudstackTestCase):
|
||||
def test_invalid_account_authroize(self):
|
||||
"""Test invalid account authroize
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -1286,7 +1287,7 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
|
||||
def test_multiple_account_egress_rule_negative(self):
|
||||
"""Test multiple account egress rules negative case
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -1335,14 +1336,14 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
|
||||
"Authorizing egress rule for sec group ID: %s for ssh access"
|
||||
% security_group.id)
|
||||
# Authorize to only account not CIDR
|
||||
user_secgrp_list = {self.accountB.account.name: 'default'}
|
||||
user_secgrp_list = {self.accountB.account.name: 'default'}
|
||||
|
||||
egress_rule = security_group.authorizeEgress(
|
||||
self.apiclient,
|
||||
self.services["sg_account"],
|
||||
account=self.accountA.account.name,
|
||||
domainid=self.accountA.account.domainid,
|
||||
user_secgrp_list=user_secgrp_list
|
||||
user_secgrp_list=user_secgrp_list
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
@ -1438,7 +1439,7 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
|
||||
|
||||
try:
|
||||
self.debug("SSHing into VM type B from VM A")
|
||||
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
|
||||
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
|
||||
res = ssh.execute("ssh %s@%s" % (
|
||||
self.services["virtual_machine"]["username"],
|
||||
self.virtual_machineB.ssh_ip
|
||||
@ -1534,7 +1535,7 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
|
||||
def test_multiple_account_egress_rule_positive(self):
|
||||
"""Test multiple account egress rules positive case
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -1610,14 +1611,14 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
|
||||
"Authorizing egress rule for sec group ID: %s for ssh access"
|
||||
% security_groupA.id)
|
||||
# Authorize to only account not CIDR
|
||||
user_secgrp_list = {self.accountB.account.name: security_groupB.name}
|
||||
user_secgrp_list = {self.accountB.account.name: security_groupB.name}
|
||||
|
||||
egress_rule = security_groupA.authorizeEgress(
|
||||
self.apiclient,
|
||||
self.services["sg_account"],
|
||||
account=self.accountA.account.name,
|
||||
domainid=self.accountA.account.domainid,
|
||||
user_secgrp_list=user_secgrp_list
|
||||
user_secgrp_list=user_secgrp_list
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
@ -1734,7 +1735,7 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
|
||||
|
||||
try:
|
||||
self.debug("SSHing into VB type B from VM A")
|
||||
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
|
||||
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
|
||||
|
||||
res = ssh.execute("ssh %s@%s" % (
|
||||
self.services["virtual_machine"]["username"],
|
||||
@ -1825,7 +1826,7 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase):
|
||||
def test_start_stop_vm_egress(self):
|
||||
""" Test stop start Vm with egress rules
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -1965,6 +1966,7 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@unittest.skip("Valid bug- ID: CS-12647")
|
||||
class TestInvalidParametersForEgress(cloudstackTestCase):
|
||||
|
||||
@ -2036,7 +2038,7 @@ class TestInvalidParametersForEgress(cloudstackTestCase):
|
||||
def test_invalid_parameters(self):
|
||||
""" Test invalid parameters for egress rules
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -2223,7 +2225,7 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
|
||||
def test_egress_after_host_maintainance(self):
|
||||
"""Test maintenance case for egress
|
||||
"""
|
||||
|
||||
|
||||
tags = ["sg", "eip"]
|
||||
|
||||
# Validate the following:
|
||||
@ -2329,12 +2331,12 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
|
||||
)
|
||||
vm = vms[0]
|
||||
|
||||
self.debug("Enabling host maintainance for ID: %s" % host.id)
|
||||
self.debug("Enabling host maintainance for ID: %s" % vm.hostid)
|
||||
cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
|
||||
cmd.id = vm.hostid
|
||||
self.apiclient.prepareHostForMaintenance(cmd)
|
||||
|
||||
self.debug("Canceling host maintainance for ID: %s" % host.id)
|
||||
self.debug("Canceling host maintainance for ID: %s" % vm.hostid)
|
||||
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
|
||||
cmd.id = vm.hostid
|
||||
self.apiclient.cancelHostMaintenance(cmd)
|
||||
|
||||
@ -47,8 +47,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"lbrule": {
|
||||
"name": "SSH",
|
||||
@ -183,7 +183,7 @@ class TestEIP(cloudstackTestCase):
|
||||
def test_01_eip_by_deploying_instance(self):
|
||||
"""Test EIP by deploying an instance
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -350,7 +350,7 @@ class TestEIP(cloudstackTestCase):
|
||||
def test_02_acquire_ip_enable_static_nat(self):
|
||||
"""Test associate new IP and enable static NAT for new IP and the VM
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -494,7 +494,7 @@ class TestEIP(cloudstackTestCase):
|
||||
def test_03_disable_static_nat(self):
|
||||
"""Test disable static NAT and release EIP acquired
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -693,7 +693,7 @@ class TestEIP(cloudstackTestCase):
|
||||
def test_04_disable_static_nat_system(self):
|
||||
"""Test disable static NAT with system = True
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -762,7 +762,7 @@ class TestEIP(cloudstackTestCase):
|
||||
def test_05_destroy_instance(self):
|
||||
"""Test EIO after destroying instance
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1000,7 +1000,7 @@ class TestELB(cloudstackTestCase):
|
||||
def test_01_elb_create(self):
|
||||
"""Test ELB by creating a LB rule
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1173,7 +1173,7 @@ class TestELB(cloudstackTestCase):
|
||||
def test_02_elb_acquire_and_create(self):
|
||||
"""Test ELB by acquiring IP and then creating a LB rule
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1321,7 +1321,7 @@ class TestELB(cloudstackTestCase):
|
||||
def test_03_elb_delete_lb_system(self):
|
||||
"""Test delete LB rule generated with public IP with is_system = 1
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
@ -1425,7 +1425,7 @@ class TestELB(cloudstackTestCase):
|
||||
def test_04_delete_lb_on_eip(self):
|
||||
"""Test delete LB rule generated on EIP
|
||||
"""
|
||||
|
||||
|
||||
tags = ["eip"]
|
||||
|
||||
# Validate the following
|
||||
|
||||
@ -47,8 +47,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"lbrule": {
|
||||
"name": "SSH",
|
||||
@ -62,7 +62,7 @@ class Services:
|
||||
"publicport": 22,
|
||||
"protocol": "TCP"
|
||||
},
|
||||
"fw_rule":{
|
||||
"fw_rule": {
|
||||
"startport": 1,
|
||||
"endport": 6000,
|
||||
"cidr": '55.55.0.0/11',
|
||||
@ -86,7 +86,7 @@ class Services:
|
||||
"ostypeid": '946b031b-0e10-4f4a-a3fc-d212ae2ea07f',
|
||||
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
|
||||
"hypervisor": 'XenServer',
|
||||
"format" : 'VHD',
|
||||
"format": 'VHD',
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": True,
|
||||
@ -96,7 +96,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 100,
|
||||
"mode":'advanced'
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ class TestHighAvailability(cloudstackTestCase):
|
||||
def test_01_host_maintenance_mode(self):
|
||||
"""Test host maintenance mode
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
@ -575,7 +575,7 @@ class TestHighAvailability(cloudstackTestCase):
|
||||
def test_02_host_maintenance_mode_with_activities(self):
|
||||
"""Test host maintenance mode with activities
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
@ -714,7 +714,7 @@ class TestHighAvailability(cloudstackTestCase):
|
||||
self.fail("SSH Access failed for %s: %s" % \
|
||||
(virtual_machine.ipaddress, e)
|
||||
)
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=virtual_machine.id,
|
||||
@ -883,7 +883,7 @@ class TestHighAvailability(cloudstackTestCase):
|
||||
self.apiclient.cancelHostMaintenance(cmd)
|
||||
self.debug("Maintenance mode canceled for host: %s" % first_host)
|
||||
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=virtual_machine_2.id,
|
||||
|
||||
@ -47,8 +47,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"network_offering": {
|
||||
"name": 'Network offering-VR services',
|
||||
@ -57,16 +57,16 @@ class Services:
|
||||
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
|
||||
"traffictype": 'GUEST',
|
||||
"availability": 'Optional',
|
||||
"serviceProviderList" : {
|
||||
"serviceProviderList": {
|
||||
"Dhcp": 'VirtualRouter',
|
||||
"Dns": 'VirtualRouter',
|
||||
"SourceNat": 'VirtualRouter',
|
||||
"PortForwarding": 'VirtualRouter',
|
||||
"Vpn": 'VirtualRouter',
|
||||
"Firewall": 'VirtualRouter',
|
||||
"Lb": 'VirtualRouter',
|
||||
"UserData": 'VirtualRouter',
|
||||
"StaticNat": 'VirtualRouter',
|
||||
"Vpn": 'VirtualRouter',
|
||||
"Firewall": 'VirtualRouter',
|
||||
"Lb": 'VirtualRouter',
|
||||
"UserData": 'VirtualRouter',
|
||||
"StaticNat": 'VirtualRouter',
|
||||
},
|
||||
},
|
||||
"network_offering_netscaler": {
|
||||
@ -76,7 +76,7 @@ class Services:
|
||||
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
|
||||
"traffictype": 'GUEST',
|
||||
"availability": 'Optional',
|
||||
"serviceProviderList" : {
|
||||
"serviceProviderList": {
|
||||
"Dhcp": 'VirtualRouter',
|
||||
"Dns": 'VirtualRouter',
|
||||
"SourceNat": 'VirtualRouter',
|
||||
@ -118,7 +118,7 @@ class Services:
|
||||
"publicport": 66,
|
||||
"protocol": "TCP"
|
||||
},
|
||||
"fw_rule":{
|
||||
"fw_rule": {
|
||||
"startport": 1,
|
||||
"endport": 6000,
|
||||
"cidr": '55.55.0.0/11',
|
||||
@ -140,7 +140,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode":'advanced'
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
@ -212,7 +212,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
def test_01_network_off_without_conserve_mode(self):
|
||||
"""Test Network offering with Conserve mode off and VR - All services
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced"]
|
||||
|
||||
# Validate the following
|
||||
@ -245,7 +245,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
|
||||
self.debug("Created n/w offering with ID: %s" %
|
||||
self.network_offering.id)
|
||||
# Enable Network offering
|
||||
# Enable Network offering
|
||||
self.network_offering.update(self.apiclient, state='Enabled')
|
||||
|
||||
# Creating network using the network offering created
|
||||
@ -257,7 +257,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
accountid=self.account.account.name,
|
||||
domainid=self.account.account.domainid,
|
||||
networkofferingid=self.network_offering.id,
|
||||
zoneid=self.zone.id
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self.debug("Created network with ID: %s" % self.network.id)
|
||||
|
||||
@ -334,7 +334,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
ip_with_nat_rule.ipaddress.ipaddress)
|
||||
NATRule.create(
|
||||
self.apiclient,
|
||||
virtual_machine,
|
||||
virtual_machine,
|
||||
self.services["natrule"],
|
||||
ipaddressid=ip_with_nat_rule.ipaddress.id
|
||||
)
|
||||
@ -457,7 +457,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
def test_02_network_off_with_conserve_mode(self):
|
||||
"""Test Network offering with Conserve mode ON and VR - All services
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advanced"]
|
||||
|
||||
# Validate the following
|
||||
@ -488,7 +488,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
|
||||
self.debug("Created n/w offering with ID: %s" %
|
||||
self.network_offering.id)
|
||||
# Enable Network offering
|
||||
# Enable Network offering
|
||||
self.network_offering.update(self.apiclient, state='Enabled')
|
||||
|
||||
# Creating network using the network offering created
|
||||
@ -500,7 +500,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
accountid=self.account.account.name,
|
||||
domainid=self.account.account.domainid,
|
||||
networkofferingid=self.network_offering.id,
|
||||
zoneid=self.zone.id
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self.debug("Created network with ID: %s" % self.network.id)
|
||||
|
||||
@ -705,7 +705,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
vpns = Vpn.list(
|
||||
self.apiclient,
|
||||
publicipid=src_nat.id,
|
||||
listall=True,
|
||||
listall=True,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
@ -790,7 +790,7 @@ class TestNOWithNetscaler(cloudstackTestCase):
|
||||
def test_01_network_off_without_conserve_mode(self):
|
||||
"""Test Nw off with Conserve mode off, VR-All services, LB-netscaler
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advancedns"]
|
||||
|
||||
# Validate the following
|
||||
@ -802,14 +802,13 @@ class TestNOWithNetscaler(cloudstackTestCase):
|
||||
# 5. On an ipaddress that has Lb rules , we should NOT allow firewall
|
||||
# rules to be programmed.
|
||||
# 6. On an ipaddress that has Lb rules , we should NOT allow PF rules
|
||||
# to be programmed.
|
||||
# to be programmed.
|
||||
# 7. We should be allowed to program multiple PF rules on the same Ip
|
||||
# address on different public ports.
|
||||
# 8. We should be allowed to program multiple LB rules on the same Ip
|
||||
# address for different public port ranges.
|
||||
# address for different public port ranges.
|
||||
# 9. On source NAT ipaddress, we should NOT be allowed to Enable VPN.
|
||||
|
||||
|
||||
# Create a network offering with all virtual router services enabled
|
||||
self.debug(
|
||||
"Creating n/w offering with all services in VR & conserve mode:ON"
|
||||
@ -897,7 +896,7 @@ class TestNOWithNetscaler(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Creating firewall rule on source NAT: %s" %
|
||||
src_nat.ipaddress)
|
||||
#Create Firewall rule on source NAT
|
||||
#Create Firewall rule on source NAT
|
||||
fw_rule = FireWallRule.create(
|
||||
self.apiclient,
|
||||
ipaddressid=src_nat.id,
|
||||
@ -1060,7 +1059,7 @@ class TestNOWithNetscaler(cloudstackTestCase):
|
||||
def test_02_network_off_with_conserve_mode_netscaler(self):
|
||||
"""Test NW off with Conserve mode ON, LB-Netscaler and VR-All services
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advancedns"]
|
||||
|
||||
# Validate the following
|
||||
@ -1073,14 +1072,13 @@ class TestNOWithNetscaler(cloudstackTestCase):
|
||||
# 5. On an ipaddress that has Lb rules , we should NOT allow firewall
|
||||
# rules to be programmed.
|
||||
# 6. On an ipaddress that has Lb rules , we should NOT allow PF rules
|
||||
# to be programmed.
|
||||
# to be programmed.
|
||||
# 7. We should be allowed to program multiple PF rules on the same Ip
|
||||
# address on different public ports.
|
||||
# 8. We should be allowed to program multiple LB rules on the same Ip
|
||||
# address for different public port ranges.
|
||||
# address for different public port ranges.
|
||||
# 9. On source NAT ipaddress, we should be allowed to Enable VPN.
|
||||
|
||||
|
||||
# Create a network offering with all virtual router services enabled
|
||||
self.debug(
|
||||
"Creating n/w offering with all services in VR & conserve mode:ON"
|
||||
@ -1436,7 +1434,7 @@ class TestNetworkUpgrade(cloudstackTestCase):
|
||||
def test_01_nwupgrade_netscaler_conserve_on(self):
|
||||
"""Test Nw upgrade to netscaler lb service and conserve mode ON
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advancedns"]
|
||||
|
||||
# Validate the following
|
||||
@ -1635,7 +1633,7 @@ class TestNetworkUpgrade(cloudstackTestCase):
|
||||
def test_02_nwupgrade_netscaler_conserve_off(self):
|
||||
"""Test Nw upgrade to netscaler lb service and conserve mode OFF
|
||||
"""
|
||||
|
||||
|
||||
tags = ["advancedns"]
|
||||
|
||||
# Validate the following
|
||||
|
||||
@ -68,8 +68,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"virtual_machine": {
|
||||
"displayname": "Test VM",
|
||||
@ -89,7 +89,7 @@ class Services:
|
||||
"ostypeid": 'f9b709f2-e0fc-4c0f-80f1-b0494168f58d',
|
||||
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
|
||||
"hypervisor": 'XenServer',
|
||||
"format" : 'VHD',
|
||||
"format": 'VHD',
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": True,
|
||||
@ -107,7 +107,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode":'advanced'
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
@ -169,11 +169,14 @@ class TestUserProjectCreation(cloudstackTestCase):
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
|
||||
def test_01_admin_project_creation(self):
|
||||
"""Test create project as a domain admin and domain user
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "basic", "sg", "eip", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Check if 'allow.user.create.projects' configuration is true
|
||||
# 2. Create a Project as domain admin
|
||||
@ -207,9 +210,9 @@ class TestUserProjectCreation(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -243,9 +246,9 @@ class TestUserProjectCreation(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain user with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -263,6 +266,7 @@ class TestUserProjectCreation(cloudstackTestCase):
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
return
|
||||
|
||||
@unittest.skip("Known bug-able to create project as a domain user")
|
||||
def test_02_user_project_creation(self):
|
||||
"""Test create project as a domain admin and domain user
|
||||
@ -301,9 +305,9 @@ class TestUserProjectCreation(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -346,24 +350,24 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
|
||||
|
||||
cls.account = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["account"],
|
||||
admin=True,
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
|
||||
|
||||
cls.user = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["user"],
|
||||
admin=True,
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
|
||||
|
||||
cls._cleanup = [cls.account, cls.user]
|
||||
return
|
||||
|
||||
@ -390,14 +394,17 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||
return
|
||||
|
||||
|
||||
def test_03_add_user_to_project(self):
|
||||
"""Add user to project when 'project.invite.required' is false"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "basic", "sg", "eip", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following:
|
||||
# 1. Create a Project
|
||||
# 2. Add users to the project. Verify user is added to project
|
||||
# as regular user
|
||||
# as regular user
|
||||
|
||||
# Verify 'project.invite.required' is set to false
|
||||
configs = Configurations.list(
|
||||
@ -427,9 +434,9 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -458,14 +465,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = Project.listAccounts(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
account=self.user.account.name,
|
||||
)
|
||||
@ -475,20 +482,20 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.role,
|
||||
'Regular',
|
||||
"Newly added user is not added as a regular user"
|
||||
)
|
||||
|
||||
|
||||
return
|
||||
|
||||
def test_04_add_user_to_project(self):
|
||||
@ -524,12 +531,12 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
)
|
||||
# Cleanup created project at end of test
|
||||
self.cleanup.append(project)
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -558,11 +565,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = ProjectInvitation.list(
|
||||
self.apiclient,
|
||||
@ -575,14 +582,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Pending',
|
||||
@ -595,11 +602,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
|
||||
# Validate the following:
|
||||
# 1. Set configuration to 5 mins
|
||||
# 2. Create a Project
|
||||
# 2. Create a Project
|
||||
# 3. Add users to the project
|
||||
# 4. As a user accept invitation within 5 mins. Verify invitation is
|
||||
# accepted and user become regular user of project
|
||||
|
||||
|
||||
# Verify 'project.invite.required' is set to false
|
||||
configs = Configurations.list(
|
||||
self.apiclient,
|
||||
@ -615,7 +622,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
int(config.value),
|
||||
self.services["configs"]["project.invite.timeout"],
|
||||
"'project.invite.timeout' should be %s" %
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
)
|
||||
|
||||
# Create project as a domain admin
|
||||
@ -627,12 +634,12 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
)
|
||||
# Cleanup created project at end of test
|
||||
self.cleanup.append(project)
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -661,11 +668,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = ProjectInvitation.list(
|
||||
self.apiclient,
|
||||
@ -678,24 +685,24 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Pending',
|
||||
"Newly added user is not added as a regular user"
|
||||
)
|
||||
|
||||
|
||||
# Accept the invite
|
||||
ProjectInvitation.update(
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
projectid=project.id,
|
||||
accept=True,
|
||||
account=self.user.account.name
|
||||
)
|
||||
@ -706,7 +713,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = Project.listAccounts(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
account=self.user.account.name,
|
||||
)
|
||||
@ -716,14 +723,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.role,
|
||||
'Regular',
|
||||
@ -736,11 +743,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
|
||||
# Validate the following:
|
||||
# 1. Set configuration to 5 mins
|
||||
# 2. Create a Project
|
||||
# 2. Create a Project
|
||||
# 3. Add users to the project
|
||||
# 4. As a user accept invitation after 5 mins. Verify invitation is
|
||||
# not accepted and is shown as expired
|
||||
|
||||
|
||||
# Verify 'project.invite.required' is set to false
|
||||
configs = Configurations.list(
|
||||
self.apiclient,
|
||||
@ -756,7 +763,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
int(config.value),
|
||||
self.services["configs"]["project.invite.timeout"],
|
||||
"'project.invite.timeout' should be %s" %
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
)
|
||||
|
||||
# Create project as a domain admin
|
||||
@ -768,12 +775,12 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
)
|
||||
# Cleanup created project at end of test
|
||||
self.cleanup.append(project)
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -802,11 +809,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = ProjectInvitation.list(
|
||||
self.apiclient,
|
||||
@ -819,20 +826,20 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Pending',
|
||||
"Newly added user is not added as a regular user"
|
||||
)
|
||||
|
||||
|
||||
# sleep for 'project.invite.timeout' * 2 interval to wait for invite
|
||||
# to expire
|
||||
time.sleep(int(config.value) * 2)
|
||||
@ -841,7 +848,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
# Accept the invite
|
||||
ProjectInvitation.update(
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
projectid=project.id,
|
||||
accept=True,
|
||||
account=self.user.account.name
|
||||
)
|
||||
@ -862,14 +869,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Expired',
|
||||
@ -882,7 +889,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
|
||||
# Validate the following:
|
||||
# 1. Set configuration to 5 mins
|
||||
# 2. Create a Project
|
||||
# 2. Create a Project
|
||||
# 3. Add users to the project
|
||||
# 4. As a user accept invitation after 5 mins.
|
||||
# 5. Resend the invitation
|
||||
@ -903,7 +910,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
int(config.value),
|
||||
self.services["configs"]["project.invite.timeout"],
|
||||
"'project.invite.timeout' should be %s" %
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
)
|
||||
|
||||
# Create project as a domain admin
|
||||
@ -915,12 +922,12 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
)
|
||||
# Cleanup created project at end of test
|
||||
self.cleanup.append(project)
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -949,11 +956,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = ProjectInvitation.list(
|
||||
self.apiclient,
|
||||
@ -966,20 +973,20 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Pending',
|
||||
"Newly added user is not added as a regular user"
|
||||
)
|
||||
|
||||
|
||||
# sleep for 'project.invite.timeout' * 2 interval to wait for invite
|
||||
# to expire
|
||||
time.sleep(int(config.value) * 2)
|
||||
@ -990,11 +997,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = ProjectInvitation.list(
|
||||
self.apiclient,
|
||||
@ -1007,14 +1014,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Pending',
|
||||
@ -1027,7 +1034,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
|
||||
# Validate the following:
|
||||
# 1. Set configuration to 5 mins
|
||||
# 2. Create a Project
|
||||
# 2. Create a Project
|
||||
# 3. Add users to the project
|
||||
# 4. As a user decline invitation within 5 mins.
|
||||
# 5. Verify invitation is rejected and user doesn't become regular
|
||||
@ -1048,7 +1055,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
int(config.value),
|
||||
self.services["configs"]["project.invite.timeout"],
|
||||
"'project.invite.timeout' should be %s" %
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
)
|
||||
|
||||
# Create project as a domain admin
|
||||
@ -1060,12 +1067,12 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
)
|
||||
# Cleanup created project at end of test
|
||||
self.cleanup.append(project)
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -1094,11 +1101,11 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.user.account.email
|
||||
)
|
||||
|
||||
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = ProjectInvitation.list(
|
||||
self.apiclient,
|
||||
@ -1111,14 +1118,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
True,
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_projects_reponse),
|
||||
0,
|
||||
"Check list project response returns a valid project"
|
||||
)
|
||||
account = accounts_reponse[0]
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
account.state,
|
||||
'Pending',
|
||||
@ -1127,7 +1134,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
# Accept the invite
|
||||
ProjectInvitation.update(
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
projectid=project.id,
|
||||
accept=False,
|
||||
account=self.user.account.name
|
||||
)
|
||||
@ -1138,7 +1145,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
))
|
||||
# listProjectAccount to verify the user is added to project or not
|
||||
accounts_reponse = Project.listAccounts(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
account=self.user.account.name,
|
||||
)
|
||||
@ -1148,13 +1155,14 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
"Check for a valid list accounts response"
|
||||
)
|
||||
return
|
||||
|
||||
@unittest.skip("Requires SMPT configs")
|
||||
def test_09_invite_to_project_by_email(self):
|
||||
"""Test invite user to project by email"""
|
||||
|
||||
# Validate the following:
|
||||
# 1. Set configuration to 5 mins
|
||||
# 2. Create a Project
|
||||
# 2. Create a Project
|
||||
# 3. Add users to the project
|
||||
# 4. As a user decline invitation within 5 mins.
|
||||
# 5. Verify invitation is rejected and user doesn't become regular
|
||||
@ -1175,7 +1183,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
int(config.value),
|
||||
self.services["configs"]["project.invite.timeout"],
|
||||
"'project.invite.timeout' should be %s" %
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
self.services["configs"]["project.invite.timeout"]
|
||||
)
|
||||
|
||||
# Create project as a domain admin
|
||||
@ -1187,12 +1195,12 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
||||
)
|
||||
# Cleanup created project at end of test
|
||||
self.cleanup.append(project)
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
|
||||
@ -25,6 +25,7 @@ from integration.lib.base import *
|
||||
from integration.lib.common import *
|
||||
import datetime
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Resource Limits Services
|
||||
"""
|
||||
@ -60,8 +61,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Tiny Disk Offering",
|
||||
@ -100,13 +101,13 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.api_client = super(
|
||||
TestProjectLimits,
|
||||
TestProjectLimits,
|
||||
cls
|
||||
).getClsTestClient().getApiClient()
|
||||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = Domain.create(
|
||||
cls.api_client,
|
||||
@ -125,10 +126,10 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
cls._cleanup = [
|
||||
cls.admin,
|
||||
cls.user,
|
||||
cls.domain
|
||||
]
|
||||
cls.admin,
|
||||
cls.user,
|
||||
cls.domain
|
||||
]
|
||||
return
|
||||
|
||||
@classmethod
|
||||
@ -183,9 +184,9 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -223,7 +224,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
)
|
||||
|
||||
# Reduce resource limits for project
|
||||
# Resource: 0 - Instance. Number of instances a user can create.
|
||||
# Resource: 0 - Instance. Number of instances a user can create.
|
||||
# Resource: 1 - IP. Number of public IP addresses a user can own.
|
||||
# Resource: 2 - Volume. Number of disk volumes a user can create.
|
||||
# Resource: 3 - Snapshot. Number of snapshots a user can create.
|
||||
@ -261,7 +262,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
1,
|
||||
"Resource limit should be updated to 1"
|
||||
)
|
||||
|
||||
|
||||
# Get the resource limits for domain
|
||||
resource_limits = list_resource_limits(
|
||||
self.apiclient,
|
||||
@ -277,7 +278,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
0,
|
||||
"List resource API response should not be empty"
|
||||
)
|
||||
|
||||
|
||||
for resource in resource_limits:
|
||||
# Update domain resource limits to 2
|
||||
update_resource_limit(
|
||||
@ -300,6 +301,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
projectid=project.id
|
||||
)
|
||||
return
|
||||
|
||||
@unittest.skip("No provision for updating resource limits from account through API")
|
||||
def test_02_project_limits_normal_user(self):
|
||||
""" Test project limits
|
||||
@ -323,9 +325,9 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -363,7 +365,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
)
|
||||
|
||||
# Reduce resource limits for project
|
||||
# Resource: 0 - Instance. Number of instances a user can create.
|
||||
# Resource: 0 - Instance. Number of instances a user can create.
|
||||
# Resource: 1 - IP. Number of public IP addresses a user can own.
|
||||
# Resource: 2 - Volume. Number of disk volumes a user can create.
|
||||
# Resource: 3 - Snapshot. Number of snapshots a user can create.
|
||||
@ -401,7 +403,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
1,
|
||||
"Resource limit should be updated to 1"
|
||||
)
|
||||
|
||||
|
||||
self.debug("Adding %s user to project: %s" % (
|
||||
self.user.account.name,
|
||||
project.name
|
||||
@ -409,10 +411,10 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
|
||||
# Add user to the project
|
||||
project.addAccount(
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
self.apiclient,
|
||||
self.user.account.name,
|
||||
)
|
||||
|
||||
|
||||
# Get the resource limits for domain
|
||||
resource_limits = list_resource_limits(
|
||||
self.apiclient,
|
||||
@ -428,7 +430,7 @@ class TestProjectLimits(cloudstackTestCase):
|
||||
0,
|
||||
"List resource API response should not be empty"
|
||||
)
|
||||
|
||||
|
||||
for resource in resource_limits:
|
||||
#with self.assertRaises(Exception):
|
||||
self.debug(
|
||||
@ -535,12 +537,12 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
# should be raised
|
||||
|
||||
self.debug(
|
||||
"Updating instance resource limits for project: %s" %
|
||||
"Updating instance resource limits for project: %s" %
|
||||
self.project.id)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
0, # Instance
|
||||
0, # Instance
|
||||
max=2,
|
||||
projectid=self.project.id
|
||||
)
|
||||
@ -589,7 +591,11 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
def test_04_publicip_per_project(self):
|
||||
"""Test Public IP limit per project
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "eip", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. set max no of IPs per project to 2.
|
||||
# 2. Create an account in this domain
|
||||
@ -599,12 +605,12 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
# appropriate error and an alert should be generated.
|
||||
|
||||
self.debug(
|
||||
"Updating public IP resource limits for project: %s" %
|
||||
"Updating public IP resource limits for project: %s" %
|
||||
self.project.id)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
1, # Public Ip
|
||||
1, # Public Ip
|
||||
max=2,
|
||||
projectid=self.project.id
|
||||
)
|
||||
@ -625,7 +631,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
"Check VM state is Running or not"
|
||||
)
|
||||
networks = Network.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
projectid=self.project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -640,7 +646,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
"Check list networks response returns a valid network"
|
||||
)
|
||||
network = networks[0]
|
||||
self.debug("Associating public IP for project: %s" %
|
||||
self.debug("Associating public IP for project: %s" %
|
||||
self.project.id)
|
||||
public_ip_1 = PublicIPAddress.create(
|
||||
self.apiclient,
|
||||
@ -679,16 +685,16 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
# 1. set max no of snapshots per project to 1.
|
||||
# 2. Create one snapshot in the project. Snapshot should be
|
||||
# successfully created
|
||||
# 5. Try to create another snapshot in this project. It should give
|
||||
# 5. Try to create another snapshot in this project. It should give
|
||||
# user an appropriate error and an alert should be generated.
|
||||
|
||||
self.debug(
|
||||
"Updating snapshot resource limits for project: %s" %
|
||||
"Updating snapshot resource limits for project: %s" %
|
||||
self.project.id)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
3, # Snapshot
|
||||
3, # Snapshot
|
||||
max=1,
|
||||
projectid=self.project.id
|
||||
)
|
||||
@ -760,12 +766,12 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
# should be generated.
|
||||
|
||||
self.debug(
|
||||
"Updating volume resource limits for project: %s" %
|
||||
"Updating volume resource limits for project: %s" %
|
||||
self.project.id)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
2, # Volume
|
||||
2, # Volume
|
||||
max=2,
|
||||
projectid=self.project.id
|
||||
)
|
||||
@ -796,12 +802,17 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
projectid=self.project.id
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_07_templates_per_project(self):
|
||||
"""Test Templates limit per project
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
# Validate the following
|
||||
=======
|
||||
tags = ["advanced", "basic", "sg", "eip", "advancedns"]
|
||||
# Validate the following
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# 1. set max no of templates per project to 1.
|
||||
# 2. Create a template in this project. Both template should be in
|
||||
# ready state
|
||||
@ -811,17 +822,17 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
||||
# Reset the volume limits
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
2, # Volume
|
||||
2, # Volume
|
||||
max=5,
|
||||
projectid=self.project.id
|
||||
)
|
||||
self.debug(
|
||||
"Updating template resource limits for domain: %s" %
|
||||
"Updating template resource limits for domain: %s" %
|
||||
self.account.account.domainid)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
4, # Template
|
||||
4, # Template
|
||||
max=1,
|
||||
projectid=self.project.id
|
||||
)
|
||||
|
||||
@ -26,6 +26,7 @@ from integration.lib.common import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
import datetime
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Resource creation Services
|
||||
"""
|
||||
@ -61,8 +62,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Tiny Disk Offering",
|
||||
@ -97,7 +98,7 @@ class Services:
|
||||
"name": "Domainwide Network",
|
||||
"displaytext": "Domainwide Network",
|
||||
"gateway": '192.168.100.1',
|
||||
"netmask": '255.255.255.0',
|
||||
"netmask": '255.255.255.0',
|
||||
"startip": '192.168.100.200',
|
||||
"endip": '192.168.100.201',
|
||||
"vlan": 4001,
|
||||
@ -134,7 +135,7 @@ class Services:
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
|
||||
class TestOfferings(cloudstackTestCase):
|
||||
|
||||
@ -176,7 +177,7 @@ class TestOfferings(cloudstackTestCase):
|
||||
cls.services["disk_offering"]
|
||||
)
|
||||
cls._cleanup = [
|
||||
cls.account,
|
||||
cls.account,
|
||||
cls.service_offering,
|
||||
cls.disk_offering
|
||||
]
|
||||
@ -225,9 +226,9 @@ class TestOfferings(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
self.debug(
|
||||
"Deploying VM instance for project: %s & service offering: %s" % (
|
||||
"Deploying VM instance for project: %s & service offering: %s" % (
|
||||
project.id,
|
||||
self.service_offering.id
|
||||
))
|
||||
@ -267,9 +268,9 @@ class TestOfferings(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
list_projects_reponse = Project.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
id=project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -351,7 +352,7 @@ class TestNetwork(cloudstackTestCase):
|
||||
domainid=cls.domain.id
|
||||
)
|
||||
cls._cleanup = [
|
||||
cls.account,
|
||||
cls.account,
|
||||
cls.service_offering,
|
||||
]
|
||||
return
|
||||
@ -382,7 +383,11 @@ class TestNetwork(cloudstackTestCase):
|
||||
def test_03_network_create(self):
|
||||
""" Test create network in project
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Create a project.
|
||||
# 2. Add virtual/direct network resource to the project. User shared
|
||||
@ -403,7 +408,7 @@ class TestNetwork(cloudstackTestCase):
|
||||
self.cleanup.append(project)
|
||||
self.debug("Created project with domain admin with ID: %s" %
|
||||
project.id)
|
||||
|
||||
|
||||
network_offerings = list_network_offerings(
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
@ -412,36 +417,36 @@ class TestNetwork(cloudstackTestCase):
|
||||
state='Enabled'
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(network_offerings, list),
|
||||
True,
|
||||
isinstance(network_offerings, list),
|
||||
True,
|
||||
"Check for the valid network offerings"
|
||||
)
|
||||
network_offering = network_offerings[0]
|
||||
|
||||
self.debug("creating a network with network offering ID: %s" %
|
||||
|
||||
self.debug("creating a network with network offering ID: %s" %
|
||||
network_offering.id)
|
||||
self.services["network"]["zoneid"] = self.zone.id
|
||||
network = Network.create(
|
||||
self.apiclient,
|
||||
self.services["network"],
|
||||
networkofferingid=network_offering.id,
|
||||
self.apiclient,
|
||||
self.services["network"],
|
||||
networkofferingid=network_offering.id,
|
||||
projectid=project.id
|
||||
)
|
||||
self.debug("Created network with ID: %s" % network.id)
|
||||
networks= Network.list(
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
networks = Network.list(
|
||||
self.apiclient,
|
||||
projectid=project.id,
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(networks, list),
|
||||
True,
|
||||
isinstance(networks, list),
|
||||
True,
|
||||
"Check for the valid network list response"
|
||||
)
|
||||
network_response = networks[0]
|
||||
|
||||
|
||||
self.debug("Deploying VM with network: %s" % network.id)
|
||||
|
||||
|
||||
virtual_machine = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
self.services["server"],
|
||||
@ -466,24 +471,24 @@ class TestNetwork(cloudstackTestCase):
|
||||
displaytext='Offering for Shared networks'
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(network_offerings, list),
|
||||
True,
|
||||
isinstance(network_offerings, list),
|
||||
True,
|
||||
"Check for the valid network offerings"
|
||||
)
|
||||
network_offering = network_offerings[0]
|
||||
|
||||
self.debug("creating a shared network in domain: %s" %
|
||||
|
||||
self.debug("creating a shared network in domain: %s" %
|
||||
self.domain.id)
|
||||
domain_network = Network.create(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
self.services["domain_network"],
|
||||
domainid=self.domain.id,
|
||||
networkofferingid=network_offering.id,
|
||||
zoneid=self.zone.id
|
||||
zoneid=self.zone.id
|
||||
)
|
||||
self._cleanup.append(domain_network)
|
||||
self.debug("Created network with ID: %s" % domain_network.id)
|
||||
|
||||
|
||||
virtual_machine = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
self.services["server"],
|
||||
@ -586,14 +591,19 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_04_public_template_use_in_project(self):
|
||||
"""Test Templates creation in projects
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
# Validate the following
|
||||
=======
|
||||
tags = ["advanced", "basic", "sg", "eip", "advancedns"]
|
||||
# Validate the following
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# 1. Create a project
|
||||
# 2. Verify Public templates can be used without any restriction
|
||||
# 3. Verify that template created in project can be used in project
|
||||
# without any restrictions
|
||||
|
||||
self.debug("Deploying VM for with public template: %s" %
|
||||
|
||||
self.debug("Deploying VM for with public template: %s" %
|
||||
self.template.id)
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -645,15 +655,20 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_05_use_private_template_in_project(self):
|
||||
"""Test use of private template in a project
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
# Validate the following
|
||||
=======
|
||||
tags = ["advanced", "basic", "sg", "eip", "advancedns"]
|
||||
# Validate the following
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# 1. Create a project
|
||||
# 2. Verify that in order to use somebody’s Private template for vm
|
||||
# creation in the project, permission to use the template has to
|
||||
# be granted to the Project (use API “updateTemplatePermissions”
|
||||
# with project id to achieve that).
|
||||
|
||||
self.debug("Deploying VM for with public template: %s" %
|
||||
|
||||
self.debug("Deploying VM for with public template: %s" %
|
||||
self.template.id)
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -701,7 +716,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
True,
|
||||
"Check Template is in ready state or not"
|
||||
)
|
||||
|
||||
|
||||
# Update template permissions to grant permission to project
|
||||
self.debug(
|
||||
"Updating template permissions:%s to grant access to project: %s" % (
|
||||
@ -714,7 +729,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
op='add',
|
||||
projectids=self.project.id
|
||||
)
|
||||
self.debug("Deploying VM for with privileged template: %s" %
|
||||
self.debug("Deploying VM for with privileged template: %s" %
|
||||
self.template.id)
|
||||
virtual_machine_2 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -864,7 +879,7 @@ class TestSnapshots(cloudstackTestCase):
|
||||
True,
|
||||
"Check Snapshot state is Running or not"
|
||||
)
|
||||
|
||||
|
||||
snapshots = Snapshot.list(
|
||||
self.apiclient,
|
||||
account=self.account.account.name,
|
||||
@ -929,7 +944,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
serviceofferingid=cls.service_offering.id,
|
||||
projectid=cls.project.id
|
||||
)
|
||||
|
||||
|
||||
cls._cleanup = [
|
||||
cls.project,
|
||||
cls.service_offering,
|
||||
@ -964,7 +979,11 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
def test_07_associate_public_ip(self):
|
||||
"""Test associate public IP within the project
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "eip", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Create a project
|
||||
# 2. Add some public Ips to the project
|
||||
@ -972,7 +991,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
# inside project
|
||||
|
||||
networks = Network.list(
|
||||
self.apiclient,
|
||||
self.apiclient,
|
||||
projectid=self.project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -996,10 +1015,10 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
projectid=self.project.id
|
||||
)
|
||||
self.cleanup.append(public_ip)
|
||||
|
||||
|
||||
#Create NAT rule
|
||||
self.debug(
|
||||
"Creating a NAT rule within project, VM ID: %s" %
|
||||
"Creating a NAT rule within project, VM ID: %s" %
|
||||
self.virtual_machine.id)
|
||||
nat_rule = NATRule.create(
|
||||
self.apiclient,
|
||||
@ -1028,9 +1047,9 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
nat_rule.id,
|
||||
"Check Correct Port forwarding Rule is returned"
|
||||
)
|
||||
|
||||
|
||||
#Create Load Balancer rule and assign VMs to rule
|
||||
self.debug("Created LB rule for public IP: %s" %
|
||||
self.debug("Created LB rule for public IP: %s" %
|
||||
public_ip.ipaddress.ipaddress)
|
||||
lb_rule = LoadBalancerRule.create(
|
||||
self.apiclient,
|
||||
@ -1065,7 +1084,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
lb_rule.id,
|
||||
"Check List Load Balancer Rules returns valid Rule"
|
||||
)
|
||||
|
||||
|
||||
#Create Firewall rule with configurations from settings file
|
||||
fw_rule = FireWallRule.create(
|
||||
self.apiclient,
|
||||
@ -1077,7 +1096,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
projectid=self.project.id
|
||||
)
|
||||
self.debug("Created firewall rule: %s" % fw_rule.id)
|
||||
|
||||
|
||||
# After Router start, FW rule should be in Active state
|
||||
fw_rules = FireWallRule.list(
|
||||
self.apiclient,
|
||||
@ -1088,7 +1107,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
True,
|
||||
"Check for list FW rules response return valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
fw_rules[0].state,
|
||||
'Active',
|
||||
@ -1105,7 +1124,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
str(self.services["fw_rule"]["endport"]),
|
||||
"Check end port of firewall rule"
|
||||
)
|
||||
|
||||
|
||||
self.debug("Deploying VM for account: %s" % self.account.account.name)
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -1116,7 +1135,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
serviceofferingid=self.service_offering.id,
|
||||
)
|
||||
self.cleanup.append(virtual_machine_1)
|
||||
|
||||
|
||||
self.debug("VM state after deploy: %s" % virtual_machine_1.state)
|
||||
# Verify VM state
|
||||
self.assertEqual(
|
||||
@ -1124,7 +1143,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
'Running',
|
||||
"Check VM state is Running or not"
|
||||
)
|
||||
|
||||
|
||||
self.debug("Creating NAT rule for VM (ID: %s) outside project" %
|
||||
virtual_machine_1.id)
|
||||
with self.assertRaises(Exception):
|
||||
@ -1134,7 +1153,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
self.services["natrule"],
|
||||
public_ip.ipaddress.id,
|
||||
)
|
||||
|
||||
|
||||
self.debug("Creating LB rule for public IP: %s outside project" %
|
||||
public_ip.ipaddress.ipaddress)
|
||||
with self.assertRaises(Exception):
|
||||
@ -1160,7 +1179,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
||||
|
||||
|
||||
class TestSecurityGroup(cloudstackTestCase):
|
||||
|
||||
|
||||
def setUp(self):
|
||||
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
@ -1189,7 +1208,7 @@ class TestSecurityGroup(cloudstackTestCase):
|
||||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
@ -1198,7 +1217,7 @@ class TestSecurityGroup(cloudstackTestCase):
|
||||
cls.services["domainid"] = cls.domain.id
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
cls.services["server"]["template"] = template.id
|
||||
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
@ -1248,8 +1267,8 @@ class TestSecurityGroup(cloudstackTestCase):
|
||||
# to that project.
|
||||
|
||||
security_group = SecurityGroup.create(
|
||||
self.apiclient,
|
||||
self.services["security_group"],
|
||||
self.apiclient,
|
||||
self.services["security_group"],
|
||||
projectid=self.project.id
|
||||
)
|
||||
self.debug("Created security group with ID: %s" % security_group.id)
|
||||
@ -1263,16 +1282,16 @@ class TestSecurityGroup(cloudstackTestCase):
|
||||
True,
|
||||
"Check for list security groups response"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(sercurity_groups),
|
||||
0,
|
||||
len(sercurity_groups),
|
||||
0,
|
||||
"Check List Security groups response"
|
||||
)
|
||||
# Authorize Security group to SSH to VM
|
||||
ingress_rule = security_group.authorize(
|
||||
self.apiclient,
|
||||
self.services["security_group"],
|
||||
self.services["security_group"],
|
||||
projectid=self.project.id
|
||||
)
|
||||
self.assertEqual(
|
||||
@ -1280,9 +1299,9 @@ class TestSecurityGroup(cloudstackTestCase):
|
||||
True,
|
||||
"Check ingress rule created properly"
|
||||
)
|
||||
|
||||
|
||||
self.debug(
|
||||
"Authorizing ingress rule for sec group ID: %s for ssh access"
|
||||
"Authorizing ingress rule for sec group ID: %s for ssh access"
|
||||
% security_group.id)
|
||||
self.virtual_machine = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -1296,8 +1315,8 @@ class TestSecurityGroup(cloudstackTestCase):
|
||||
self.project.id
|
||||
))
|
||||
self.assertEqual(
|
||||
self.virtual_machine.state,
|
||||
'Running',
|
||||
self.virtual_machine.state,
|
||||
'Running',
|
||||
"VM state should be running after deployment"
|
||||
)
|
||||
# Deploy another VM with same security group outside the project
|
||||
|
||||
@ -26,6 +26,7 @@ from integration.lib.common import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
import datetime
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Snapshots Services
|
||||
"""
|
||||
@ -49,8 +50,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
@ -107,7 +108,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode":'advanced'
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
@ -141,14 +142,14 @@ class TestVmUsage(cloudstackTestCase):
|
||||
)
|
||||
|
||||
cls.services["account"] = cls.account.account.name
|
||||
|
||||
|
||||
cls.project = Project.create(
|
||||
cls.api_client,
|
||||
cls.services["project"],
|
||||
account=cls.account.account.name,
|
||||
domainid=cls.account.account.domainid
|
||||
)
|
||||
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
@ -206,17 +207,17 @@ class TestVmUsage(cloudstackTestCase):
|
||||
self.debug("Stopping the VM: %s" % self.virtual_machine.id)
|
||||
# Stop the VM
|
||||
self.virtual_machine.stop(self.apiclient)
|
||||
|
||||
|
||||
time.sleep(self.services["sleep"])
|
||||
# Destroy the VM
|
||||
self.debug("Destroying the VM: %s" % self.virtual_machine.id)
|
||||
self.virtual_machine.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -226,7 +227,7 @@ class TestVmUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -237,7 +238,7 @@ class TestVmUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -247,7 +248,7 @@ class TestVmUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -335,14 +336,14 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
)
|
||||
|
||||
cls.services["account"] = cls.account.account.name
|
||||
|
||||
|
||||
cls.project = Project.create(
|
||||
cls.api_client,
|
||||
cls.services["project"],
|
||||
account=cls.account.account.name,
|
||||
domainid=cls.account.account.domainid
|
||||
)
|
||||
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
@ -355,7 +356,7 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
projectid=cls.project.id
|
||||
)
|
||||
networks = Network.list(
|
||||
cls.api_client,
|
||||
cls.api_client,
|
||||
projectid=cls.project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -402,7 +403,7 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
return
|
||||
|
||||
def test_01_public_ip_usage(self):
|
||||
"""Test Assign new IP and verify usage calculation
|
||||
"""Test Assign new IP and verify usage calculation
|
||||
"""
|
||||
|
||||
# Validate the following
|
||||
@ -412,17 +413,17 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
# has IP.Release event for released IP for this account
|
||||
# 3. Delete the newly created account
|
||||
|
||||
self.debug("Deleting public IP: %s" %
|
||||
self.debug("Deleting public IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
|
||||
# Release one of the IP
|
||||
self.public_ip.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -442,12 +443,12 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(qresultset, list),
|
||||
True,
|
||||
@ -582,8 +583,8 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(volume_response, list),
|
||||
True,
|
||||
isinstance(volume_response, list),
|
||||
True,
|
||||
"Check for valid list volumes response"
|
||||
)
|
||||
data_volume = volume_response[0]
|
||||
@ -601,11 +602,11 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
cmd.id = data_volume.id
|
||||
self.apiclient.deleteVolume(cmd)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -615,7 +616,7 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -626,12 +627,12 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -642,7 +643,7 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
# Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
|
||||
@ -717,7 +718,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
type='ROOT',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(list_volume, list):
|
||||
if isinstance(list_volume, list):
|
||||
cls.volume = list_volume[0]
|
||||
else:
|
||||
raise Exception("List Volumes failed!")
|
||||
@ -775,11 +776,11 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
self.template.delete(self.apiclient)
|
||||
self.debug("Deleted template with ID: %s" % self.template.id)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -789,7 +790,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -800,7 +801,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -816,10 +817,10 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
0,
|
||||
"Check DB Query result set"
|
||||
)
|
||||
|
||||
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
|
||||
|
||||
# Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
|
||||
self.assertEqual(
|
||||
qresult.count('TEMPLATE.CREATE'),
|
||||
@ -846,7 +847,7 @@ class TestISOUsage(cloudstackTestCase):
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
cls.services["iso"]["zoneid"] = cls.zone.id
|
||||
# Create Account, ISO image etc
|
||||
# Create Account, ISO image etc
|
||||
cls.account = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["account"],
|
||||
@ -917,12 +918,12 @@ class TestISOUsage(cloudstackTestCase):
|
||||
# Delete the ISO
|
||||
self.debug("Deleting ISO with ID: %s" % self.iso.id)
|
||||
self.iso.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -932,7 +933,7 @@ class TestISOUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -943,18 +944,18 @@ class TestISOUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(qresultset, list),
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -984,7 +985,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.api_client = super(
|
||||
TestLBRuleUsage,
|
||||
TestLBRuleUsage,
|
||||
cls
|
||||
).getClsTestClient().getApiClient()
|
||||
cls.services = Services().services
|
||||
@ -1028,7 +1029,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
projectid=cls.project.id
|
||||
)
|
||||
networks = Network.list(
|
||||
cls.api_client,
|
||||
cls.api_client,
|
||||
projectid=cls.project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -1077,7 +1078,11 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
def test_01_lb_usage(self):
|
||||
"""Test Create/Delete a LB rule and verify correct usage is recorded
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "eip", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Acquire a IP for this account. lb.rule.create event is registered
|
||||
# for this account in cloud.usage_event table
|
||||
@ -1087,7 +1092,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
# 4. Delete this account.
|
||||
|
||||
self.debug(
|
||||
"Creating load balancer rule for public IP: %s" %
|
||||
"Creating load balancer rule for public IP: %s" %
|
||||
self.public_ip_1.ipaddress.id)
|
||||
#Create Load Balancer rule and assign VMs to rule
|
||||
lb_rule = LoadBalancerRule.create(
|
||||
@ -1100,11 +1105,11 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
|
||||
lb_rule.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -1114,7 +1119,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1125,7 +1130,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -1146,7 +1151,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
|
||||
# Check for LB.CREATE, LB.DELETE in cloud.usage_event table
|
||||
# Check for LB.CREATE, LB.DELETE in cloud.usage_event table
|
||||
self.assertEqual(
|
||||
qresult.count('LB.CREATE'),
|
||||
1,
|
||||
@ -1242,7 +1247,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
|
||||
def test_01_snapshot_usage(self):
|
||||
"""Test Create/Delete a manual snap shot and verify
|
||||
correct usage is recorded
|
||||
correct usage is recorded
|
||||
"""
|
||||
|
||||
# Validate the following
|
||||
@ -1252,7 +1257,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
# generated for the destroyed Snapshot
|
||||
# 3. Delete the account
|
||||
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
projectid=self.project.id,
|
||||
@ -1264,7 +1269,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check if list volumes return a valid data"
|
||||
)
|
||||
|
||||
|
||||
volume = volumes[0]
|
||||
|
||||
# Create a snapshot from the ROOTDISK
|
||||
@ -1275,11 +1280,11 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
self.debug("Deleting snapshot: %s" % snapshot.id)
|
||||
snapshot.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -1289,7 +1294,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1300,12 +1305,12 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(qresultset, list),
|
||||
True,
|
||||
@ -1386,7 +1391,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
projectid=cls.project.id
|
||||
)
|
||||
networks = Network.list(
|
||||
cls.api_client,
|
||||
cls.api_client,
|
||||
projectid=cls.project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -1435,7 +1440,11 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
def test_01_nat_usage(self):
|
||||
"""Test Create/Delete a PF rule and verify correct usage is recorded
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Acquire a IP for this account
|
||||
# 2. Create a PF rule on the IP associated with this account.
|
||||
@ -1445,7 +1454,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
# is registered for this account in cloud.usage_event table
|
||||
# 4. Delete this account.
|
||||
|
||||
self.debug("Creating NAT rule with public IP: %s" %
|
||||
self.debug("Creating NAT rule with public IP: %s" %
|
||||
self.public_ip_1.ipaddress.id)
|
||||
#Create NAT rule
|
||||
nat_rule = NATRule.create(
|
||||
@ -1459,11 +1468,11 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
self.debug("Deleting NAT rule: %s" % nat_rule.id)
|
||||
nat_rule.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -1473,7 +1482,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1484,7 +1493,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -1569,7 +1578,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
projectid=cls.project.id
|
||||
)
|
||||
networks = Network.list(
|
||||
cls.api_client,
|
||||
cls.api_client,
|
||||
projectid=cls.project.id,
|
||||
listall=True
|
||||
)
|
||||
@ -1618,16 +1627,20 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
def test_01_vpn_usage(self):
|
||||
"""Test Create/Delete a VPN and verify correct usage is recorded
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Enable VPN for this IP. vpn.add.user event is registered for this
|
||||
# account in cloud.usage_event table
|
||||
# 2. Add user to this vpn
|
||||
# 2. Add user to this vpn
|
||||
# 3. Delete user for this VPN. vpn.user.delete event is registered for
|
||||
# this account in cloud.usage_event table
|
||||
# 4. Delete this account.
|
||||
|
||||
self.debug("Created VPN with public IP: %s" %
|
||||
self.debug("Created VPN with public IP: %s" %
|
||||
self.public_ip.ipaddress.id)
|
||||
#Assign VPN to Public IP
|
||||
vpn = Vpn.create(
|
||||
@ -1636,7 +1649,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
projectid=self.project.id
|
||||
)
|
||||
|
||||
self.debug("Created VPN user for account: %s" %
|
||||
self.debug("Created VPN user for account: %s" %
|
||||
self.account.account.name)
|
||||
|
||||
vpnuser = VpnUser.create(
|
||||
@ -1654,11 +1667,11 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
self.debug("Deleting VPN: %s" % vpn.publicipid)
|
||||
vpn.delete(self.apiclient)
|
||||
|
||||
# Fetch project account ID from project UUID
|
||||
# Fetch project account ID from project UUID
|
||||
self.debug(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select project_account_id from projects where uuid = '%s';" \
|
||||
% self.project.id
|
||||
@ -1668,7 +1681,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1679,7 +1692,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -1698,8 +1711,8 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
|
||||
# Check for VPN user related events
|
||||
|
||||
# Check for VPN user related events
|
||||
self.assertEqual(
|
||||
qresult.count('VPN.USER.ADD'),
|
||||
1,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@ from integration.lib.base import *
|
||||
from integration.lib.common import *
|
||||
import datetime
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Resource Limits Services
|
||||
"""
|
||||
@ -47,8 +48,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
@ -81,6 +82,7 @@ class Services:
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -153,7 +155,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
def test_01_vm_per_account(self):
|
||||
"""Test VM limit per account
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Set user_vm=1 limit for account 1.
|
||||
@ -162,18 +164,18 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
# 3. Try to start 2 VMs account 2. Verify 2 SM are started properly
|
||||
|
||||
self.debug(
|
||||
"Updating instance resource limit for account: %s" %
|
||||
"Updating instance resource limit for account: %s" %
|
||||
self.account_1.account.name)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
0, # Instance
|
||||
0, # Instance
|
||||
account=self.account_1.account.name,
|
||||
domainid=self.account_1.account.domainid,
|
||||
max=1
|
||||
)
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_1.account.name)
|
||||
|
||||
virtual_machine = VirtualMachine.create(
|
||||
@ -204,7 +206,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
serviceofferingid=self.service_offering.id
|
||||
)
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_2.account.name)
|
||||
# Start 2 instances for account_2
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
@ -224,7 +226,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_2.account.name)
|
||||
virtual_machine_2 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -246,7 +248,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
def test_02_publicip_per_account(self):
|
||||
"""Test Public IP limit per account
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Set Public_IP= 2 limit for account 1.
|
||||
@ -256,21 +258,21 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
# denied to acquire more than one IP.
|
||||
# 5. Acquire 2 IP in account 2. Verify account 2 should be able to
|
||||
# Acquire IP without any warning
|
||||
|
||||
|
||||
self.debug(
|
||||
"Updating public IP resource limit for account: %s" %
|
||||
"Updating public IP resource limit for account: %s" %
|
||||
self.account_1.account.name)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
1, # Public Ip
|
||||
1, # Public Ip
|
||||
account=self.account_1.account.name,
|
||||
domainid=self.account_1.account.domainid,
|
||||
max=2
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_1.account.name)
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -289,7 +291,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_2.account.name)
|
||||
# Create VM for second account
|
||||
virtual_machine_2 = VirtualMachine.create(
|
||||
@ -308,7 +310,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
"Check VM state is Running or not"
|
||||
)
|
||||
self.debug(
|
||||
"Associating public IP for account: %s" %
|
||||
"Associating public IP for account: %s" %
|
||||
virtual_machine_1.account)
|
||||
public_ip_1 = PublicIPAddress.create(
|
||||
self.apiclient,
|
||||
@ -343,7 +345,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Associating public IP for account: %s" %
|
||||
"Associating public IP for account: %s" %
|
||||
virtual_machine_2.account)
|
||||
# Assign Public IP for account 2
|
||||
public_ip_3 = PublicIPAddress.create(
|
||||
@ -365,7 +367,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
"Check Public IP state is allocated or not"
|
||||
)
|
||||
self.debug(
|
||||
"Associating public IP for account: %s" %
|
||||
"Associating public IP for account: %s" %
|
||||
virtual_machine_2.account)
|
||||
public_ip_4 = PublicIPAddress.create(
|
||||
self.apiclient,
|
||||
@ -389,7 +391,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
def test_03_snapshots_per_account(self):
|
||||
"""Test Snapshot limit per account
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Set snapshot= 2 limit for account 1.
|
||||
@ -401,19 +403,19 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
# create snapshots without any warning
|
||||
|
||||
self.debug(
|
||||
"Updating public IP resource limit for account: %s" %
|
||||
"Updating public IP resource limit for account: %s" %
|
||||
self.account_1.account.name)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
3, # Snapshot
|
||||
3, # Snapshot
|
||||
account=self.account_1.account.name,
|
||||
domainid=self.account_1.account.domainid,
|
||||
max=1
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_1.account.name)
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -432,7 +434,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Deploying VM instance in account: %s" %
|
||||
"Deploying VM instance in account: %s" %
|
||||
self.account_1.account.name)
|
||||
# Create VM for second account
|
||||
virtual_machine_2 = VirtualMachine.create(
|
||||
@ -504,7 +506,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
"Check for list volume response return valid data"
|
||||
)
|
||||
volume = volumes[0]
|
||||
|
||||
|
||||
self.debug("Creating snapshot from volume: %s" % volumes[0].id)
|
||||
# Create a snapshot from the ROOTDISK (Account 2)
|
||||
snapshot_2 = Snapshot.create(self.apiclient,
|
||||
@ -545,7 +547,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
def test_04_volumes_per_account(self):
|
||||
"""Test Volumes limit per account
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Set volumes=2 limit for account 1.
|
||||
@ -557,12 +559,12 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
# create Volume without any warning
|
||||
|
||||
self.debug(
|
||||
"Updating volume resource limit for account: %s" %
|
||||
"Updating volume resource limit for account: %s" %
|
||||
self.account_1.account.name)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
2, # Volume
|
||||
2, # Volume
|
||||
account=self.account_1.account.name,
|
||||
domainid=self.account_1.account.domainid,
|
||||
max=2
|
||||
@ -687,7 +689,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
def test_05_templates_per_account(self):
|
||||
"""Test Templates limit per account
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Set templates=1 limit for account 1.
|
||||
@ -697,19 +699,19 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
# able to create template without any error
|
||||
|
||||
self.debug(
|
||||
"Updating template resource limit for account: %s" %
|
||||
"Updating template resource limit for account: %s" %
|
||||
self.account_1.account.name)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
4, # Template
|
||||
4, # Template
|
||||
account=self.account_1.account.name,
|
||||
domainid=self.account_1.account.domainid,
|
||||
max=1
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Updating volume resource limit for account: %s" %
|
||||
"Updating volume resource limit for account: %s" %
|
||||
self.account_1.account.name)
|
||||
virtual_machine_1 = VirtualMachine.create(
|
||||
self.apiclient,
|
||||
@ -728,7 +730,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Deploying virtual machine for account: %s" %
|
||||
"Deploying virtual machine for account: %s" %
|
||||
self.account_2.account.name)
|
||||
# Create VM for second account
|
||||
virtual_machine_2 = VirtualMachine.create(
|
||||
@ -917,7 +919,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
def test_01_vm_per_domain(self):
|
||||
"""Test VM limit per domain
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Set max VM per domain to 2
|
||||
@ -926,12 +928,12 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
# should be raised
|
||||
|
||||
self.debug(
|
||||
"Updating instance resource limits for domain: %s" %
|
||||
"Updating instance resource limits for domain: %s" %
|
||||
self.account.account.domainid)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
0, # Instance
|
||||
0, # Instance
|
||||
domainid=self.account.account.domainid,
|
||||
max=2
|
||||
)
|
||||
@ -983,7 +985,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
def test_01_publicip_per_domain(self):
|
||||
"""Test Public IP limit per domain
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. set max no of IPs per domain to 2.
|
||||
@ -994,12 +996,12 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
# appropriate error and an alert should be generated.
|
||||
|
||||
self.debug(
|
||||
"Updating public IP resource limits for domain: %s" %
|
||||
"Updating public IP resource limits for domain: %s" %
|
||||
self.account.account.domainid)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
1, # Public Ip
|
||||
1, # Public Ip
|
||||
domainid=self.account.account.domainid,
|
||||
max=2
|
||||
)
|
||||
@ -1053,7 +1055,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
def test_03_snapshots_per_domain(self):
|
||||
"""Test Snapshot limit per domain
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. set max no of snapshots per domain to 1.
|
||||
@ -1065,12 +1067,12 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
# user an appropriate error and an alert should be generated.
|
||||
|
||||
self.debug(
|
||||
"Updating snapshot resource limits for domain: %s" %
|
||||
"Updating snapshot resource limits for domain: %s" %
|
||||
self.account.account.domainid)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
3, # Snapshot
|
||||
3, # Snapshot
|
||||
domainid=self.account.account.domainid,
|
||||
max=1
|
||||
)
|
||||
@ -1136,7 +1138,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
def test_04_volumes_per_domain(self):
|
||||
"""Test Volumes limit per domain
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. set max no of volume per domain to 1.
|
||||
@ -1147,12 +1149,12 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
# should be generated.
|
||||
|
||||
self.debug(
|
||||
"Updating volume resource limits for domain: %s" %
|
||||
"Updating volume resource limits for domain: %s" %
|
||||
self.account.account.domainid)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
2, # Volume
|
||||
2, # Volume
|
||||
domainid=self.account.account.domainid,
|
||||
max=2
|
||||
)
|
||||
@ -1189,9 +1191,9 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
def test_05_templates_per_domain(self):
|
||||
"""Test Templates limit per domain
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# Validate the following
|
||||
# 1. set max no of templates per domain to 2.
|
||||
# 2. Create an account in this domain
|
||||
# 3. Create 2 templates in this domain. Both template should be in
|
||||
@ -1202,18 +1204,18 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
2, # Volume
|
||||
2, # Volume
|
||||
domainid=self.account.account.domainid,
|
||||
max=5
|
||||
)
|
||||
|
||||
self.debug(
|
||||
"Updating template resource limits for domain: %s" %
|
||||
"Updating template resource limits for domain: %s" %
|
||||
self.account.account.domainid)
|
||||
# Set usage_vm=1 for Account 1
|
||||
update_resource_limit(
|
||||
self.apiclient,
|
||||
4, # Template
|
||||
4, # Template
|
||||
domainid=self.account.account.domainid,
|
||||
max=2
|
||||
)
|
||||
@ -1301,14 +1303,14 @@ class TestResources(cloudstackTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.api_client = super(
|
||||
TestResources,
|
||||
TestResources,
|
||||
cls
|
||||
).getClsTestClient().getApiClient()
|
||||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls._cleanup = []
|
||||
return
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
@ -1335,16 +1337,16 @@ class TestResources(cloudstackTestCase):
|
||||
|
||||
def test_01_zones(self):
|
||||
"""Check the status of zones"""
|
||||
tags = ["advanced","advancedns"]
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. List zones
|
||||
# 2. Check allocation state is "enabled" or not
|
||||
|
||||
|
||||
zones = Zone.list(
|
||||
self.apiclient,
|
||||
id=self.zone.id,
|
||||
listall=True
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(zones, list),
|
||||
@ -1361,16 +1363,16 @@ class TestResources(cloudstackTestCase):
|
||||
|
||||
def test_02_pods(self):
|
||||
"""Check the status of pods"""
|
||||
tags = ["advanced","advancedns"]
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. List pods
|
||||
# 2. Check allocation state is "enabled" or not
|
||||
|
||||
|
||||
pods = Pod.list(
|
||||
self.apiclient,
|
||||
zoneid=self.zone.id,
|
||||
listall=True
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(pods, list),
|
||||
@ -1384,19 +1386,19 @@ class TestResources(cloudstackTestCase):
|
||||
"Pods allocation state should be enabled"
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_03_clusters(self):
|
||||
"""Check the status of clusters"""
|
||||
tags = ["advanced","advancedns"]
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. List clusters
|
||||
# 2. Check allocation state is "enabled" or not
|
||||
|
||||
|
||||
clusters = Cluster.list(
|
||||
self.apiclient,
|
||||
zoneid=self.zone.id,
|
||||
listall=True
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(clusters, list),
|
||||
@ -1410,20 +1412,20 @@ class TestResources(cloudstackTestCase):
|
||||
"Clusters allocation state should be enabled"
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_04_hosts(self):
|
||||
"""Check the status of hosts"""
|
||||
tags = ["advanced","advancedns"]
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. List hosts with type=Routing
|
||||
# 2. Check state is "Up" or not
|
||||
|
||||
|
||||
hosts = Host.list(
|
||||
self.apiclient,
|
||||
zoneid=self.zone.id,
|
||||
type='Routing',
|
||||
listall=True
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(hosts, list),
|
||||
@ -1437,19 +1439,19 @@ class TestResources(cloudstackTestCase):
|
||||
"Host should be in Up state and running"
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_05_storage_pools(self):
|
||||
"""Check the status of Storage pools"""
|
||||
tags = ["advanced","advancedns"]
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. List storage pools for the zone
|
||||
# 2. Check state is "enabled" or not
|
||||
|
||||
|
||||
storage_pools = StoragePool.list(
|
||||
self.apiclient,
|
||||
zoneid=self.zone.id,
|
||||
listall=True
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(storage_pools, list),
|
||||
@ -1463,20 +1465,20 @@ class TestResources(cloudstackTestCase):
|
||||
"storage pool should be in Up state and running"
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
def test_06_secondary_storage(self):
|
||||
"""Check the status of secondary storage"""
|
||||
tags = ["advanced","advancedns"]
|
||||
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. List secondary storage
|
||||
# 2. Check state is "Up" or not
|
||||
|
||||
|
||||
sec_storages = Host.list(
|
||||
self.apiclient,
|
||||
zoneid=self.zone.id,
|
||||
type='SecondaryStorage',
|
||||
listall=True
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(sec_storages, list),
|
||||
|
||||
@ -82,7 +82,7 @@ class Services:
|
||||
"publicport": 2222,
|
||||
"protocol": 'TCP',
|
||||
},
|
||||
"fw_rule":{
|
||||
"fw_rule": {
|
||||
"startport": 1,
|
||||
"endport": 6000,
|
||||
"cidr": '55.55.0.0/11',
|
||||
@ -90,7 +90,7 @@ class Services:
|
||||
},
|
||||
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9',
|
||||
# Used for Get_Template : CentOS 5.3 (64 bit)
|
||||
"mode": 'advanced', # Networking mode: Advanced, basic
|
||||
"mode": 'advanced', # Networking mode: Advanced, basic
|
||||
}
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ class TestRouterServices(cloudstackTestCase):
|
||||
# e. LB
|
||||
# f. VPN
|
||||
# g. userdata
|
||||
# 2. wait for router to start and guest network to be created
|
||||
# 2. wait for router to start and guest network to be created
|
||||
# a. listRouters account=user, domainid=1 (router state=Running)
|
||||
# b. listNetworks account=user domainid=1 (network state=Implemented)
|
||||
# c. listVirtualMachines account=user domainid=1 (VM state=Running)
|
||||
@ -318,7 +318,7 @@ class TestRouterServices(cloudstackTestCase):
|
||||
"""
|
||||
tags = ["advanced"]
|
||||
# Validate the following
|
||||
# 1. wait for router to start and guest network to be created
|
||||
# 1. wait for router to start and guest network to be created
|
||||
# a.listRouters account=user, domainid=1 (router state=Running)
|
||||
# b.listNetworks account=user domainid=1 (network state=Implemented)
|
||||
# c.listVirtualMachines account=user domainid=1 (VM states=Running)
|
||||
@ -436,9 +436,9 @@ class TestRouterServices(cloudstackTestCase):
|
||||
)
|
||||
self.debug("network.gc.wait: %s" % gcwait[0].value)
|
||||
|
||||
total_wait = int(gcinterval[0].value) + int (gcwait[0].value)
|
||||
total_wait = int(gcinterval[0].value) + int(gcwait[0].value)
|
||||
# Router is stopped after (network.gc.interval *2) time. Wait for
|
||||
# (network.gc.interval+network.gc.wait) * 2 for moving router to 'Stopped'
|
||||
# (network.gc.interval+network.gc.wait) * 2 for moving router to 'Stopped'
|
||||
time.sleep(total_wait * 2)
|
||||
|
||||
routers = list_routers(
|
||||
@ -580,7 +580,6 @@ class TestRouterServices(cloudstackTestCase):
|
||||
return
|
||||
|
||||
|
||||
|
||||
class TestRouterStopCreatePF(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -657,10 +656,10 @@ class TestRouterStopCreatePF(cloudstackTestCase):
|
||||
# 2. stopRouter for this account
|
||||
# 3. wait for listRouters to report Router as 'Stopped'
|
||||
# 4. listPublicIpAddresses account=user, domainid=1 - pick ipaddressid
|
||||
# 5. createPortForwardingRule (ipaddressid from step 5.)
|
||||
# 5. createPortForwardingRule (ipaddressid from step 5.)
|
||||
# a. for port 22 (ssh) for user VM deployed in step 1.
|
||||
# b. public port 222 , private port 22
|
||||
# 6. startRouter stopped for this account
|
||||
# 6. startRouter stopped for this account
|
||||
# 7. wait for listRouters to show router as Running
|
||||
|
||||
# Get router details associated for that account
|
||||
@ -720,7 +719,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
|
||||
)
|
||||
public_ip = public_ips[0]
|
||||
|
||||
# Open up firewall port for SSH
|
||||
# Open up firewall port for SSH
|
||||
fw_rule = FireWallRule.create(
|
||||
self.apiclient,
|
||||
ipaddressid=public_ip.id,
|
||||
@ -791,6 +790,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
class TestRouterStopCreateLB(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -923,8 +923,8 @@ class TestRouterStopCreateLB(cloudstackTestCase):
|
||||
"Check for list public IPs response return valid data"
|
||||
)
|
||||
public_ip = public_ips[0]
|
||||
|
||||
# Open up firewall port for SSH
|
||||
|
||||
# Open up firewall port for SSH
|
||||
fw_rule = FireWallRule.create(
|
||||
self.apiclient,
|
||||
ipaddressid=public_ip.id,
|
||||
@ -1076,7 +1076,7 @@ class TestRouterStopCreateFW(cloudstackTestCase):
|
||||
# (optional backend)
|
||||
# 3. verify on router using iptables -t nat -nvx if rules are applied
|
||||
|
||||
# Get the router details associated with account
|
||||
# Get the router details associated with account
|
||||
routers = list_routers(
|
||||
self.apiclient,
|
||||
account=self.account.account.name,
|
||||
@ -1223,4 +1223,3 @@ class TestRouterStopCreateFW(cloudstackTestCase):
|
||||
"Check public IP address"
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@ from integration.lib.base import *
|
||||
from integration.lib.common import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Snapshots Services
|
||||
"""
|
||||
@ -44,8 +45,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 200, # in MHz
|
||||
"memory": 256, # In MBs
|
||||
"cpuspeed": 200, # in MHz
|
||||
"memory": 256, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small Disk",
|
||||
@ -71,10 +72,10 @@ class Services:
|
||||
"recurring_snapshot": {
|
||||
"intervaltype": 'HOURLY',
|
||||
# Frequency of snapshots
|
||||
"maxsnaps": 1, # Should be min 2
|
||||
"maxsnaps": 1, # Should be min 2
|
||||
"schedule": 1,
|
||||
"timezone": 'US/Arizona',
|
||||
# Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
|
||||
# Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
|
||||
},
|
||||
"templates": {
|
||||
"displaytext": 'Template',
|
||||
@ -84,7 +85,7 @@ class Services:
|
||||
},
|
||||
"diskdevice": "/dev/xvda",
|
||||
"diskname": "TestDiskServ",
|
||||
"size": 1, # GBs
|
||||
"size": 1, # GBs
|
||||
|
||||
"mount_dir": "/mnt/tmp",
|
||||
"sub_dir": "test",
|
||||
@ -96,7 +97,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode" : 'advanced', # Networking mode: Advanced, Basic
|
||||
"mode": 'advanced', # Networking mode: Advanced, Basic
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +166,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
||||
def test_01_createVM_snapshotTemplate(self):
|
||||
"""Test create VM, Snapshot and Template
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. Deploy VM using default template, small service offering
|
||||
# and small data disk offering.
|
||||
@ -191,7 +192,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
||||
serviceofferingid=self.service_offering.id
|
||||
)
|
||||
self.debug("Created VM with ID: %s" % self.virtual_machine.id)
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=self.virtual_machine.id,
|
||||
@ -332,7 +333,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
||||
|
||||
export_path = '/'.join(parse_url[3:])
|
||||
# Export path: export/test
|
||||
|
||||
|
||||
# Sleep to ensure that snapshot is reflected in sec storage
|
||||
time.sleep(self.services["sleep"])
|
||||
try:
|
||||
@ -344,7 +345,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
||||
self.services["mgmt_server"]["password"],
|
||||
)
|
||||
|
||||
cmds = [
|
||||
cmds = [
|
||||
"mkdir -p %s" % self.services["mount_dir"],
|
||||
"mount %s/%s %s" % (
|
||||
sec_storage_ip,
|
||||
@ -361,7 +362,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
||||
self.debug("command: %s" % c)
|
||||
result = ssh_client.execute(c)
|
||||
self.debug("Result: %s" % result)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
self.fail("SSH failed for Management server: %s" %
|
||||
self.services["mgmt_server"]["ipaddress"])
|
||||
@ -379,7 +380,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("SSH failed for Management server: %s" %
|
||||
self.services["mgmt_server"]["ipaddress"])
|
||||
|
||||
|
||||
res = str(uuids)
|
||||
self.assertEqual(
|
||||
res.count(snapshot_uuid),
|
||||
@ -430,7 +431,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
domainid=cls.account.account.domainid,
|
||||
serviceofferingid=cls.service_offering.id
|
||||
)
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
cls.api_client,
|
||||
virtualmachineid=cls.virtual_machine.id,
|
||||
@ -473,7 +474,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
def test_02_accountSnapshotClean(self):
|
||||
"""Test snapshot cleanup after account deletion
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. listAccounts API should list out the newly created account
|
||||
# 2. listVirtualMachines() command should return the deployed VM.
|
||||
@ -518,7 +519,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
for virtual_machine in virtual_machines:
|
||||
self.debug("VM ID: %s, VM state: %s" % (
|
||||
virtual_machine.id,
|
||||
virtual_machine.state
|
||||
virtual_machine.state
|
||||
))
|
||||
self.assertEqual(
|
||||
virtual_machine.state,
|
||||
@ -591,7 +592,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
|
||||
export_path = '/'.join(parse_url[3:])
|
||||
# Export path: export/test
|
||||
|
||||
|
||||
# Sleep to ensure that snapshot is reflected in sec storage
|
||||
time.sleep(self.services["sleep"])
|
||||
try:
|
||||
@ -621,7 +622,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
self.debug("command: %s" % c)
|
||||
result = ssh_client.execute(c)
|
||||
self.debug("Result: %s" % result)
|
||||
|
||||
|
||||
uuids.append(result)
|
||||
|
||||
# Unmount the Sec Storage
|
||||
@ -633,14 +634,14 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
except Exception:
|
||||
self.fail("SSH failed for management server: %s" %
|
||||
self.services["mgmt_server"]["ipaddress"])
|
||||
|
||||
|
||||
res = str(uuids)
|
||||
self.assertEqual(
|
||||
res.count(snapshot_uuid),
|
||||
1,
|
||||
"Check snapshot UUID in secondary storage and database"
|
||||
)
|
||||
|
||||
|
||||
self.debug("Deleting account: %s" % self.account.account.name)
|
||||
# Delete account
|
||||
self.account.delete(self.apiclient)
|
||||
@ -655,7 +656,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
"Check list response returns a valid list"
|
||||
)
|
||||
self.debug("account.cleanup.interval: %s" % interval[0].value)
|
||||
|
||||
|
||||
# Wait for account cleanup interval
|
||||
time.sleep(int(interval[0].value) * 2)
|
||||
|
||||
@ -663,14 +664,14 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=self.account.account.id
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
accounts,
|
||||
None,
|
||||
"List accounts should return empty list after account deletion"
|
||||
)
|
||||
|
||||
uuids = []
|
||||
self.assertEqual(
|
||||
accounts,
|
||||
None,
|
||||
"List accounts should return empty list after account deletion"
|
||||
)
|
||||
|
||||
uuids = []
|
||||
for host in hosts:
|
||||
# hosts[0].name = "nfs://192.168.100.21/export/test"
|
||||
parse_url = (host.name).split('/')
|
||||
@ -684,7 +685,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
# Export path: export/test
|
||||
|
||||
try:
|
||||
cmds = [
|
||||
cmds = [
|
||||
"mount %s/%s %s" % (
|
||||
sec_storage_ip,
|
||||
export_path,
|
||||
@ -701,7 +702,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
self.debug("command: %s" % c)
|
||||
result = ssh_client.execute(c)
|
||||
self.debug("Result: %s" % result)
|
||||
|
||||
|
||||
uuids.append(result)
|
||||
# Unmount the Sec Storage
|
||||
cmds = [
|
||||
@ -715,7 +716,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
||||
except Exception:
|
||||
self.fail("SSH failed for management server: %s" %
|
||||
self.services["mgmt_server"]["ipaddress"])
|
||||
|
||||
|
||||
res = str(uuids)
|
||||
self.assertNotEqual(
|
||||
res.count(snapshot_uuid),
|
||||
@ -804,7 +805,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
||||
def test_03_snapshot_detachedDisk(self):
|
||||
"""Test snapshot from detached disk
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. login in VM and write some data on data disk(use fdisk to
|
||||
# partition datadisk,fdisk /dev/sdb, and make filesystem using
|
||||
@ -863,7 +864,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
||||
self.services["sub_lvl_dir2"],
|
||||
self.services["random_data"]
|
||||
),
|
||||
"sync",
|
||||
"sync",
|
||||
]
|
||||
for c in cmds:
|
||||
self.debug(ssh_client.execute(c))
|
||||
@ -908,7 +909,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("SSH failed for VM with IP: %s" %
|
||||
self.virtual_machine.ipaddress)
|
||||
|
||||
|
||||
# Fetch values from database
|
||||
qresultset = self.dbclient.execute(
|
||||
"select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
|
||||
@ -954,7 +955,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
||||
|
||||
export_path = '/'.join(parse_url[3:])
|
||||
# Export path: export/test
|
||||
|
||||
|
||||
# Sleep to ensure that snapshot is reflected in sec storage
|
||||
time.sleep(self.services["sleep"])
|
||||
try:
|
||||
@ -983,7 +984,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
||||
|
||||
for c in cmds:
|
||||
result = ssh_client.execute(c)
|
||||
|
||||
|
||||
uuids.append(result)
|
||||
# Unmount the Sec Storage
|
||||
cmds = [
|
||||
@ -994,7 +995,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("SSH failed for management server: %s" %
|
||||
self.services["mgmt_server"]["ipaddress"])
|
||||
|
||||
|
||||
res = str(uuids)
|
||||
self.assertEqual(
|
||||
res.count(snapshot_uuid),
|
||||
@ -1076,15 +1077,15 @@ class TestSnapshotLimit(cloudstackTestCase):
|
||||
def test_04_snapshot_limit(self):
|
||||
"""Test snapshot limit in snapshot policies
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. Perform hourly recurring snapshot on the root disk of VM and keep
|
||||
# the maxsnapshots as 1
|
||||
# 2. listSnapshots should list the snapshot that was created
|
||||
# snapshot folder in secondary storage should contain only one
|
||||
# 2. listSnapshots should list the snapshot that was created
|
||||
# snapshot folder in secondary storage should contain only one
|
||||
# snapshot image(/secondary/snapshots/$accountid/$volumeid/)
|
||||
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=self.virtual_machine.id,
|
||||
@ -1116,7 +1117,7 @@ class TestSnapshotLimit(cloudstackTestCase):
|
||||
True,
|
||||
"Check list response returns a valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
snapshot_policy,
|
||||
None,
|
||||
@ -1148,7 +1149,7 @@ class TestSnapshotLimit(cloudstackTestCase):
|
||||
snapshottype='RECURRING',
|
||||
listall=True
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(snapshots, list),
|
||||
True,
|
||||
@ -1159,7 +1160,7 @@ class TestSnapshotLimit(cloudstackTestCase):
|
||||
self.services["recurring_snapshot"]["maxsnaps"],
|
||||
"Check maximum number of recurring snapshots retained"
|
||||
)
|
||||
snapshot = snapshots[0]
|
||||
snapshot = snapshots[0]
|
||||
# Sleep to ensure that snapshot is reflected in sec storage
|
||||
time.sleep(self.services["sleep"])
|
||||
|
||||
@ -1328,13 +1329,13 @@ class TestSnapshotEvents(cloudstackTestCase):
|
||||
def test_05_snapshot_events(self):
|
||||
"""Test snapshot events
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. Perform snapshot on the root disk of this VM and check the events/alerts.
|
||||
# 2. delete the snapshots and check the events/alerts
|
||||
# 3. listEvents() shows created/deleted snapshot events
|
||||
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=self.virtual_machine.id,
|
||||
|
||||
@ -49,8 +49,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
@ -71,15 +71,15 @@ class Services:
|
||||
"diskname": "Test Volume",
|
||||
},
|
||||
"templates": {
|
||||
# Configs for different Template formats
|
||||
# Configs for different Template formats
|
||||
# For Eg. raw image, zip etc
|
||||
0:{
|
||||
0: {
|
||||
"displaytext": "Public Template",
|
||||
"name": "Public template",
|
||||
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9',
|
||||
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
|
||||
"hypervisor": 'XenServer',
|
||||
"format" : 'VHD',
|
||||
"format": 'VHD',
|
||||
"isfeatured": True,
|
||||
"ispublic": True,
|
||||
"isextractable": True,
|
||||
@ -92,11 +92,11 @@ class Services:
|
||||
"templatefilter": 'self',
|
||||
},
|
||||
"templatefilter": 'self',
|
||||
"destzoneid": 2, # For Copy template (Destination zone)
|
||||
"destzoneid": 2, # For Copy template (Destination zone)
|
||||
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9',
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced', # Networking mode: Advanced, basic
|
||||
"mode": 'advanced', # Networking mode: Advanced, basic
|
||||
}
|
||||
|
||||
|
||||
@ -162,7 +162,7 @@ class TestCreateTemplate(cloudstackTestCase):
|
||||
def test_01_create_template(self):
|
||||
"""Test create public & private template
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following:
|
||||
# 1. Upload a templates in raw img format. Create a Vm instances from
|
||||
# raw img template.
|
||||
@ -212,7 +212,7 @@ class TestCreateTemplate(cloudstackTestCase):
|
||||
break
|
||||
elif timeout == 0:
|
||||
raise Exception("List template failed!")
|
||||
|
||||
|
||||
time.sleep(5)
|
||||
timeout = timeout - 1
|
||||
#Verify template response to check whether template added successfully
|
||||
@ -221,13 +221,13 @@ class TestCreateTemplate(cloudstackTestCase):
|
||||
True,
|
||||
"Check for list template response return valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_template_response),
|
||||
0,
|
||||
"Check template available in List Templates"
|
||||
)
|
||||
|
||||
|
||||
template_response = list_template_response[0]
|
||||
self.assertEqual(
|
||||
template_response.isready,
|
||||
@ -314,10 +314,10 @@ class TestTemplates(cloudstackTestCase):
|
||||
#Stop virtual machine
|
||||
cls.virtual_machine.stop(cls.api_client)
|
||||
|
||||
timeout = cls.services["timeout"]
|
||||
timeout = cls.services["timeout"]
|
||||
#Wait before server has be successfully stopped
|
||||
time.sleep(cls.services["sleep"])
|
||||
|
||||
|
||||
while True:
|
||||
list_volume = list_volumes(
|
||||
cls.api_client,
|
||||
@ -329,10 +329,10 @@ class TestTemplates(cloudstackTestCase):
|
||||
break
|
||||
elif timeout == 0:
|
||||
raise Exception("List volumes failed.")
|
||||
|
||||
|
||||
time.sleep(5)
|
||||
timeout = timeout -1
|
||||
|
||||
timeout = timeout - 1
|
||||
|
||||
cls.volume = list_volume[0]
|
||||
|
||||
#Create template from volume
|
||||
@ -378,7 +378,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_01_create_template_volume(self):
|
||||
"""Test Create template from volume
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following:
|
||||
# 1. Deploy new VM using the template created from Volume
|
||||
@ -392,7 +392,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
domainid=self.account.account.domainid,
|
||||
serviceofferingid=self.service_offering.id,
|
||||
)
|
||||
|
||||
|
||||
self.debug("creating an instance with template ID: %s" % self.template.id)
|
||||
self.cleanup.append(virtual_machine)
|
||||
vm_response = list_virtual_machines(
|
||||
@ -417,12 +417,12 @@ class TestTemplates(cloudstackTestCase):
|
||||
|
||||
def test_02_copy_template(self):
|
||||
"""Test for copy template from one zone to another"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. copy template should be successful and
|
||||
# secondary storage should contain new copied template.
|
||||
|
||||
|
||||
self.debug(
|
||||
"Copying template from zone: %s to %s" % (
|
||||
self.template.id,
|
||||
@ -447,7 +447,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
True,
|
||||
"Check for list template response return valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_template_response),
|
||||
0,
|
||||
@ -476,7 +476,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_03_delete_template(self):
|
||||
"""Test Delete template
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following:
|
||||
# 1. Create a template and verify it is shown in list templates response
|
||||
@ -495,7 +495,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
True,
|
||||
"Check for list template response return valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(list_template_response),
|
||||
0,
|
||||
@ -508,12 +508,12 @@ class TestTemplates(cloudstackTestCase):
|
||||
self.template.id,
|
||||
"Check display text of updated template"
|
||||
)
|
||||
|
||||
|
||||
self.debug("Deleting template: %s" % self.template)
|
||||
# Delete the template
|
||||
self.template.delete(self.apiclient)
|
||||
self.debug("Delete template: %s successful" % self.template)
|
||||
|
||||
|
||||
list_template_response = list_templates(
|
||||
self.apiclient,
|
||||
templatefilter=\
|
||||
@ -531,7 +531,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
def test_04_template_from_snapshot(self):
|
||||
"""Create Template from snapshot
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 2. Snapshot the Root disk
|
||||
@ -546,7 +546,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
listall=True
|
||||
)
|
||||
volume = volumes[0]
|
||||
|
||||
|
||||
self.debug("Creating a snapshot from volume: %s" % volume.id)
|
||||
#Create a snapshot of volume
|
||||
snapshot = Snapshot.create(
|
||||
|
||||
@ -26,6 +26,7 @@ from integration.lib.common import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
import datetime
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test Snapshots Services
|
||||
"""
|
||||
@ -103,7 +104,7 @@ class Services:
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode":'advanced'
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
@ -192,16 +193,16 @@ class TestVmUsage(cloudstackTestCase):
|
||||
self.debug("Stopping the VM: %s" % self.virtual_machine.id)
|
||||
# Stop the VM
|
||||
self.virtual_machine.stop(self.apiclient)
|
||||
|
||||
|
||||
time.sleep(self.services["sleep"])
|
||||
# Destroy the VM
|
||||
self.debug("Destroying the VM: %s" % self.virtual_machine.id)
|
||||
self.virtual_machine.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -211,7 +212,7 @@ class TestVmUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -222,7 +223,7 @@ class TestVmUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -232,7 +233,7 @@ class TestVmUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -368,7 +369,7 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
return
|
||||
|
||||
def test_01_public_ip_usage(self):
|
||||
"""Test Assign new IP and verify usage calculation
|
||||
"""Test Assign new IP and verify usage calculation
|
||||
"""
|
||||
|
||||
# Validate the following
|
||||
@ -378,16 +379,16 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
# has IP.Release event for released IP for this account
|
||||
# 3. Delete the newly created account
|
||||
|
||||
self.debug("Deleting public IP: %s" %
|
||||
self.debug("Deleting public IP: %s" %
|
||||
self.public_ip.ipaddress.ipaddress)
|
||||
|
||||
# Release one of the IP
|
||||
self.public_ip.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -407,12 +408,12 @@ class TestPublicIPUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(qresultset, list),
|
||||
True,
|
||||
@ -537,8 +538,8 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(volume_response, list),
|
||||
True,
|
||||
isinstance(volume_response, list),
|
||||
True,
|
||||
"Check for valid list volumes response"
|
||||
)
|
||||
data_volume = volume_response[0]
|
||||
@ -556,10 +557,10 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
cmd.id = data_volume.id
|
||||
self.apiclient.deleteVolume(cmd)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -569,7 +570,7 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -580,12 +581,12 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -596,7 +597,7 @@ class TestVolumeUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
# Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
|
||||
@ -663,7 +664,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
type='ROOT',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(list_volume, list):
|
||||
if isinstance(list_volume, list):
|
||||
cls.volume = list_volume[0]
|
||||
else:
|
||||
raise Exception("List Volumes failed!")
|
||||
@ -719,10 +720,10 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
self.template.delete(self.apiclient)
|
||||
self.debug("Deleted template with ID: %s" % self.template.id)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -732,7 +733,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -743,7 +744,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -759,10 +760,10 @@ class TestTemplateUsage(cloudstackTestCase):
|
||||
0,
|
||||
"Check DB Query result set"
|
||||
)
|
||||
|
||||
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
|
||||
|
||||
# Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
|
||||
self.assertEqual(
|
||||
qresult.count('TEMPLATE.CREATE'),
|
||||
@ -789,7 +790,7 @@ class TestISOUsage(cloudstackTestCase):
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
cls.services["iso"]["zoneid"] = cls.zone.id
|
||||
# Create Account, ISO image etc
|
||||
# Create Account, ISO image etc
|
||||
cls.account = Account.create(
|
||||
cls.api_client,
|
||||
cls.services["account"],
|
||||
@ -853,11 +854,11 @@ class TestISOUsage(cloudstackTestCase):
|
||||
# Delete the ISO
|
||||
self.debug("Deleting ISO with ID: %s" % self.iso.id)
|
||||
self.iso.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -867,7 +868,7 @@ class TestISOUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -878,18 +879,18 @@ class TestISOUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(qresultset, list),
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1002,7 +1003,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
# 4. Delete this account.
|
||||
|
||||
self.debug(
|
||||
"Creating load balancer rule for public IP: %s" %
|
||||
"Creating load balancer rule for public IP: %s" %
|
||||
self.public_ip_1.ipaddress.id)
|
||||
#Create Load Balancer rule and assign VMs to rule
|
||||
lb_rule = LoadBalancerRule.create(
|
||||
@ -1015,10 +1016,10 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
|
||||
lb_rule.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -1028,7 +1029,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1039,7 +1040,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -1060,7 +1061,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
|
||||
# Check for LB.CREATE, LB.DELETE in cloud.usage_event table
|
||||
# Check for LB.CREATE, LB.DELETE in cloud.usage_event table
|
||||
self.assertEqual(
|
||||
qresult.count('LB.CREATE'),
|
||||
1,
|
||||
@ -1146,7 +1147,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
|
||||
def test_01_snapshot_usage(self):
|
||||
"""Test Create/Delete a manual snap shot and verify
|
||||
correct usage is recorded
|
||||
correct usage is recorded
|
||||
"""
|
||||
|
||||
# Validate the following
|
||||
@ -1156,7 +1157,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
# generated for the destroyed Snapshot
|
||||
# 3. Delete the account
|
||||
|
||||
# Get the Root disk of VM
|
||||
# Get the Root disk of VM
|
||||
volumes = list_volumes(
|
||||
self.apiclient,
|
||||
virtualmachineid=self.virtual_machine.id,
|
||||
@ -1168,7 +1169,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check if list volumes return a valid data"
|
||||
)
|
||||
|
||||
|
||||
volume = volumes[0]
|
||||
|
||||
# Create a snapshot from the ROOTDISK
|
||||
@ -1179,10 +1180,10 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
self.debug("Deleting snapshot: %s" % snapshot.id)
|
||||
snapshot.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -1192,7 +1193,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1203,12 +1204,12 @@ class TestSnapshotUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
)
|
||||
|
||||
|
||||
self.assertEqual(
|
||||
isinstance(qresultset, list),
|
||||
True,
|
||||
@ -1318,7 +1319,11 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
def test_01_nat_usage(self):
|
||||
"""Test Create/Delete a PF rule and verify correct usage is recorded
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
tags = ["advanced", "advancedns"]
|
||||
>>>>>>> 6d17e21... This commit has following fixes:
|
||||
# Validate the following
|
||||
# 1. Acquire a IP for this account
|
||||
# 2. Create a PF rule on the IP associated with this account.
|
||||
@ -1328,7 +1333,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
# is registered for this account in cloud.usage_event table
|
||||
# 4. Delete this account.
|
||||
|
||||
self.debug("Creating NAT rule with public IP: %s" %
|
||||
self.debug("Creating NAT rule with public IP: %s" %
|
||||
self.public_ip_1.ipaddress.id)
|
||||
#Create NAT rule
|
||||
nat_rule = NATRule.create(
|
||||
@ -1342,10 +1347,10 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
self.debug("Deleting NAT rule: %s" % nat_rule.id)
|
||||
nat_rule.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -1355,7 +1360,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1366,7 +1371,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -1484,12 +1489,12 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
# Validate the following
|
||||
# 1. Enable VPN for this IP. vpn.add.user event is registered for this
|
||||
# account in cloud.usage_event table
|
||||
# 2. Add user to this vpn
|
||||
# 2. Add user to this vpn
|
||||
# 3. Delete user for this VPN. vpn.user.delete event is registered for
|
||||
# this account in cloud.usage_event table
|
||||
# 4. Delete this account.
|
||||
|
||||
self.debug("Created VPN with public IP: %s" %
|
||||
self.debug("Created VPN with public IP: %s" %
|
||||
self.public_ip.ipaddress.id)
|
||||
#Assign VPN to Public IP
|
||||
vpn = Vpn.create(
|
||||
@ -1499,7 +1504,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
domainid=self.account.account.domainid
|
||||
)
|
||||
|
||||
self.debug("Created VPN user for account: %s" %
|
||||
self.debug("Created VPN user for account: %s" %
|
||||
self.account.account.name)
|
||||
|
||||
vpnuser = VpnUser.create(
|
||||
@ -1518,10 +1523,10 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
self.debug("Deleting VPN: %s" % vpn.publicipid)
|
||||
vpn.delete(self.apiclient)
|
||||
|
||||
# Fetch account ID from account_uuid
|
||||
# Fetch account ID from account_uuid
|
||||
self.debug("select id from account where uuid = '%s';" \
|
||||
% self.account.account.id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select id from account where uuid = '%s';" \
|
||||
% self.account.account.id
|
||||
@ -1531,7 +1536,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
True,
|
||||
"Check DB query result set for valid data"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(qresultset),
|
||||
0,
|
||||
@ -1542,7 +1547,7 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
account_id = qresult[0]
|
||||
self.debug("select type from usage_event where account_id = '%s';" \
|
||||
% account_id)
|
||||
|
||||
|
||||
qresultset = self.dbclient.execute(
|
||||
"select type from usage_event where account_id = '%s';" \
|
||||
% account_id
|
||||
@ -1561,8 +1566,8 @@ class TestVpnUsage(cloudstackTestCase):
|
||||
|
||||
qresult = str(qresultset)
|
||||
self.debug("Query result: %s" % qresult)
|
||||
|
||||
# Check for VPN user related events
|
||||
|
||||
# Check for VPN user related events
|
||||
self.assertEqual(
|
||||
qresult.count('VPN.USER.ADD'),
|
||||
1,
|
||||
|
||||
@ -50,8 +50,8 @@ class Services:
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 64, # In MBs
|
||||
},
|
||||
"disk_offering": {
|
||||
"displaytext": "Small",
|
||||
@ -143,7 +143,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
def test_01_volume_attach(self):
|
||||
"""Test Attach volumes (max capacity)
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. Deploy a vm and create 5 data disk
|
||||
# 2. Attach all the created Volume to the vm.
|
||||
@ -163,7 +163,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Created volume: %s for account: %s" % (
|
||||
volume.id,
|
||||
self.account.account.name
|
||||
self.account.account.name
|
||||
))
|
||||
# Check List Volume response for newly created volume
|
||||
list_volume_response = list_volumes(
|
||||
@ -182,7 +182,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Attach volume: %s to VM: %s" % (
|
||||
volume.id,
|
||||
self.virtual_machine.id
|
||||
self.virtual_machine.id
|
||||
))
|
||||
# Check all volumes attached to same VM
|
||||
list_volume_response = list_volumes(
|
||||
@ -196,7 +196,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list volumes response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
list_volume_response,
|
||||
None,
|
||||
@ -246,7 +246,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list VM response for valid list"
|
||||
)
|
||||
|
||||
|
||||
#Verify VM response to check whether VM deployment was successful
|
||||
self.assertNotEqual(
|
||||
len(vm_response),
|
||||
@ -276,7 +276,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list VM response for valid list"
|
||||
)
|
||||
|
||||
|
||||
#Verify VM response to check whether VM deployment was successful
|
||||
self.assertNotEqual(
|
||||
len(vm_response),
|
||||
@ -295,7 +295,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
def test_02_volume_attach_max(self):
|
||||
"""Test attach volumes (more than max) to an instance
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Attach one more data volume to VM (Already 5 attached)
|
||||
@ -312,7 +312,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Created volume: %s for account: %s" % (
|
||||
volume.id,
|
||||
self.account.account.name
|
||||
self.account.account.name
|
||||
))
|
||||
# Check List Volume response for newly created volume
|
||||
list_volume_response = list_volumes(
|
||||
@ -324,7 +324,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list volumes response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
list_volume_response,
|
||||
None,
|
||||
@ -334,7 +334,7 @@ class TestAttachVolume(cloudstackTestCase):
|
||||
with self.assertRaises(Exception):
|
||||
self.debug("Trying to Attach volume: %s to VM: %s" % (
|
||||
volume.id,
|
||||
self.virtual_machine.id
|
||||
self.virtual_machine.id
|
||||
))
|
||||
self.virtual_machine.attach_volume(
|
||||
self.apiclient,
|
||||
@ -426,7 +426,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
def test_01_volume_attach_detach(self):
|
||||
"""Test Volume attach/detach to VM (5 data volumes)
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Deploy a vm and create 5 data disk
|
||||
@ -449,7 +449,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Created volume: %s for account: %s" % (
|
||||
volume.id,
|
||||
self.account.account.name
|
||||
self.account.account.name
|
||||
))
|
||||
self.cleanup.append(volume)
|
||||
volumes.append(volume)
|
||||
@ -464,7 +464,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list volumes response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
list_volume_response,
|
||||
None,
|
||||
@ -472,7 +472,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Attach volume: %s to VM: %s" % (
|
||||
volume.id,
|
||||
self.virtual_machine.id
|
||||
self.virtual_machine.id
|
||||
))
|
||||
# Attach volume to VM
|
||||
self.virtual_machine.attach_volume(
|
||||
@ -492,7 +492,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list volumes response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
list_volume_response,
|
||||
None,
|
||||
@ -508,7 +508,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
for volume in volumes:
|
||||
self.debug("Detach volume: %s to VM: %s" % (
|
||||
volume.id,
|
||||
self.virtual_machine.id
|
||||
self.virtual_machine.id
|
||||
))
|
||||
self.virtual_machine.detach_volume(
|
||||
self.apiclient,
|
||||
@ -530,7 +530,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
True,
|
||||
"Check list VM response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(vm_response),
|
||||
0,
|
||||
@ -542,7 +542,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
||||
'Running',
|
||||
"Check the state of VM"
|
||||
)
|
||||
|
||||
|
||||
# Stop VM
|
||||
self.debug("Stopping the VM: %s" % self.virtual_machine.id)
|
||||
self.virtual_machine.stop(self.apiclient)
|
||||
@ -674,7 +674,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
|
||||
def test_01_volume_iso_attach(self):
|
||||
"""Test Volumes and ISO attach
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Create and attach 5 data volumes to VM
|
||||
@ -693,7 +693,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Created volume: %s for account: %s" % (
|
||||
volume.id,
|
||||
self.account.account.name
|
||||
self.account.account.name
|
||||
))
|
||||
# Check List Volume response for newly created volume
|
||||
list_volume_response = list_volumes(
|
||||
@ -746,7 +746,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
|
||||
domainid=self.account.account.domainid,
|
||||
)
|
||||
self.debug("Created ISO with ID: %s for account: %s" % (
|
||||
iso.id,
|
||||
iso.id,
|
||||
self.account.account.name
|
||||
))
|
||||
|
||||
@ -778,7 +778,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
|
||||
True,
|
||||
"Check list VM response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
len(vm_response),
|
||||
0,
|
||||
@ -870,7 +870,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
def test_01_attach_volume(self):
|
||||
"""Attach a created Volume to a Running VM
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. Create a data volume.
|
||||
# 2. List Volumes should not have vmname and virtualmachineid fields in
|
||||
@ -954,7 +954,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
def test_02_detach_volume(self):
|
||||
"""Detach a Volume attached to a VM
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
|
||||
# Validate the following
|
||||
# 1. Data disk should be detached from instance
|
||||
@ -979,7 +979,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
True,
|
||||
"Check list volumes response for valid list"
|
||||
)
|
||||
|
||||
|
||||
self.assertNotEqual(
|
||||
list_volume_response,
|
||||
None,
|
||||
@ -1002,7 +1002,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
def test_03_delete_detached_volume(self):
|
||||
"""Delete a Volume unattached to an VM
|
||||
"""
|
||||
tags = ["advanced","advancedns"]
|
||||
tags = ["advanced", "advancedns"]
|
||||
# Validate the following
|
||||
# 1. volume should be deleted successfully and listVolume should not
|
||||
# contain the deleted volume details.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user