diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py index 05c56798577..b55a6baa0fc 100644 --- a/test/integration/component/test_accounts.py +++ b/test/integration/component/test_accounts.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Account """ @@ -54,8 +54,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", @@ -75,7 +75,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, @@ -84,7 +84,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -135,9 +135,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 @@ -270,9 +270,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 @@ -334,8 +334,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" ) @@ -350,8 +350,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" ) @@ -369,11 +369,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 @@ -424,12 +425,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 @@ -440,12 +441,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)) @@ -531,7 +532,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 @@ -559,11 +560,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, @@ -650,7 +651,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 @@ -662,11 +663,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, @@ -692,6 +693,7 @@ class TestServiceOfferingSiblings(cloudstackTestCase): ) return + @unittest.skip("Open Questions") class TestServiceOfferingHierarchy(cloudstackTestCase): @@ -765,7 +767,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 @@ -818,6 +820,7 @@ class TestServiceOfferingHierarchy(cloudstackTestCase): ) return + @unittest.skip("Open Questions") class TesttemplateHierarchy(cloudstackTestCase): @@ -896,7 +899,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 @@ -956,6 +959,7 @@ class TesttemplateHierarchy(cloudstackTestCase): ) return + class TestAddVmToSubDomain(cloudstackTestCase): @classmethod @@ -1023,19 +1027,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 @@ -1053,11 +1058,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 diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py index fc6f2b4ec09..12314206ddc 100644 --- a/test/integration/component/test_blocker_bugs.py +++ b/test/integration/component/test_blocker_bugs.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ Tests for Blocker bugs """ @@ -23,6 +23,7 @@ from marvin.cloudstackTestCase import * from marvin.cloudstackAPI import * from marvin.remoteSSHClient import remoteSSHClient + class Services: """Test Services """ @@ -45,8 +46,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", @@ -66,7 +67,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', @@ -75,11 +76,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", @@ -94,12 +95,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): @@ -121,10 +122,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, @@ -181,9 +182,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 @@ -192,31 +193,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( @@ -270,8 +271,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] @@ -292,7 +293,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, @@ -303,13 +304,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" @@ -331,7 +332,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 @@ -340,7 +341,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" % ( @@ -368,7 +369,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( @@ -420,7 +421,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"] @@ -453,7 +454,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: @@ -476,13 +477,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=\ @@ -490,7 +491,7 @@ class TestTemplate(cloudstackTestCase): id=template.id, zoneid=self.zone.id ) - + self.assertEqual( isinstance(list_template_response, list), True, @@ -521,7 +522,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" ) @@ -529,7 +530,7 @@ class TestTemplate(cloudstackTestCase): class TestNATRules(cloudstackTestCase): - + @classmethod def setUpClass(cls): @@ -565,10 +566,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 = [ @@ -597,25 +598,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( @@ -658,7 +659,7 @@ class TestNATRules(cloudstackTestCase): True, "Check database query returns a valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -680,20 +681,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( @@ -706,7 +707,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';" \ @@ -716,7 +717,7 @@ class TestNATRules(cloudstackTestCase): "select id, state from firewall_rules where ip_address_id = '%s';" \ % public_ip.id ) - + self.assertEqual( len(qresultset), 0, @@ -738,7 +739,7 @@ class TestRouters(cloudstackTestCase): cls.zone.id, cls.services["ostypeid"] ) - + # Create an account, domain etc cls.domain = Domain.create( cls.api_client, @@ -750,7 +751,7 @@ class TestRouters(cloudstackTestCase): admin=True, domainid=cls.domain.id ) - + cls.user_account = Account.create( cls.api_client, cls.services["account"], @@ -799,13 +800,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( @@ -906,11 +907,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 @@ -1033,7 +1033,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, @@ -1071,13 +1071,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, @@ -1094,11 +1094,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 @@ -1110,7 +1110,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 @@ -1143,7 +1143,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, @@ -1178,7 +1178,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 @@ -1247,15 +1247,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, diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py index f2154586d41..44940b2c5f2 100644 --- a/test/integration/component/test_egress_rules.py +++ b/test/integration/component/test_egress_rules.py @@ -34,7 +34,7 @@ class Services: def __init__(self): self.services = { - "disk_offering":{ + "disk_offering": { "displaytext": "Small", "name": "Small", "disksize": 1 @@ -64,8 +64,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', @@ -107,8 +107,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" @@ -117,7 +118,7 @@ class Services: # CentOS 5.3 (64-bit) "sleep": 60, "timeout": 10, - "mode":'basic', + "mode": 'basic', # Networking mode: Basic or Advanced } @@ -194,7 +195,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: @@ -351,7 +352,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase): def test_authorizeIngressRule(self): """Test authorize ingress rule """ - + tags = ["sg", "eip"] # Validate the following: @@ -509,7 +510,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: @@ -711,7 +712,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase): """ Test default group with egress rule added after vm deploy and ping, ssh test """ - + tags = ["sg", "eip"] # Validate the following: @@ -808,7 +809,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) @@ -893,7 +894,7 @@ class TestRevokeEgressRule(cloudstackTestCase): def test_revoke_egress_rule(self): """Test revoke security group egress rule """ - + tags = ["sg", "eip"] # Validate the following: @@ -994,7 +995,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) @@ -1035,7 +1036,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) @@ -1155,7 +1156,7 @@ class TestInvalidAccountAuthroize(cloudstackTestCase): def test_invalid_account_authroize(self): """Test invalid account authroize """ - + tags = ["sg", "eip"] # Validate the following: @@ -1283,7 +1284,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: @@ -1332,14 +1333,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( @@ -1435,7 +1436,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 @@ -1531,7 +1532,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: @@ -1607,14 +1608,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( @@ -1731,7 +1732,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"], @@ -1822,7 +1823,7 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase): def test_start_stop_vm_egress(self): """ Test stop start Vm with egress rules """ - + tags = ["sg", "eip"] # Validate the following: @@ -1962,6 +1963,7 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase): ) return + @unittest.skip("Valid bug- ID: CS-12647") class TestInvalidParametersForEgress(cloudstackTestCase): @@ -2033,7 +2035,7 @@ class TestInvalidParametersForEgress(cloudstackTestCase): def test_invalid_parameters(self): """ Test invalid parameters for egress rules """ - + tags = ["sg", "eip"] # Validate the following: @@ -2220,7 +2222,7 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase): def test_egress_after_host_maintainance(self): """Test maintenance case for egress """ - + tags = ["sg", "eip"] # Validate the following: @@ -2326,12 +2328,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) diff --git a/test/integration/component/test_eip_elb.py b/test/integration/component/test_eip_elb.py index 771c7c15ae1..aed815ad884 100644 --- a/test/integration/component/test_eip_elb.py +++ b/test/integration/component/test_eip_elb.py @@ -44,8 +44,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", @@ -180,7 +180,7 @@ class TestEIP(cloudstackTestCase): def test_01_eip_by_deploying_instance(self): """Test EIP by deploying an instance """ - + tags = ["eip"] # Validate the following @@ -347,7 +347,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 @@ -491,7 +491,7 @@ class TestEIP(cloudstackTestCase): def test_03_disable_static_nat(self): """Test disable static NAT and release EIP acquired """ - + tags = ["eip"] # Validate the following @@ -690,7 +690,7 @@ class TestEIP(cloudstackTestCase): def test_04_disable_static_nat_system(self): """Test disable static NAT with system = True """ - + tags = ["eip"] # Validate the following @@ -759,7 +759,7 @@ class TestEIP(cloudstackTestCase): def test_05_destroy_instance(self): """Test EIO after destroying instance """ - + tags = ["eip"] # Validate the following @@ -997,7 +997,7 @@ class TestELB(cloudstackTestCase): def test_01_elb_create(self): """Test ELB by creating a LB rule """ - + tags = ["eip"] # Validate the following @@ -1170,7 +1170,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 @@ -1318,7 +1318,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 @@ -1422,7 +1422,7 @@ class TestELB(cloudstackTestCase): def test_04_delete_lb_on_eip(self): """Test delete LB rule generated on EIP """ - + tags = ["eip"] # Validate the following diff --git a/test/integration/component/test_high_availability.py b/test/integration/component/test_high_availability.py index 21e04c5a4d5..63f0f46d04c 100644 --- a/test/integration/component/test_high_availability.py +++ b/test/integration/component/test_high_availability.py @@ -44,8 +44,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", @@ -59,7 +59,7 @@ class Services: "publicport": 22, "protocol": "TCP" }, - "fw_rule":{ + "fw_rule": { "startport": 1, "endport": 6000, "cidr": '55.55.0.0/11', @@ -83,7 +83,7 @@ class Services: "ostypeid": '1d4a6dce-8db1-4c08-8752-e88b360d8287', "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, @@ -93,7 +93,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 100, - "mode":'advanced' + "mode": 'advanced' } @@ -172,7 +172,7 @@ class TestHighAvailability(cloudstackTestCase): def test_01_host_maintenance_mode(self): """Test host maintenance mode """ - + tags = ["advanced", "advancedns"] # Validate the following @@ -563,7 +563,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 @@ -692,7 +692,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, @@ -861,7 +861,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, diff --git a/test/integration/component/test_netscaler_lb.py b/test/integration/component/test_netscaler_lb.py index 8d625c29b7e..512ba480ed2 100644 --- a/test/integration/component/test_netscaler_lb.py +++ b/test/integration/component/test_netscaler_lb.py @@ -44,8 +44,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": "TestVM", @@ -78,7 +78,7 @@ class Services: "availability": 'Optional', "specifyVlan": False, "specifyIpRanges": False, - "serviceProviderList" : { + "serviceProviderList": { "Dhcp": 'VirtualRouter', "Dns": 'VirtualRouter', "SourceNat": 'VirtualRouter', @@ -105,7 +105,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', @@ -138,7 +138,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -224,7 +224,7 @@ class TestLbSourceNat(cloudstackTestCase): def test_add_lb_on_source_nat(self): """Test Create LB rule for sourceNat IP address """ - + tags = ["advancedns"] # Validate the following @@ -433,7 +433,7 @@ class TestLbOnIpWithPf(cloudstackTestCase): def test_lb_on_ip_with_pf(self): """Test Create LB rule for sourceNat IP address """ - + tags = ["advancedns"] # Validate the following @@ -644,7 +644,7 @@ class TestPfOnIpWithLb(cloudstackTestCase): def test_pf_on_ip_with_lb(self): """Test Create a port forwarding rule on an Ip address that already has a LB rule. """ - + tags = ["advancedns"] # Validate the following @@ -856,7 +856,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase): def test_lb_on_non_source_nat(self): """Test Create LB rule for non-sourceNat IP address """ - + tags = ["advancedns"] # Validate the following @@ -1071,7 +1071,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase): def test_add_multiple_vms_lb(self): """Test Add multiple Vms to an existing LB rule. """ - + tags = ["advancedns"] # Validate the following @@ -1082,7 +1082,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase): # this rule. LB rule should be # In Netscaler: For every Vm added to the LB rule: # 1. A server and service instance is created using guest VM’s IP and - # port number on the Netscaler LB device, + # port number on the Netscaler LB device, # 2. This service is bound to lb virtual server corresponding to lb # rule. @@ -1349,7 +1349,7 @@ class TestMultipleLbRules(cloudstackTestCase): def test_multiple_lb_publicip(self): """Test Create multiple LB rules using different public Ips acquired """ - + tags = ["advancedns"] # Validate the following @@ -1665,7 +1665,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase): def test_multiple_lb_same_publicip(self): """Test Create multiple LB rules using same public Ips on diff ports """ - + tags = ["advancedns"] # Validate the following @@ -2022,7 +2022,7 @@ class TestLoadBalancingRule(cloudstackTestCase): def test_01_edit_name_lb_rule(self): """Test edit name of LB rule """ - + tags = ["advancedns"] # Validate the following @@ -2056,7 +2056,7 @@ class TestLoadBalancingRule(cloudstackTestCase): def test_02_edit_lb_ports(self): """Test edit public port of LB rule """ - + tags = ["advancedns"] # Validate the following @@ -2078,7 +2078,7 @@ class TestLoadBalancingRule(cloudstackTestCase): def test_03_delete_lb_rule(self): """Test delete LB rule """ - + tags = ["advancedns"] # Validate the following @@ -2127,6 +2127,7 @@ class TestLoadBalancingRule(cloudstackTestCase): (self.services["netscaler"]["ipaddress"], e)) return + @unittest.skip("Questions - How to verify after changing public/private ports?") class TestDeleteCreateLBRule(cloudstackTestCase): @@ -2244,7 +2245,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase): def test_01_create_with_same_public_port(self): """Test create LB rule with same public port after deleting rule""" - + tags = ["advancedns"] # Validate the following @@ -2405,7 +2406,7 @@ class TestVmWithLb(cloudstackTestCase): def test_01_delete_public_ip(self): """Test delete one public Ip with LB rules""" - + tags = ["advancedns"] # Validate the following @@ -2474,7 +2475,7 @@ class TestVmWithLb(cloudstackTestCase): def test_02_stop_user_vm(self): """Test stop user VM with LB""" - + tags = ["advancedns"] # Validate the following @@ -2554,7 +2555,7 @@ class TestVmWithLb(cloudstackTestCase): def test_03_start_user_vm(self): """Test start user VM with LB""" - + tags = ["advancedns"] # Validate the following @@ -2625,11 +2626,11 @@ class TestVmWithLb(cloudstackTestCase): def test_04_migrate_user_vm(self): """Test migrate user VM with LB""" - + tags = ["advancedns"] # Validate the following - # 1. Create 2 instances and add these two for load balancing + # 1. Create 2 instances and add these two for load balancing # 2. migrate one Vm to another host. # 3. Test whether the request are sent to stopped user VM after migrate # 4. In netscaler, the LB rules are still configured. @@ -2738,7 +2739,7 @@ class TestVmWithLb(cloudstackTestCase): def test_05_reboot_user_vm(self): """Test reboot user VM with LB""" - + tags = ["advancedns"] # Validate the following @@ -2808,7 +2809,7 @@ class TestVmWithLb(cloudstackTestCase): def test_06_destroy_user_vm(self): """Test destroy user VM with LB""" - + tags = ["advancedns"] # Validate the following @@ -2891,7 +2892,7 @@ class TestVmWithLb(cloudstackTestCase): def test_07_delete_all_public_ip(self): """Test delete all public Ip with LB rules""" - + tags = ["advancedns"] # Validate the following diff --git a/test/integration/component/test_netscaler_lb_algo.py b/test/integration/component/test_netscaler_lb_algo.py index 4b079c890ac..1cd78dc61bc 100644 --- a/test/integration/component/test_netscaler_lb_algo.py +++ b/test/integration/component/test_netscaler_lb_algo.py @@ -67,7 +67,7 @@ class Services: "numretries": 2, "lbdevicededicated": False, "lbdevicecapacity": 50, - "port": 22, + "port": 22, }, "network_offering": { "name": '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', @@ -104,7 +104,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -541,7 +541,6 @@ class TestLbWithLeastConn(cloudstackTestCase): return - class TestLbWithSourceIp(cloudstackTestCase): @classmethod @@ -754,7 +753,6 @@ class TestLbWithSourceIp(cloudstackTestCase): return - class TestLbAlgoRrLc(cloudstackTestCase): @classmethod @@ -967,7 +965,6 @@ class TestLbAlgoRrLc(cloudstackTestCase): return - class TestLbAlgoLcRr(cloudstackTestCase): @classmethod @@ -1177,7 +1174,6 @@ class TestLbAlgoLcRr(cloudstackTestCase): return - class TestLbAlgoRrSb(cloudstackTestCase): @classmethod @@ -1390,7 +1386,6 @@ class TestLbAlgoRrSb(cloudstackTestCase): return - class TestLbAlgoSbRr(cloudstackTestCase): @classmethod @@ -1605,7 +1600,6 @@ class TestLbAlgoSbRr(cloudstackTestCase): return - class TestLbAlgoSbLc(cloudstackTestCase): @classmethod @@ -1820,7 +1814,6 @@ class TestLbAlgoSbLc(cloudstackTestCase): return - class TestLbAlgoLcSb(cloudstackTestCase): @classmethod @@ -1970,7 +1963,7 @@ class TestLbAlgoLcSb(cloudstackTestCase): lb_rule.name )) lb_rule.assign(self.apiclient, [self.virtual_machine]) - + self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?") self.debug("SSH into netscaler: %s" % self.services["netscaler"]["ipaddress"]) diff --git a/test/integration/component/test_netscaler_nw_off.py b/test/integration/component/test_netscaler_nw_off.py index c19a8267852..b70b3cc8241 100644 --- a/test/integration/component/test_netscaler_nw_off.py +++ b/test/integration/component/test_netscaler_nw_off.py @@ -44,8 +44,8 @@ class Services: "name": "Tiny Instance", "displaytext": "Tiny Instance", "cpunumber": 1, - "cpuspeed": 100, # in MHz - "memory": 128, # In MBs + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs }, "virtual_machine": { "displayname": "TestVM", @@ -102,7 +102,7 @@ class Services: "availability": 'Optional', "specifyVlan": False, "specifyIpRanges": False, - "serviceProviderList" : { + "serviceProviderList": { "Dhcp": 'VirtualRouter', "Dns": 'VirtualRouter', "SourceNat": 'VirtualRouter', @@ -129,7 +129,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', @@ -157,11 +157,10 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } - class TestAddMultipleNetScaler(cloudstackTestCase): @classmethod @@ -205,7 +204,7 @@ class TestAddMultipleNetScaler(cloudstackTestCase): def test_add_netscaler_device(self): """Test add netscaler device """ - + tags = ["advancedns"] # Validate the following @@ -363,7 +362,7 @@ class TestAddMultipleNSDiffZone(cloudstackTestCase): def test_add_mul_netscaler_diff_zone(self): """Test add netscaler devices in different zones """ - + tags = ["advancedns"] # Validate the following @@ -651,7 +650,7 @@ class TestNetScalerSharedMode(cloudstackTestCase): def test_01_netscaler_shared_mode(self): """Test netscaler device in shared mode """ - + tags = ["advancedns"] # Validate the following @@ -806,12 +805,12 @@ class TestNetScalerSharedMode(cloudstackTestCase): def test_02_multiple_netscaler_capacilty(self): """Test multiple netscaler devices with limited capacity """ - + tags = ["advancedns"] # Validate the following - # 1. Add another netscaler device and spawn a new VM again - # 2. VM deployement should be successful + # 1. Add another netscaler device and spawn a new VM again + # 2. VM deployement should be successful self.debug("Adding another netscaler device: %s" % self.services["netscaler_2"]["ipaddress"]) @@ -908,7 +907,7 @@ class TestNetScalerSharedMode(cloudstackTestCase): def test_03_multiple_netscaler_full_capacilty(self): """Test netscaler device with full capacity """ - + tags = ["advancedns"] # Validate the following @@ -993,7 +992,7 @@ class TestNetScalerSharedMode(cloudstackTestCase): def test_04_delete_account_after_capacity_full(self): """Test delete and add resouces after netscaler device capacity is full """ - + tags = ["advancedns"] # Validate the following @@ -1178,7 +1177,7 @@ class TestNwOffDedicatedNetscaler(cloudstackTestCase): def test_nw_off_dedicated_mode(self): """Test network offering in dedicated mode device """ - + tags = ["advancedns"] # Validate the following @@ -1211,7 +1210,7 @@ class TestNwOffDedicatedNetscaler(cloudstackTestCase): # Creating network using the network offering created self.debug("Creating network with network offering: %s" % self.network_offering.id) - + self.network_1 = Network.create( self.apiclient, self.services["network"], @@ -1220,18 +1219,18 @@ class TestNwOffDedicatedNetscaler(cloudstackTestCase): networkofferingid=self.network_offering.id, zoneid=self.zone.id ) - self.debug("Deploy Instance with network: %s" % self.network_1.name) + self.debug("Deploy Instance with network: %s" % self.network_1.name) with self.assertRaises(Exception): - # Spawn an instance in that network - VirtualMachine.create( + # Spawn an instance in that network + VirtualMachine.create( self.apiclient, self.services["virtual_machine"], accountid=self.account_1.account.name, domainid=self.account_1.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network_1.id)] - ) - self.debug("Created instance failed!") + ) + self.debug("Created instance failed!") return @@ -1372,7 +1371,7 @@ class TestNwOffNetscaler(cloudstackTestCase): def test_ns_shared_nw_dedicated(self): """Test netscaler device in shared mode with network offering in dedicated mode """ - + tags = ["advancedns"] # Validate the following @@ -1413,37 +1412,37 @@ class TestNwOffNetscaler(cloudstackTestCase): networkofferingid=self.network_offering.id, zoneid=self.zone.id ) - self.debug("Deploying VM in account: %s" % self.account_1.account.name) - virtual_machine = VirtualMachine.create( + self.debug("Deploying VM in account: %s" % self.account_1.account.name) + virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], accountid=self.account_1.account.name, domainid=self.account_1.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] - ) + ) # Creating network using the network offering created self.debug("Creating different network with network offering: %s" % self.network_offering.id) self.network_2 = Network.create( - self.apiclient, - self.services["network"], - accountid=self.account_2.account.name, - domainid=self.account_2.account.domainid, - networkofferingid=self.network_offering.id, - zoneid=self.zone.id - ) + self.apiclient, + self.services["network"], + accountid=self.account_2.account.name, + domainid=self.account_2.account.domainid, + networkofferingid=self.network_offering.id, + zoneid=self.zone.id + ) self.debug("Created network with ID: %s" % self.network_2.id) with self.assertRaises(Exception): - VirtualMachine.create( + VirtualMachine.create( self.apiclient, self.services["virtual_machine"], accountid=self.account_2.account.name, domainid=self.account_2.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network_2.id)] - ) + ) self.debug( "Attempt to create second network with dedicated network offering failed!") self.debug("Deleting account: %s" % self.account_1.account.name) @@ -1682,7 +1681,7 @@ class TestNwOffSToDUpgrade(cloudstackTestCase): def test_shared_to_dedicated_upgrade(self): """Test upgrade from shared LB isolation to dedicated LB isolation""" - + tags = ["advancedns"] # Validate the following @@ -1850,9 +1849,9 @@ class TestNwOffSToDUpgrade(cloudstackTestCase): physicalnetworkid=self.physical_network.id ) - self.debug("Stopping All VMs before upgrading network for account: %s" % - self.account_1.account.name) - virtual_machine_1.stop(self.apiclient) + self.debug("Stopping All VMs before upgrading network for account: %s" % + self.account_1.account.name) + virtual_machine_1.stop(self.apiclient) list_vm_response = VirtualMachine.list( self.apiclient, @@ -1876,7 +1875,7 @@ class TestNwOffSToDUpgrade(cloudstackTestCase): "Stopped", "VM state should be running after deployment" ) - self.debug("All Vms are in stopped state") + self.debug("All Vms are in stopped state") self.debug("Upgrading the network: %s" % self.network_1.id) self.network_1.update( self.apiclient, @@ -1905,9 +1904,9 @@ class TestNwOffSToDUpgrade(cloudstackTestCase): "Network offering ID should match with new offering ID" ) - self.debug("Starting All VMs after upgrading network for account: %s" % - self.account_1.account.name) - virtual_machine_1.start(self.apiclient) + self.debug("Starting All VMs after upgrading network for account: %s" % + self.account_1.account.name) + virtual_machine_1.start(self.apiclient) list_vm_response = VirtualMachine.list( self.apiclient, @@ -1931,7 +1930,7 @@ class TestNwOffSToDUpgrade(cloudstackTestCase): "Running", "VM state should be running after deployment" ) - self.debug("All Vms are in running state") + self.debug("All Vms are in running state") try: self.debug( "Associating public Ip to the network: %s" % @@ -2099,7 +2098,7 @@ class TestNwOffDToSUpgrade(cloudstackTestCase): def test_shared_to_dedicated_upgrade(self): """Test upgrade from shared LB isolation to dedicated LB isolation""" - + tags = ["advancedns"] # Validate the following @@ -2258,8 +2257,8 @@ class TestNwOffDToSUpgrade(cloudstackTestCase): "VM state should be running after deployment" ) - self.debug("Stopping all VMs in account: %s" % self.account_3.account.name) - virtual_machine_3.stop(self.apiclient) + self.debug("Stopping all VMs in account: %s" % self.account_3.account.name) + virtual_machine_3.stop(self.apiclient) list_vm_response = VirtualMachine.list( self.apiclient, @@ -2283,7 +2282,7 @@ class TestNwOffDToSUpgrade(cloudstackTestCase): "Stopped", "VM state should be stopped" ) - self.debug("All user VMs stopped") + self.debug("All user VMs stopped") self.debug("Upgrading the network: %s" % self.network_3.id) self.network_3.update( self.apiclient, @@ -2311,10 +2310,10 @@ class TestNwOffDToSUpgrade(cloudstackTestCase): self.network_offering_shared.id, "Network offering ID should match with new offering ID" ) - self.debug("Starting instances in account: %s" % self.account_3.account.name) - virtual_machine_3.start(self.apiclient) + self.debug("Starting instances in account: %s" % self.account_3.account.name) + virtual_machine_3.start(self.apiclient) - list_vm_response = VirtualMachine.list( + list_vm_response = VirtualMachine.list( self.apiclient, id=virtual_machine_3.id ) diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py index 8d37b335550..010dbf2404b 100644 --- a/test/integration/component/test_network_offering.py +++ b/test/integration/component/test_network_offering.py @@ -44,8 +44,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', @@ -54,16 +54,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": { @@ -73,7 +73,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', @@ -115,7 +115,7 @@ class Services: "publicport": 66, "protocol": "TCP" }, - "fw_rule":{ + "fw_rule": { "startport": 1, "endport": 6000, "cidr": '55.55.0.0/11', @@ -137,7 +137,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -209,7 +209,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 @@ -242,7 +242,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 @@ -254,7 +254,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) @@ -331,7 +331,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 ) @@ -454,7 +454,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 @@ -485,7 +485,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 @@ -497,7 +497,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) @@ -702,7 +702,7 @@ class TestNOVirtualRouter(cloudstackTestCase): vpns = Vpn.list( self.apiclient, publicipid=src_nat.id, - listall=True, + listall=True, ) self.assertEqual( @@ -787,7 +787,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 @@ -799,14 +799,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" @@ -894,7 +893,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, @@ -1057,7 +1056,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 @@ -1070,14 +1069,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" @@ -1433,7 +1431,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 @@ -1632,7 +1630,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 diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py index 7888b000e91..77361647a6d 100644 --- a/test/integration/component/test_project_configs.py +++ b/test/integration/component/test_project_configs.py @@ -65,8 +65,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", @@ -86,7 +86,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, @@ -104,7 +104,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -166,11 +166,10 @@ 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 """ - tags = ["advanced", "basic", "sg", "eip", "advancedns"] + tags = ["advanced", "basic", "sg", "eip", "advancedns"] # Validate the following # 1. Check if 'allow.user.create.projects' configuration is true # 2. Create a Project as domain admin @@ -203,9 +202,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 ) @@ -239,9 +238,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 ) @@ -259,6 +258,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 @@ -296,9 +296,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 ) @@ -341,24 +341,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 @@ -385,14 +385,13 @@ 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""" - tags = ["advanced", "basic", "sg", "eip", "advancedns"] + tags = ["advanced", "basic", "sg", "eip", "advancedns"] # 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( @@ -422,9 +421,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 ) @@ -453,14 +452,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, ) @@ -470,20 +469,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): @@ -493,7 +492,7 @@ class TestProjectInviteRequired(cloudstackTestCase): # 1. Create a Project # 2. Add users to the project. verify user is shown in pending state - # Verify 'project.invite.required' is set to false + # Verify 'project.invite.required' is set to false configs = Configurations.list( self.apiclient, name='project.invite.required' @@ -519,12 +518,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 ) @@ -553,11 +552,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, @@ -570,14 +569,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', @@ -590,11 +589,11 @@ class TestProjectInviteRequired(cloudstackTestCase): tags = ["advanced", "basic", "sg", "eip", "advancedns"] # 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, @@ -610,7 +609,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 @@ -622,12 +621,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 ) @@ -656,11 +655,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, @@ -673,24 +672,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 ) @@ -701,7 +700,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, ) @@ -711,14 +710,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', @@ -731,11 +730,11 @@ class TestProjectInviteRequired(cloudstackTestCase): tags = ["advanced", "basic", "sg", "eip", "advancedns"] # 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, @@ -751,7 +750,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 @@ -763,12 +762,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 ) @@ -797,11 +796,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, @@ -814,20 +813,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) @@ -836,7 +835,7 @@ class TestProjectInviteRequired(cloudstackTestCase): # Accept the invite ProjectInvitation.update( self.apiclient, - projectid=project.id, + projectid=project.id, accept=True, account=self.user.account.name ) @@ -857,14 +856,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', @@ -877,7 +876,7 @@ class TestProjectInviteRequired(cloudstackTestCase): tags = ["advanced", "basic", "sg", "eip", "advancedns"] # 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 @@ -898,7 +897,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 @@ -910,12 +909,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 ) @@ -944,11 +943,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, @@ -961,20 +960,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) @@ -985,11 +984,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, @@ -1002,14 +1001,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', @@ -1022,7 +1021,7 @@ class TestProjectInviteRequired(cloudstackTestCase): tags = ["advanced", "basic", "sg", "eip", "advancedns"] # 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 @@ -1043,7 +1042,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 @@ -1055,12 +1054,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 ) @@ -1089,11 +1088,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, @@ -1106,14 +1105,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', @@ -1122,7 +1121,7 @@ class TestProjectInviteRequired(cloudstackTestCase): # Accept the invite ProjectInvitation.update( self.apiclient, - projectid=project.id, + projectid=project.id, accept=False, account=self.user.account.name ) @@ -1133,7 +1132,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, ) @@ -1143,19 +1142,20 @@ 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""" tags = ["advanced", "basic", "sg", "eip", "advancedns"] # 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 # user. - # Verify 'project.invite.required' is set to false + # Verify 'project.invite.required' is set to false configs = Configurations.list( self.apiclient, name='project.invite.timeout' @@ -1170,7 +1170,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 @@ -1182,12 +1182,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 ) diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py index d1735fdfc4b..70348ee6402 100644 --- a/test/integration/component/test_project_limits.py +++ b/test/integration/component/test_project_limits.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Resource limits """ @@ -22,6 +22,7 @@ from integration.lib.base import * from integration.lib.common import * import datetime + class Services: """Test Resource Limits Services """ @@ -57,8 +58,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,13 +98,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, @@ -122,10 +123,10 @@ class TestProjectLimits(cloudstackTestCase): domainid=cls.domain.id ) cls._cleanup = [ - cls.admin, - cls.user, - cls.domain - ] + cls.admin, + cls.user, + cls.domain + ] return @classmethod @@ -169,7 +170,7 @@ class TestProjectLimits(cloudstackTestCase): # 4. Create Resource more than its set limit for a project. Verify # resource allocation should fail giving proper message - # Create project as a domain admin + # Create project as a domain admin project = Project.create( self.apiclient, self.services["project"], @@ -180,9 +181,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 ) @@ -220,7 +221,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. @@ -258,7 +259,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, @@ -274,7 +275,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( @@ -297,6 +298,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 @@ -320,9 +322,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 ) @@ -360,7 +362,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. @@ -398,7 +400,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 @@ -406,10 +408,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, @@ -425,7 +427,7 @@ class TestProjectLimits(cloudstackTestCase): 0, "List resource API response should not be empty" ) - + for resource in resource_limits: #with self.assertRaises(Exception): self.debug( @@ -532,12 +534,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 ) @@ -586,7 +588,7 @@ class TestResourceLimitsProject(cloudstackTestCase): def test_04_publicip_per_project(self): """Test Public IP limit per project """ - tags = ["advanced","eip","advancedns"] + tags = ["advanced", "eip", "advancedns"] # Validate the following # 1. set max no of IPs per project to 2. # 2. Create an account in this domain @@ -596,12 +598,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 ) @@ -622,7 +624,7 @@ class TestResourceLimitsProject(cloudstackTestCase): "Check VM state is Running or not" ) networks = Network.list( - self.apiclient, + self.apiclient, projectid=self.project.id, listall=True ) @@ -637,7 +639,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, @@ -676,16 +678,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 ) @@ -757,12 +759,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 ) @@ -793,12 +795,12 @@ class TestResourceLimitsProject(cloudstackTestCase): projectid=self.project.id ) return - + def test_07_templates_per_project(self): """Test Templates limit per project """ tags = ["advanced", "basic", "sg", "eip", "advancedns"] - # Validate the following + # Validate the following # 1. set max no of templates per project to 1. # 2. Create a template in this project. Both template should be in # ready state @@ -808,17 +810,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 ) diff --git a/test/integration/component/test_project_resources.py b/test/integration/component/test_project_resources.py index 131508679e6..cd2961661aa 100644 --- a/test/integration/component/test_project_resources.py +++ b/test/integration/component/test_project_resources.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Resource creation """ @@ -23,6 +23,7 @@ from integration.lib.common import * from marvin.remoteSSHClient import remoteSSHClient import datetime + class Services: """Test Resource creation Services """ @@ -58,8 +59,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", @@ -94,7 +95,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, @@ -131,7 +132,7 @@ class Services: "timeout": 10, "mode": 'advanced', } - + class TestOfferings(cloudstackTestCase): @@ -173,7 +174,7 @@ class TestOfferings(cloudstackTestCase): cls.services["disk_offering"] ) cls._cleanup = [ - cls.account, + cls.account, cls.service_offering, cls.disk_offering ] @@ -222,9 +223,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 )) @@ -264,9 +265,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 ) @@ -348,7 +349,7 @@ class TestNetwork(cloudstackTestCase): domainid=cls.domain.id ) cls._cleanup = [ - cls.account, + cls.account, cls.service_offering, ] return @@ -379,7 +380,7 @@ class TestNetwork(cloudstackTestCase): def test_03_network_create(self): """ Test create network in project """ - tags = ["advanced", "advancedns"] + tags = ["advanced", "advancedns"] # Validate the following # 1. Create a project. # 2. Add virtual/direct network resource to the project. User shared @@ -400,7 +401,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, @@ -409,36 +410,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"], @@ -463,24 +464,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"], @@ -584,13 +585,13 @@ class TestTemplates(cloudstackTestCase): """Test Templates creation in projects """ tags = ["advanced", "basic", "sg", "eip", "advancedns"] - # Validate the following + # Validate the following # 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, @@ -643,14 +644,14 @@ class TestTemplates(cloudstackTestCase): """Test use of private template in a project """ tags = ["advanced", "basic", "sg", "eip", "advancedns"] - # Validate the following + # Validate the following # 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, @@ -698,7 +699,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" % ( @@ -711,7 +712,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, @@ -861,7 +862,7 @@ class TestSnapshots(cloudstackTestCase): True, "Check Snapshot state is Running or not" ) - + snapshots = Snapshot.list( self.apiclient, account=self.account.account.name, @@ -926,7 +927,7 @@ class TestPublicIpAddress(cloudstackTestCase): serviceofferingid=cls.service_offering.id, projectid=cls.project.id ) - + cls._cleanup = [ cls.project, cls.service_offering, @@ -961,7 +962,7 @@ class TestPublicIpAddress(cloudstackTestCase): def test_07_associate_public_ip(self): """Test associate public IP within the project """ - tags = ["advanced", "eip", "advancedns"] + tags = ["advanced", "eip", "advancedns"] # Validate the following # 1. Create a project # 2. Add some public Ips to the project @@ -969,7 +970,7 @@ class TestPublicIpAddress(cloudstackTestCase): # inside project networks = Network.list( - self.apiclient, + self.apiclient, projectid=self.project.id, listall=True ) @@ -993,10 +994,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, @@ -1025,9 +1026,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, @@ -1062,7 +1063,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, @@ -1074,7 +1075,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, @@ -1085,7 +1086,7 @@ class TestPublicIpAddress(cloudstackTestCase): True, "Check for list FW rules response return valid data" ) - + self.assertEqual( fw_rules[0].state, 'Active', @@ -1102,7 +1103,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, @@ -1113,7 +1114,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( @@ -1121,7 +1122,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): @@ -1131,7 +1132,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): @@ -1157,7 +1158,7 @@ class TestPublicIpAddress(cloudstackTestCase): class TestSecurityGroup(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() @@ -1186,7 +1187,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, @@ -1195,7 +1196,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"] @@ -1245,8 +1246,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) @@ -1260,16 +1261,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( @@ -1277,9 +1278,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, @@ -1293,8 +1294,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 diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py index 177287dbd1e..2b8a94a9935 100644 --- a/test/integration/component/test_project_usage.py +++ b/test/integration/component/test_project_usage.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Snapshots """ @@ -23,6 +23,7 @@ from integration.lib.common import * from marvin.remoteSSHClient import remoteSSHClient import datetime + class Services: """Test Snapshots Services """ @@ -46,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 }, "disk_offering": { "displaytext": "Small", @@ -104,7 +105,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -138,14 +139,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"] @@ -203,17 +204,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 @@ -223,7 +224,7 @@ class TestVmUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -234,7 +235,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 @@ -244,7 +245,7 @@ class TestVmUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -332,14 +333,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"] @@ -352,7 +353,7 @@ class TestPublicIPUsage(cloudstackTestCase): projectid=cls.project.id ) networks = Network.list( - cls.api_client, + cls.api_client, projectid=cls.project.id, listall=True ) @@ -399,7 +400,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 """ tags = ["advanced", "eip", "advancedns"] # Validate the following @@ -409,17 +410,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 @@ -439,12 +440,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, @@ -579,8 +580,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] @@ -598,11 +599,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 @@ -612,7 +613,7 @@ class TestVolumeUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -623,12 +624,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, @@ -639,7 +640,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 @@ -714,7 +715,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!") @@ -772,11 +773,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 @@ -786,7 +787,7 @@ class TestTemplateUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -797,7 +798,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 @@ -813,10 +814,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'), @@ -843,7 +844,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"], @@ -914,12 +915,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 @@ -929,7 +930,7 @@ class TestISOUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -940,18 +941,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, @@ -981,7 +982,7 @@ class TestLBRuleUsage(cloudstackTestCase): @classmethod def setUpClass(cls): cls.api_client = super( - TestLBRuleUsage, + TestLBRuleUsage, cls ).getClsTestClient().getApiClient() cls.services = Services().services @@ -1025,7 +1026,7 @@ class TestLBRuleUsage(cloudstackTestCase): projectid=cls.project.id ) networks = Network.list( - cls.api_client, + cls.api_client, projectid=cls.project.id, listall=True ) @@ -1074,7 +1075,7 @@ class TestLBRuleUsage(cloudstackTestCase): def test_01_lb_usage(self): """Test Create/Delete a LB rule and verify correct usage is recorded """ - tags = ["advanced", "eip", "advancedns"] + tags = ["advanced", "eip", "advancedns"] # Validate the following # 1. Acquire a IP for this account. lb.rule.create event is registered # for this account in cloud.usage_event table @@ -1084,7 +1085,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( @@ -1097,11 +1098,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 @@ -1111,7 +1112,7 @@ class TestLBRuleUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1122,7 +1123,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 @@ -1143,7 +1144,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, @@ -1239,7 +1240,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 """ tags = ["advanced", "basic", "sg", "eip", "advancedns"] # Validate the following @@ -1249,7 +1250,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, @@ -1261,7 +1262,7 @@ class TestSnapshotUsage(cloudstackTestCase): True, "Check if list volumes return a valid data" ) - + volume = volumes[0] # Create a snapshot from the ROOTDISK @@ -1272,11 +1273,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 @@ -1286,7 +1287,7 @@ class TestSnapshotUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1297,12 +1298,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, @@ -1383,7 +1384,7 @@ class TestNatRuleUsage(cloudstackTestCase): projectid=cls.project.id ) networks = Network.list( - cls.api_client, + cls.api_client, projectid=cls.project.id, listall=True ) @@ -1432,7 +1433,7 @@ class TestNatRuleUsage(cloudstackTestCase): def test_01_nat_usage(self): """Test Create/Delete a PF rule and verify correct usage is recorded """ - tags = ["advanced", "advancedns"] + tags = ["advanced", "advancedns"] # Validate the following # 1. Acquire a IP for this account # 2. Create a PF rule on the IP associated with this account. @@ -1442,7 +1443,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( @@ -1456,11 +1457,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 @@ -1470,7 +1471,7 @@ class TestNatRuleUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1481,7 +1482,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 @@ -1566,7 +1567,7 @@ class TestVpnUsage(cloudstackTestCase): projectid=cls.project.id ) networks = Network.list( - cls.api_client, + cls.api_client, projectid=cls.project.id, listall=True ) @@ -1615,16 +1616,16 @@ class TestVpnUsage(cloudstackTestCase): def test_01_vpn_usage(self): """Test Create/Delete a VPN and verify correct usage is recorded """ - tags = ["advanced", "advancedns"] + tags = ["advanced", "advancedns"] # 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( @@ -1633,7 +1634,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( @@ -1651,11 +1652,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 @@ -1665,7 +1666,7 @@ class TestVpnUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1676,7 +1677,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 @@ -1695,8 +1696,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, diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py index c1d00d90e9f..a78bb1bc4fb 100644 --- a/test/integration/component/test_projects.py +++ b/test/integration/component/test_projects.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Project """ @@ -41,7 +41,7 @@ class Services: "ipaddress": '192.168.100.21', "username": 'root', "password": 'fr3sca', - "port": 22, + "port": 22, }, "account": { "email": "administrator@clogeny.com", @@ -73,8 +73,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", @@ -92,7 +92,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -107,7 +107,7 @@ class TestMultipleProjectCreation(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, @@ -120,14 +120,14 @@ class TestMultipleProjectCreation(cloudstackTestCase): admin=True, domainid=cls.domain.id ) - + cls.user = Account.create( cls.api_client, cls.services["account"], admin=True, domainid=cls.domain.id ) - + cls._cleanup = [cls.account, cls.user] return @@ -161,7 +161,7 @@ class TestMultipleProjectCreation(cloudstackTestCase): tags = ["advanced", "basic", "sg", "eip", "advancedns"] # Validate the following # 1. Create multiple project. Verify at step 1 An account is allowed - # to create multiple projects + # to create multiple projects # 2. add one account to multiple project. Verify at step 2 an account # is allowed to added to multiple project @@ -179,7 +179,7 @@ class TestMultipleProjectCreation(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -193,9 +193,9 @@ class TestMultipleProjectCreation(cloudstackTestCase): self.cleanup.append(project_1) self.debug("Created project with domain admin with ID: %s" % project_1.id) - + list_projects_reponse = Project.list( - self.apiclient, + self.apiclient, id=project_1.id, listall=True ) @@ -228,9 +228,9 @@ class TestMultipleProjectCreation(cloudstackTestCase): self.cleanup.append(project_2) self.debug("Created project with domain user with ID: %s" % project_2.id) - + list_projects_reponse = Project.list( - self.apiclient, + self.apiclient, id=project_2.id, listall=True ) @@ -247,17 +247,17 @@ class TestMultipleProjectCreation(cloudstackTestCase): 0, "Check list project response returns a valid project" ) - + # Add user to the project project_1.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_1.id, account=self.user.account.name, ) @@ -267,14 +267,14 @@ class TestMultipleProjectCreation(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', @@ -282,14 +282,14 @@ class TestMultipleProjectCreation(cloudstackTestCase): ) # Add user to the project project_2.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_2.id, account=self.user.account.name, ) @@ -299,14 +299,14 @@ class TestMultipleProjectCreation(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', @@ -343,14 +343,14 @@ class TestCrossDomainAccountAdd(cloudstackTestCase): admin=True, domainid=cls.domain.id ) - + cls.user = Account.create( cls.api_client, cls.services["account"], admin=True, domainid=cls.new_domain.id ) - + cls._cleanup = [cls.account, cls.user] return @@ -400,7 +400,7 @@ class TestCrossDomainAccountAdd(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -414,9 +414,9 @@ class TestCrossDomainAccountAdd(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 ) @@ -439,8 +439,8 @@ class TestCrossDomainAccountAdd(cloudstackTestCase): list_project.name, "Check project name from list response" ) - - self.debug("Adding user: %s from domain: %s to project: %s" %( + + self.debug("Adding user: %s from domain: %s to project: %s" % ( self.user.account.name, self.user.account.domainid, project.id @@ -448,12 +448,12 @@ class TestCrossDomainAccountAdd(cloudstackTestCase): with self.assertRaises(Exception): # Add user to the project from different domain project.addAccount( - self.apiclient, + self.apiclient, self.user.account.name ) self.debug("User add to project failed!") return - + class TestDeleteAccountWithProject(cloudstackTestCase): @@ -527,7 +527,7 @@ class TestDeleteAccountWithProject(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -541,9 +541,9 @@ class TestDeleteAccountWithProject(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 ) @@ -569,10 +569,11 @@ class TestDeleteAccountWithProject(cloudstackTestCase): # Deleting account who is owner of the project with self.assertRaises(Exception): self.account.delete(self.apiclient) - self.debug("Deleting account %s failed!" % + self.debug("Deleting account %s failed!" % self.account.account.name) return + @unittest.skip("Deleting domain doesn't cleanup account") class TestDeleteDomainWithProject(cloudstackTestCase): @@ -589,7 +590,7 @@ class TestDeleteDomainWithProject(cloudstackTestCase): cls.domain = Domain.create( cls.api_client, cls.services["domain"] - ) + ) cls.account = Account.create( cls.api_client, @@ -647,7 +648,7 @@ class TestDeleteDomainWithProject(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -660,9 +661,9 @@ class TestDeleteDomainWithProject(cloudstackTestCase): # Cleanup created project at end of test 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 ) @@ -685,12 +686,12 @@ class TestDeleteDomainWithProject(cloudstackTestCase): list_project.name, "Check project name from list response" ) - + self.debug("Deleting domain: %s forcefully" % self.domain.name) # Delete domain with cleanup=True self.domain.delete(self.apiclient, cleanup=True) self.debug("Removed domain: %s" % self.domain.name) - + interval = list_configurations( self.apiclient, name='account.cleanup.interval' @@ -701,14 +702,14 @@ class TestDeleteDomainWithProject(cloudstackTestCase): "Check if account.cleanup.interval config present" ) self.debug( - "Sleep for account cleanup interval: %s" % + "Sleep for account cleanup interval: %s" % interval[0].value) # Sleep to ensure that all resources are deleted time.sleep(int(interval[0].value)) - + # Project should be deleted as part of domain cleanup list_projects_reponse = Project.list( - self.apiclient, + self.apiclient, id=project.id, listall=True ) @@ -735,7 +736,7 @@ class TestProjectOwners(cloudstackTestCase): cls.services ) cls.zone = get_zone(cls.api_client, cls.services) - + # Create accounts cls.admin = Account.create( cls.api_client, @@ -774,7 +775,7 @@ class TestProjectOwners(cloudstackTestCase): except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return - + def test_05_user_project_owner_promotion(self): """ Test Verify a project user can be later promoted to become a owner @@ -800,7 +801,7 @@ class TestProjectOwners(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -814,9 +815,9 @@ class TestProjectOwners(cloudstackTestCase): # Cleanup created project at end of test 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 ) @@ -845,13 +846,13 @@ class TestProjectOwners(cloudstackTestCase): )) # Add user to the project project.addAccount( - self.apiclient, - self.new_admin.account.name, + self.apiclient, + self.new_admin.account.name, ) - + # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.new_admin.account.name, ) @@ -861,29 +862,29 @@ class TestProjectOwners(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" ) - + # Update the project with new admin project.update( - self.apiclient, + self.apiclient, account=self.new_admin.account.name ) - + # listProjectAccount to verify the user is new admin of the project accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.new_admin.account.name, ) @@ -893,23 +894,23 @@ class TestProjectOwners(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, 'Admin', "Newly added user is not added as a regular user" ) - + # listProjectAccount to verify old user becomes a regular user accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.admin.account.name, ) @@ -919,14 +920,14 @@ class TestProjectOwners(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', @@ -941,7 +942,7 @@ class TestProjectOwners(cloudstackTestCase): # Validate the following # 1. Create a project. # 2. Add account to the project. Edit account to make it a project - # owner. + # owner. # 3. Update project to add another account as an owner # Verify 'project.invite.required' is set to false @@ -958,7 +959,7 @@ class TestProjectOwners(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -973,9 +974,9 @@ class TestProjectOwners(cloudstackTestCase): self.debug("Created project with domain admin with ID: %s" % project.id) self.user = Account.create( - self.apiclient, + self.apiclient, self.services["account"], - admin=True, + admin=True, domainid=self.domain.id ) self.cleanup.append(self.user) @@ -983,7 +984,7 @@ class TestProjectOwners(cloudstackTestCase): self.user.account.name) list_projects_reponse = Project.list( - self.apiclient, + self.apiclient, id=project.id, listall=True ) @@ -1012,13 +1013,13 @@ class TestProjectOwners(cloudstackTestCase): )) # Add user to the project project.addAccount( - self.apiclient, - self.new_admin.account.name, + self.apiclient, + self.new_admin.account.name, ) - + # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.new_admin.account.name, ) @@ -1028,30 +1029,30 @@ class TestProjectOwners(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" ) - self.debug("Updating project with new Admin: %s" % + self.debug("Updating project with new Admin: %s" % self.new_admin.account.name) # Update the project with new admin project.update( - self.apiclient, + self.apiclient, account=self.new_admin.account.name ) - + # listProjectAccount to verify the user is new admin of the project accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.new_admin.account.name, ) @@ -1060,33 +1061,33 @@ class TestProjectOwners(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, 'Admin', "Newly added user is not added as a regular user" ) - + self.debug("Adding %s user to project: %s" % ( self.user.account.name, project.name )) # Add user to the project project.addAccount( - self.apiclient, - self.user.account.name, + self.apiclient, + self.user.account.name, ) - + # 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, ) @@ -1095,32 +1096,32 @@ class TestProjectOwners(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" ) - self.debug("Updating project with new Admin: %s" % + self.debug("Updating project with new Admin: %s" % self.user.account.name) # Update the project with new admin project.update( - self.apiclient, + self.apiclient, account=self.user.account.name ) - + # listProjectAccount to verify the user is new admin of the project accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.user.account.name, ) @@ -1130,23 +1131,23 @@ class TestProjectOwners(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, 'Admin', "Newly added user is not added as a regular user" ) - + # listProjectAccount to verify old user becomes a regular user accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=project.id, account=self.new_admin.account.name, ) @@ -1155,14 +1156,14 @@ class TestProjectOwners(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', @@ -1192,7 +1193,7 @@ class TestProjectResources(cloudstackTestCase): cls.api_client, cls.services["disk_offering"] ) - + cls.account = Account.create( cls.api_client, cls.services["account"], @@ -1230,7 +1231,7 @@ class TestProjectResources(cloudstackTestCase): except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return - + def test_07_project_resources_account_delete(self): """ Test Verify after an account is removed from the project, all his resources stay with the project. @@ -1256,7 +1257,7 @@ class TestProjectResources(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -1270,9 +1271,9 @@ class TestProjectResources(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 ) @@ -1301,13 +1302,13 @@ class TestProjectResources(cloudstackTestCase): )) # Add user to the project project.addAccount( - self.apiclient, - self.user.account.name, + self.apiclient, + self.user.account.name, ) - + # 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, ) @@ -1316,14 +1317,14 @@ class TestProjectResources(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', @@ -1331,39 +1332,39 @@ class TestProjectResources(cloudstackTestCase): ) # Create some resources(volumes) for the projects volume = Volume.create( - self.apiclient, - self.services["volume"], - zoneid=self.zone.id, - diskofferingid=self.disk_offering.id, + self.apiclient, + self.services["volume"], + zoneid=self.zone.id, + diskofferingid=self.disk_offering.id, projectid=project.id ) self.cleanup.append(volume) # Delete the project user self.user.delete(self.apiclient) - + volumes = Volume.list(self.apiclient, id=volume.id) - + self.assertEqual( isinstance(volumes, list), True, "Check for a valid list volumes response" ) - + self.assertNotEqual( len(volumes), 0, "Check list volumes API response returns a valid list" ) volume_response = volumes[0] - + self.assertEqual( volume_response.name, volume.name, "Volume should exist after project user deletion." ) return - + def test_08_cleanup_after_project_delete(self): """ Test accounts are unassigned from project after project deletion """ @@ -1389,7 +1390,7 @@ class TestProjectResources(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Create project as a domain admin @@ -1402,9 +1403,9 @@ class TestProjectResources(cloudstackTestCase): # Cleanup created project at end of test 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 ) @@ -1440,13 +1441,13 @@ class TestProjectResources(cloudstackTestCase): )) # Add user to the project project.addAccount( - self.apiclient, + self.apiclient, self.user.account.name ) - + # 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, ) @@ -1455,14 +1456,14 @@ class TestProjectResources(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', @@ -1470,10 +1471,10 @@ class TestProjectResources(cloudstackTestCase): ) # Create some resources(volumes) for the projects volume = Volume.create( - self.apiclient, - self.services["volume"], - zoneid=self.zone.id, - diskofferingid=self.disk_offering.id, + self.apiclient, + self.services["volume"], + zoneid=self.zone.id, + diskofferingid=self.disk_offering.id, projectid=project.id ) self.debug("Created a volume: %s for project: %s" % ( @@ -1484,17 +1485,17 @@ class TestProjectResources(cloudstackTestCase): self.debug("Deleting project: %s" % project.name) project.delete(self.apiclient) self.debug("Successfully deleted project: %s" % project.name) - + volumes = Volume.list(self.apiclient, id=volume.id) - + self.assertEqual( volumes, None, "Resources (volume) should be deleted as part of cleanup" ) - + accounts = Project.listAccounts(self.apiclient, projectid=project.id) - + self.assertEqual( accounts, None, @@ -1519,8 +1520,8 @@ class TestProjectSuspendActivate(cloudstackTestCase): cls.services ) cls.template = get_template( - cls.api_client, - cls.zone.id, + cls.api_client, + cls.zone.id, cls.services["ostypeid"] ) # Create account, service offering, disk offering etc. @@ -1545,7 +1546,7 @@ class TestProjectSuspendActivate(cloudstackTestCase): admin=True, domainid=cls.domain.id ) - + # Create project as a domain admin cls.project = Project.create( cls.api_client, @@ -1584,7 +1585,7 @@ class TestProjectSuspendActivate(cloudstackTestCase): except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return - + def test_09_project_suspend(self): """ Test Verify after an account is removed from the project, all his resources stay with the project. @@ -1610,7 +1611,7 @@ class TestProjectSuspendActivate(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) self.debug("Adding %s user to project: %s" % ( @@ -1619,13 +1620,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): )) # Add user to the project self.project.addAccount( - self.apiclient, - self.user.account.name, + self.apiclient, + self.user.account.name, ) - + # listProjectAccount to verify the user is added to project or not accounts_reponse = Project.listAccounts( - self.apiclient, + self.apiclient, projectid=self.project.id, account=self.user.account.name, ) @@ -1634,20 +1635,20 @@ class TestProjectSuspendActivate(cloudstackTestCase): True, "Check for a valid list accounts response" ) - + self.assertNotEqual( len(accounts_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" ) - + virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -1661,7 +1662,7 @@ class TestProjectSuspendActivate(cloudstackTestCase): )) self.debug("Suspending a project: %s" % self.project.name) self.project.suspend(self.apiclient) - + # Check status of all VMs associated with project vms = VirtualMachine.list( self.apiclient, @@ -1673,13 +1674,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): True, "Check for a valid list accounts response" ) - + self.assertNotEqual( len(vms), 0, "Check list project response returns a valid project" ) - + for vm in vms: self.debug("VM ID: %s state: %s" % (vm.id, vm.state)) self.assertEqual( @@ -1688,30 +1689,30 @@ class TestProjectSuspendActivate(cloudstackTestCase): "VM should be in stopped state after project suspension" ) - self.debug("Attempting to create volume in suspended project") + self.debug("Attempting to create volume in suspended project") with self.assertRaises(Exception): # Create some resources(volumes) for the projects volume = Volume.create( - self.apiclient, - self.services["volume"], - zoneid=self.zone.id, - diskofferingid=self.disk_offering.id, + self.apiclient, + self.services["volume"], + zoneid=self.zone.id, + diskofferingid=self.disk_offering.id, projectid=self.project.id ) - + self.debug("Volume creation failed") # Start the stopped VM - self.debug("Attempting to start VM: %s in suspended project" % - virtual_machine.id) + self.debug("Attempting to start VM: %s in suspended project" % + virtual_machine.id) with self.assertRaises(Exception): virtual_machine.start(self.apiclient) self.debug("VM start failed!") - + # Destroy Stopped VM virtual_machine.delete(self.apiclient) self.debug("Destroying VM: %s" % virtual_machine.id) - + # Check status of all VMs associated with project vms = VirtualMachine.list( self.apiclient, @@ -1723,13 +1724,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): True, "Check for a valid list accounts response" ) - + self.assertNotEqual( len(vms), 0, "Check list project response returns a valid project" ) - + for vm in vms: self.debug("VM ID: %s state: %s" % (vm.id, vm.state)) self.assertEqual( @@ -1740,12 +1741,12 @@ class TestProjectSuspendActivate(cloudstackTestCase): return def test_10_project_activation(self): - """ Test project activation after suspension + """ Test project activation after suspension """ tags = ["advanced", "basic", "sg", "eip", "advancedns"] # Validate the following # 1. Activate the project - # 2. Verify project is activated and we are able to add resources + # 2. Verify project is activated and we are able to add resources # Verify 'project.invite.required' is set to false configs = Configurations.list( @@ -1761,13 +1762,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): self.assertEqual( (config.value).lower(), 'false', - "'project.invite.required' should be set to false" + "'project.invite.required' should be set to false" ) # Activating the project self.debug("Activating project: %s" % self.project.name) self.project.activate(self.apiclient) - + virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -1775,7 +1776,7 @@ class TestProjectSuspendActivate(cloudstackTestCase): serviceofferingid=self.service_offering.id, projectid=self.project.id ) - + self.cleanup.append(virtual_machine) self.debug("Created a VM: %s for project: %s" % ( virtual_machine.id, @@ -1792,13 +1793,13 @@ class TestProjectSuspendActivate(cloudstackTestCase): True, "Check for a valid list accounts response" ) - + self.assertNotEqual( len(vms), 0, "Check list project response returns a valid project" ) - + for vm in vms: self.debug("VM ID: %s state: %s" % (vm.id, vm.state)) self.assertEqual( diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py index 61a91c8b153..56b46a3820d 100644 --- a/test/integration/component/test_resource_limits.py +++ b/test/integration/component/test_resource_limits.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Resource limits """ @@ -22,6 +22,7 @@ from integration.lib.base import * from integration.lib.common import * import datetime + class Services: """Test Resource Limits Services """ @@ -44,8 +45,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", @@ -78,6 +79,7 @@ class Services: "mode": 'advanced', } + class TestResourceLimitsAccount(cloudstackTestCase): @classmethod @@ -150,7 +152,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. @@ -159,18 +161,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( @@ -201,7 +203,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( @@ -221,7 +223,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, @@ -243,7 +245,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. @@ -253,21 +255,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, @@ -286,7 +288,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( @@ -305,7 +307,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, @@ -340,7 +342,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( @@ -362,7 +364,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, @@ -386,7 +388,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. @@ -398,19 +400,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, @@ -429,7 +431,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( @@ -501,7 +503,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, @@ -542,7 +544,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. @@ -554,12 +556,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 @@ -684,7 +686,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. @@ -694,19 +696,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, @@ -725,7 +727,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( @@ -914,7 +916,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 @@ -923,12 +925,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 ) @@ -980,7 +982,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. @@ -991,12 +993,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 ) @@ -1050,7 +1052,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. @@ -1062,12 +1064,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 ) @@ -1133,7 +1135,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. @@ -1144,12 +1146,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 ) @@ -1186,9 +1188,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 @@ -1199,18 +1201,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 ) @@ -1298,14 +1300,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): @@ -1332,16 +1334,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), @@ -1358,16 +1360,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), @@ -1381,19 +1383,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), @@ -1407,20 +1409,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), @@ -1434,19 +1436,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), @@ -1460,20 +1462,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), diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py index a6692dc9ae5..73c24ed3959 100644 --- a/test/integration/component/test_routers.py +++ b/test/integration/component/test_routers.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for routers """ @@ -79,7 +79,7 @@ class Services: "publicport": 2222, "protocol": 'TCP', }, - "fw_rule":{ + "fw_rule": { "startport": 1, "endport": 6000, "cidr": '55.55.0.0/11', @@ -87,7 +87,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 } @@ -177,7 +177,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) @@ -315,7 +315,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) @@ -433,9 +433,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( @@ -577,7 +577,6 @@ class TestRouterServices(cloudstackTestCase): return - class TestRouterStopCreatePF(cloudstackTestCase): @classmethod @@ -654,10 +653,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 @@ -717,7 +716,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, @@ -788,6 +787,7 @@ class TestRouterStopCreatePF(cloudstackTestCase): ) return + class TestRouterStopCreateLB(cloudstackTestCase): @classmethod @@ -920,8 +920,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, @@ -1073,7 +1073,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, @@ -1220,4 +1220,3 @@ class TestRouterStopCreateFW(cloudstackTestCase): "Check public IP address" ) return - diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py index 86cdee4e778..0b1072b03a6 100644 --- a/test/integration/component/test_security_groups.py +++ b/test/integration/component/test_security_groups.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 for Security groups @@ -34,7 +34,7 @@ class Services: def __init__(self): self.services = { - "disk_offering":{ + "disk_offering": { "displaytext": "Small", "name": "Small", "disksize": 1 @@ -44,12 +44,12 @@ class Services: "firstname": "Test", "lastname": "User", "username": "test", - # Random characters are appended in create account to + # Random characters are appended in create account to # ensure unique username generated each time "password": "fr3sca", }, "virtual_machine": { - # Create a small virtual machine instance with disk offering + # Create a small virtual machine instance with disk offering "displayname": "Test VM", "username": "root", # VM creds for SSH "password": "password", @@ -62,15 +62,15 @@ class Services: }, "host": { "publicport": 22, - "username": "root", # Host creds for SSH + "username": "root", # Host creds for SSH "password": "fr3sca", }, "service_offering": { "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', @@ -84,19 +84,19 @@ class Services: "protocol": 'ICMP', "startport": -1, "endport": -1, - "cidrlist": '0.0.0.0/0', + "cidrlist": '0.0.0.0/0', }, "ostypeid": '0c2c5d19-525b-41be-a8c3-c6607412f82b', # CentOS 5.3 (64-bit) "sleep": 60, "timeout": 10, - "mode":'basic', + "mode": 'basic', # Networking mode: Basic or Advanced } class TestDefaultSecurityGroup(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() @@ -122,7 +122,7 @@ class TestDefaultSecurityGroup(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, @@ -131,7 +131,7 @@ class TestDefaultSecurityGroup(cloudstackTestCase): cls.services["domainid"] = cls.domain.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = template.id - + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -165,12 +165,12 @@ class TestDefaultSecurityGroup(cloudstackTestCase): def test_01_deployVM_InDefaultSecurityGroup(self): """Test deploy VM in default security group """ - + tags = ["sg", "eip"] # Validate the following: # 1. deploy Virtual machine using admin user - # 2. listVM should show a VM in Running state + # 2. listVM should show a VM in Running state # 3. listRouters should show one router running self.virtual_machine = VirtualMachine.create( @@ -182,7 +182,7 @@ class TestDefaultSecurityGroup(cloudstackTestCase): ) self.debug("Deployed VM with ID: %s" % self.virtual_machine.id) self.cleanup.append(self.virtual_machine) - + list_vm_response = list_virtual_machines( self.apiclient, id=self.virtual_machine.id @@ -216,8 +216,8 @@ class TestDefaultSecurityGroup(cloudstackTestCase): self.virtual_machine.displayname, "Check virtual machine displayname in listVirtualMachines" ) - - # Verify List Routers response for account + + # Verify List Routers response for account self.debug( "Verify list routers response for account: %s" \ % self.account.account.name @@ -232,11 +232,11 @@ class TestDefaultSecurityGroup(cloudstackTestCase): True, "Check for list Routers response" ) - + self.debug("Router Response: %s" % routers) self.assertEqual( - len(routers), - 1, + len(routers), + 1, "Check virtual router is created for account or not" ) return @@ -244,14 +244,14 @@ class TestDefaultSecurityGroup(cloudstackTestCase): def test_02_listSecurityGroups(self): """Test list security groups for admin account """ - + tags = ["sg", "eip"] # Validate the following: # 1. listSecurityGroups in admin account # 2. There should be one security group (default) listed for the admin account # 3. No Ingress Rules should be part of the default security group - + sercurity_groups = SecurityGroup.list( self.apiclient, account=self.account.account.name, @@ -263,11 +263,11 @@ class TestDefaultSecurityGroup(cloudstackTestCase): "Check for list security groups response" ) self.assertNotEqual( - len(sercurity_groups), - 0, + len(sercurity_groups), + 0, "Check List Security groups response" ) - self.debug("List Security groups response: %s" % + self.debug("List Security groups response: %s" % str(sercurity_groups)) self.assertEqual( hasattr(sercurity_groups, 'ingressrule'), @@ -275,16 +275,16 @@ class TestDefaultSecurityGroup(cloudstackTestCase): "Check ingress rule attribute for default security group" ) return - + def test_03_accessInDefaultSecurityGroup(self): """Test access in default security group """ - + tags = ["sg", "eip"] # Validate the following: # 1. deploy Virtual machine using admin user - # 2. listVM should show a VM in Running state + # 2. listVM should show a VM in Running state # 3. listRouters should show one router running self.virtual_machine = VirtualMachine.create( @@ -296,7 +296,7 @@ class TestDefaultSecurityGroup(cloudstackTestCase): ) self.debug("Deployed VM with ID: %s" % self.virtual_machine.id) self.cleanup.append(self.virtual_machine) - + list_vm_response = list_virtual_machines( self.apiclient, id=self.virtual_machine.id @@ -306,7 +306,7 @@ class TestDefaultSecurityGroup(cloudstackTestCase): True, "Check for list VM response" ) - + self.debug( "Verify listVirtualMachines response for virtual machine: %s" \ % self.virtual_machine.id @@ -342,12 +342,12 @@ class TestDefaultSecurityGroup(cloudstackTestCase): True, "Check for list security groups response" ) - - self.debug("List Security groups response: %s" % + + self.debug("List Security groups response: %s" % str(sercurity_groups)) self.assertNotEqual( - len(sercurity_groups), - 0, + len(sercurity_groups), + 0, "Check List Security groups response" ) self.assertEqual( @@ -355,7 +355,7 @@ class TestDefaultSecurityGroup(cloudstackTestCase): False, "Check ingress rule attribute for default security group" ) - + # SSH Attempt to VM should fail with self.assertRaises(Exception): self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip) @@ -366,10 +366,10 @@ class TestDefaultSecurityGroup(cloudstackTestCase): self.virtual_machine.password ) return - + class TestAuthorizeIngressRule(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() @@ -395,7 +395,7 @@ class TestAuthorizeIngressRule(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, @@ -404,7 +404,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase): cls.services["domainid"] = cls.domain.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = template.id - + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -436,7 +436,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase): def test_01_authorizeIngressRule(self): """Test authorize ingress rule """ - + tags = ["sg", "eip"] # Validate the following: @@ -444,11 +444,11 @@ class TestAuthorizeIngressRule(cloudstackTestCase): #2. Createsecuritygroup (ssh-incoming) for this account #3. authorizeSecurityGroupIngress to allow ssh access to the VM #4. deployVirtualMachine into this security group (ssh-incoming) - + security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) @@ -463,17 +463,17 @@ class TestAuthorizeIngressRule(cloudstackTestCase): True, "Check for list security groups response" ) - + self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) # Authorize Security group to SSH to VM ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -481,8 +481,8 @@ class TestAuthorizeIngressRule(cloudstackTestCase): True, "Check ingress rule created properly" ) - - self.debug("Authorizing ingress rule for sec group ID: %s for ssh access" + + self.debug("Authorizing ingress rule for sec group ID: %s for ssh access" % security_group.id) self.virtual_machine = VirtualMachine.create( self.apiclient, @@ -505,7 +505,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase): class TestRevokeIngressRule(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() @@ -531,7 +531,7 @@ class TestRevokeIngressRule(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, @@ -540,7 +540,7 @@ class TestRevokeIngressRule(cloudstackTestCase): cls.services["domainid"] = cls.domain.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = template.id - + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -572,7 +572,7 @@ class TestRevokeIngressRule(cloudstackTestCase): def test_01_revokeIngressRule(self): """Test revoke ingress rule """ - + tags = ["sg", "eip"] # Validate the following: @@ -581,15 +581,15 @@ class TestRevokeIngressRule(cloudstackTestCase): #3. authorizeSecurityGroupIngress to allow ssh access to the VM #4. deployVirtualMachine into this security group (ssh-incoming) #5. Revoke the ingress rule, SSH access should fail - + security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) - + # Default Security group should not have any ingress rule sercurity_groups = SecurityGroup.list( self.apiclient, @@ -601,28 +601,28 @@ class TestRevokeIngressRule(cloudstackTestCase): True, "Check for list security groups response" ) - + self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) # Authorize Security group to SSH to VM - self.debug("Authorizing ingress rule for sec group ID: %s for ssh access" + self.debug("Authorizing ingress rule for sec group ID: %s for ssh access" % security_group.id) ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) - + self.assertEqual( isinstance(ingress_rule, dict), True, "Check ingress rule created properly" ) - + ssh_rule = (ingress_rule["ingressrule"][0]).__dict__ self.virtual_machine = VirtualMachine.create( self.apiclient, @@ -633,7 +633,7 @@ class TestRevokeIngressRule(cloudstackTestCase): securitygroupids=[security_group.id] ) self.debug("Deploying VM in account: %s" % self.account.account.name) - + # Should be able to SSH VM try: self.debug("SSH into VM: %s" % self.virtual_machine.id) @@ -642,12 +642,12 @@ class TestRevokeIngressRule(cloudstackTestCase): self.fail("SSH Access failed for %s: %s" % \ (self.virtual_machine.ipaddress, e) ) - - self.debug("Revoking ingress rule for sec group ID: %s for ssh access" + + self.debug("Revoking ingress rule for sec group ID: %s for ssh access" % security_group.id) # Revoke Security group to SSH to VM result = security_group.revoke( - self.apiclient, + self.apiclient, id=ssh_rule["ruleid"] ) @@ -664,7 +664,7 @@ class TestRevokeIngressRule(cloudstackTestCase): class TestDhcpOnlyRouter(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() @@ -690,17 +690,17 @@ class TestDhcpOnlyRouter(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, cls.services["ostypeid"] ) - + cls.services["domainid"] = cls.domain.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = template.id - + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -739,13 +739,13 @@ class TestDhcpOnlyRouter(cloudstackTestCase): def test_01_dhcpOnlyRouter(self): """Test router services for user account """ - + tags = ["sg", "eip", "basic"] - + # Validate the following #1. List routers for any user account #2. The only service supported by this router should be dhcp - + # Find router associated with user account list_router_response = list_routers( self.apiclient, @@ -764,7 +764,7 @@ class TestDhcpOnlyRouter(cloudstackTestCase): zoneid=router.zoneid, type='Routing', state='Up', - virtualmachineid=self.virtual_machine.id + id=router.hostid ) self.assertEqual( isinstance(hosts, list), @@ -772,7 +772,7 @@ class TestDhcpOnlyRouter(cloudstackTestCase): "Check list host returns a valid list" ) host = hosts[0] - + self.debug("Router ID: %s, state: %s" % (router.id, router.state)) self.assertEqual( @@ -798,10 +798,10 @@ class TestDhcpOnlyRouter(cloudstackTestCase): "Check dnsmasq service is running or not" ) return - + class TestdeployVMWithUserData(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() @@ -827,17 +827,17 @@ class TestdeployVMWithUserData(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, cls.services["ostypeid"] ) - + cls.services["domainid"] = cls.domain.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["template"] = template.id - + cls.service_offering = ServiceOffering.create( cls.api_client, cls.services["service_offering"] @@ -865,12 +865,12 @@ class TestdeployVMWithUserData(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - + def test_01_deployVMWithUserData(self): """Test Deploy VM with User data""" - + tags = ["sg", "eip"] - + # Validate the following # 1. CreateAccount of type user # 2. CreateSecurityGroup ssh-incoming @@ -878,7 +878,7 @@ class TestdeployVMWithUserData(cloudstackTestCase): # 4. deployVirtualMachine into this group with some base64 encoded user-data # 5. wget http://10.1.1.1/latest/user-data to get the latest userdata from the # router for this VM - + # Find router associated with user account list_router_response = list_routers( self.apiclient, @@ -891,11 +891,11 @@ class TestdeployVMWithUserData(cloudstackTestCase): "Check list response returns a valid list" ) router = list_router_response[0] - + security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) @@ -911,23 +911,23 @@ class TestdeployVMWithUserData(cloudstackTestCase): "Check for list security groups response" ) self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) - + self.debug( "Authorize Ingress Rule for Security Group %s for account: %s" \ % ( security_group.id, self.account.account.name )) - + # Authorize Security group to SSH to VM ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -950,13 +950,13 @@ class TestdeployVMWithUserData(cloudstackTestCase): "SSH to VM with IP Address: %s"\ % self.virtual_machine.ssh_ip ) - + ssh = self.virtual_machine.get_ssh_client() except Exception as e: self.fail("SSH Access failed for %s: %s" % \ (self.virtual_machine.ipaddress, e) ) - + cmds = [ "wget http://%s/latest/user-data" % router.guestipaddress, "cat user-data", @@ -964,39 +964,39 @@ class TestdeployVMWithUserData(cloudstackTestCase): for c in cmds: result = ssh.execute(c) self.debug("%s: %s" % (c, result)) - + res = str(result) self.assertEqual( res.count(self.services["virtual_machine"]["userdata"]), - 1, + 1, "Verify user data" ) return class TestDeleteSecurityGroup(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() - + self.services = Services().services # Get Zone, Domain and templates self.domain = get_domain(self.apiclient, self.services) self.zone = get_zone(self.apiclient, self.services) - + template = get_template( self.apiclient, self.zone.id, self.services["ostypeid"] ) - + self.services["domainid"] = self.domain.id self.services["virtual_machine"]["zoneid"] = self.zone.id self.services["virtual_machine"]["template"] = template.id - + self.service_offering = ServiceOffering.create( self.apiclient, self.services["service_offering"] @@ -1041,23 +1041,23 @@ class TestDeleteSecurityGroup(cloudstackTestCase): raise Exception("Warning: Exception during cleanup : %s" % e) return - + def test_01_delete_security_grp_running_vm(self): """Test delete security group with running VM""" - + tags = ["sg", "eip"] - + # Validate the following # 1. createsecuritygroup (ssh-incoming) for this account # 2. authorizeSecurityGroupIngress to allow ssh access to the VM # 3. deployVirtualMachine into this security group (ssh-incoming) # 4. deleteSecurityGroup created in step 1. Deletion should fail # complaining there are running VMs in this group - + security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) @@ -1072,10 +1072,10 @@ class TestDeleteSecurityGroup(cloudstackTestCase): True, "Check for list security groups response" ) - + self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) self.debug( @@ -1084,12 +1084,12 @@ class TestDeleteSecurityGroup(cloudstackTestCase): security_group.id, self.account.account.name )) - + # Authorize Security group to SSH to VM ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1097,7 +1097,7 @@ class TestDeleteSecurityGroup(cloudstackTestCase): True, "Check ingress rule created properly" ) - + self.virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -1107,41 +1107,41 @@ class TestDeleteSecurityGroup(cloudstackTestCase): securitygroupids=[security_group.id] ) self.debug("Deploying VM in account: %s" % self.account.account.name) - + # Deleting Security group should raise exception security_group.delete(self.apiclient) - + #sleep to ensure that Security group is deleted properly time.sleep(self.services["sleep"]) - + # Default Security group should not have any ingress rule sercurity_groups = SecurityGroup.list( self.apiclient, id=security_group.id ) self.assertNotEqual( - sercurity_groups, - None, + sercurity_groups, + None, "Check List Security groups response" ) return def test_02_delete_security_grp_withoout_running_vm(self): """Test delete security group without running VM""" - + tags = ["sg", "eip"] - + # Validate the following # 1. createsecuritygroup (ssh-incoming) for this account # 2. authorizeSecurityGroupIngress to allow ssh access to the VM # 3. deployVirtualMachine into this security group (ssh-incoming) # 4. deleteSecurityGroup created in step 1. Deletion should fail # complaining there are running VMs in this group - + security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) @@ -1157,11 +1157,11 @@ class TestDeleteSecurityGroup(cloudstackTestCase): "Check for list security groups response" ) self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) - + self.debug( "Authorize Ingress Rule for Security Group %s for account: %s" \ % ( @@ -1171,8 +1171,8 @@ class TestDeleteSecurityGroup(cloudstackTestCase): # Authorize Security group to SSH to VM ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1180,7 +1180,7 @@ class TestDeleteSecurityGroup(cloudstackTestCase): True, "Check ingress rule created properly" ) - + self.virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -1190,10 +1190,10 @@ class TestDeleteSecurityGroup(cloudstackTestCase): securitygroupids=[security_group.id] ) self.debug("Deploying VM in account: %s" % self.account.account.name) - + # Destroy the VM self.virtual_machine.delete(self.apiclient) - + config = list_configurations( self.apiclient, name='expunge.delay' @@ -1207,7 +1207,7 @@ class TestDeleteSecurityGroup(cloudstackTestCase): self.debug("expunge.delay: %s" % response.value) # Wait for some time more than expunge.delay time.sleep(int(response.value) * 2) - + # Deleting Security group should raise exception try: self.debug("Deleting Security Group: %s" % security_group.id) @@ -1217,32 +1217,32 @@ class TestDeleteSecurityGroup(cloudstackTestCase): % security_group.id ) return - + class TestIngressRule(cloudstackTestCase): - + def setUp(self): self.apiclient = self.testClient.getApiClient() self.dbclient = self.testClient.getDbConnection() self.cleanup = [] - + self.services = Services().services # Get Zone, Domain and templates self.domain = get_domain(self.apiclient, self.services) self.zone = get_zone(self.apiclient, self.services) - + template = get_template( self.apiclient, self.zone.id, self.services["ostypeid"] ) - + self.services["domainid"] = self.domain.id self.services["virtual_machine"]["zoneid"] = self.zone.id self.services["virtual_machine"]["template"] = template.id - + self.service_offering = ServiceOffering.create( self.apiclient, self.services["service_offering"] @@ -1290,20 +1290,20 @@ class TestIngressRule(cloudstackTestCase): def test_01_authorizeIngressRule_AfterDeployVM(self): """Test delete security group with running VM""" - + tags = ["sg", "eip"] - + # Validate the following # 1. createsecuritygroup (ssh-incoming, 22via22) for this account # 2. authorizeSecurityGroupIngress to allow ssh access to the VM # 3. deployVirtualMachine into this security group (ssh-incoming) # 4. authorizeSecurityGroupIngress to allow ssh access (startport:222 to # endport:22) to the VM - + security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) @@ -1319,8 +1319,8 @@ class TestIngressRule(cloudstackTestCase): "Check for list security groups response" ) self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) self.debug( @@ -1329,12 +1329,12 @@ class TestIngressRule(cloudstackTestCase): security_group.id, self.account.account.name )) - + # Authorize Security group to SSH to VM ingress_rule_1 = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1351,7 +1351,7 @@ class TestIngressRule(cloudstackTestCase): securitygroupids=[security_group.id] ) self.debug("Deploying VM in account: %s" % self.account.account.name) - + self.debug( "Authorize Ingress Rule for Security Group %s for account: %s" \ % ( @@ -1361,8 +1361,8 @@ class TestIngressRule(cloudstackTestCase): # Authorize Security group to SSH to VM ingress_rule_2 = security_group.authorize( self.apiclient, - self.services["security_group_2"], - account=self.account.account.name, + self.services["security_group_2"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1377,16 +1377,16 @@ class TestIngressRule(cloudstackTestCase): self.services["security_group"]["endport"] )) self.virtual_machine.get_ssh_client() - + except Exception as e: self.fail("SSH access failed for ingress rule ID: %s, %s" \ % (ingress_rule_1["id"], e)) - + # User should be able to ping VM try: self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip) result = subprocess.call(['ping', '-c 1', self.virtual_machine.ssh_ip]) - + self.debug("Ping result: %s" % result) # if ping successful, then result should be 0 self.assertEqual( @@ -1394,7 +1394,7 @@ class TestIngressRule(cloudstackTestCase): 0, "Check if ping is successful or not" ) - + except Exception as e: self.fail("Ping failed for ingress rule ID: %s, %s" \ % (ingress_rule_2["id"], e)) @@ -1402,9 +1402,9 @@ class TestIngressRule(cloudstackTestCase): def test_02_revokeIngressRule_AfterDeployVM(self): """Test Revoke ingress rule after deploy VM""" - + tags = ["sg", "eip"] - + # Validate the following # 1. createsecuritygroup (ssh-incoming, 22via22) for this account # 2. authorizeSecurityGroupIngress to allow ssh access to the VM @@ -1417,13 +1417,13 @@ class TestIngressRule(cloudstackTestCase): # but allowed through port 22 security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) - + # Default Security group should not have any ingress rule sercurity_groups = SecurityGroup.list( self.apiclient, @@ -1436,23 +1436,23 @@ class TestIngressRule(cloudstackTestCase): "Check for list security groups response" ) self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) - + self.debug( "Authorize Ingress Rule for Security Group %s for account: %s" \ % ( security_group.id, self.account.account.name )) - + # Authorize Security group to SSH to VM ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1469,19 +1469,19 @@ class TestIngressRule(cloudstackTestCase): securitygroupids=[security_group.id] ) self.debug("Deploying VM in account: %s" % self.account.account.name) - + self.debug( "Authorize Ingress Rule for Security Group %s for account: %s" \ % ( security_group.id, self.account.account.name )) - + # Authorize Security group to SSH to VM ingress_rule_2 = security_group.authorize( self.apiclient, - self.services["security_group_2"], - account=self.account.account.name, + self.services["security_group_2"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1489,10 +1489,10 @@ class TestIngressRule(cloudstackTestCase): True, "Check ingress rule created properly" ) - + ssh_rule = (ingress_rule["ingressrule"][0]).__dict__ icmp_rule = (ingress_rule_2["ingressrule"][0]).__dict__ - + # SSH should be allowed on 22 try: self.debug("Trying to SSH into VM %s on port %s" % ( @@ -1500,16 +1500,16 @@ class TestIngressRule(cloudstackTestCase): self.services["security_group"]["endport"] )) self.virtual_machine.get_ssh_client() - + except Exception as e: self.fail("SSH access failed for ingress rule ID: %s, %s" \ % (ssh_rule["ruleid"], e)) - + # User should be able to ping VM try: self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip) result = subprocess.call(['ping', '-c 1', self.virtual_machine.ssh_ip]) - + self.debug("Ping result: %s" % result) # if ping successful, then result should be 0 self.assertEqual( @@ -1517,21 +1517,21 @@ class TestIngressRule(cloudstackTestCase): 0, "Check if ping is successful or not" ) - + except Exception as e: self.fail("Ping failed for ingress rule ID: %s, %s" \ % (icmp_rule["ruleid"], e)) - + self.debug( "Revoke Ingress Rule for Security Group %s for account: %s" \ % ( security_group.id, self.account.account.name )) - + result = security_group.revoke( - self.apiclient, - id = icmp_rule["ruleid"] + self.apiclient, + id=icmp_rule["ruleid"] ) self.debug("Revoke ingress rule result: %s" % result) @@ -1540,7 +1540,7 @@ class TestIngressRule(cloudstackTestCase): try: self.debug("Trying to ping VM %s" % self.virtual_machine.ssh_ip) result = subprocess.call(['ping', '-c 1', self.virtual_machine.ssh_ip]) - + self.debug("Ping result: %s" % result) # if ping successful, then result should be 0 self.assertNotEqual( @@ -1548,7 +1548,7 @@ class TestIngressRule(cloudstackTestCase): 0, "Check if ping is successful or not" ) - + except Exception as e: self.fail("Ping failed for ingress rule ID: %s, %s" \ % (icmp_rule["ruleid"], e)) @@ -1556,9 +1556,9 @@ class TestIngressRule(cloudstackTestCase): def test_03_stopStartVM_verifyIngressAccess(self): """Test Start/Stop VM and Verify ingress rule""" - + tags = ["sg", "eip"] - + # Validate the following # 1. createsecuritygroup (ssh-incoming, 22via22) for this account # 2. authorizeSecurityGroupIngress to allow ssh access to the VM @@ -1569,9 +1569,9 @@ class TestIngressRule(cloudstackTestCase): # verify that ssh-access to the VM is allowed security_group = SecurityGroup.create( - self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.apiclient, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.debug("Created security group with ID: %s" % security_group.id) @@ -1586,25 +1586,25 @@ class TestIngressRule(cloudstackTestCase): True, "Check for list security groups response" ) - + self.assertEqual( - len(sercurity_groups), - 2, + len(sercurity_groups), + 2, "Check List Security groups response" ) - + self.debug( "Authorize Ingress Rule for Security Group %s for account: %s" \ % ( security_group.id, self.account.account.name )) - + # Authorize Security group to SSH to VM ingress_rule = security_group.authorize( self.apiclient, - self.services["security_group"], - account=self.account.account.name, + self.services["security_group"], + account=self.account.account.name, domainid=self.account.account.domainid ) self.assertEqual( @@ -1612,7 +1612,7 @@ class TestIngressRule(cloudstackTestCase): True, "Check ingress rule created properly" ) - + self.virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], @@ -1622,7 +1622,7 @@ class TestIngressRule(cloudstackTestCase): securitygroupids=[security_group.id] ) self.debug("Deploying VM in account: %s" % self.account.account.name) - + # SSH should be allowed on 22 port try: self.debug("Trying to SSH into VM %s" % self.virtual_machine.ssh_ip) @@ -1631,17 +1631,17 @@ class TestIngressRule(cloudstackTestCase): self.fail("SSH access failed for ingress rule ID: %s" \ % ingress_rule["id"] ) - + self.virtual_machine.stop(self.apiclient) - + # Sleep to ensure that VM is in stopped state time.sleep(self.services["sleep"]) - + self.virtual_machine.start(self.apiclient) - + # Sleep to ensure that VM is in running state time.sleep(self.services["sleep"]) - + # SSH should be allowed on 22 port after restart try: self.debug("Trying to SSH into VM %s" % self.virtual_machine.ssh_ip) diff --git a/test/integration/component/test_security_keys_encryption.py b/test/integration/component/test_security_keys_encryption.py index 89907c217d2..8538dc4b88b 100755 --- a/test/integration/component/test_security_keys_encryption.py +++ b/test/integration/component/test_security_keys_encryption.py @@ -30,8 +30,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": "TestVM", @@ -52,23 +52,23 @@ class Services: "password": "fr3sca", }, "globalconfig": { - "security.hash.key": "test", - "vmware.guest.vswitch": "test", - "vmware.public.vswitch": "test", - "vmware.private.vswitch": "test", - "kvm.guest.network.device": "test", - "ovm.guest.network.device": "test", - "xen.guest.network.device": "test", - "kvm.public.network.device": "test", - "ovm.public.network.device": "test", - "xen.public.network.device": "test", - "kvm.private.network.device": "test", - "ovm.private.network.device": "test", - "xen.private.network.device": "test", - "xen.storage.network.device1": "test", - "xen.storage.network.device2": "test", - "alert.smtp.password": "test", - "project.smtp.password": "test", + "security.hash.key" : "test", + "vmware.guest.vswitch" : "test", + "vmware.public.vswitch" : "test", + "vmware.private.vswitch" : "test", + "kvm.guest.network.device" : "test", + "ovm.guest.network.device" : "test", + "xen.guest.network.device" : "test", + "kvm.public.network.device" : "test", + "ovm.public.network.device" : "test", + "xen.public.network.device" : "test", + "kvm.private.network.device" : "test", + "ovm.private.network.device" : "test", + "xen.private.network.device" : "test", + "xen.storage.network.device1" : "test", + "xen.storage.network.device2" : "test", + "alert.smtp.password" : "test", + "project.smtp.password" : "test", }, "ostypeid": '7ddbbbb5-bb09-40de-b038-ee78995788ea', # Cent OS 5.3 (64 bit) @@ -364,7 +364,7 @@ class TestSecurityKeysEncryption(cloudstackTestCase): self.assertNotEqual( config_value, v, - "Configuration %s 's value should be stored in encrypted format in DB" % k + "Check configuration value in database is not equal to value set to verify the value is encrypted" ) #Setting the configuration value back to None as default value diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py index a609602e2cd..ec6a60c9446 100644 --- a/test/integration/component/test_snapshots.py +++ b/test/integration/component/test_snapshots.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Snapshots """ @@ -22,6 +22,7 @@ from integration.lib.base import * from integration.lib.common import * from marvin.remoteSSHClient import remoteSSHClient + class Services: """Test Snapshots Services """ @@ -41,8 +42,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", @@ -68,10 +69,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', @@ -81,7 +82,7 @@ class Services: }, "diskdevice": "/dev/xvda", "diskname": "TestDiskServ", - "size": 1, # GBs + "size": 1, # GBs "mount_dir": "/mnt/tmp", "sub_dir": "test", @@ -93,7 +94,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 } @@ -162,7 +163,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. @@ -188,7 +189,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, @@ -329,7 +330,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: @@ -341,7 +342,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, @@ -358,7 +359,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"]) @@ -376,7 +377,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), @@ -427,7 +428,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, @@ -470,7 +471,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. @@ -515,7 +516,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, @@ -588,7 +589,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: @@ -618,7 +619,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 @@ -630,14 +631,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) @@ -652,7 +653,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) @@ -660,14 +661,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('/') @@ -681,7 +682,7 @@ class TestAccountSnapshotClean(cloudstackTestCase): # Export path: export/test try: - cmds = [ + cmds = [ "mount %s/%s %s" % ( sec_storage_ip, export_path, @@ -698,7 +699,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 = [ @@ -712,7 +713,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), @@ -801,7 +802,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 @@ -860,7 +861,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)) @@ -905,7 +906,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';" \ @@ -951,7 +952,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: @@ -980,7 +981,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase): for c in cmds: result = ssh_client.execute(c) - + uuids.append(result) # Unmount the Sec Storage cmds = [ @@ -991,7 +992,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), @@ -1073,15 +1074,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, @@ -1113,7 +1114,7 @@ class TestSnapshotLimit(cloudstackTestCase): True, "Check list response returns a valid list" ) - + self.assertNotEqual( snapshot_policy, None, @@ -1145,7 +1146,7 @@ class TestSnapshotLimit(cloudstackTestCase): snapshottype='RECURRING', listall=True ) - + self.assertEqual( isinstance(snapshots, list), True, @@ -1156,7 +1157,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"]) @@ -1325,13 +1326,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, diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py index ba20f5f2927..231f36c96b1 100644 --- a/test/integration/component/test_stopped_vm.py +++ b/test/integration/component/test_stopped_vm.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 for stopped Virtual Maschine life cycle @@ -25,6 +25,7 @@ from integration.lib.common import * #Import System modules import time + class Services: """Test Stopped VM Life Cycle Services """ @@ -36,14 +37,14 @@ class Services: "firstname": "Test", "lastname": "User", "username": "test", - # Random characters are appended in create account to + # Random characters are appended in create account to # ensure unique username generated each time "password": "password", }, "virtual_machine": { "displayname": "testserver", - "username": "root", # VM creds for SSH + "username": "root", # VM creds for SSH "password": "password", "ssh_port": 22, "hypervisor": 'XenServer', @@ -56,8 +57,8 @@ class Services: "name": "Tiny Instance", "displaytext": "Tiny Instance", "cpunumber": 1, - "cpuspeed": 100, # in MHz - "memory": 128, # In MBs + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs }, "disk_offering": { "displaytext": "Small volume", @@ -76,12 +77,12 @@ class Services: "url": "http://nfs1.lab.vmops.com/isos_32bit/dsl-4.4.10.iso", # Source URL where ISO is located "ostypeid": '19e6a39f-92db-4d2c-b375-33e7f42d86be', - "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO + "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO }, "template": { "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, @@ -169,11 +170,11 @@ class TestDeployVM(cloudstackTestCase): def test_01_deploy_vm_no_startvm(self): """Test Deploy Virtual Machine with no startVM parameter """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm without specifying the startvm parameter - # 2. Should be able to login to the VM. + # 1. deploy Vm without specifying the startvm parameter + # 2. Should be able to login to the VM. # 3. listVM command should return the deployed VM.State of this VM # should be "Running". @@ -223,11 +224,11 @@ class TestDeployVM(cloudstackTestCase): def test_02_deploy_vm_startvm_true(self): """Test Deploy Virtual Machine with startVM=true parameter """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=true - # 2. Should be able to login to the VM. + # 1. deploy Vm with the startvm=true + # 2. Should be able to login to the VM. # 3. listVM command should return the deployed VM.State of this VM # should be "Running". @@ -278,11 +279,11 @@ class TestDeployVM(cloudstackTestCase): def test_03_deploy_vm_startvm_false(self): """Test Deploy Virtual Machine with startVM=false parameter """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=false - # 2. Should not be able to login to the VM. + # 1. deploy Vm with the startvm=false + # 2. Should not be able to login to the VM. # 3. listVM command should return the deployed VM.State of this VM # should be "Stopped". # 4. Check listRouters call for that account. List routers should @@ -355,10 +356,10 @@ class TestDeployVM(cloudstackTestCase): ) # Sleep to ensure that all resources are deleted time.sleep((int(interval[0].value) + int(delay[0].value))) - list_vm_response = list_virtual_machines( + list_vm_response = list_virtual_machines( self.apiclient, id=self.virtual_machine.id - ) + ) self.assertEqual( list_vm_response, @@ -370,10 +371,10 @@ class TestDeployVM(cloudstackTestCase): def test_04_deploy_startvm_false_attach_volume(self): """Test Deploy Virtual Machine with startVM=false and attach volume """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=false. Attach volume to the instance + # 1. deploy Vm with the startvm=false. Attach volume to the instance # 2. listVM command should return the deployed VM.State of this VM # should be "Stopped". # 3. Attach volume should be successful @@ -437,10 +438,10 @@ class TestDeployVM(cloudstackTestCase): """Test Deploy Virtual Machine with startVM=false and change service offering """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=false. Attach volume to the instance + # 1. deploy Vm with the startvm=false. Attach volume to the instance # 2. listVM command should return the deployed VM.State of this VM # should be "Stopped". # 3. Attach volume should be successful @@ -536,7 +537,7 @@ class TestDeployVM(cloudstackTestCase): self.apiclient, virtualmachineid=self.virtual_machine.id, type='DATADISK', - id=volume.id, + id=volume.id, listall=True ) self.assertEqual( @@ -550,10 +551,10 @@ class TestDeployVM(cloudstackTestCase): """Test Deploy Virtual Machine with startVM=false and attach detach volumes """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=false. Attach volume to the instance + # 1. deploy Vm with the startvm=false. Attach volume to the instance # 2. listVM command should return the deployed VM.State of this VM # should be "Stopped". # 3. Attach volume should be successful @@ -621,7 +622,7 @@ class TestDeployVM(cloudstackTestCase): self.apiclient, virtualmachineid=self.virtual_machine.id, type='DATADISK', - id=volume.id, + id=volume.id, listall=True ) self.assertEqual( @@ -634,10 +635,10 @@ class TestDeployVM(cloudstackTestCase): def test_07_deploy_startvm_attach_iso(self): """Test Deploy Virtual Machine with startVM=false and attach ISO """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=false. Attach volume to the instance + # 1. deploy Vm with the startvm=false. Attach volume to the instance # 2. listVM command should return the deployed VM.State of this VM # should be "Stopped". # 3. Attach ISO to the instance. Attach ISO should be successful @@ -726,10 +727,10 @@ class TestDeployVM(cloudstackTestCase): """Test Deploy Virtual Machine with startVM=false and attach volume already attached to different machine """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=false. Attach volume to the instance + # 1. deploy Vm with the startvm=false. Attach volume to the instance # 2. listVM command should return the deployed VM.State of this VM # should be "Stopped". # 3. Create an instance with datadisk attached to it. Detach DATADISK @@ -854,7 +855,6 @@ class TestDeployVM(cloudstackTestCase): return - class TestDeployHaEnabledVM(cloudstackTestCase): @classmethod @@ -924,12 +924,12 @@ class TestDeployHaEnabledVM(cloudstackTestCase): self.debug("Warning! Exception in tearDown: %s" % e) def test_01_deploy_ha_vm_startvm_false(self): - """Test Deploy HA enabled Virtual Machine with startvm=false + """Test Deploy HA enabled Virtual Machine with startvm=false """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deployHA enabled Vm with the startvm parameter = false + # 1. deployHA enabled Vm with the startvm parameter = false # 2. listVM command should return the deployed VM. State of this VM # should be "Created". @@ -973,12 +973,12 @@ class TestDeployHaEnabledVM(cloudstackTestCase): return def test_02_deploy_ha_vm_from_iso(self): - """Test Deploy HA enabled Virtual Machine from ISO + """Test Deploy HA enabled Virtual Machine from ISO """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deployHA enabled Vm using ISO with the startvm parameter=true + # 1. deployHA enabled Vm using ISO with the startvm parameter=true # 2. listVM command should return the deployed VM. State of this VM # should be "Running". @@ -1038,12 +1038,12 @@ class TestDeployHaEnabledVM(cloudstackTestCase): return def test_03_deploy_ha_vm_iso_startvm_false(self): - """Test Deploy HA enabled Virtual Machine from ISO with startvm=false + """Test Deploy HA enabled Virtual Machine from ISO with startvm=false """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deployHA enabled Vm using ISO with the startvm parameter=false + # 1. deployHA enabled Vm using ISO with the startvm parameter=false # 2. listVM command should return the deployed VM. State of this VM # should be "Stopped". @@ -1157,11 +1157,11 @@ class TestRouterStateAfterDeploy(cloudstackTestCase): def test_01_deploy_vm_no_startvm(self): """Test Deploy Virtual Machine with no startVM parameter """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: - # 1. deploy Vm without specifying the startvm parameter - # 2. Should be able to login to the VM. + # 1. deploy Vm without specifying the startvm parameter + # 2. Should be able to login to the VM. # 3. listVM command should return the deployed VM.State of this VM # should be "Running". @@ -1372,15 +1372,14 @@ class TestDeployVMBasicZone(cloudstackTestCase): def test_01_deploy_vm_startvm_true(self): """Test Deploy Virtual Machine with startVM=true parameter """ - tags = ["eip","basic","sg"] + tags = ["eip", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=true - # 2. Should be able to login to the VM. + # 1. deploy Vm with the startvm=true + # 2. Should be able to login to the VM. # 3. listVM command should return the deployed VM.State of this VM # should be "Running". - self.debug("Checking the network type of the zone: %s" % self.zone.networktype) self.assertEqual( @@ -1431,15 +1430,14 @@ class TestDeployVMBasicZone(cloudstackTestCase): def test_02_deploy_vm_startvm_false(self): """Test Deploy Virtual Machine with startVM=true parameter """ - tags = ["eip","basic","sg"] + tags = ["eip", "basic", "sg"] # Validate the following: - # 1. deploy Vm with the startvm=true - # 2. Should be able to login to the VM. + # 1. deploy Vm with the startvm=true + # 2. Should be able to login to the VM. # 3. listVM command should return the deployed VM.State of this VM # should be "Running". - self.debug("Checking the network type of the zone: %s" % self.zone.networktype) self.assertEqual( @@ -1570,10 +1568,10 @@ class TestDeployVMFromTemplate(cloudstackTestCase): account=self.account.account.name, domainid=self.account.account.domainid ) - try: - self.template.download(self.apiclient) - except Exception as e: - raise Exception("Template download failed: %s" % e) + try: + self.template.download(self.apiclient) + except Exception as e: + raise Exception("Template download failed: %s" % e) self.cleanup = [self.account] return @@ -1590,7 +1588,7 @@ class TestDeployVMFromTemplate(cloudstackTestCase): """Test Deploy Virtual Machine with startVM=false & enabledpassword in template """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following: # 1. Create the password enabled template @@ -1727,7 +1725,7 @@ class TestVMAccountLimit(cloudstackTestCase): def test_vm_per_account(self): """Test VM limit per account """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following # 1. Set the resource limit for VM per account. @@ -1740,7 +1738,7 @@ class TestVMAccountLimit(cloudstackTestCase): # Set usage_vm=1 for Account 1 update_resource_limit( self.apiclient, - 0, # Instance + 0, # Instance account=self.account.account.name, domainid=self.account.account.domainid, max=1 @@ -1843,7 +1841,7 @@ class TestUploadAttachVolume(cloudstackTestCase): def test_upload_attach_volume(self): """Test Upload volume and attach to VM in stopped state """ - tags = ["advanced","eip","advancedns","basic","sg"] + tags = ["advanced", "eip", "advancedns", "basic", "sg"] # Validate the following # 1. Upload the volume using uploadVolume API call diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py index f18cb08531d..4c96bf47ef6 100644 --- a/test/integration/component/test_templates.py +++ b/test/integration/component/test_templates.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Templates """ @@ -46,8 +46,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", @@ -68,15 +68,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, @@ -89,11 +89,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 } @@ -159,7 +159,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. @@ -209,7 +209,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 @@ -218,13 +218,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, @@ -311,10 +311,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, @@ -326,10 +326,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 @@ -375,7 +375,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 @@ -389,7 +389,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( @@ -414,12 +414,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, @@ -444,7 +444,7 @@ class TestTemplates(cloudstackTestCase): True, "Check for list template response return valid list" ) - + self.assertNotEqual( len(list_template_response), 0, @@ -473,7 +473,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 @@ -492,7 +492,7 @@ class TestTemplates(cloudstackTestCase): True, "Check for list template response return valid list" ) - + self.assertNotEqual( len(list_template_response), 0, @@ -505,12 +505,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=\ @@ -528,7 +528,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 @@ -543,7 +543,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( diff --git a/test/integration/component/test_upload_volumes.py b/test/integration/component/test_upload_volumes.py index a7fa8286e4c..1a7594e1d2a 100644 --- a/test/integration/component/test_upload_volumes.py +++ b/test/integration/component/test_upload_volumes.py @@ -89,7 +89,7 @@ class Services: "publicport": 22, }, "sleep": 50, - "ostypeid": '7ddbbbb5-bb09-40de-b038-ee78995788ea', + "ostypeid": 'e6e3dd0f-03c8-4cab-9c32-89769c17ccb3', "mode": 'basic', } diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py index 4f61d6ba1d9..5aea3e63c8b 100644 --- a/test/integration/component/test_usage.py +++ b/test/integration/component/test_usage.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Snapshots """ @@ -23,6 +23,7 @@ from integration.lib.common import * from marvin.remoteSSHClient import remoteSSHClient import datetime + class Services: """Test Snapshots Services """ @@ -100,7 +101,7 @@ class Services: # Cent OS 5.3 (64 bit) "sleep": 60, "timeout": 10, - "mode":'advanced' + "mode": 'advanced' } @@ -189,16 +190,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 @@ -208,7 +209,7 @@ class TestVmUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -219,7 +220,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 @@ -229,7 +230,7 @@ class TestVmUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -365,7 +366,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 """ tags = ["advanced", "eip", "advancedns"] # Validate the following @@ -375,16 +376,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 @@ -404,12 +405,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, @@ -534,8 +535,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] @@ -553,10 +554,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 @@ -566,7 +567,7 @@ class TestVolumeUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -577,12 +578,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, @@ -593,7 +594,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 @@ -660,7 +661,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!") @@ -716,10 +717,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 @@ -729,7 +730,7 @@ class TestTemplateUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -740,7 +741,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 @@ -756,10 +757,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'), @@ -786,7 +787,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"], @@ -850,11 +851,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 @@ -864,7 +865,7 @@ class TestISOUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -875,18 +876,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, @@ -999,7 +1000,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( @@ -1012,10 +1013,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 @@ -1025,7 +1026,7 @@ class TestLBRuleUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1036,7 +1037,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 @@ -1057,7 +1058,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, @@ -1143,7 +1144,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 """ tags = ["advanced", "basic", "sg", "eip", "advancedns"] # Validate the following @@ -1153,7 +1154,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, @@ -1165,7 +1166,7 @@ class TestSnapshotUsage(cloudstackTestCase): True, "Check if list volumes return a valid data" ) - + volume = volumes[0] # Create a snapshot from the ROOTDISK @@ -1176,10 +1177,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 @@ -1189,7 +1190,7 @@ class TestSnapshotUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1200,12 +1201,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, @@ -1315,7 +1316,7 @@ class TestNatRuleUsage(cloudstackTestCase): def test_01_nat_usage(self): """Test Create/Delete a PF rule and verify correct usage is recorded """ - tags = ["advanced", "advancedns"] + tags = ["advanced", "advancedns"] # Validate the following # 1. Acquire a IP for this account # 2. Create a PF rule on the IP associated with this account. @@ -1325,7 +1326,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( @@ -1339,10 +1340,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 @@ -1352,7 +1353,7 @@ class TestNatRuleUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1363,7 +1364,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 @@ -1481,12 +1482,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( @@ -1496,7 +1497,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( @@ -1515,10 +1516,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 @@ -1528,7 +1529,7 @@ class TestVpnUsage(cloudstackTestCase): True, "Check DB query result set for valid data" ) - + self.assertNotEqual( len(qresultset), 0, @@ -1539,7 +1540,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 @@ -1558,8 +1559,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, diff --git a/test/integration/component/test_vmware_drs.py b/test/integration/component/test_vmware_drs.py index e00ca70f934..83c830220f3 100644 --- a/test/integration/component/test_vmware_drs.py +++ b/test/integration/component/test_vmware_drs.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 for VMware DRS testing @@ -25,6 +25,7 @@ from integration.lib.common import * #Import System modules import time + class Services: """Test vmware DRS services """ @@ -36,14 +37,14 @@ class Services: "firstname": "Test", "lastname": "User", "username": "test", - # Random characters are appended in create account to + # Random characters are appended in create account to # ensure unique username generated each time "password": "password", }, "virtual_machine": { "displayname": "testserver", - "username": "root", # VM creds for SSH + "username": "root", # VM creds for SSH "password": "password", "ssh_port": 22, "hypervisor": 'XenServer', @@ -56,15 +57,15 @@ class Services: "name": "Tiny Instance", "displaytext": "Tiny Instance", "cpunumber": 1, - "cpuspeed": 100, # in MHz - "memory": 128, # In MBs + "cpuspeed": 100, # in MHz + "memory": 128, # In MBs }, "anti_affinity": { "host_1": "10.147.29.55", "host_2": "10.147.29.61", - "vm_2": '73973255-9354-4b1a-b98f-30a3531fd16d', - "vm_1": '11d4e127-7e07-47bb-8ec9-6a9e9ac672ce', - # VM IDs created manually on host 1 and anti-affinity rules added + "vm_2": '73973255-9354-4b1a-b98f-30a3531fd16d', + "vm_1": '11d4e127-7e07-47bb-8ec9-6a9e9ac672ce', + # VM IDs created manually on host 1 and anti-affinity rules added }, "affinity": { "host_1": "10.147.29.55", @@ -162,7 +163,7 @@ class TestVMPlacement(cloudstackTestCase): - Another host should have some capacity remaining - DRS Cluster is configured in "Fully automated" mode """ - tags = ["advanced","vmware","eip","advancedns","basic","sg"] + tags = ["advanced", "vmware", "eip", "advancedns", "basic", "sg"] # Validate the following # 1. Create a new VM in a host which is almost fully utilized # 2 Automatically places VM on the other host @@ -290,7 +291,7 @@ class TestAntiAffinityRules(cloudstackTestCase): - Add host names to host_1,host_2 and IDs of VM 1,2 in the settings class "anti_affinity" above. """ - tags = ["advanced","vmware","eip","advancedns","basic","sg"] + tags = ["advanced", "vmware", "eip", "advancedns", "basic", "sg"] # Validate the following # 1. Deploy VMs on host 1 and 2 @@ -382,10 +383,10 @@ class TestAntiAffinityRules(cloudstackTestCase): self.apiclient, zoneid=self.zone.id, type='Routing', - id=host_1.id + id=host_1.id ) if isinstance(hosts, list): - host = hosts[0] + host = hosts[0] if host.resourcestate == 'Maintenance': break elif timeout == 0: @@ -491,7 +492,7 @@ class TestAffinityRules(cloudstackTestCase): - Add host names to host_1,host_2 and IDs of VM 1,2 in the settings class "affinity" above. """ - tags = ["advanced","vmware","eip","advancedns","basic","sg"] + tags = ["advanced", "vmware", "eip", "advancedns", "basic", "sg"] # Validate the following # 1. Deploy VMs 2 VMs on same hosts diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py index 1b905d4d813..39abbf77420 100644 --- a/test/integration/component/test_volumes.py +++ b/test/integration/component/test_volumes.py @@ -9,7 +9,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# # Automatically generated by addcopyright.py at 04/03/2012 """ P1 tests for Volumes """ @@ -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 }, "disk_offering": { "displaytext": "Small", @@ -140,7 +140,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. @@ -160,7 +160,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( @@ -179,7 +179,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( @@ -193,7 +193,7 @@ class TestAttachVolume(cloudstackTestCase): True, "Check list volumes response for valid list" ) - + self.assertNotEqual( list_volume_response, None, @@ -243,7 +243,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), @@ -273,7 +273,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), @@ -292,7 +292,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) @@ -309,7 +309,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( @@ -321,7 +321,7 @@ class TestAttachVolume(cloudstackTestCase): True, "Check list volumes response for valid list" ) - + self.assertNotEqual( list_volume_response, None, @@ -331,7 +331,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, @@ -423,7 +423,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 @@ -446,7 +446,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) @@ -461,7 +461,7 @@ class TestAttachDetachVolume(cloudstackTestCase): True, "Check list volumes response for valid list" ) - + self.assertNotEqual( list_volume_response, None, @@ -469,7 +469,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( @@ -489,7 +489,7 @@ class TestAttachDetachVolume(cloudstackTestCase): True, "Check list volumes response for valid list" ) - + self.assertNotEqual( list_volume_response, None, @@ -505,7 +505,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, @@ -527,7 +527,7 @@ class TestAttachDetachVolume(cloudstackTestCase): True, "Check list VM response for valid list" ) - + self.assertNotEqual( len(vm_response), 0, @@ -539,7 +539,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) @@ -671,7 +671,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 @@ -690,7 +690,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( @@ -743,7 +743,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 )) @@ -775,7 +775,7 @@ class TestAttachVolumeISO(cloudstackTestCase): True, "Check list VM response for valid list" ) - + self.assertNotEqual( len(vm_response), 0, @@ -867,7 +867,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 @@ -951,7 +951,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 @@ -976,7 +976,7 @@ class TestVolumes(cloudstackTestCase): True, "Check list volumes response for valid list" ) - + self.assertNotEqual( list_volume_response, None, @@ -999,7 +999,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.