40 Commits

Author SHA1 Message Date
dahn
a1f825e7c7
python3: Migrate Marvin and smoketests to python3 (#4727)
This PR prepares marvin and tests for python3. it was part of #4479, until nose2 was decided to be abandoned from that PR.

Re-PR of #4543 and #3730 to enable cooperation

Co-authored-by: Daan Hoogland <dahn@onecht.net>
Co-authored-by: Gabriel Beims Bräscher <gabriel@apache.org>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2021-05-04 23:19:37 +05:30
Daan Hoogland
70ef0788c9 CLOUDSTACK-9408: Fix download urls in sql and scripts
This fixes the agreed upon url on download.cloudstack.org in various
sql files and misc scripts.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-04-20 12:33:33 +05:30
Rohit Yadav
ae32aa13ed CLOUDSTACK-9594: Fix regression in test_templates
Fixes regression in component test `test_templates.py`

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-12-09 11:57:40 +05:30
Rohit Yadav
8769597523 Merge pull request #1763 from sudhansu7/CLOUDSTACK-9594
CLOUDSTACK-9594: API "list templates templatefilter=all" reveals allAPI "list templates templatefilter=all" reveals all templates.
Using a "list templates templatefilter=all" API call any domain admin can see all templates of all domains in ACS. Information returned includes the account and domain of the template's owner.

The template data shows what that VM is using and any hints from the label. This would give an advantage in what attack vectors to use. The account and domain can possibly be used in brute force attack to guess the password and login information.

Test Scenario:

created two accounts in different domain.

```
mysql> select account_id,username,api_key from user where id in (4,5);
+------------+-----------+----------------------------------------------------------------------------------------+
| account_id | username  | api_key                                                                                |
+------------+-----------+----------------------------------------------------------------------------------------+
|          4 | sudadmin1 | 3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg |
|          5 | sudadmin  | N5uHVOrg1Ek1F1a_5OXTz4WpLG3ewHqcbPUSBjQ-2CTJdxmUe2go0S8fyqH4Np0scYiehYg2KqthZXCWEyKx1A |
+------------+-----------+----------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> select account_name,domain_id from account where id in (4,5);
+--------------+-----------+
| account_name | domain_id |
+--------------+-----------+
| sudadmin     |         2 |
| sudadmin1    |         3 |
+--------------+-----------+
2 rows in set (0.00 sec)
```

User sudadmin registered a private template named 'Debian'.

http://10.147.59.107:8080/client/api?apikey=N5uHVOrg1Ek1F1a_5OXTz4WpLG3ewHqcbPUSBjQ-2CTJdxmUe2go0S8fyqH4Np0scYiehYg2KqthZXCWEyKx1A&command=listTemplates&templatefilter=self&signature=ODt7zEWCLL20z1FT%2FIkd1molRaM%3D

listTemplate with "templatefilter=self", lists the newly registered template.

```
<listtemplatesresponse cloud-stack-version="4.8.0">
<count>1</count>
	<template>
		<id>51026d32-60ee-4e25-8ffd-3fa3c57fc14c</id>
		<name>Debian</name>
		<displaytext>Debian</displaytext>
		<ispublic>false</ispublic>
		<created>2016-11-10T17:18:00-0500</created>
		<isready>true</isready>
		<passwordenabled>false</passwordenabled>
		<format>VHD</format>
		<isfeatured>false</isfeatured>
		<crossZones>false</crossZones>
		<ostypeid>38c1fc84-a687-11e6-a8c8-06f654000053</ostypeid>
		<ostypename>Debian GNU/Linux 7(64-bit)</ostypename>
		<account>sudadmin</account>
		<zoneid>25fa5b74-d4c2-4bad-8e3a-ceffcd10985e</zoneid>
		<zonename>z1</zonename>
		<status>Download Complete</status>
		<size>2621440000</size>
		<templatetype>USER</templatetype>
		<hypervisor>XenServer</hypervisor>
		<domain>SUDDOMAIN</domain>
		<domainid>a350c00d-4048-4876-ae09-74ad4b7bb28c</domainid>
		<isextractable>false</isextractable>
		<checksum>e87a6d7291b999c92baa9623c9c3c207</checksum>
		<details>{hypervisortoolsversion=xenserver61}</details>
		<sshkeyenabled>false</sshkeyenabled>
		<isdynamicallyscalable>false</isdynamicallyscalable>
	</template>
</listtemplatesresponse>

```

User: sudadmin1
listTemplate with "templatefilter=self" does not list any template.

http://10.147.59.107:8080/client/api?apikey=3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg&command=listTemplates&templatefilter=self&signature=RfKsdg3RxDkqJotbTlHU2RdbdPA%3D

`<listtemplatesresponse cloud-stack-version="4.8.0"/>
`

NO TEMPLATES

**listTemplate with "templatefilter=all" lists all templates**

http://10.147.59.107:8080/client/api?apikey=3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg&command=listTemplates&templatefilter=all&signature=l5tubfyABT67d1jY702dvtZODbc%3D

Result:

```
<listtemplatesresponse cloud-stack-version="4.8.0">
<count>3</count>
	<template>
		<id>38451a02-a687-11e6-a8c8-06f654000053</id>
		<name>CentOS 5.6(64-bit) no GUI (XenServer)</name>
		<displaytext>CentOS 5.6(64-bit) no GUI (XenServer)</displaytext>
		<ispublic>true</ispublic>
		....
	</template>
	<template>
		<id>51026d32-60ee-4e25-8ffd-3fa3c57fc14c</id>
		<name>Debian</name>
		<displaytext>Debian</displaytext>
		<ispublic>false</ispublic>
		<created>2016-11-10T17:18:00-0500</created>
		<isready>true</isready>
		<passwordenabled>false</passwordenabled>
		<format>VHD</format>
		<isfeatured>false</isfeatured>
		<crossZones>false</crossZones>
		<ostypeid>38c1fc84-a687-11e6-a8c8-06f654000053</ostypeid>
		<ostypename>Debian GNU/Linux 7(64-bit)</ostypename>
		**<account>sudadmin</account>**
		<zoneid>25fa5b74-d4c2-4bad-8e3a-ceffcd10985e</zoneid>
		<zonename>z1</zonename>
		<size>2621440000</size>
		<templatetype>USER</templatetype>
		<hypervisor>XenServer</hypervisor>
		<domain>SUDDOMAIN</domain>
		<domainid>a350c00d-4048-4876-ae09-74ad4b7bb28c</domainid>
		<isextractable>false</isextractable>
		<checksum>e87a6d7291b999c92baa9623c9c3c207</checksum>
		<details>{hypervisortoolsversion=xenserver61}</details>
		<sshkeyenabled>false</sshkeyenabled>
		<isdynamicallyscalable>false</isdynamicallyscalable>
	</template>
	<template>
		<id>5f6af7bb-d965-4b9b-ab45-6d455b0d6bbe</id>
		<name>SystemVM Template (XenServer)</name>
		<displaytext>SystemVM Template (XenServer)</displaytext>
		<ispublic>false</ispublic>
		.....
	</template>
</listtemplatesresponse>

```

**After Fix:**

http://10.147.59.107:8080/client/api?apikey=3qeSuWadNzUFZ_i6c6zbwafjM3Eo0TWpkHw3En9jNsg5Ditk2N18DnbbL2quBYQ7FsdXQ8rwxbyFlE8vyUTwEg&command=listTemplates&templatefilter=all&signature=l5tubfyABT67d1jY702dvtZODbc%3D

```
<listtemplatesresponse cloud-stack-version="4.8.0">
<count>1</count>
	<template>
		<id>38451a02-a687-11e6-a8c8-06f654000053</id>
		<name>CentOS 5.6(64-bit) no GUI (XenServer)</name>
		<displaytext>CentOS 5.6(64-bit) no GUI (XenServer)</displaytext>
		<ispublic>true</ispublic>
		<created>2016-11-10T09:32:44-0500</created>
		<isready>true</isready>
		<passwordenabled>false</passwordenabled>
		<format>VHD</format>
		<isfeatured>true</isfeatured>
		<crossZones>true</crossZones>
		<ostypeid>38a2bfd6-a687-11e6-a8c8-06f654000053</ostypeid>
		<ostypename>CentOS 5.6 (64-bit)</ostypename>
		<account>system</account>
		<zoneid>25fa5b74-d4c2-4bad-8e3a-ceffcd10985e</zoneid>
		<zonename>z1</zonename>
		<size>21474836480</size>
		<templatetype>BUILTIN</templatetype>
		<hypervisor>XenServer</hypervisor>
		<domain>ROOT</domain>
		<domainid>383e0ea6-a687-11e6-a8c8-06f654000053</domainid>
		<isextractable>true</isextractable>
		<checksum>905cec879afd9c9d22ecc8036131a180</checksum>
		<sshkeyenabled>false</sshkeyenabled>
		<isdynamicallyscalable>true</isdynamicallyscalable>
	</template>
</listtemplatesresponse>

```

Bug has been fixed considering below points
1. templatefilter=all or isofilter=all is applicable only to admin and domain admin.
2. With templatefilter=all or isofilter=all below are the visiblity of templates in system.
- admin should be able to see all templates/iso in system.
- domain admin should be able to see all public template and templates under its domain tree (including sub domain).
- domain admin in a project context should be able to see all public templates and templates registered
as project account and templates which are shared(using updateTemplatePermission api) with project account.

Also Modified "test/integration/component/test_escalation_listTemplateDomainAdmin.py"
This marvin test was written for this scenario but for the second account "templatefilter=all" is not used.

* pr/1763:
  CLOUDSTACK-9594: reverted changes  introduced in  CLOUDSTACK-9376
  CLOUDSTACK-9594: API "list templates templatefilter=all" reveals all templates of all domains

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-12-09 00:31:09 +05:30
Rohit Yadav
0cb60a72fe CLOUDSTACK-9376: Restrict listTemplates API with filter=all for root admin
Restricts use of listemplates API with templatefilter=all for root admin only.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-27 15:01:15 -04:00
Gaurav Aradhye
d73f64a518 CLOUDSTACK-8582: Skipping unsuitable test cases for simulator
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #532
2015-07-16 10:30:14 +05:30
Gaurav Aradhye
6c3dc15fcb CLOUDSTACK-8394: Skip test cases through setUp() instead of setUpClass()
Signed-off-by: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
This closes #231
2015-05-06 16:25:32 +05:30
SrikanteswaraRao Talluri
3eb5c76911 CLOUDSTACK-8161: added skips for the tests which are not supported on LXC:
1. snapshot related
2. template create from volume.
3. VM create from ISO.
4. Data volume related operations on a non RBD storage.

Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2015-01-30 15:52:33 +05:30
Gaurav Aradhye
214d63ee1e CLOUDSTACK-8124: Skipping snapshot tests on hyperv hypervisor
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2015-01-05 18:04:37 +05:30
Ashutosh K
30a2ade17a CLOUDSTACK-7942: Fixing account permission issue in test_template.py
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2014-11-25 18:48:53 +05:30
Chandan Purushothama
50990c4042 CLOUDSTACK-7554 : Fixed the script - /component/test_templates.py - User Account now has permissions to the Template created by Admin 2014-09-16 12:11:48 +05:30
Girish Shilamkar
598e9b1cbc CLOUDSTACK-7413: Adding required_hardware tag to regression test cases so that the test cases are picked up by simulator accordingly 2014-08-25 09:14:22 +05:30
Girish Shilamkar
247c796693 CLOUDSTACK-6536: Code cleanup - removing unnecessary waits after VM stop operation, modifying imports, removing white-spaces, adding try catch blocks whenever necessary 2014-05-07 02:43:10 -04:00
SrikanteswaraRao Talluri
0e223d6787 Merge branch 'master' into marvin
Conflicts:
	test/integration/component/test_base_image_updation.py
	test/integration/component/test_cpu_domain_limits.py
	test/integration/component/test_cpu_limits.py
	test/integration/component/test_cpu_project_limits.py
	test/integration/component/test_ip_reservation.py
	test/integration/component/test_memory_limits.py
	test/integration/component/test_mm_domain_limits.py
	test/integration/component/test_mm_project_limits.py
	test/integration/component/test_persistent_networks.py
	test/integration/component/test_portable_ip.py
	test/integration/component/test_routers.py
	test/integration/smoke/test_deploy_vm.py
	test/integration/smoke/test_deploy_vm_with_userdata.py
	test/integration/smoke/test_internal_lb.py
	test/integration/smoke/test_vm_life_cycle.py
	test/integration/smoke/test_volumes.py
	tools/marvin/marvin/codes.py
	tools/marvin/marvin/configGenerator.py
	tools/marvin/marvin/lib/base.py
	tools/marvin/marvin/lib/common.py
	tools/marvin/marvin/lib/utils.py
2014-04-08 17:53:37 +05:30
SrikanteswaraRao Talluri
91a5e3bb66 CLOUDSTACK-6125: adding 'selfservice','provisioning' tags to segregate the tests
that can be run on simulator only and that needs hardware.
2014-03-28 15:34:57 +05:30
Girish Shilamkar
d70ef2a279 CLOUDSTACK-5925: Changes to regression tests as per new get_zone, get_pod etc definitions 2014-02-26 17:13:21 +05:30
Santhosh Edukulla
bf77e9d669 CLOUDSTACK-6160: Changes to marvin apiclient
Removed apiclient.hypervisor references. More details in the bug
Few other changes pending for this related to VirtualMachine.create
need to be cleaned up
2014-02-24 18:56:46 +05:30
Santhosh Edukulla
bf72441d13 CLOUDSTACK-6006: Remove integration folder and lib 2014-02-04 12:01:58 +05:30
Ashutosh K
944358706d CLOUDSTACK-5802: Increased timeout for template state to become ready, improved assertion messages 2014-01-08 11:10:04 +05:30
Santhosh Edukulla
4473bb2185 Fixed few indentation errors and removed unwanted imports 2013-11-11 10:32:01 +05:30
Santhosh Edukulla
c7fe212c3b CLOUDSTACK-5099: Utils.py-has-wrong-reference, cleaned it. As well added Uniform naming convention
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2013-11-08 16:34:46 +05:30
SrikanteswaraRao Talluri
65b12f45b9 Revert "CLOUSTACK-5099: Utils.py-has-wrong-reference, cleaned it. As well added Uniform naming convention"
This reverts commit ec00a6fb74042259ceea6add676de3f15e642d4a.
2013-11-08 16:05:30 +05:30
Santhosh Edukulla
ec00a6fb74 CLOUSTACK-5099: Utils.py-has-wrong-reference, cleaned it. As well added Uniform naming convention
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2013-11-08 16:02:10 +05:30
Girish Shilamkar
c6f0d46911 CLOUDSTACK-4407: Use extractTemplate API to get hypervisor specific template information
Template url, hypervisor and format were defined in Service class to be Xenserver specific
and therefore registering a new template failed on Vmware and KVM.
Fixed this to get hypervisor specific info for registering new template.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit 20256706b376551fe8993ee2e73c61df31dcb6de)
2013-08-29 14:10:54 +05:30
Prasanna Santhanam
8bc72ad55c Unskip all skipped tests
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-06-10 10:04:52 +05:30
Prasanna Santhanam
a4356b559c More fixes to regression tests:
- Remove extraneous non-ascii chars
- cloudconnection is auto GCed. No explicit cleanup required.
- Add environment tags for shared network tests
- Invalid account.account references
- Indentation errors
- Skip the storage motion test on unsuitable host environment
- remove copy template test. covered in the smoke tests
- invalid keys in service dictionary
- Unskipping tests skipped tests
-
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-05-25 15:40:42 +05:30
Nitin Mehta
c11dbad9c9 merge master 2013-05-11 15:28:43 +05:30
Prasanna Santhanam
d0108b8132 Fixing the incorrect zone typo
zone.networktype reference corrected as part of commit
5ee3cc41fecb08b0dba16341fef12684a50ecc98
2013-04-21 12:33:00 +05:30
Talluri
5ee3cc41fe CLOUDSTACK-2032: populate mode in the services dict from the list zones instead of hard coding
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-04-17 19:40:13 +05:30
Talluri
9342f561f7 CLOUDSTACK-1530: Fix integration test scripts in the components folder for imports and ostypeid Fix the integration scripts for nose import and ostypeid corrections
from nose.plugins.attrib import attr

"ostype": 'CentOS 5.3 (64-bit)',

        template = get_template(
                            cls.api_client,
                            cls.zone.id,
                            cls.services["ostype"]
                            )

Signed-off-by: Talluri <Srikanteswararao.Talluri@citrix.com>
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-03-06 13:45:07 +05:30
Talluri
4b539ddcb3 Summary: Fixes marvin integration test for copy template/iso between zones
Detail:
This is a fix
1. to populate 'destzoneid' as part of the test data by issuing
listZones API. Earlier, this is provided manually in the test data.
2. to  wait till the ISO/template is downloaded & installed successfully
before being deleted as part of the cleanup.

BUG-ID: CLOUDSTACK-567
Reviewed-by: Prasanna Santhanam
Reported-by: Prasanna Santhanam
Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1354234426 -0800
2012-11-29 16:13:46 -08:00
Prasanna Santhanam
802ddd43ca Summary: Moving the test integration libraries into marvin for CLI work
Detail: Integration tests use these libraries (base,utils,common) for
simplifying the usage of the API. These define the verbs of each
entity's usage (create, delete, add etc). For the CLI to present the
simplified API we'll leverage the integration libraries.

+ Fixes to setup-test-data.sh - kvm and xen each use a different version
of the built-in Cent OS template, 5.5 and 5.3 namely.

At a later point the setup-test-data script needs to be obsoleted.
ostypeids in tests should directly be determined from listOsTypes API
calls

Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1351520707 +0530
2012-10-29 20:23:02 +05:30
Prasanna Santhanam
5e451f899c Summary: Removing dbclient.close calls from integration tests
Detail:  Marvin auto-manages its connections now and there is no need to
call dbclient.close on tearDown of the test setup.

Signed-off-by: Prasanna Santhanam <tsp@apache.org> 1351152797 +0530
2012-10-25 13:44:45 +05:30
Prasanna Santhanam
cef2ad170f Adding more classifications
- maintenance (host goes to maitnenance)
- multihost, multizone, multistorage
2012-09-12 18:48:33 +05:30
Prasanna Santhanam
9043e49522 migrating tags to attr decorators for nose attrib classification 2012-09-12 18:48:32 +05:30
Prasanna Santhanam
b433b1afa6 Various fixes to tests
- Configuration fixes in Security groups and Egress rules
- Fixing white spaces in component test suite
2012-09-12 18:48:31 +05:30
Prasanna Santhanam
a725fdc3ab Adding the tags for different configurations in to testcase 2012-09-12 18:48:30 +05:30
David Nalley
7b7d51cecd apply chip childers licensing patches for the test directory
https://reviews.apache.org/r/5444/
2012-06-26 11:19:58 -04:00
Chirag Jog
cbbed24ef4 Adding ELP/EIP tests & firewall rule changes for SSH 2012-05-22 19:17:26 +05:30
Prasanna Santhanam
e29b0dafb6 Moving smoke tests and component tests into the test folder
Reviewed-by: pychecker
2012-05-17 17:01:49 +05:30