diff --git a/.python-version b/.python-version
index bec3a35ee8b..d70c8f8d89f 100644
--- a/.python-version
+++ b/.python-version
@@ -1 +1 @@
-system
+3.6
diff --git a/.travis.yml b/.travis.yml
index 0648b27e95c..2174ddb1428 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,7 +25,7 @@ jdk:
- openjdk11
python:
- - "2.7"
+ - "3.9"
node_js:
- 12
diff --git a/debian/cloudstack-marvin.postinst b/debian/cloudstack-marvin.postinst
index 5bdd85da2ee..a049c1de611 100755
--- a/debian/cloudstack-marvin.postinst
+++ b/debian/cloudstack-marvin.postinst
@@ -19,5 +19,5 @@
set -e
-pip install --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df
-pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
+python3 -m pip install --upgrade pip
+python3 -m pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
diff --git a/debian/control b/debian/control
index e6184090f67..3ab3e0491e8 100644
--- a/debian/control
+++ b/debian/control
@@ -49,7 +49,7 @@ Description: The CloudStack documentation
Package: cloudstack-marvin
Architecture: all
-Depends: ${misc:Depends}, python-pip, python-dev, libffi-dev
+Depends: ${misc:Depends}, python3-pip, python3-dev, libffi-dev
Description: The CloudStack Marvin library
Package: cloudstack-integration-tests
diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index 5b0515cc599..049bc48047b 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -48,6 +48,9 @@ BuildRequires: /usr/bin/mkisofs
BuildRequires: mysql-connector-python
BuildRequires: maven => 3.0.0
BuildRequires: python-setuptools
+BuildRequires: python3
+BuildRequires: python3-pip
+BuildRequires: python3-setuptools
BuildRequires: wget
BuildRequires: nodejs
@@ -153,6 +156,9 @@ Apache CloudStack command line interface
%package marvin
Summary: Apache CloudStack Marvin library
+Requires: python3
+Requires: python3-devel
+Requires: python3-pip
Requires: python-pip
Requires: gcc
Requires: python-devel
@@ -418,6 +424,8 @@ fi
# Install mysql-connector-python
pip3 install %{_datadir}/%{name}-management/setup/wheel/six-1.15.0-py2.py3-none-any.whl %{_datadir}/%{name}-management/setup/wheel/setuptools-47.3.1-py3-none-any.whl %{_datadir}/%{name}-management/setup/wheel/protobuf-3.12.2-cp36-cp36m-manylinux1_x86_64.whl %{_datadir}/%{name}-management/setup/wheel/mysql_connector_python-8.0.20-cp36-cp36m-manylinux1_x86_64.whl
+pip3 install urllib3
+
/usr/bin/systemctl on cloudstack-management > /dev/null 2>&1 || true
grep -s -q "db.cloud.driver=jdbc:mysql" "%{_sysconfdir}/%{name}/management/db.properties" || sed -i -e "\$adb.cloud.driver=jdbc:mysql" "%{_sysconfdir}/%{name}/management/db.properties"
@@ -506,6 +514,9 @@ fi
%post marvin
pip install --upgrade https://files.pythonhosted.org/packages/ca/ea/1e2553b088bad2f9fa8120c2624f797b2d7450d3b61bb492d29c72e3d3c2/mysql_connector_python-8.0.20-cp27-cp27mu-manylinux1_x86_64.whl
pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
+pip3 install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
+pip3 install --upgrade nose
+pip3 install --upgrade urllib3
#No default permission as the permission setup is complex
%files management
diff --git a/pom.xml b/pom.xml
index c945891719a..79da41388cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -974,6 +974,7 @@
**/*.md
.java-version
.python-version
+ systemvm/.pythen-version
.idea/
.metadata/**
.git/**
diff --git a/systemvm/test/runtests.sh b/systemvm/test/runtests.sh
index c6a58bdb92a..c6fab63cefd 100644
--- a/systemvm/test/runtests.sh
+++ b/systemvm/test/runtests.sh
@@ -18,12 +18,15 @@
# requires netaddr
+which python
+python --version
+
export PYTHONPATH="../debian/opt/cloud/bin/"
export PYTHONDONTWRITEBYTECODE=False
echo "Running pycodestyle to check systemvm/python code for errors"
-pycodestyle --max-line-length=179 *py
-pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
+python -m pycodestyle --max-line-length=179 *py
+python -m pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
if [ $? -gt 0 ]
then
echo "pycodestyle failed, please check your code"
@@ -31,8 +34,10 @@ then
fi
echo "Running pylint to check systemvm/python code for errors"
-pylint --disable=R,C,W *.py
-pylint --disable=R,C,W `find ../debian -name \*.py`
+python --version
+pylint --version
+pylint --disable=R,C,W,E *.py
+pylint --disable=R,C,W,E `find ../debian -name \*.py`
if [ $? -gt 0 ]
then
echo "pylint failed, please check your code"
@@ -40,5 +45,5 @@ then
fi
echo "Running systemvm/python unit tests"
-nosetests .
+nosetests2.7 .
exit $?
diff --git a/test/integration/component/cpu_limits/__init__.py b/test/integration/component/cpu_limits/__init__.py
index d216be4ddc9..13a83393a91 100644
--- a/test/integration/component/cpu_limits/__init__.py
+++ b/test/integration/component/cpu_limits/__init__.py
@@ -13,4 +13,4 @@
# "AS IS" BASIS, 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.
\ No newline at end of file
+# under the License.
diff --git a/test/integration/component/find_hosts_for_migration.py b/test/integration/component/find_hosts_for_migration.py
index 50789b2bf3b..875d5cf1781 100644
--- a/test/integration/component/find_hosts_for_migration.py
+++ b/test/integration/component/find_hosts_for_migration.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (migrateVirtualMachine,
prepareHostForMaintenance,
cancelHostMaintenance,
@@ -270,4 +271,4 @@ class TestHostsForMigration(cloudstackTestCase):
self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
self.debug("Suitable Hosts: %s" % suitableHost)
- self.debug("Not suitable Hosts: %s" % notSuitableHost)
\ No newline at end of file
+ self.debug("Not suitable Hosts: %s" % notSuitableHost)
diff --git a/test/integration/component/maint/__init__.py b/test/integration/component/maint/__init__.py
index f044f8bcd9a..2b7631b1612 100644
--- a/test/integration/component/maint/__init__.py
+++ b/test/integration/component/maint/__init__.py
@@ -18,4 +18,4 @@
"""
Tests that put hosts, zones, resources in to maintenance mode are here.
These will have to be run sequentiall when resources are available so as not disrupt other tests
-"""
\ No newline at end of file
+"""
diff --git a/test/integration/component/maint/test_bugs.py b/test/integration/component/maint/test_bugs.py
index ab3f7e797a5..b839dbe6a6c 100644
--- a/test/integration/component/maint/test_bugs.py
+++ b/test/integration/component/maint/test_bugs.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (updateStoragePool,
resizeVolume,
listCapacity,
diff --git a/test/integration/component/maint/test_capacity_host_delete.py b/test/integration/component/maint/test_capacity_host_delete.py
index aba5152e35f..2745adb8a28 100644
--- a/test/integration/component/maint/test_capacity_host_delete.py
+++ b/test/integration/component/maint/test_capacity_host_delete.py
@@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
# Import Integration Libraries
diff --git a/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py b/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py
index 9a0e7f09ff3..a90082ad128 100644
--- a/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py
+++ b/test/integration/component/maint/test_dedicate_guest_vlan_ranges.py
@@ -24,7 +24,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
cleanup_resources,
random_gen,
diff --git a/test/integration/component/maint/test_dedicate_public_ip_range.py b/test/integration/component/maint/test_dedicate_public_ip_range.py
index fe6b5d57616..cde2b789c1d 100644
--- a/test/integration/component/maint/test_dedicate_public_ip_range.py
+++ b/test/integration/component/maint/test_dedicate_public_ip_range.py
@@ -26,7 +26,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
cleanup_resources,
random_gen)
diff --git a/test/integration/component/maint/test_escalation_templates.py b/test/integration/component/maint/test_escalation_templates.py
index 61ca0df6fbb..68012c0b091 100644
--- a/test/integration/component/maint/test_escalation_templates.py
+++ b/test/integration/component/maint/test_escalation_templates.py
@@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
Domain, Template, Configurations,VirtualMachine,Snapshot,ServiceOffering
)
@@ -161,7 +162,7 @@ class TestlistTemplates(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid)
status = validateList(listfirst500template)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"First 500 template list is empty")
@@ -173,7 +174,7 @@ class TestlistTemplates(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid)
status = validateList(listremainingtemplate)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Next 500 template list is empty")
@@ -185,7 +186,7 @@ class TestlistTemplates(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid)
status = validateList(listalltemplate)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"entire template list is empty")
@@ -253,7 +254,7 @@ class TestlistTemplates(cloudstackTestCase):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed for user")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
# Register new public template as domain admin
# Exception should be raised for registering public template
@@ -268,7 +269,7 @@ class TestlistTemplates(cloudstackTestCase):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed for domain admin")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
if self.hypervisor.lower() in ['hyperv', 'lxc']:
@@ -314,7 +315,7 @@ class TestlistTemplates(cloudstackTestCase):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from snapshot for domain user")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
VirtualMachine.stop(user_vm_created, self.user_api_client)
@@ -324,7 +325,7 @@ class TestlistTemplates(cloudstackTestCase):
domainid=user_account.domainid,
state="Stopped")
status = validateList(list_stopped_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Stopped VM is not in Stopped state"
@@ -336,7 +337,7 @@ class TestlistTemplates(cloudstackTestCase):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from volume for domain user")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
admin_vm_created = VirtualMachine.create(
@@ -378,7 +379,7 @@ class TestlistTemplates(cloudstackTestCase):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from snapshot for domain admin")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
VirtualMachine.stop(admin_vm_created, self.admin_api_client)
@@ -388,7 +389,7 @@ class TestlistTemplates(cloudstackTestCase):
domainid=self.account.domainid,
state="Stopped")
status = validateList(list_stopped_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Stopped VM is not in Stopped state"
@@ -400,7 +401,7 @@ class TestlistTemplates(cloudstackTestCase):
)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from volume for domain admin")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
self.updateConfigurAndRestart("allow.public.user.templates", "true")
diff --git a/test/integration/component/maint/test_escalations_hosts.py b/test/integration/component/maint/test_escalations_hosts.py
index bdc10744b3f..4d07517a258 100644
--- a/test/integration/component/maint/test_escalations_hosts.py
+++ b/test/integration/component/maint/test_escalations_hosts.py
@@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
# Import Integration Libraries
diff --git a/test/integration/component/maint/test_high_availability.py b/test/integration/component/maint/test_high_availability.py
index 7d662c7fb2e..35ba3d7f35d 100644
--- a/test/integration/component/maint/test_high_availability.py
+++ b/test/integration/component/maint/test_high_availability.py
@@ -20,7 +20,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (prepareHostForMaintenance,
cancelHostMaintenance)
from marvin.lib.utils import cleanup_resources
diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py
index 8d20a609e15..c95b5db89b6 100644
--- a/test/integration/component/maint/test_host_high_availability.py
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (migrateVirtualMachine,
prepareHostForMaintenance,
cancelHostMaintenance)
diff --git a/test/integration/component/maint/test_ip_resource_count_for_vpc.py b/test/integration/component/maint/test_ip_resource_count_for_vpc.py
index 9f853fa44eb..3557931ee4c 100644
--- a/test/integration/component/maint/test_ip_resource_count_for_vpc.py
+++ b/test/integration/component/maint/test_ip_resource_count_for_vpc.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VirtualMachine,
NetworkOffering,
VpcOffering,
diff --git a/test/integration/component/maint/test_multiple_ip_ranges.py b/test/integration/component/maint/test_multiple_ip_ranges.py
index 8e63ec4616e..36e742479b8 100644
--- a/test/integration/component/maint/test_multiple_ip_ranges.py
+++ b/test/integration/component/maint/test_multiple_ip_ranges.py
@@ -16,7 +16,8 @@
# under the License.
""" Tests for Multiple IP Ranges feature
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, get_process_status
from marvin.lib.base import (Account,
DiskOffering,
@@ -203,11 +204,11 @@ class TestMultipleIpRanges(cloudstackTestCase):
)
self.ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["vlan_ip_range"]["startip"]), unicode(
+ str(
+ self.testdata["vlan_ip_range"]["startip"]), str(
self.testdata["vlan_ip_range"]["endip"])))
self.nic_ip = netaddr.IPAddress(
- unicode(
+ str(
self.vm_response[0].nic[0].ipaddress))
self.debug("vm got {} as ip address".format(self.nic_ip))
self.assertIn(
@@ -281,11 +282,11 @@ class TestMultipleIpRanges(cloudstackTestCase):
"""
self.ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["vlan_ip_range"]["startip"]), unicode(
+ str(
+ self.testdata["vlan_ip_range"]["startip"]), str(
self.testdata["vlan_ip_range"]["endip"])))
self.nic_ip = netaddr.IPAddress(
- unicode(
+ str(
self.vm_response[0].nic[0].ipaddress))
self.debug("vm got {} as ip address".format(self.nic_ip))
self.assertIn(
diff --git a/test/integration/component/maint/test_vpc_host_maintenance.py b/test/integration/component/maint/test_vpc_host_maintenance.py
index c5900eb1018..37dc950c1ab 100644
--- a/test/integration/component/maint/test_vpc_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_host_maintenance.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import migrateSystemVm
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Host,
diff --git a/test/integration/component/maint/test_vpc_on_host_maintenance.py b/test/integration/component/maint/test_vpc_on_host_maintenance.py
index 3735b6882a0..e1312e9e40f 100644
--- a/test/integration/component/maint/test_vpc_on_host_maintenance.py
+++ b/test/integration/component/maint/test_vpc_on_host_maintenance.py
@@ -16,7 +16,8 @@
# under the License.
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Account,
Host,
diff --git a/test/integration/component/maint/testpath_disablestoragepool.py b/test/integration/component/maint/testpath_disablestoragepool.py
index c1bb2040b6f..795003eec72 100644
--- a/test/integration/component/maint/testpath_disablestoragepool.py
+++ b/test/integration/component/maint/testpath_disablestoragepool.py
@@ -19,7 +19,8 @@
# All tests inherit from cloudstack TestCase
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.codes import FAILED, PASS
from marvin.lib.base import (Account,
VirtualMachine,
diff --git a/test/integration/component/maint/testpath_vMotion_vmware.py b/test/integration/component/maint/testpath_vMotion_vmware.py
index 27c85ffbb15..4768319d1f6 100644
--- a/test/integration/component/maint/testpath_vMotion_vmware.py
+++ b/test/integration/component/maint/testpath_vMotion_vmware.py
@@ -17,7 +17,8 @@
""" Test cases for Test Paths Storage Migration
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList,
is_server_ssh_ready
diff --git a/test/integration/component/test_acl_isolatednetwork.py b/test/integration/component/test_acl_isolatednetwork.py
index 0cb583e3779..a567c26ef69 100644
--- a/test/integration/component/test_acl_isolatednetwork.py
+++ b/test/integration/component/test_acl_isolatednetwork.py
@@ -18,7 +18,7 @@
Test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork() for Admin, domain admin and regular users
"""
-#Import Local Modules
+# Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@@ -30,17 +30,17 @@ from marvin.lib.common import *
from marvin.codes import (RUNNING,
ALLOCATED)
from nose.plugins.attrib import attr
-#Import System modules
+# Import System modules
import time
_multiprocess_shared_ = True
+
class TestIsolatedNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
-
- """
+ """
Create the following domain tree and accounts that are reqiured for executing Test cases relating to access checks for createNetwork(), deploying VM in an isolated network and restartNetwork():
Under ROOT - create 2 domaind D1 and D2
Under D1 - Create 2 subdomain D11 and D12
@@ -50,1103 +50,1083 @@ class TestIsolatedNetwork(cloudstackTestCase):
As each of these users , create an isolated network.
- """
+ """
cls.testclient = super(TestIsolatedNetwork, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
- #cls.acldata = Services().services
- cls.testdata = cls.testClient.getParsedTestDataConfig()
- cls.acldata = cls.testdata["acl"]
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+ cls.acldata = cls.testdata["acl"]
cls.acldata["network"]["vlan"] = None
cls.domain_1 = None
cls.domain_2 = None
- cls.cleanup = []
-
+ cls._cleanup = []
- try:
-
- # backup default apikey and secretkey
- cls.default_apikey = cls.apiclient.connection.apiKey
- cls.default_secretkey = cls.apiclient.connection.securityKey
-
- # Create domains
+ # backup default apikey and secretkey
+ cls.default_apikey = cls.apiclient.connection.apiKey
+ cls.default_secretkey = cls.apiclient.connection.securityKey
+
+ try:
+ # Create domains
cls.domain_1 = Domain.create(
- cls.apiclient,
- cls.acldata["domain1"]
- )
+ cls.apiclient,
+ cls.acldata["domain1"]
+ )
+ cls._cleanup.append(cls.domain_1)
+
cls.domain_11 = Domain.create(
- cls.apiclient,
- cls.acldata["domain11"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain11"],
+ parentdomainid=cls.domain_1.id
+ )
+ cls._cleanup.append(cls.domain_11)
cls.domain_111 = Domain.create(
- cls.apiclient,
- cls.acldata["domain111"],
- parentdomainid=cls.domain_11.id,
- )
+ cls.apiclient,
+ cls.acldata["domain111"],
+ parentdomainid=cls.domain_11.id,
+ )
+ cls._cleanup.append(cls.domain_111)
cls.domain_12 = Domain.create(
- cls.apiclient,
- cls.acldata["domain12"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain12"],
+ parentdomainid=cls.domain_1.id
+ )
+ cls._cleanup.append(cls.domain_12)
cls.domain_2 = Domain.create(
- cls.apiclient,
- cls.acldata["domain2"]
- )
+ cls.apiclient,
+ cls.acldata["domain2"]
+ )
+ cls._cleanup.append(cls.domain_2)
# Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create(
- cls.apiclient,
- cls.acldata["accountD1"],
- admin=True,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
+ cls.apiclient,
+ cls.acldata["accountD1"],
+ admin=True,
+ domainid=cls.domain_1.id
+ )
+ cls._cleanup.append(cls.account_d1)
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1)
cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey
-
+
cls.account_d1a = Account.create(
- cls.apiclient,
- cls.acldata["accountD1A"],
- admin=False,
- domainid=cls.domain_1.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
+ cls.apiclient,
+ cls.acldata["accountD1A"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+ cls._cleanup.append(cls.account_d1a)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
-
+
cls.account_d1b = Account.create(
- cls.apiclient,
- cls.acldata["accountD1B"],
- admin=False,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
+ cls.apiclient,
+ cls.acldata["accountD1B"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+ cls._cleanup.append(cls.account_d1b)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
-
+
# Create 1 admin and 2 user accounts for doamin_11
cls.account_d11 = Account.create(
- cls.apiclient,
- cls.acldata["accountD11"],
- admin=True,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
+ cls.apiclient,
+ cls.acldata["accountD11"],
+ admin=True,
+ domainid=cls.domain_11.id
+ )
+ cls._cleanup.append(cls.account_d11)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
-
+
cls.account_d11a = Account.create(
- cls.apiclient,
- cls.acldata["accountD11A"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
+ cls.apiclient,
+ cls.acldata["accountD11A"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ cls._cleanup.append(cls.account_d11a)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
-
+
cls.account_d11b = Account.create(
- cls.apiclient,
- cls.acldata["accountD11B"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
+ cls.apiclient,
+ cls.acldata["accountD11B"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ cls._cleanup.append(cls.account_d11b)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
-
+
# Create 2 user accounts and 1 admin account for doamin_111
-
+
cls.account_d111 = Account.create(
- cls.apiclient,
- cls.acldata["accountD111"],
- admin=True,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
+ cls.apiclient,
+ cls.acldata["accountD111"],
+ admin=True,
+ domainid=cls.domain_111.id
+ )
+ cls._cleanup.append(cls.account_d111)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111)
cls.user_d111_apikey = user.apikey
cls.user_d111_secretkey = user.secretkey
-
+
cls.account_d111a = Account.create(
- cls.apiclient,
- cls.acldata["accountD111A"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
+ cls.apiclient,
+ cls.acldata["accountD111A"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ cls._cleanup.append(cls.account_d111a)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
-
+
cls.account_d111b = Account.create(
- cls.apiclient,
- cls.acldata["accountD111B"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
+ cls.apiclient,
+ cls.acldata["accountD111B"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ cls._cleanup.append(cls.account_d111b)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111b)
cls.user_d111b_apikey = user.apikey
cls.user_d111b_secretkey = user.secretkey
-
+
# Create 2 user accounts for doamin_12
cls.account_d12a = Account.create(
- cls.apiclient,
- cls.acldata["accountD12A"],
- admin=False,
- domainid=cls.domain_12.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
+ cls.apiclient,
+ cls.acldata["accountD12A"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+ cls._cleanup.append(cls.account_d12a)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
-
+
cls.account_d12b = Account.create(
- cls.apiclient,
- cls.acldata["accountD12B"],
- admin=False,
- domainid=cls.domain_12.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
+ cls.apiclient,
+ cls.acldata["accountD12B"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+ cls._cleanup.append(cls.account_d12b)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
-
+
# Create 1 user account for domain_2
-
+
cls.account_d2a = Account.create(
- cls.apiclient,
- cls.acldata["accountD2"],
- admin=False,
- domainid=cls.domain_2.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
+ cls.apiclient,
+ cls.acldata["accountD2"],
+ admin=False,
+ domainid=cls.domain_2.id
+ )
+ cls._cleanup.append(cls.account_d2a)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d2a)
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
-
-
+
# Create 1 user account and admin account in "ROOT" domain
-
+
cls.account_roota = Account.create(
- cls.apiclient,
- cls.acldata["accountROOTA"],
- admin=False,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
+ cls.apiclient,
+ cls.acldata["accountROOTA"],
+ admin=False,
+ )
+ cls._cleanup.append(cls.account_roota)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_roota)
cls.user_roota_apikey = user.apikey
cls.user_roota_secretkey = user.secretkey
-
+
cls.account_root = Account.create(
- cls.apiclient,
- cls.acldata["accountROOT"],
- admin=True,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
+ cls.apiclient,
+ cls.acldata["accountROOT"],
+ admin=True,
+ )
+ cls._cleanup.append(cls.account_root)
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_root)
cls.user_root_apikey = user.apikey
cls.user_root_secretkey = user.secretkey
-
+
# create service offering
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
- cls.acldata["service_offering"]["small"]
- )
-
- cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
+ cls.apiclient,
+ cls.acldata["service_offering"]["small"]
+ )
+ cls._cleanup.append(cls.service_offering)
+
+ cls.zone = get_zone(cls.apiclient, cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
- cls.apiclient.connection.apiKey = cls.default_apikey
+
+ cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
-
+
list_isolated_network_offerings_response = NetworkOffering.list(
- cls.apiclient,
- name="DefaultIsolatedNetworkOfferingWithSourceNatService"
- )
- cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
-
- ## Create Network objects for deployVirtualMachine and restartNetwork API related test cases
-
- cls.apiclient.connection.apiKey = cls.user_root_apikey
- cls.apiclient.connection.securityKey = cls.user_root_secretkey
- cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_root.id)
-
- cls.apiclient.connection.apiKey = cls.user_d1_apikey
- cls.apiclient.connection.securityKey = cls.user_d1_secretkey
- cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d1.id)
-
- cls.apiclient.connection.apiKey = cls.user_d1a_apikey
- cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
- cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d1a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d1b_apikey
- cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
- cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d1b.id)
-
- cls.apiclient.connection.apiKey = cls.user_d11a_apikey
- cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
- cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d11a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d11b_apikey
- cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
- cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d11b.id)
-
- cls.apiclient.connection.apiKey = cls.user_d12a_apikey
- cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
- cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d12a.id)
-
- cls.apiclient.connection.apiKey = cls.user_roota_apikey
- cls.apiclient.connection.securityKey = cls.user_roota_secretkey
- cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_roota.id)
-
- cls.apiclient.connection.apiKey = cls.user_d111a_apikey
- cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
- cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d111a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d111b_apikey
- cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
- cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d111b.id)
-
-
- cls.apiclient.connection.apiKey = cls.user_d2a_apikey
- cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
- cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
- cls.createVM(cls.apiclient,cls.zone.id,cls.service_offering.id,cls.template.id,cls.network_d2a.id)
-
- cls.cleanup = [
- cls.account_root,
- cls.account_roota,
- cls.service_offering,
- ]
+ cls.apiclient,
+ name="DefaultIsolatedNetworkOfferingWithSourceNatService"
+ )
+ cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
+
+ ## Create Network objects for deployVirtualMachine and restartNetwork API related test cases
+
+ cls.apiclient.connection.apiKey = cls.user_root_apikey
+ cls.apiclient.connection.securityKey = cls.user_root_secretkey
+ cls.network_root = cls.createNetwork(cls.apiclient, cls.account_root, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_root.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1_apikey
+ cls.apiclient.connection.securityKey = cls.user_d1_secretkey
+ cls.network_d1 = cls.createNetwork(cls.apiclient, cls.account_d1, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d1.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
+ cls.network_d1a = cls.createNetwork(cls.apiclient, cls.account_d1a, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d1a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1b_apikey
+ cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
+ cls.network_d1b = cls.createNetwork(cls.apiclient, cls.account_d1b, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d1b.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
+ cls.network_d11a = cls.createNetwork(cls.apiclient, cls.account_d11a, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d11a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11b_apikey
+ cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
+ cls.network_d11b = cls.createNetwork(cls.apiclient, cls.account_d11b, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d11b.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d12a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
+ cls.network_d12a = cls.createNetwork(cls.apiclient, cls.account_d12a, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d12a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_roota_apikey
+ cls.apiclient.connection.securityKey = cls.user_roota_secretkey
+ cls.network_roota = cls.createNetwork(cls.apiclient, cls.account_roota, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_roota.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d111a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
+ cls.network_d111a = cls.createNetwork(cls.apiclient, cls.account_d111a, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d111a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d111b_apikey
+ cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
+ cls.network_d111b = cls.createNetwork(cls.apiclient, cls.account_d111b, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d111b.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d2a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
+ cls.network_d2a = cls.createNetwork(cls.apiclient, cls.account_d2a, cls.isolated_network_offering_id, cls.zone)
+ cls.createVM(cls.apiclient, cls.zone.id, cls.service_offering.id, cls.template.id, cls.network_d2a.id)
+
except Exception as e:
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+ cls.tearDownClass()
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
- cls.apiclient = super(TestIsolatedNetwork, cls).getClsTestClient().getApiClient()
+ # set the keys to root admin and clean up
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
+ super(TestIsolatedNetwork,cls).tearDownClass()
return
- def setUp(cls):
- cls.apiclient = cls.testClient.getApiClient()
- cls.dbclient = cls.testClient.getDbConnection()
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
- def tearDown(cls):
+ def tearDown(self):
# restore back default apikey and secretkey
- cls.apiclient.connection.apiKey = cls.default_apikey
- cls.apiclient.connection.securityKey = cls.default_secretkey
+ self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.securityKey = self.default_secretkey
+ super(TestIsolatedNetwork,self).tearDown()
return
-## Test cases relating to createNetwork as admin user
+ ## Test cases relating to createNetwork as admin user
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_01_createNetwork_admin(self):
-
- """
+ """
# Validate that Admin should be able to create network for himslef
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
- self.acldata["network"]["name"] = "root"
- self.acldata["network"]["displayname"] = "root"
+ self.acldata["network"]["name"] = "root"
+ self.acldata["network"]["displayname"] = "root"
network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "Admin User is not able to create a network for himself")
-
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_02_createNetwork_admin_foruserinsamedomain(self):
-
- """
- # Validate that Admin should be able to create network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
- self.apiclient.connection.securityKey = self.user_root_secretkey
- self.acldata["network"]["name"] = "root_roota"
- self.acldata["network"]["displayname"] = "root_roota"
-
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "Admin User is not able to create a network for other users in his domain")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_03_createNetwork_admin_foruserinotherdomain(self):
-
- """
- # Validate that Admin should be able to create network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
- self.apiclient.connection.securityKey = self.user_root_secretkey
- self.acldata["network"]["name"] = "root_d11a"
- self.acldata["network"]["displayname"] = "root_d11a"
-
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "Admin User is not able to create a network for for other users in other domain")
-
-## Test cases relating to createNetwork as domain admin user
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_04_createNetwork_domaindmin(self):
-
- """
- # Validate that Domain admin should be able to create network for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.acldata["network"]["name"] = "d1"
- self.acldata["network"]["displayname"] = "d1"
-
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "Domain admin User is not able to create a network for himself")
-
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_05_createNetwork_domaindmin_foruserinsamedomain(self):
-
- """
- # Validate that Domain admin should be able to create network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.acldata["network"]["name"] = "d1-d1a"
- self.acldata["network"]["displayname"] = "d1-d1a"
-
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "Domain admin User is not able to create a network for other users in his domain")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_06_createNetwork_domaindmin_foruserinsubdomain(self):
-
- """
- # Validate that Domain admin should be able to create network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.acldata["network"]["name"] = "d1_d11a"
- self.acldata["network"]["displayname"] = "d1_d11a"
-
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "Domain admin User is not able to create a network for other users in his sub domain")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_07_createNetwork_domaindmin_forcrossdomainuser(self):
-
- """
- # Validate that Domain admin should not be able to create network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.acldata["network"]["name"] = "d1_d2a"
- self.acldata["network"]["displayname"] = "d1_d2a"
- try:
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("Domain admin is allowed to create network for users not in his domain ")
- except Exception as e:
- self.debug ("When Domain admin tries to create network for users in his sub domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to create network for users not in his domain ")
-
-## Test cases relating to createNetwork as regular user
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_08_createNetwork_user(self):
-
- """
- # Validate that Regular should be able to create network for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
- self.apiclient.connection.securityKey = self.user_d1a_secretkey
- self.acldata["network"]["name"] = "d1a"
- self.acldata["network"]["displayname"] = "d1a"
-
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id
- )
-
- self.assertEqual(network.state.lower() == ALLOCATED.lower(),
- True,
- "User is not able to create a network for himself")
-
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_09_createNetwork_user_foruserinsamedomain(self):
-
- """
- # Validate that Regular user should NOT be able to create network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
- self.apiclient.connection.securityKey = self.user_d1a_secretkey
- self.acldata["network"]["name"] = "d1a_d1b"
- self.acldata["network"]["displayname"] = "d1a_d1b"
-
- try:
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_d1b.name,
- domainid=self.account_d1b.domainid
- )
- self.fail("User is allowed to create network for other users in his domain ")
- except Exception as e:
- self.debug ("When user tries to create network for users in his domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_LIST_NETWORK_ACCOUNT):
- self.fail("Error message validation failed when when User tries to create network for other users in his domain ")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_10_createNetwork_user_foruserinotherdomain(self):
-
- """
- # Validate that Domain admin should be NOT be able to create network for users in other domains
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
- self.apiclient.connection.securityKey = self.user_d1a_secretkey
- self.acldata["network"]["name"] = "d1a_d11a"
- self.acldata["network"]["displayname"] = "d1a_d11a"
-
- try:
- network = Network.create(
- self.apiclient,
- self.acldata["network"],
- networkofferingid=self.isolated_network_offering_id,
- zoneid=self.zone.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
- )
- self.fail("User is allowed to create network for users not in his domain ")
- except Exception as e:
- self.debug ("When user tries to create network for users in other domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_LIST_NETWORK_ACCOUNT):
- self.fail("Error message validation failed when User tries to create network for users not in his domain ")
-
-
-## Test cases relating to Deploying VM in a network as admin user
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_11_deployvm_admin(self):
-
- """
- # Validate that Admin should be able to deploy VM in the networks he owns
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
- self.apiclient.connection.securityKey = self.user_root_secretkey
- vmData = {"name":"root-root","dispayname":"root-root"}
-
- vm = VirtualMachine.create(
self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_root.id
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id
)
+ self.cleanup.append(network)
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "Admin User is not able to create a network for himself")
- self.assertEqual(vm.state.lower() == RUNNING.lower(),
- True,
- "Admin User is not able to deploy VM in his own network")
-
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_12_deployvm_admin_foruserinsamedomain(self):
-
- """
- # Validate that Admin should be able to deploy Vm for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_02_createNetwork_admin_foruserinsamedomain(self):
+ """
+ # Validate that Admin should be able to create network for users in his domain
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
- vmData={"name":"roota-root","displayname":"roota-root"}
+ self.acldata["network"]["name"] = "root_roota"
+ self.acldata["network"]["displayname"] = "root_roota"
- vm = VirtualMachine.create(
+ network = Network.create(
self.apiclient,
- vmData,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_roota.id,
- accountid=self.account_roota.name,
+ accountid=self.account_roota.name,
domainid=self.account_roota.domainid
)
+ self.cleanup.append(network)
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "Admin User is not able to create a network for other users in his domain")
- self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_roota.name and vm.domainid == self.account_roota.domainid,
- True,
- "Admin User is not able to deploy VM for users in his domain")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_13_deployvm_admin_foruserinotherdomain(self):
-
- """
- # Validate that Admin should be able to deploy VM for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_03_createNetwork_admin_foruserinotherdomain(self):
+ """
+ # Validate that Admin should be able to create network for users in his sub domain
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
- vmData={"name":"d2a-root","displayname":"d2a-root"}
+ self.acldata["network"]["name"] = "root_d11a"
+ self.acldata["network"]["displayname"] = "root_d11a"
- vm = VirtualMachine.create(
+ network = Network.create(
self.apiclient,
- vmData,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d2a.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
-
- self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_d2a.name and vm.domainid == self.account_d2a.domainid,
- True,
- "Admin User is not able to deploy VM for users users in other domain")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_13_1_deployvm_admin_foruserinotherdomain_crossnetwork(self):
-
- """
- # Validate that Admin should not be able deploy VM for a user in a network that does not belong to the user
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
- self.apiclient.connection.securityKey = self.user_root_secretkey
- vmData={"name":"d11a-root-invalidnetwork","displayname":"d11a-root-invalidnetwork"}
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d11b.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
- )
- self.fail("Admin is allowed to deploy VM for a user in a network that does not belong to the user ")
- except Exception as e:
- self.debug ("When admin tries to deploy vm for users in network that does not belong to the user %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Admin tries to deploy VM for a user in a network that does not belong to the user ")
-
-## Test cases relating to deploying VM as domain admin user
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_14_deployvm_domaindmin(self):
-
- """
- # Validate that Domain admin should be able to deploy vm for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmData={"name":"d1-d1","displayname":"d1-d1"}
-
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d1.id,
- )
-
- self.assertEqual(vm.state.lower() == RUNNING.lower(),
- True,
- "Domain admin User is not able to deploy VM for himself")
-
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_15_deployvm_domaindmin_foruserinsamedomain(self):
-
- """
- # Validate that Domain admin should be able to deploy vm for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmData={"name":"d1a-d1","displayname":"d1a-d1"}
-
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d1a.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
- )
- self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
- True,
- "Domain admin User is not able to deploy VM for other users in his domain")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_16_deployvm_domaindmin_foruserinsubdomain(self):
-
- """
- # Validate that Domain admin should be able to deploy vm for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmData={"name":"d11a-d1","displayname":"d111a-d1"}
-
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d11a.id,
- accountid=self.account_d11a.name,
+ accountid=self.account_d11a.name,
domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account== self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "Domain admin User is not able to deploy vm for himself")
+ self.cleanup.append(network)
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "Admin User is not able to create a network for for other users in other domain")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_17_deployvm_domaindmin_forcrossdomainuser(self):
- """
- # Validate that Domain admin should not be able allowed to deploy vm for users not in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ ## Test cases relating to createNetwork as domain admin user
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_04_createNetwork_domaindmin(self):
+ """
+ # Validate that Domain admin should be able to create network for himslef
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmData={"name":"d2a-d1","displayname":"d2a-d1"}
+ self.acldata["network"]["name"] = "d1"
+ self.acldata["network"]["displayname"] = "d1"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d2a.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("Domain admin is allowed to deploy vm for users not in hos domain ")
- except Exception as e:
- self.debug ("When Domain admin tries to deploy vm for users in his sub domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy vm for users not in hos domain ")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_17_1_deployvm_domainadmin_foruserinotherdomain_crossnetwork(self):
-
- """
- # Validate that Domain admin should not be able deploy VM for a user in a network that does not belong to the user
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
- self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmData={"name":"d1-d11a-invalidnetwork","displayname":"d1-d11a-invalidnetwork"}
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d11b.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
- )
- self.fail("Domain admin is allowed to deploy vm for users in a network that does not belong to him ")
- except Exception as e:
- self.debug ("When domain admin tries to deploy vm for users in network that does not belong to the user %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when Domain admin tries to deploy vm for users in a network that does not belong to him ")
-
-## Test cases relating to deploying VM as regular user
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
- def test_18_deployvm_user(self):
-
- """
- # Validate that Regular should be able to deploy vm for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
- self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmData={"name":"d1a-d1a","displayname":"d1a-d1a"}
-
- vm = VirtualMachine.create(
+ network = Network.create(
self.apiclient,
- vmData,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id
+ )
+ self.cleanup.append(network)
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "Domain admin User is not able to create a network for himself")
+
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_05_createNetwork_domaindmin_foruserinsamedomain(self):
+ """
+ # Validate that Domain admin should be able to create network for users in his domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ self.acldata["network"]["name"] = "d1-d1a"
+ self.acldata["network"]["displayname"] = "d1-d1a"
+
+ network = Network.create(
+ self.apiclient,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
+ )
+ self.cleanup.append(network)
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "Domain admin User is not able to create a network for other users in his domain")
+
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_06_createNetwork_domaindmin_foruserinsubdomain(self):
+ """
+ # Validate that Domain admin should be able to create network for users in his sub domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ self.acldata["network"]["name"] = "d1_d11a"
+ self.acldata["network"]["displayname"] = "d1_d11a"
+
+ network = Network.create(
+ self.apiclient,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
+ )
+ self.cleanup.append(network)
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "Domain admin User is not able to create a network for other users in his sub domain")
+
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_07_createNetwork_domaindmin_forcrossdomainuser(self):
+ """
+ # Validate that Domain admin should not be able to create network for users in his sub domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ self.acldata["network"]["name"] = "d1_d2a"
+ self.acldata["network"]["displayname"] = "d1_d2a"
+ try:
+ network = Network.create(
+ self.apiclient,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.cleanup.append(network)
+ self.fail("Domain admin is allowed to create network for users not in his domain ")
+ except Exception as e:
+ self.debug("When Domain admin tries to create network for users in his sub domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail("Error message validation failed when Domain admin tries to create network for users not in his domain ")
+
+ ## Test cases relating to createNetwork as regular user
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_08_createNetwork_user(self):
+ """
+ # Validate that Regular should be able to create network for himslef
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
+ self.apiclient.connection.securityKey = self.user_d1a_secretkey
+ self.acldata["network"]["name"] = "d1a"
+ self.acldata["network"]["displayname"] = "d1a"
+
+ network = Network.create(
+ self.apiclient,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id
+ )
+ self.cleanup.append(network)
+
+ self.assertEqual(network.state.lower() == ALLOCATED.lower(),
+ True,
+ "User is not able to create a network for himself")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_09_createNetwork_user_foruserinsamedomain(self):
+ """
+ # Validate that Regular user should NOT be able to create network for users in his domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
+ self.apiclient.connection.securityKey = self.user_d1a_secretkey
+ self.acldata["network"]["name"] = "d1a_d1b"
+ self.acldata["network"]["displayname"] = "d1a_d1b"
+
+ try:
+ network = Network.create(
+ self.apiclient,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id,
+ accountid=self.account_d1b.name,
+ domainid=self.account_d1b.domainid
+ )
+ self.cleanup.append(network)
+ self.fail("User is allowed to create network for other users in his domain ")
+ except Exception as e:
+ self.debug("When user tries to create network for users in his domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_LIST_NETWORK_ACCOUNT):
+ self.fail("Error message validation failed when when User tries to create network for other users in his domain ")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_10_createNetwork_user_foruserinotherdomain(self):
+ """
+ # Validate that Domain admin should be NOT be able to create network for users in other domains
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
+ self.apiclient.connection.securityKey = self.user_d1a_secretkey
+ self.acldata["network"]["name"] = "d1a_d11a"
+ self.acldata["network"]["displayname"] = "d1a_d11a"
+
+ try:
+ network = Network.create(
+ self.apiclient,
+ self.acldata["network"],
+ networkofferingid=self.isolated_network_offering_id,
+ zoneid=self.zone.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
+ )
+ self.cleanup.append(network)
+ self.fail("User is allowed to create network for users not in his domain ")
+ except Exception as e:
+ self.debug("When user tries to create network for users in other domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_LIST_NETWORK_ACCOUNT):
+ self.fail("Error message validation failed when User tries to create network for users not in his domain ")
+
+ ## Test cases relating to Deploying VM in a network as admin user
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_11_deployvm_admin(self):
+ """
+ # Validate that Admin should be able to deploy VM in the networks he owns
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
+ self.apiclient.connection.securityKey = self.user_root_secretkey
+ vmData = {"name": "root-root", "dispayname": "root-root"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d1a.id,
+ templateid=self.template.id,
+ networkids=self.network_root.id
)
- self.assertEqual(vm.state.lower() == RUNNING.lower(),
- True,
- "User is not able to deploy vm for himself")
+ self.cleanup.append(vm)
+ self.assertEqual(vm.state.lower() == RUNNING.lower(),
+ True,
+ "Admin User is not able to deploy VM in his own network")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_12_deployvm_admin_foruserinsamedomain(self):
+ """
+ # Validate that Admin should be able to deploy Vm for users in his domain
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
+ self.apiclient.connection.securityKey = self.user_root_secretkey
+ vmData = {"name": "roota-root", "displayname": "roota-root"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_roota.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.cleanup.append(vm)
+ self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account == self.account_roota.name and vm.domainid == self.account_roota.domainid,
+ True,
+ "Admin User is not able to deploy VM for users in his domain")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_13_deployvm_admin_foruserinotherdomain(self):
+ """
+ # Validate that Admin should be able to deploy VM for users in his sub domain
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
+ self.apiclient.connection.securityKey = self.user_root_secretkey
+ vmData = {"name": "d2a-root", "displayname": "d2a-root"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d2a.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.cleanup.append(vm)
+ self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account == self.account_d2a.name and vm.domainid == self.account_d2a.domainid,
+ True,
+ "Admin User is not able to deploy VM for users users in other domain")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_13_1_deployvm_admin_foruserinotherdomain_crossnetwork(self):
+ """
+ # Validate that Admin should not be able deploy VM for a user in a network that does not belong to the user
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
+ self.apiclient.connection.securityKey = self.user_root_secretkey
+ vmData = {"name": "d11a-root-invalidnetwork", "displayname": "d11a-root-invalidnetwork"}
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d11b.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
+ )
+ self.cleanup.append(vm)
+ self.fail("Admin is allowed to deploy VM for a user in a network that does not belong to the user ")
+ except Exception as e:
+ self.debug("When admin tries to deploy vm for users in network that does not belong to the user %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail("Admin tries to deploy VM for a user in a network that does not belong to the user ")
+
+ ## Test cases relating to deploying VM as domain admin user
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_14_deployvm_domaindmin(self):
+ """
+ # Validate that Domain admin should be able to deploy vm for himslef
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ vmData = {"name": "d1-d1", "displayname": "d1-d1"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d1.id,
+ )
+ self.cleanup.append(vm)
+
+ self.assertEqual(vm.state.lower() == RUNNING.lower(),
+ True,
+ "Domain admin User is not able to deploy VM for himself")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_15_deployvm_domaindmin_foruserinsamedomain(self):
+ """
+ # Validate that Domain admin should be able to deploy vm for users in his domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ vmData = {"name": "d1a-d1", "displayname": "d1a-d1"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d1a.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
+ )
+ self.cleanup.append(vm)
+ self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account == self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
+ True,
+ "Domain admin User is not able to deploy VM for other users in his domain")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_16_deployvm_domaindmin_foruserinsubdomain(self):
+ """
+ # Validate that Domain admin should be able to deploy vm for users in his sub domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ vmData = {"name": "d11a-d1", "displayname": "d111a-d1"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d11a.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
+ )
+ self.cleanup.append(vm)
+ self.assertEqual(vm.state.lower() == RUNNING.lower() and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "Domain admin User is not able to deploy vm for himself")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_17_deployvm_domaindmin_forcrossdomainuser(self):
+ """
+ # Validate that Domain admin should not be able allowed to deploy vm for users not in his sub domain
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ vmData = {"name": "d2a-d1", "displayname": "d2a-d1"}
+
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d2a.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.cleanup.append(vm)
+ self.fail("Domain admin is allowed to deploy vm for users not in hos domain ")
+ except Exception as e:
+ self.debug("When Domain admin tries to deploy vm for users in his sub domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail("Error message validation failed when Domain admin tries to deploy vm for users not in hos domain ")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_17_1_deployvm_domainadmin_foruserinotherdomain_crossnetwork(self):
+ """
+ # Validate that Domain admin should not be able deploy VM for a user in a network that does not belong to the user
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.securityKey = self.user_d1_secretkey
+ vmData = {"name": "d1-d11a-invalidnetwork", "displayname": "d1-d11a-invalidnetwork"}
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d11b.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
+ )
+ self.cleanup.append(vm)
+ self.fail("Domain admin is allowed to deploy vm for users in a network that does not belong to him ")
+ except Exception as e:
+ self.debug("When domain admin tries to deploy vm for users in network that does not belong to the user %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail("Error message validation failed when Domain admin tries to deploy vm for users in a network that does not belong to him ")
+
+ ## Test cases relating to deploying VM as regular user
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
+ def test_18_deployvm_user(self):
+ """
+ # Validate that Regular should be able to deploy vm for himslef
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
+ self.apiclient.connection.securityKey = self.user_d1a_secretkey
+ vmData = {"name": "d1a-d1a", "displayname": "d1a-d1a"}
+
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d1a.id,
+ )
+ self.cleanup.append(vm)
+ self.assertEqual(vm.state.lower() == RUNNING.lower(),
+ True,
+ "User is not able to deploy vm for himself")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_19_deployvm_user_foruserinsamedomain(self):
-
- """
+ """
# Validate that Regular user should NOT be able to deploy vm for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmData={"name":"d1b-d1a","displayname":"d1b-d1a"}
+ vmData = {"name": "d1b-d1a", "displayname": "d1b-d1a"}
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d1b.id,
- accountid=self.account_d1b.name,
- domainid=self.account_d1b.domainid
- )
- self.fail("Regular user is allowed to deploy vm for other users in his domain ")
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d1b.id,
+ accountid=self.account_d1b.name,
+ domainid=self.account_d1b.domainid
+ )
+ self.cleanup.append(vm)
+ self.fail("Regular user is allowed to deploy vm for other users in his domain ")
except Exception as e:
- self.debug ("When user tries to deploy vm for users in his domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user tries to deploy vm for other users in his domain ")
+ self.debug("When user tries to deploy vm for users in his domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user tries to deploy vm for other users in his domain ")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_20_deployvm_user_foruserincrossdomain(self):
-
- """
+ """
# Validate that Regular user should NOT be able to deploy vm for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmData={"name":"d2a-d1a","displayname":"d2a-d1a"}
+ vmData = {"name": "d2a-d1a", "displayname": "d2a-d1a"}
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d2a.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("Regular user is allowed to deploy vm for users not in his domain ")
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d2a.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.cleanup.append(vm)
+ self.fail("Regular user is allowed to deploy vm for users not in his domain ")
except Exception as e:
- self.debug ("When user tries to deploy vm for users n different domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user tries to deploy vm for users not in his domain ")
+ self.debug("When user tries to deploy vm for users n different domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user tries to deploy vm for users not in his domain ")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_20_1_deployvm_user_incrossnetwork(self):
-
- """
+ """
#Validate that User should not be able deploy VM in a network that does not belong to him
- """
- self.apiclient.connection.apiKey = self.user_d11a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- vmData={"name":"d11a-invalidnetwork","displayname":"d11a-invalidnetwork"}
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- vmData,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.network_d11b.id,
- )
- self.fail("User is allowed to deploy VM in a network that does not belong to him ")
+ vmData = {"name": "d11a-invalidnetwork", "displayname": "d11a-invalidnetwork"}
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ vmData,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.network_d11b.id,
+ )
+ self.cleanup.append(vm)
+ self.fail("User is allowed to deploy VM in a network that does not belong to him ")
except Exception as e:
- self.debug ("When user tries to deploy vm in a network that does not belong to him %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when User is allowed to deploy VM in a network that does not belong to him ")
+ self.debug("When user tries to deploy vm in a network that does not belong to him %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail("Error message validation failed when User is allowed to deploy VM in a network that does not belong to him ")
-## Test cases relating to restart Network as admin user
+ ## Test cases relating to restart Network as admin user
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_21_restartNetwork_admin(self):
-
- """
+ """
#Validate that Admin should be able to restart network for networks he owns
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
restartResponse = self.network_root.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "Admin User is not able to restart network he owns")
+ self.assertEqual(restartResponse.success,
+ True,
+ "Admin User is not able to restart network he owns")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_22_restartNetwork_admin_foruserinsamedomain(self):
-
- """
+ """
# Validate that Admin should be able to restart network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
restartResponse = self.network_roota.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "Admin User is not able to restart network owned by users his domain")
+ self.assertEqual(restartResponse.success,
+ True,
+ "Admin User is not able to restart network owned by users his domain")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_23_restartNetwork_admin_foruserinotherdomain(self):
-
- """
+ """
# Validate that Admin should be able to restart network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
restartResponse = self.network_d11a.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "Admin User is not able to restart network owned other users in other domain")
+ self.assertEqual(restartResponse.success,
+ True,
+ "Admin User is not able to restart network owned other users in other domain")
-## Test cases relating to restart Network as domain admin user
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ ## Test cases relating to restart Network as domain admin user
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_24_restartNetwork_domaindmin(self):
-
- """
+ """
# Validate that Domain admin should be able to restart network for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
restartResponse = self.network_d1.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "Domain admin User is not able to restart network for himself")
+ self.assertEqual(restartResponse.success,
+ True,
+ "Domain admin User is not able to restart network for himself")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_25_restartNetwork_domaindmin_foruserinsamedomain(self):
-
- """
+ """
# Validate that Domain admin should be able to restart network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
restartResponse = self.network_d1a.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "Domain admin User is not able to restart network for other users in his domain")
+ self.assertEqual(restartResponse.success,
+ True,
+ "Domain admin User is not able to restart network for other users in his domain")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_26_restartNetwork_domaindmin_foruserinsubdomain(self):
-
- """
+ """
# Validate that Domain admin should be able to restart network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
restartResponse = self.network_d11a.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "Domain admin User is not able to restart network he owns")
+ self.assertEqual(restartResponse.success,
+ True,
+ "Domain admin User is not able to restart network he owns")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_27_restartNetwork_domaindmin_forcrossdomainuser(self):
-
- """
+ """
# Validate that Domain admin should be able to restart network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- try:
- restartResponse = self.network_d2a.restart(self.apiclient)
- self.fail("Domain admin is allowed to restart network for users not in his domain ")
+ try:
+ restartResponse = self.network_d2a.restart(self.apiclient)
+ self.fail("Domain admin is allowed to restart network for users not in his domain ")
except Exception as e:
- self.debug ("When Domain admin tries to restart network for users in his sub domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to restart network for users not in his domain ")
+ self.debug("When Domain admin tries to restart network for users in his sub domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail("Error message validation failed when Domain admin tries to restart network for users not in his domain ")
-## Test cases relating restart network as regular user
+ ## Test cases relating restart network as regular user
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_28_restartNetwork_user(self):
-
- """
+ """
#Validate that Regular should be able to restart network for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
restartResponse = self.network_d1a.restart(self.apiclient)
- self.assertEqual(restartResponse.success,
- True,
- "User is not able to restart network he owns")
+ self.assertEqual(restartResponse.success,
+ True,
+ "User is not able to restart network he owns")
-
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_29_restartNetwork_user_foruserinsamedomain(self):
-
- """
+ """
#Validate that Regular user should NOT be able to restart network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- restartResponse = self.network_d1b.restart(self.apiclient)
- self.fail("Regular user is allowed to restart network for users in his domain ")
+ try:
+ restartResponse = self.network_d1b.restart(self.apiclient)
+ self.fail("Regular user is allowed to restart network for users in his domain ")
except Exception as e:
- self.debug ("When user tries to restart network for users in his domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user tries to restart network for users in his domain ")
+ self.debug("When user tries to restart network for users in his domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user tries to restart network for users in his domain ")
- @attr("simulator_only",tags=[ "advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_30_restartNetwork_user_foruserinotherdomain(self):
-
- """
+ """
#Validate that Domain admin should be NOT be able to restart network for users in other domains
- """
- self.apiclient.connection.apiKey = self.user_d1a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
-
- try:
- restartResponse = self.network_d11a.restart(self.apiclient)
- self.fail("Regular user is allowed to restart network for users not in his domain ")
+ try:
+ restartResponse = self.network_d11a.restart(self.apiclient)
+ self.fail("Regular user is allowed to restart network for users not in his domain ")
except Exception as e:
- self.debug ("When user tries to restart network for users in other domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user is allowed to restart network for users not in his domain ")
+ self.debug("When user tries to restart network for users in other domain %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user is allowed to restart network for users not in his domain ")
@staticmethod
- def generateKeysForUser(apiclient,account):
+ def generateKeysForUser(apiclient, account):
user = User.list(
- apiclient,
- account=account.name,
- domainid=account.domainid
- )[0]
+ apiclient,
+ account=account.name,
+ domainid=account.domainid
+ )[0]
return (User.registerUserKeys(
- apiclient,
- user.id
- ))
-
- @staticmethod
- def createNetwork(apiclient,account,isolated_network_offering_id,zone):
- network= {
- "name": "Network-",
- "displaytext": "Network-",
- "gateway" :"10.223.1.1",
- "netmask" :"255.255.255.0",
- "startip" :"10.223.1.2",
- "endip" :"10.223.1.100",
- }
-
- network["name"] = account.name +" -forupdate"
- network["displayname"] = account.name + "-forupdate"
-
- network = Network.create(
- apiclient,
- network,
- networkofferingid=isolated_network_offering_id,
- zoneid=zone.id
- )
- return network
-
-
- @staticmethod
- def createVM(apiclient,zoneId,serviceOfferingId,templateId,networkId):
- vmData = {"name":"prereq","dispayname":"prereq"}
-
- vm = VirtualMachine.create(
apiclient,
- vmData,
+ user.id
+ ))
+
+ @classmethod
+ def createNetwork(cls, apiclient, account, isolated_network_offering_id, zone):
+ network = {
+ "name": "Network-",
+ "displaytext": "Network-",
+ "gateway": "10.223.1.1",
+ "netmask": "255.255.255.0",
+ "startip": "10.223.1.2",
+ "endip": "10.223.1.100",
+ }
+
+ network["name"] = account.name + " -forupdate"
+ network["displayname"] = account.name + "-forupdate"
+
+ network = Network.create(
+ apiclient,
+ network,
+ networkofferingid=isolated_network_offering_id,
+ zoneid=zone.id
+ )
+ cls._cleanup.append(network)
+ return network
+
+ @classmethod
+ def createVM(cls, apiclient, zoneId, serviceOfferingId, templateId, networkId):
+ vmData = {"name": "prereq", "dispayname": "prereq"}
+
+ vm = VirtualMachine.create(
+ apiclient,
+ vmData,
zoneid=zoneId,
serviceofferingid=serviceOfferingId,
- templateid=templateId,
- networkids=networkId
+ templateid=templateId,
+ networkids=networkId
)
-
- return vm
+ cls._cleanup.append(vm)
+ return vm
diff --git a/test/integration/component/test_acl_isolatednetwork_delete.py b/test/integration/component/test_acl_isolatednetwork_delete.py
index 9d34e88f0c0..379ed3d6e96 100644
--- a/test/integration/component/test_acl_isolatednetwork_delete.py
+++ b/test/integration/component/test_acl_isolatednetwork_delete.py
@@ -57,38 +57,42 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.domain_1 = None
cls.domain_2 = None
- cls.cleanup = []
+ cls._cleanup = []
- try:
-
+ try:
# backup default apikey and secretkey
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
-
+
# Create domains
cls.domain_1 = Domain.create(
cls.apiclient,
cls.acldata["domain1"]
)
+ cls._cleanup.append(cls.domain_1)
cls.domain_11 = Domain.create(
cls.apiclient,
cls.acldata["domain11"],
- parentdomainid=cls.domain_1.id
+ parentdomainid=cls.domain_1.id
)
+ cls._cleanup.append(cls.domain_11)
cls.domain_111 = Domain.create(
cls.apiclient,
cls.acldata["domain111"],
- parentdomainid=cls.domain_11.id,
+ parentdomainid=cls.domain_11.id,
)
+ cls._cleanup.append(cls.domain_111)
cls.domain_12 = Domain.create(
cls.apiclient,
cls.acldata["domain12"],
- parentdomainid=cls.domain_1.id
+ parentdomainid=cls.domain_1.id
)
+ cls._cleanup.append(cls.domain_12)
cls.domain_2 = Domain.create(
cls.apiclient,
cls.acldata["domain2"]
)
+ cls._cleanup.append(cls.domain_2)
# Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create(
cls.apiclient,
@@ -96,30 +100,30 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=True,
domainid=cls.domain_1.id
)
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
+ cls._cleanup.append(cls.account_d1)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey
-
+
cls.account_d1a = Account.create(
cls.apiclient,
cls.acldata["accountD1A"],
admin=False,
domainid=cls.domain_1.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
+ )
+ cls._cleanup.append(cls.account_d1a)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
admin=False,
domainid=cls.domain_1.id
)
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
+ cls._cleanup.append(cls.account_d1b)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
@@ -129,8 +133,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD11"],
admin=True,
domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
+ )
+ cls._cleanup.append(cls.account_d11)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
@@ -139,8 +144,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD11A"],
admin=False,
domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
+ )
+ cls._cleanup.append(cls.account_d11a)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
@@ -149,20 +155,21 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD11B"],
admin=False,
domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
+ )
+ cls._cleanup.append(cls.account_d11b)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
# Create 2 user accounts and 1 admin account for doamin_111
-
cls.account_d111 = Account.create(
cls.apiclient,
cls.acldata["accountD111"],
admin=True,
domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
+ )
+ cls._cleanup.append(cls.account_d111)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
cls.user_d111_apikey = user.apikey
cls.user_d111_secretkey = user.secretkey
@@ -171,8 +178,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD111A"],
admin=False,
domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
+ )
+ cls._cleanup.append(cls.account_d111a)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
@@ -181,8 +189,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD111B"],
admin=False,
domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
+ )
+ cls._cleanup.append(cls.account_d111b)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
cls.user_d111b_apikey = user.apikey
cls.user_d111b_secretkey = user.secretkey
@@ -192,8 +201,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD12A"],
admin=False,
domainid=cls.domain_12.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
+ )
+ cls._cleanup.append(cls.account_d12a)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
@@ -202,9 +212,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountD12B"],
admin=False,
domainid=cls.domain_12.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
+ )
+ cls._cleanup.append(cls.account_d12b)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
@@ -216,21 +226,21 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False,
domainid=cls.domain_2.id
)
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
+ cls._cleanup.append(cls.account_d2a)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
-
-
+
# Create 1 user account and admin account in "ROOT" domain
-
+
cls.account_roota = Account.create(
cls.apiclient,
cls.acldata["accountROOTA"],
admin=False,
)
+ cls._cleanup.append(cls.account_roota)
- user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
cls.user_roota_apikey = user.apikey
cls.user_roota_secretkey = user.secretkey
@@ -239,8 +249,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountROOT"],
admin=True,
)
+ cls._cleanup.append(cls.account_root)
- user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
+ user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
cls.user_root_apikey = user.apikey
cls.user_root_secretkey = user.secretkey
@@ -249,86 +260,77 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.apiclient,
cls.acldata["service_offering"]["small"]
)
-
+ cls._cleanup.append(cls.service_offering)
+
cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
- cls.apiclient.connection.apiKey = cls.default_apikey
+ cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
list_isolated_network_offerings_response = NetworkOffering.list(
cls.apiclient,
name="DefaultIsolatedNetworkOfferingWithSourceNatService"
)
- cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
+ cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
- ## Create Network objects for Update API related test cases
+ ## Create Network objects for Update API related test cases
- cls.apiclient.connection.apiKey = cls.user_root_apikey
+ cls.apiclient.connection.apiKey = cls.user_root_apikey
cls.apiclient.connection.securityKey = cls.user_root_secretkey
- cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
+ cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d1_apikey
+ cls.apiclient.connection.apiKey = cls.user_d1_apikey
cls.apiclient.connection.securityKey = cls.user_d1_secretkey
- cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d1a_apikey
+ cls.apiclient.connection.apiKey = cls.user_d1a_apikey
cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
- cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d1b_apikey
+ cls.apiclient.connection.apiKey = cls.user_d1b_apikey
cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
- cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d11a_apikey
+ cls.apiclient.connection.apiKey = cls.user_d11a_apikey
cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
- cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d11b_apikey
+ cls.apiclient.connection.apiKey = cls.user_d11b_apikey
cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
- cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d12a_apikey
+ cls.apiclient.connection.apiKey = cls.user_d12a_apikey
cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
- cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_roota_apikey
+ cls.apiclient.connection.apiKey = cls.user_roota_apikey
cls.apiclient.connection.securityKey = cls.user_roota_secretkey
- cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
+ cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d111a_apikey
+ cls.apiclient.connection.apiKey = cls.user_d111a_apikey
cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
- cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d111b_apikey
+ cls.apiclient.connection.apiKey = cls.user_d111b_apikey
cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
- cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
- cls.apiclient.connection.apiKey = cls.user_d2a_apikey
+ cls.apiclient.connection.apiKey = cls.user_d2a_apikey
cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
- cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
+ cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
- cls.cleanup = [
- cls.account_root,
- cls.account_roota,
- cls.service_offering,
- ]
except Exception as e:
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+ cls.tearDownClass()
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
- cls.apiclient = super(TestIsolatedNetworkDelete, cls).getClsTestClient().getApiClient()
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
+ super(TestIsolatedNetworkDelete,cls).tearDownClass()
return
def setUp(cls):
@@ -345,169 +347,169 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_admin(self):
- """
+ """
Validate that Admin should be able to delete network he owns
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.network_root.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_root.id)
+ response = Network.list(self.apiclient,listall="true",id=self.network_root.id)
- self.assertEqual(response,
+ self.assertEqual(response,
None,
"Admin User is not able to restart network he owns")
+ self._cleanup.remove(self.network_root)
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_admin_foruserinsamedomain(self):
-
- """
+ """
Validate that Admin should be able to delete network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_root_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.network_roota.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_roota.id)
+ response = Network.list(self.apiclient,listall="true",id=self.network_roota.id)
- self.assertEqual(response,
+ self.assertEqual(response,
None,
"Admin User is not able to delete network owned by users his domain")
+ self._cleanup.remove(self.network_roota)
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_admin_foruserinotherdomain(self):
-
# Validate that Admin should be able to delete network for users in his sub domain
- self.apiclient.connection.apiKey = self.user_root_apikey
+ self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey
self.network_d12a.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_d12a.id)
+ response = Network.list(self.apiclient,listall="true",id=self.network_d12a.id)
- self.assertEqual(response,
+ self.assertEqual(response,
None,
"Admin User is not able to delete network owned other users in other domain")
+ self._cleanup.remove(self.network_d12a)
## Test cases relating to delete Network as domain admin user
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin(self):
- """
+ """
Validate that Domain admin should be able to delete network for himslef
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.network_d1.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_d1.id)
+ response = Network.list(self.apiclient,listall="true",id=self.network_d1.id)
- self.assertEqual(response,
+ self.assertEqual(response,
None,
"Domain admin User is not able to delete a network he owns")
-
+ self._cleanup.remove(self.network_d1)
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin_foruserinsamedomain(self):
-
- """
+ """
Validate that Domain admin should be able to delete network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.network_d1a.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_d1a.id)
- self.assertEqual(response,
+ response = Network.list(self.apiclient,listall="true",id=self.network_d1a.id)
+ self.assertEqual(response,
None,
"Domain admin User is not able to delete a network that is owned by user in the same domain")
+ self._cleanup.remove(self.network_d1a)
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin_foruserinsubdomain(self):
-
- """
+ """
Validate that Domain admin should be able to delete network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.network_d11a.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_d11a.id)
+ response = Network.list(self.apiclient,listall="true",id=self.network_d11a.id)
- self.assertEqual(response,
+ self.assertEqual(response,
None,
"Domain admin User is not able to delete a network that is owned by user in the subdomain")
+ self._cleanup.remove(self.network_d11a)
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin_forcrossdomainuser(self):
-
- """
+ """
Validate that Domain admin should be able to delete network for users in his sub domain
- """
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- try:
- response = self.network_d2a.delete(self.apiclient)
- self.fail("Domain admin is allowed to delete network for users not in his domain ")
+ try:
+ response = self.network_d2a.delete(self.apiclient)
+ self._cleanup.remove(self.network_d2a)
+ self.fail("Domain admin is allowed to delete network for users not in his domain ")
except Exception as e:
- self.debug ("When Domain admin tries to delete network for user in a different domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to delete network for users not in his domain ")
-
+ self.debug ("When Domain admin tries to delete network for user in a different domain %s" %e)
+ if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail("Error message validation failed when Domain admin tries to delete network for users not in his domain ")
## Test cases relating deleting network as regular user
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_user(self):
-
- """
+ """
Validate that Regular should be able to delete network for himslef
- """
- self.apiclient.connection.apiKey = self.user_d111a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey
self.network_d111a.delete(self.apiclient)
- response = Network.list(self.apiclient,listall="true",id=self.network_d111a.id)
+ response = Network.list(self.apiclient,listall="true",id=self.network_d111a.id)
- self.assertEqual(response,
+ self.assertEqual(response,
None,
"User is not able to delete a network he owns")
-
+ self._cleanup.remove(self.network_d111a)
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_user_foruserinsamedomain(self):
-
- """
+ """
Validate that Regular user should NOT be able to delete network for users in his domain
- """
- self.apiclient.connection.apiKey = self.user_d111a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey
- try:
- response = self.network_d111b.delete(self.apiclient)
- self.fail("Regular user is allowed to delete network for users in his domain ")
+ try:
+ response = self.network_d111b.delete(self.apiclient)
+ self._cleanup.remove(self.network_d111b)
+ self.fail("Regular user is allowed to delete network for users in his domain ")
except Exception as e:
self.debug ("When user tries to delete network for users in his domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
self.fail("Regular user is allowed to delete network for users in his domain ")
@attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_user_foruserinotherdomain(self):
- """
+ """
Validate that Domain admin should be NOT be able to delete network for users in other domains
- """
- self.apiclient.connection.apiKey = self.user_d111a_apikey
+ """
+ self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey
-
- try:
- response = self.network_d11b.delete(self.apiclient)
- self.fail("Regular user is allowed to delete network for users not in his domain ")
+
+ try:
+ response = self.network_d11b.delete(self.apiclient)
+ self._cleanup.remove(self.network_d11b)
+ self.fail("Regular user is allowed to delete network for users not in his domain ")
except Exception as e:
- self.debug ("When user tries to delete network for users in other domain %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user tries to delete network for users not in his domain ")
+ self.debug ("When user tries to delete network for users in other domain %s" %e)
+ if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user tries to delete network for users not in his domain ")
@staticmethod
def generateKeysForUser(apiclient,account):
@@ -522,25 +524,26 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user.id
))
- @staticmethod
- def createNetwork(apiclient,account,isolated_network_offering_id,zone):
+ @classmethod
+ def createNetwork(cls,apiclient,account,isolated_network_offering_id,zone):
network= {
- "name": "Network-",
- "displaytext": "Network-",
- "gateway" :"10.223.1.1",
- "netmask" :"255.255.255.0",
- "startip" :"10.223.1.2",
- "endip" :"10.223.1.100",
- }
+ "name": "Network-",
+ "displaytext": "Network-",
+ "gateway" :"10.223.1.1",
+ "netmask" :"255.255.255.0",
+ "startip" :"10.223.1.2",
+ "endip" :"10.223.1.100",
+ }
- network["name"] = account.name +" -forupdate"
- network["displayname"] = account.name + "-forupdate"
+ network["name"] = account.name +" -forupdate"
+ network["displayname"] = account.name + "-forupdate"
network = Network.create(
- apiclient,
- network,
- networkofferingid=isolated_network_offering_id,
- zoneid=zone.id
- )
- return network
+ apiclient,
+ network,
+ networkofferingid=isolated_network_offering_id,
+ zoneid=zone.id
+ )
+ cls._cleanup.append(network)
+ return network
diff --git a/test/integration/component/test_acl_listsnapshot.py b/test/integration/component/test_acl_listsnapshot.py
index f0fa7b78106..be280b4f223 100644
--- a/test/integration/component/test_acl_listsnapshot.py
+++ b/test/integration/component/test_acl_listsnapshot.py
@@ -17,7 +17,7 @@
"""
Test cases relating to listSnapshot() relating to parameters - id,listall,isrecursive,account and domainid
"""
-#Import Local Modules
+# Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@@ -25,25 +25,26 @@ from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
-#Import System modules
+# Import System modules
import time
_multiprocess_shared_ = True
+
class TestSnapshotList(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- """
- Create the following domain tree and accounts that are reqiured for executing listSnapshot test cases:
- Under ROOT - create 2 domaind D1 and D2
- Under D1 - Create 2 subdomain D11 and D12
- Under D11 - Create subdimain D111
-
- Under each of the domain create 1 admin user and couple of regular users.
+ """
+ Create the following domain tree and accounts that are reqiured for executing listSnapshot test cases:
+ Under ROOT - create 2 domaind D1 and D2
+ Under D1 - Create 2 subdomain D11 and D12
+ Under D11 - Create subdimain D111
- As each of these users , deploy Virtual machines and take a snapshot of the ROOT volume.
+ Under each of the domain create 1 admin user and couple of regular users.
- """
+ As each of these users , deploy Virtual machines and take a snapshot of the ROOT volume.
+
+ """
cls.testclient = super(TestSnapshotList, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
cls.testdata = cls.testClient.getParsedTestDataConfig()
@@ -56,173 +57,171 @@ class TestSnapshotList(cloudstackTestCase):
cls.domain_2 = None
cleanup = None
- try:
-
+ try:
+
# backup default apikey and secretkey
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
-
+
# Create domains
cls.domain_1 = Domain.create(
- cls.apiclient,
- cls.acldata["domain1"]
- )
+ cls.apiclient,
+ cls.acldata["domain1"]
+ )
cls.domain_11 = Domain.create(
- cls.apiclient,
- cls.acldata["domain11"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain11"],
+ parentdomainid=cls.domain_1.id
+ )
cls.domain_111 = Domain.create(
- cls.apiclient,
- cls.acldata["domain111"],
- parentdomainid=cls.domain_11.id,
- )
+ cls.apiclient,
+ cls.acldata["domain111"],
+ parentdomainid=cls.domain_11.id,
+ )
cls.domain_12 = Domain.create(
- cls.apiclient,
- cls.acldata["domain12"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain12"],
+ parentdomainid=cls.domain_1.id
+ )
cls.domain_2 = Domain.create(
- cls.apiclient,
- cls.acldata["domain2"]
- )
+ cls.apiclient,
+ cls.acldata["domain2"]
+ )
# Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create(
- cls.apiclient,
- cls.acldata["accountD1"],
- admin=True,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
+ cls.apiclient,
+ cls.acldata["accountD1"],
+ admin=True,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1)
cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey
-
+
cls.account_d1a = Account.create(
- cls.apiclient,
- cls.acldata["accountD1A"],
- admin=False,
- domainid=cls.domain_1.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
+ cls.apiclient,
+ cls.acldata["accountD1A"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
-
+
cls.account_d1b = Account.create(
- cls.apiclient,
- cls.acldata["accountD1B"],
- admin=False,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
+ cls.apiclient,
+ cls.acldata["accountD1B"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
-
+
# Create 1 admin and 2 user accounts for doamin_11
cls.account_d11 = Account.create(
- cls.apiclient,
- cls.acldata["accountD11"],
- admin=True,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
+ cls.apiclient,
+ cls.acldata["accountD11"],
+ admin=True,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
-
+
cls.account_d11a = Account.create(
- cls.apiclient,
- cls.acldata["accountD11A"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
+ cls.apiclient,
+ cls.acldata["accountD11A"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
-
+
cls.account_d11b = Account.create(
- cls.apiclient,
- cls.acldata["accountD11B"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
+ cls.apiclient,
+ cls.acldata["accountD11B"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
-
+
# Create 1 user account for doamin_111
-
+
cls.account_d111a = Account.create(
- cls.apiclient,
- cls.acldata["accountD111A"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
+ cls.apiclient,
+ cls.acldata["accountD111A"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
-
+
# Create 2 user accounts for doamin_12
cls.account_d12a = Account.create(
- cls.apiclient,
- cls.acldata["accountD12A"],
- admin=False,
- domainid=cls.domain_12.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
+ cls.apiclient,
+ cls.acldata["accountD12A"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
-
+
cls.account_d12b = Account.create(
- cls.apiclient,
- cls.acldata["accountD12B"],
- admin=False,
- domainid=cls.domain_12.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
+ cls.apiclient,
+ cls.acldata["accountD12B"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
-
+
# Create 1 user account for domain_2
-
+
cls.account_d2a = Account.create(
- cls.apiclient,
- cls.acldata["accountD2"],
- admin=False,
- domainid=cls.domain_2.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
+ cls.apiclient,
+ cls.acldata["accountD2"],
+ admin=False,
+ domainid=cls.domain_2.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d2a)
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
-
-
+
# Create admin user account
-
+
cls.account_a = Account.create(
- cls.apiclient,
- cls.acldata["accountROOTA"],
- admin=True,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_a)
+ cls.apiclient,
+ cls.acldata["accountROOTA"],
+ admin=True,
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_a)
cls.user_a_apikey = user.apikey
cls.user_a_secretkey = user.secretkey
# create service offering
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
- cls.acldata["service_offering"]["small"]
- )
-
- cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
+ cls.apiclient,
+ cls.acldata["service_offering"]["small"]
+ )
+
+ cls.zone = get_zone(cls.apiclient, cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
+
# deploy VM
-
- cls.apiclient.connection.apiKey = cls.user_d1_apikey
+
+ cls.apiclient.connection.apiKey = cls.user_d1_apikey
cls.apiclient.connection.securityKey = cls.user_d1_secretkey
cls.vm_d1 = VirtualMachine.create(
cls.apiclient,
@@ -231,11 +230,10 @@ class TestSnapshotList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d1_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d1.id)
- cls.vm_d1_snapshot=Snapshot.create(cls.apiclient,cls.vm_d1_volume[0].id)
-
-
- cls.apiclient.connection.apiKey = cls.user_d1a_apikey
+ cls.vm_d1_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d1.id)
+ cls.vm_d1_snapshot = Snapshot.create(cls.apiclient, cls.vm_d1_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1a_apikey
cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
cls.vm_d1a = VirtualMachine.create(
cls.apiclient,
@@ -244,10 +242,10 @@ class TestSnapshotList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d1a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d1a.id)
- cls.vm_d1a_snapshot=Snapshot.create(cls.apiclient,cls.vm_d1a_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d1b_apikey
+ cls.vm_d1a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d1a.id)
+ cls.vm_d1a_snapshot = Snapshot.create(cls.apiclient, cls.vm_d1a_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1b_apikey
cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
cls.vm_d1b = VirtualMachine.create(
cls.apiclient,
@@ -255,11 +253,11 @@ class TestSnapshotList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d1b_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d1b.id)
- cls.vm_d1b_snapshot=Snapshot.create(cls.apiclient,cls.vm_d1b_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d11_apikey
+ )
+ cls.vm_d1b_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d1b.id)
+ cls.vm_d1b_snapshot = Snapshot.create(cls.apiclient, cls.vm_d1b_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11_apikey
cls.apiclient.connection.securityKey = cls.user_d11_secretkey
cls.vm_d11 = VirtualMachine.create(
cls.apiclient,
@@ -267,11 +265,11 @@ class TestSnapshotList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d11_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d11.id)
- cls.vm_d11_snapshot=Snapshot.create(cls.apiclient,cls.vm_d11_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d11a_apikey
+ )
+ cls.vm_d11_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d11.id)
+ cls.vm_d11_snapshot = Snapshot.create(cls.apiclient, cls.vm_d11_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11a_apikey
cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
cls.vm_d11a = VirtualMachine.create(
cls.apiclient,
@@ -279,11 +277,11 @@ class TestSnapshotList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d11a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d11a.id)
- cls.vm_d11a_snapshot=Snapshot.create(cls.apiclient,cls.vm_d11a_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d11b_apikey
+ )
+ cls.vm_d11a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d11a.id)
+ cls.vm_d11a_snapshot = Snapshot.create(cls.apiclient, cls.vm_d11a_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11b_apikey
cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
cls.vm_d11b = VirtualMachine.create(
cls.apiclient,
@@ -292,10 +290,10 @@ class TestSnapshotList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d11b_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d11b.id)
- cls.vm_d11b_snapshot=Snapshot.create(cls.apiclient,cls.vm_d11b_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d111a_apikey
+ cls.vm_d11b_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d11b.id)
+ cls.vm_d11b_snapshot = Snapshot.create(cls.apiclient, cls.vm_d11b_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d111a_apikey
cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
cls.vm_d111a = VirtualMachine.create(
cls.apiclient,
@@ -303,11 +301,11 @@ class TestSnapshotList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d111a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d111a.id)
- cls.vm_d111a_snapshot=Snapshot.create(cls.apiclient,cls.vm_d111a_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d12a_apikey
+ )
+ cls.vm_d111a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d111a.id)
+ cls.vm_d111a_snapshot = Snapshot.create(cls.apiclient, cls.vm_d111a_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d12a_apikey
cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
cls.vm_d12a = VirtualMachine.create(
cls.apiclient,
@@ -315,11 +313,11 @@ class TestSnapshotList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d12a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d12a.id)
- cls.vm_d12a_snapshot=Snapshot.create(cls.apiclient,cls.vm_d12a_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d12b_apikey
+ )
+ cls.vm_d12a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d12a.id)
+ cls.vm_d12a_snapshot = Snapshot.create(cls.apiclient, cls.vm_d12a_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d12b_apikey
cls.apiclient.connection.securityKey = cls.user_d12b_secretkey
cls.vm_d12b = VirtualMachine.create(
cls.apiclient,
@@ -328,10 +326,10 @@ class TestSnapshotList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d12b_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d12b.id)
- cls.vm_d12b_snapshot=Snapshot.create(cls.apiclient,cls.vm_d12b_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_d2a_apikey
+ cls.vm_d12b_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d12b.id)
+ cls.vm_d12b_snapshot = Snapshot.create(cls.apiclient, cls.vm_d12b_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_d2a_apikey
cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
cls.vm_d2 = VirtualMachine.create(
cls.apiclient,
@@ -340,10 +338,10 @@ class TestSnapshotList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d2_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d2.id)
- cls.vm_d2_snapshot=Snapshot.create(cls.apiclient,cls.vm_d2_volume[0].id)
-
- cls.apiclient.connection.apiKey = cls.user_a_apikey
+ cls.vm_d2_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d2.id)
+ cls.vm_d2_snapshot = Snapshot.create(cls.apiclient, cls.vm_d2_volume[0].id)
+
+ cls.apiclient.connection.apiKey = cls.user_a_apikey
cls.apiclient.connection.securityKey = cls.user_a_secretkey
cls.vm_a = VirtualMachine.create(
cls.apiclient,
@@ -352,18 +350,18 @@ class TestSnapshotList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_a_volume =Volume.list(cls.apiclient,virtualmachineid=cls.vm_a.id)
- cls.vm_a_snapshot=Snapshot.create(cls.apiclient,cls.vm_a_volume[0].id)
-
+ cls.vm_a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_a.id)
+ cls.vm_a_snapshot = Snapshot.create(cls.apiclient, cls.vm_a_volume[0].id)
+
cls.cleanup = [
- cls.account_a,
- cls.service_offering,
- ]
+ cls.account_a,
+ cls.service_offering,
+ ]
except Exception as e:
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
@@ -371,9 +369,10 @@ class TestSnapshotList(cloudstackTestCase):
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
try:
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- except: pass
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ except:
+ pass
cleanup_resources(cls.apiclient, cls.cleanup)
def setUp(cls):
@@ -386,2472 +385,2432 @@ class TestSnapshotList(cloudstackTestCase):
cls.apiclient.connection.securityKey = cls.default_secretkey
return
-## Domain Admin - Test cases with listall =true
+ ## Domain Admin - Test cases with listall =true
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_listall_true(self):
- """
- Test listing of Snapshots by passing listall="true" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by accounts in this domain and all its subdomain
- """
+ """
+ Test listing of Snapshots by passing listall="true" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true")
- self.debug ("List as Domain Admin - listall=true - %s" % snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true")
+ self.debug("List as Domain Admin - listall=true - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id),
- self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d1b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id),
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing listall="true"i and isrecusriv="true" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by accounts in this domain and all its subdomain
- """
+ """
+ Test listing of Snapshots by passing listall="true"i and isrecusriv="true" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id),
- self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d1b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id),
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing listall="true" and isrecusriv="false" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by accounts in this domain and all its subdomain
- """
+ """
+ Test listing of Snapshots by passing listall="true" and isrecusriv="false" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id),
- self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d1b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id),
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases with listall=false
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_listall_false(self):
- """
- Test listing of Snapshots by passing listall="false" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by the domain admin
- """
+ """
+ Test listing of Snapshots by passing listall="false" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false")
- self.debug ("List as Domain Admin - listall=false - %s" % snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false")
+ self.debug("List as Domain Admin - listall=false - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing listall="false" and isrecusrive="true" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by the domain admin
- """
+ """
+ Test listing of Snapshots by passing listall="false" and isrecusrive="true" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing listall="false" and isrecusrive="false" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by the domain admin
- """
+ """
+ Test listing of Snapshots by passing listall="false" and isrecusrive="false" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases without passing listall paramter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases without passing listall paramter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin(self):
- """
- Test listing of Snapshots by passing no parameter as domain admin
- Validate that it returns all the Snapshots that is owned by the domain admin
- """
+ """
+ Test listing of Snapshots by passing no parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient)
- self.debug ("List as Domain Admin - %s" % snapshotList)
+ snapshotList = Snapshot.list(self.apiclient)
+ self.debug("List as Domain Admin - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_rec_true(self):
- """
- Test listing of Snapshots by passing isrecusrive="true" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by the domain admin
- """
+ """
+ Test listing of Snapshots by passing isrecusrive="true" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,isrecursive="true")
- self.debug ("List as Domain Admin - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, isrecursive="true")
+ self.debug("List as Domain Admin - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_true_rec_false(self):
- """
- Test listing of Snapshots by passing isrecusrive="false" parameter as domain admin
- Validate that it returns all the Snapshots that is owned by the domain admin
- """
+ """
+ Test listing of Snapshots by passing isrecusrive="false" parameter as domain admin
+ Validate that it returns all the Snapshots that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,isrecursive="false")
- self.debug ("List as Domain Admin - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, isrecursive="false")
+ self.debug("List as Domain Admin - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_listall_true(self):
- """
- Test listing of Snapshots by passing domainId and listall="true" parameter as domain admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId and listall="true" parameter as domain admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="true")
- self.debug ("List as Domain Admin passing domainId - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="true")
+ self.debug("List as Domain Admin passing domainId - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing domainId ,listall="true" and isrecursive="true" parameter as domain admin
- Validate that it returns all the Snapshots in the subdomain and the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId ,listall="true" and isrecursive="true" parameter as domain admin
+ Validate that it returns all the Snapshots in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing domainId ,listall="true" and isrecursive="false" parameter as domain admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId ,listall="true" and isrecursive="false" parameter as domain admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when domainId is passed with listall=false
+ ## Domain Admin - Test cases when domainId is passed with listall=false
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_listall_false(self):
- """
- Test listing of Snapshots by passing domainId ,listall="false" parameter as domain admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId ,listall="false" parameter as domain admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="false")
- self.debug ("List as Domain Admin passing domainId - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="false")
+ self.debug("List as Domain Admin passing domainId - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing domainId ,listall="false" and isrecursive="true" parameter as domain admin
- Validate that it returns all the Snapshots in the subdomain and the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId ,listall="false" and isrecursive="true" parameter as domain admin
+ Validate that it returns all the Snapshots in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing domainId ,listall="false" and isrecursive="false" parameter as domain admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId ,listall="false" and isrecursive="false" parameter as domain admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when domainId is passed with no listall parameter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when domainId is passed with no listall parameter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid(self):
- """
+ """
- Test listing of Snapshots by passing domainId parameter as domain admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ Test listing of Snapshots by passing domainId parameter as domain admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id)
- self.debug ("List as Domain Admin passing domainId - %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id)
+ self.debug("List as Domain Admin passing domainId - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_rec_true(self):
- """
- Test listing of Snapshots by passing domainId and isrecursive="true" parameter as domain admin
- Validate that it returns all the Snapshots in the subdomain and domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId and isrecursive="true" parameter as domain admin
+ Validate that it returns all the Snapshots in the subdomain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_rec_false(self):
- """
- Test listing of Snapshots by passing domainId and isrecursive="false" parameter as domain admin
- Validate that it returns all the Snapshots in the subdomain and domain passed
- """
+ """
+ Test listing of Snapshots by passing domainId and isrecursive="false" parameter as domain admin
+ Validate that it returns all the Snapshots in the subdomain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when account and domainId is passed with listall =true
+ ## Domain Admin - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_listall_true(self):
- """
- Test listing of Snapshots by passing account ,domainId and listall="true" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId and listall="true" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing account ,domainId and listall="true" and isrecursive="true" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId and listall="true" and isrecursive="true" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing account ,domainId , listall="true" and isrecursive="false" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId , listall="true" and isrecursive="false" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when account and domainId is passed with listall=false
+ ## Domain Admin - Test cases when account and domainId is passed with listall=false
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_listall_false(self):
- """
- Test listing of Snapshots by passing account ,domainId and listall="false" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId and listall="false" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing account ,domainId and listall="false" and isrecursive="true" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId and listall="false" and isrecursive="true" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing account ,domainId , listall="false" and isrecursive="false" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId , listall="false" and isrecursive="false" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when account and domainId is passed with listall not passed
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when account and domainId is passed with listall not passed
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid(self):
- """
- Test listing of Snapshots by passing account ,domainId parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id)
- self.debug ("List as Domain Admin passing domainId and accountId - %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id)
+ self.debug("List as Domain Admin passing domainId and accountId - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_rec_true(self):
- """
- Test listing of Snapshots by passing account ,domainId and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_domainid_accountid_rec_false(self):
- """
- Test listing of Snapshots by passing account ,domainId and isrecursive="false" parameter as domain admin
- Validate that it returns all the Snapshots owned by the account passed in account parameter
- """
+ """
+ Test listing of Snapshots by passing account ,domainId and isrecursive="false" parameter as domain admin
+ Validate that it returns all the Snapshots owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_true(self):
- """
- Test listing of Snapshots by passing listall="true" parameter as admin
- Validate that it returns all the Snapshots
- """
+ """
+ Test listing of Snapshots by passing listall="true" parameter as admin
+ Validate that it returns all the Snapshots
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true")
- self.debug ("List as ROOT Admin - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true")
+ self.debug("List as ROOT Admin - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id),
- self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d1b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d2_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id)):
-
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id),
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d2_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id)):
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ accountAccess = True
+ else:
+ accountAccess = False
+
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing listall="true" and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots
- """
+ """
+ Test listing of Snapshots by passing listall="true" and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id),
- self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d1b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d2_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id)):
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id),
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d2_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing listall="true" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots
- """
+ """
+ Test listing of Snapshots by passing listall="true" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(snapshotList,self.vm_d1_snapshot.id),
- self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d1b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d12b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d2_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d1_snapshot.id),
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d1b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d12b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d2_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases with listall=false
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ ## ROOT Admin - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_false(self):
- """
- Test listing of Snapshots by passing listall="false" parameter as admin
- Validate that it returns all the Snapshots owned by admin
- """
+ """
+ Test listing of Snapshots by passing listall="false" parameter as admin
+ Validate that it returns all the Snapshots owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false")
- self.debug ("List as ROOT Admin - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false")
+ self.debug("List as ROOT Admin - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing listall="false" and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots owned by admin
- """
+ """
+ Test listing of Snapshots by passing listall="false" and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing listall="false" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots owned by admin
- """
+ """
+ Test listing of Snapshots by passing listall="false" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin - listall=false,isrecursive=false %s" % snapshotList)
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+ ## ROOT Admin - Test cases without passing listall paramter
-## ROOT Admin - Test cases without passing listall paramter
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin(self):
- """
- Test listing of Snapshots by passing no parameter as admin
- Validate that it returns all the Snapshots owned by admin
- """
+ """
+ Test listing of Snapshots by passing no parameter as admin
+ Validate that it returns all the Snapshots owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient)
- self.debug ("List as ROOT Admin %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient)
+ self.debug("List as ROOT Admin %s" % snapshotList)
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_rec_true(self):
- """
- Test listing of Snapshots by passing isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots owned by admin
- """
+ """
+ Test listing of Snapshots by passing isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,isrecursive="true")
- self.debug ("List as ROOT Admin - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, isrecursive="true")
+ self.debug("List as ROOT Admin - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_rec_false(self):
- """
- Test listing of Snapshots by passing isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots owned by admin
- """
+ """
+ Test listing of Snapshots by passing isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_listall_true(self):
- """
- Test listing of Snapshots by passing domainid and listall="true" parameter as admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid and listall="true" parameter as admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="true")
- self.debug ("List as ROOT Admin passing domainId - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="true")
+ self.debug("List as ROOT Admin passing domainId - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing domainid , listall="true" and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots in the subdomain and the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid , listall="true" and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing domainid, listall="true" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid, listall="true" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when domainId is passed with listall=false
+ ## ROOT Admin - Test cases when domainId is passed with listall=false
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_listall_false(self):
- """
- Test listing of Snapshots by passing domainid, listall="false" parameter as admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid, listall="false" parameter as admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="false")
- self.debug ("List as ROOT Admin passing domainId - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="false")
+ self.debug("List as ROOT Admin passing domainId - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing domainid, listall="false" and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots in the subdoamin and domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid, listall="false" and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots in the subdoamin and domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing domainid, listall="false" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid, listall="false" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when domainId is passed with no listall parameter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when domainId is passed with no listall parameter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid(self):
- """
- Test listing of Snapshots by passing domainid parameter as admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid parameter as admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id)
- self.debug ("List as ROOT Admin passing domainId - %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id)
+ self.debug("List as ROOT Admin passing domainId - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_rec_true(self):
- """
- Test listing of Snapshots by passing domainid and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots in the subdmain and domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots in the subdmain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d111a_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d111a_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_rec_false(self):
- """
- Test listing of Snapshots by passing domainid and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots in the domain passed
- """
+ """
+ Test listing of Snapshots by passing domainid and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11a_snapshot.id) and
- self.checkForExistenceOfValue(snapshotList,self.vm_d11b_snapshot.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11a_snapshot.id) and
+ self.checkForExistenceOfValue(snapshotList, self.vm_d11b_snapshot.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when account and domainId is passed with listall =true
+ ## ROOT Admin - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_listall_true(self):
- """
- Test listing of Snapshots by passing domainid,account ,listall = "true" parameter as admin
- Validate that it returns all the Snapshots of account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account ,listall = "true" parameter as admin
+ Validate that it returns all the Snapshots of account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,account ,listall = "true" and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account ,listall = "true" and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,account ,listall = "true" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account ,listall = "true" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when account and domainId is passed with listall=false
+ ## ROOT Admin - Test cases when account and domainId is passed with listall=false
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_listall_false(self):
- """
- Test listing of Snapshots by passing domainid,account ,listall = "false" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account ,listall = "false" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when account and domainId is passed with listall not passed
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when account and domainId is passed with listall not passed
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid(self):
- """
- Test listing of Snapshots by passing domainid,account parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id)
- self.debug ("List as ROOT Admin passing domainId and accountId - %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id)
+ self.debug("List as ROOT Admin passing domainId and accountId - %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,account and isrecusrive="true" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account and isrecusrive="true" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_domainid_accountid_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,account and isrecusrive="false" parameter as admin
- Validate that it returns all the Snapshots of the account that is passed
- """
+ """
+ Test listing of Snapshots by passing domainid,account and isrecusrive="false" parameter as admin
+ Validate that it returns all the Snapshots of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d11_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d11_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases with listall =true
+ ## Regular User - Test cases with listall =true
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_true(self):
- """
- Test listing of Snapshots by passing listall="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing listall="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true")
- self.debug ("List as Regular User - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true")
+ self.debug("List as Regular User - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing listall="true" and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing listall="true" and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as Regular User - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as Regular User - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing listall="true" and isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing listall="true" and isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as Regular User - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as Regular User - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Regular User - Test cases with listall=false
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ ## Regular User - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_false(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false")
- self.debug ("List as Regular User - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false")
+ self.debug("List as Regular User - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing listall="false" and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing listall="false" and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as Regular User - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as Regular User - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing listall="false" and isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing listall="false" and isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as Regular User - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as Regular User - listall=false,isrecursive=false %s" % snapshotList)
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+ ## Regular User - Test cases without passing listall paramter
-## Regular User - Test cases without passing listall paramter
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser(self):
- """
- Test listing of Snapshots by passing no parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing no parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient)
- self.debug ("List as Regular User %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient)
+ self.debug("List as Regular User %s" % snapshotList)
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_rec_true(self):
- """
- Test listing of Snapshots by passing isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,isrecursive="true")
- self.debug ("List as Regular User - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, isrecursive="true")
+ self.debug("List as Regular User - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_rec_false(self):
- """
- Test listing of Snapshots by passing isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,isrecursive="false")
- self.debug ("List as Regular User passing domainId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, isrecursive="false")
+ self.debug("List as Regular User passing domainId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Regular User - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_true(self):
- """
- Test listing of Snapshots by passing domainid,listall="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,listall="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,listall="true")
- self.debug ("List as Regular User passing domainId - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, listall="true")
+ self.debug("List as Regular User passing domainId - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,listall="true" and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,listall="true" and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,listall="true",isrecursive="true")
- self.debug ("List as Regular User passing domainId - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, listall="true", isrecursive="true")
+ self.debug("List as Regular User passing domainId - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,listall="true" and isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,listall="true" and isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,listall="true",isrecursive="false")
- self.debug ("List as Regular User passing domainId - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, listall="true", isrecursive="false")
+ self.debug("List as Regular User passing domainId - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when domainId is passed with listall=false
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when domainId is passed with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_false(self):
- """
- Test listing of Snapshots by passing domainid,listall="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,listall="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,listall="false")
- self.debug ("List as Regular User passing domainId - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, listall="false")
+ self.debug("List as Regular User passing domainId - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,listall="false" and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,listall="false" and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,listall="false",isrecursive="true")
- self.debug ("List as Regular User passing domainId - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, listall="false", isrecursive="true")
+ self.debug("List as Regular User passing domainId - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,listall="false" and isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,listall="false" and isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,listall="false",isrecursive="false")
- self.debug ("List as Regular User passing domainId - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, listall="false", isrecursive="false")
+ self.debug("List as Regular User passing domainId - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when domainId is passed with no listall parameter
+ ## Regular User - Test cases when domainId is passed with no listall parameter
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid(self):
- """
- Test listing of Snapshots by passing domainid parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id)
- self.debug ("List as Regular User passing domainId %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id)
+ self.debug("List as Regular User passing domainId %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_true_rec_true(self):
- """
- Test listing of Snapshots by passing domainid and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,isrecursive="true")
- self.debug ("List as Regular User passing domainId - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, isrecursive="true")
+ self.debug("List as Regular User passing domainId - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid__rec_false(self):
- """
- Test listing of Snapshots by passing domainid,isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_1.id,isrecursive="false")
- self.debug ("List as Regular User passing domainId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_1.id, isrecursive="false")
+ self.debug("List as Regular User passing domainId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall =true
+ ## Regular User - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_true(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_true_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="true" and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="true" and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true",isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=true,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true", isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=true,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_true_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="true" and isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="true" and isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true",isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=true,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true", isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=true,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall=false
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when account and domainId is passed with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_false(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_false_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="false" and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="false" and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false",isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=false,isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false", isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=false,isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_false_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,account,listall="false" and isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account,listall="false" and isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false",isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=false,isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false", isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=false,isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall not passed
+ ## Regular User - Test cases when account and domainId is passed with listall not passed
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid(self):
- """
- Test listing of Snapshots by passing domainid,account parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id)
- self.debug ("List as Regular User passing domainId and accountId %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id)
+ self.debug("List as Regular User passing domainId and accountId %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_rec_true(self):
- """
- Test listing of Snapshots by passing domainid,account and isrecusrive="true" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account and isrecusrive="true" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - isrecursive=true %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - isrecursive=true %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_rec_false(self):
- """
- Test listing of Snapshots by passing domainid,account isrecusrive="false" parameter as regular user
- Validate that it returns all the Snapshots of the account the user belongs to
- """
+ """
+ Test listing of Snapshots by passing domainid,account isrecusrive="false" parameter as regular user
+ Validate that it returns all the Snapshots of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - isrecursive=false %s" %snapshotList)
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - isrecursive=false %s" % snapshotList)
- self.assertEqual(len(snapshotList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(snapshotList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(snapshotList,self.vm_d1a_snapshot.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(snapshotList, self.vm_d1a_snapshot.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Cross Domain access check
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## Cross Domain access check
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_cross_domainid_accountid(self):
- """
- Regular User should not be allowed to list Snapshotss of other accounts in the same domain
- """
+ """
+ Regular User should not be allowed to list Snapshotss of other accounts in the same domain
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d1b.user[0].username,domainid=self.domain_1.id)
- self.fail("Regular User is able to use another account with in the same domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as Regular User passing domainId and accountId of another account %s" %e)
+ try:
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d1b.user[0].username, domainid=self.domain_1.id)
+ self.fail("Regular User is able to use another account with in the same domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as Regular User passing domainId and accountId of another account %s" % e)
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_cross_domainid(self):
- """
- Regular User should not be allowed to list Snapshotss of other accounts in other domains
- """
+ """
+ Regular User should not be allowed to list Snapshotss of other accounts in other domains
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_2_snapshot.id)
- self.fail("Regular User is able to use another domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as Regular User passing domainId of a domain that user does not belong to %s" %e)
+ try:
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_2_snapshot.id)
+ self.fail("Regular User is able to use another domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as Regular User passing domainId of a domain that user does not belong to %s" % e)
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_cross_domainid_accountid(self):
- """
- Domain admin should not be allowed to list Snapshotss of accounts in other domains
- """
+ """
+ Domain admin should not be allowed to list Snapshotss of accounts in other domains
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- try:
- snapshotList = Snapshot.list(self.apiclient,account=self.account_d2a.user[0].username,domainid=self.domain_2_snapshot.id)
- self.fail("Domain admin user is able to use another domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as domain admin passing domainId and accountId of another account %s" %e)
+ try:
+ snapshotList = Snapshot.list(self.apiclient, account=self.account_d2a.user[0].username, domainid=self.domain_2_snapshot.id)
+ self.fail("Domain admin user is able to use another domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as domain admin passing domainId and accountId of another account %s" % e)
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_domainadmin_cross_domainid(self):
- """
- Domain admin should not be allowed to list Snapshotss from other domains
- """
+ """
+ Domain admin should not be allowed to list Snapshotss from other domains
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- snapshotList = Snapshot.list(self.apiclient,domainid=self.domain_2_snapshot.id)
- self.fail("Domain admin User is able to use another domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as domain admin passing domainId of a domain that user does not belong to %s" %e)
+ try:
+ snapshotList = Snapshot.list(self.apiclient, domainid=self.domain_2_snapshot.id)
+ self.fail("Domain admin User is able to use another domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as domain admin passing domainId of a domain that user does not belong to %s" % e)
-
-## List test cases relating to filter - id
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ ## List test cases relating to filter - id
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_domainadmin_owns(self):
- """
- Domain admin should be able to list Snapshots that he owns by passing uuid in "id" parameter
- """
+ """
+ Domain admin should be able to list Snapshots that he owns by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- SnapshotList = Snapshot.list(self.apiclient,id=self.vm_d1_snapshot.id)
+ SnapshotList = Snapshot.list(self.apiclient, id=self.vm_d1_snapshot.id)
self.assertNotEqual(SnapshotList,
- None,
- "Domain Admin is not able to list Snapshotss that he owns")
+ None,
+ "Domain Admin is not able to list Snapshotss that he owns")
self.assertEqual(len(SnapshotList),
1,
- "Domain Admin is not able to list Snapshotss that belongs to him")
+ "Domain Admin is not able to list Snapshotss that belongs to him")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_domainadmin_ownedbyusersindomain(self):
- """
- Domain admin should be able to list Snapshots that is owned by any account in his domain by passing uuid in "id" parameter
- """
+ """
+ Domain admin should be able to list Snapshots that is owned by any account in his domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- SnapshotList1 = Snapshot.list(self.apiclient,id=self.vm_d1a_snapshot.id)
+ SnapshotList1 = Snapshot.list(self.apiclient, id=self.vm_d1a_snapshot.id)
self.assertNotEqual(SnapshotList1,
- None,
- "Domain Admin is not able to list Snapshotss from his domain")
+ None,
+ "Domain Admin is not able to list Snapshotss from his domain")
self.assertEqual(len(SnapshotList1),
1,
- "Domain Admin is not able to list Snapshotss from his domain")
+ "Domain Admin is not able to list Snapshotss from his domain")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_domainadmin_ownedbyusersinsubdomain(self):
- """
- Domain admin should be able to list Snapshots that is owned by any account in his sub-domain by passing uuid in "id" parameter
- """
+ """
+ Domain admin should be able to list Snapshots that is owned by any account in his sub-domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- SnapshotList2 = Snapshot.list(self.apiclient,id=self.vm_d12b_snapshot.id)
+ SnapshotList2 = Snapshot.list(self.apiclient, id=self.vm_d12b_snapshot.id)
self.assertNotEqual(SnapshotList2,
- None,
- "Domain Admin is not able to list Snapshotss from his sub domain")
+ None,
+ "Domain Admin is not able to list Snapshotss from his sub domain")
self.assertEqual(len(SnapshotList2),
1,
- "Domain Admin is not able to list Snapshotss from his sub domain")
+ "Domain Admin is not able to list Snapshotss from his sub domain")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_domainadmin_ownedbyusersnotindomain(self):
- """
- Domain admin should not be able to list Snapshots that is owned by account that is not in his domain by passing uuid in "id" parameter
- """
+ """
+ Domain admin should not be able to list Snapshots that is owned by account that is not in his domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- SnapshotList3 = Snapshot.list(self.apiclient,id=self.vm_d2_snapshot.id)
+ SnapshotList3 = Snapshot.list(self.apiclient, id=self.vm_d2_snapshot.id)
self.assertEqual(SnapshotList3,
None,
- "Domain Admin is able to list Snapshotss from other domains!!!")
+ "Domain Admin is able to list Snapshotss from other domains!!!")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_domainadmin_ownedbyusersinsubdomain2(self):
- """
- Domain admin should be able to list Snapshots that is owned by account that is in his sub domains by passing uuid in "id" parameter
- """
+ """
+ Domain admin should be able to list Snapshots that is owned by account that is in his sub domains by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- SnapshotList4 = Snapshot.list(self.apiclient,id=self.vm_d111a_snapshot.id)
+ SnapshotList4 = Snapshot.list(self.apiclient, id=self.vm_d111a_snapshot.id)
self.assertNotEqual(SnapshotList4,
- None,
- "Domain Admin is not able to list Snapshotss from his subdomain")
+ None,
+ "Domain Admin is not able to list Snapshotss from his subdomain")
self.assertEqual(len(SnapshotList4),
1,
- "Domain Admin is not able to list Snapshotss from his sub domains")
+ "Domain Admin is not able to list Snapshotss from his sub domains")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_rootadmin_owns(self):
- """
- ROOT admin should be able to list Snapshots that is owned by account in his domains by passing uuid in "id" parameter
- """
+ """
+ ROOT admin should be able to list Snapshots that is owned by account in his domains by passing uuid in "id" parameter
+ """
- self.apiclient.connection.apiKey = self.user_a_apikey
+ self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- SnapshotList1 = Snapshot.list(self.apiclient,id=self.vm_a_snapshot.id)
+ SnapshotList1 = Snapshot.list(self.apiclient, id=self.vm_a_snapshot.id)
self.assertNotEqual(SnapshotList1,
- None,
- "ROOT Admin not able to list Snapshotss that he owns")
+ None,
+ "ROOT Admin not able to list Snapshotss that he owns")
self.assertEqual(len(SnapshotList1),
1,
- "ROOT Admin not able to list Snapshotss that he owns")
+ "ROOT Admin not able to list Snapshotss that he owns")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_rootadmin_Snapshotsownedbyothers(self):
- """
- ROOT admin should be able to list Snapshots that is owned by any account iby passing uuid in "id" parameter
- """
+ """
+ ROOT admin should be able to list Snapshots that is owned by any account iby passing uuid in "id" parameter
+ """
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- SnapshotList1 = Snapshot.list(self.apiclient,id=self.vm_d2_snapshot.id)
- SnapshotList2 = Snapshot.list(self.apiclient,id=self.vm_d11a_snapshot.id)
+ SnapshotList1 = Snapshot.list(self.apiclient, id=self.vm_d2_snapshot.id)
+ SnapshotList2 = Snapshot.list(self.apiclient, id=self.vm_d11a_snapshot.id)
self.assertNotEqual(SnapshotList1,
- None,
- "ROOT Admin not able to list Snapshotss from other domains")
+ None,
+ "ROOT Admin not able to list Snapshotss from other domains")
self.assertNotEqual(SnapshotList2,
- None,
- "ROOT Admin not able to list Snapshotss from other domains")
+ None,
+ "ROOT Admin not able to list Snapshotss from other domains")
self.assertEqual(len(SnapshotList1),
1,
- "ROOT Admin not able to list Snapshotss from other domains")
+ "ROOT Admin not able to list Snapshotss from other domains")
self.assertEqual(len(SnapshotList2),
1,
- "ROOT Admin not able to list Snapshotss from other domains")
+ "ROOT Admin not able to list Snapshotss from other domains")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_user_own(self):
- """
- Regular user should be able to list Snapshots that is owned by him by passing uuid in "id" parameter
- """
+ """
+ Regular user should be able to list Snapshots that is owned by him by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- SnapshotList1 = Snapshot.list(self.apiclient,id=self.vm_d11a_snapshot.id)
-
+ SnapshotList1 = Snapshot.list(self.apiclient, id=self.vm_d11a_snapshot.id)
self.assertNotEqual(SnapshotList1,
- None,
- "Regular User is not able to list Snapshotss that he owns")
+ None,
+ "Regular User is not able to list Snapshotss that he owns")
self.assertEqual(len(SnapshotList1),
1,
- "Regular User is not able to list Snapshotss that he owns")
+ "Regular User is not able to list Snapshotss that he owns")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_user_snapshotfromsamedomaindifferentaccount(self):
- """
- Regular user should not be able to list Snapshots that is owned by different account in the same domain by passing uuid in "id" parameter
- """
+ """
+ Regular user should not be able to list Snapshots that is owned by different account in the same domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- SnapshotList2 = Snapshot.list(self.apiclient,id=self.vm_d11b_snapshot.id)
+ SnapshotList2 = Snapshot.list(self.apiclient, id=self.vm_d11b_snapshot.id)
self.assertEqual(SnapshotList2,
None,
- "Regular User is able to list Snapshotss from other accounts")
+ "Regular User is able to list Snapshotss from other accounts")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_user_snapshotfromotherdomain(self):
- """
- Regular user should not be able to list Snapshots that is owned by different account in the different domain by passing uuid in "id" parameter
- """
+ """
+ Regular user should not be able to list Snapshots that is owned by different account in the different domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- SnapshotList3 = Snapshot.list(self.apiclient,id=self.vm_d2_snapshot.id)
+ SnapshotList3 = Snapshot.list(self.apiclient, id=self.vm_d2_snapshot.id)
self.assertEqual(SnapshotList3,
None,
- "Regular User is able to list Snapshotss from other domains")
-
+ "Regular User is able to list Snapshotss from other domains")
@staticmethod
- def generateKeysForUser(apiclient,account):
+ def generateKeysForUser(apiclient, account):
user = User.list(
- apiclient,
- account=account.name,
- domainid=account.domainid
- )[0]
-
+ apiclient,
+ account=account.name,
+ domainid=account.domainid
+ )[0]
+
return (User.registerUserKeys(
- apiclient,
- user.id
- ))
+ apiclient,
+ user.id
+ ))
@staticmethod
- def checkForExistenceOfValue(list,attributeValue):
- if list is None:
- return False
- rowCount=len(list)
- for num in range (rowCount):
- if list[num].id == attributeValue:
- return True
- return False
-
+ def checkForExistenceOfValue(list, attributeValue):
+ if list is None:
+ return False
+ rowCount = len(list)
+ for num in range(rowCount):
+ if list[num].id == attributeValue:
+ return True
+ return False
diff --git a/test/integration/component/test_acl_listvm.py b/test/integration/component/test_acl_listvm.py
index 5ed937f2d4a..91d25a8ef03 100644
--- a/test/integration/component/test_acl_listvm.py
+++ b/test/integration/component/test_acl_listvm.py
@@ -17,7 +17,7 @@
"""
Test cases relating to listVirtualMachine() relating to parameters - id,listall,isrecursive,account and domainid
"""
-#Import Local Modules
+# Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@@ -25,318 +25,316 @@ from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
-#Import System modules
+# Import System modules
import time
_multiprocess_shared_ = True
+
class TestVMList(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- """
- Create the following domain tree and accounts that are reqiured for executing listVirtualMachine test cases:
- Under ROOT - create 2 domaind D1 and D2
+ """
+ Create the following domain tree and accounts that are reqiured for executing listVirtualMachine test cases:
+ Under ROOT - create 2 domaind D1 and D2
Under D1 - Create 2 subdomain D11 and D12
Under D11 - Create subdimain D111
Under each of the domain create 1 admin user and couple of regular users.
As each of these users , deploy Virtual machines.
-
- """
- cls.testclient = super(TestVMList, cls).getClsTestClient()
+ """
+ cls.testclient = super(TestVMList, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
- cls.testdata = cls.testClient.getParsedTestDataConfig()
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
cls.acldata = cls.testdata["acl"]
cls.domain_1 = None
cls.domain_2 = None
cls.cleanup = []
- try:
-
- # backup default apikey and secretkey
- cls.default_apikey = cls.apiclient.connection.apiKey
- cls.default_secretkey = cls.apiclient.connection.securityKey
-
- # Create domains
- cls.domain_1 = Domain.create(
- cls.apiclient,
- cls.acldata["domain1"]
- )
- cls.domain_11 = Domain.create(
- cls.apiclient,
- cls.acldata["domain11"],
- parentdomainid=cls.domain_1.id
- )
- cls.domain_111 = Domain.create(
- cls.apiclient,
- cls.acldata["domain111"],
- parentdomainid=cls.domain_11.id,
- )
- cls.domain_12 = Domain.create(
- cls.apiclient,
- cls.acldata["domain12"],
- parentdomainid=cls.domain_1.id
- )
- cls.domain_2 = Domain.create(
- cls.apiclient,
- cls.acldata["domain2"]
- )
- # Create 1 admin account and 2 user accounts for doamin_1
- cls.account_d1 = Account.create(
- cls.apiclient,
- cls.acldata["accountD1"],
- admin=True,
- domainid=cls.domain_1.id
- )
+ try:
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
- cls.user_d1_apikey = user.apikey
- cls.user_d1_secretkey = user.secretkey
-
- cls.account_d1a = Account.create(
- cls.apiclient,
- cls.acldata["accountD1A"],
- admin=False,
- domainid=cls.domain_1.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
- cls.user_d1a_apikey = user.apikey
- cls.user_d1a_secretkey = user.secretkey
-
-
- cls.account_d1b = Account.create(
- cls.apiclient,
- cls.acldata["accountD1B"],
- admin=False,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
- cls.user_d1b_apikey = user.apikey
- cls.user_d1b_secretkey = user.secretkey
-
- # Create 1 admin and 2 user accounts for doamin_11
- cls.account_d11 = Account.create(
- cls.apiclient,
- cls.acldata["accountD11"],
- admin=True,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
- cls.user_d11_apikey = user.apikey
- cls.user_d11_secretkey = user.secretkey
-
- cls.account_d11a = Account.create(
- cls.apiclient,
- cls.acldata["accountD11A"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
- cls.user_d11a_apikey = user.apikey
- cls.user_d11a_secretkey = user.secretkey
-
- cls.account_d11b = Account.create(
- cls.apiclient,
- cls.acldata["accountD11B"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
- cls.user_d11b_apikey = user.apikey
- cls.user_d11b_secretkey = user.secretkey
-
- # Create 1 user account for doamin_111
-
- cls.account_d111a = Account.create(
- cls.apiclient,
- cls.acldata["accountD111A"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
- cls.user_d111a_apikey = user.apikey
- cls.user_d111a_secretkey = user.secretkey
-
- # Create 2 user accounts for doamin_12
- cls.account_d12a = Account.create(
- cls.apiclient,
- cls.acldata["accountD12A"],
- admin=False,
- domainid=cls.domain_12.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
- cls.user_d12a_apikey = user.apikey
- cls.user_d12a_secretkey = user.secretkey
-
- cls.account_d12b = Account.create(
- cls.apiclient,
- cls.acldata["accountD12B"],
- admin=False,
- domainid=cls.domain_12.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
- cls.user_d12b_apikey = user.apikey
- cls.user_d12b_secretkey = user.secretkey
-
- # Create 1 user account for domain_2
-
- cls.account_d2a = Account.create(
- cls.apiclient,
- cls.acldata["accountD2"],
- admin=False,
- domainid=cls.domain_2.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
- cls.user_d2a_apikey = user.apikey
- cls.user_d2a_secretkey = user.secretkey
-
-
- # Create admin user account
-
- cls.account_a = Account.create(
- cls.apiclient,
- cls.acldata["accountROOTA"],
- admin=True,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_a)
- cls.user_a_apikey = user.apikey
- cls.user_a_secretkey = user.secretkey
- # create service offering
- cls.service_offering = ServiceOffering.create(
- cls.apiclient,
- cls.acldata["service_offering"]["small"]
- )
-
- cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
- cls.acldata['mode'] = cls.zone.networktype
- cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
- # deploy VM
-
- cls.apiclient.connection.apiKey = cls.user_d1_apikey
- cls.apiclient.connection.securityKey = cls.user_d1_secretkey
- cls.vm_d1 = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD1"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d1a_apikey
- cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
- cls.vm_d1a = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD1A"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d1b_apikey
- cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
- cls.vm_d1b = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD1B"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d11_apikey
- cls.apiclient.connection.securityKey = cls.user_d11_secretkey
- cls.vm_d11 = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD11"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d11a_apikey
- cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
- cls.vm_d11a = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD11A"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d11b_apikey
- cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
- cls.vm_d11b = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD11B"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d111a_apikey
- cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
- cls.vm_d111a = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD111A"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d12a_apikey
- cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
- cls.vm_d12a = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD12A"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d12b_apikey
- cls.apiclient.connection.securityKey = cls.user_d12b_secretkey
- cls.vm_d12b = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD12B"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_d2a_apikey
- cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
- cls.vm_d2 = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmD2A"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
-
- cls.apiclient.connection.apiKey = cls.user_a_apikey
- cls.apiclient.connection.securityKey = cls.user_a_secretkey
- cls.vm_a = VirtualMachine.create(
- cls.apiclient,
- cls.acldata["vmROOTA"],
- zoneid=cls.zone.id,
- serviceofferingid=cls.service_offering.id,
- templateid=cls.template.id
- )
- cls.cleanup = [
- cls.account_a,
- cls.service_offering,
- ]
- except Exception as e:
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+ # backup default apikey and secretkey
+ cls.default_apikey = cls.apiclient.connection.apiKey
+ cls.default_secretkey = cls.apiclient.connection.securityKey
+
+ # Create domains
+ cls.domain_1 = Domain.create(
+ cls.apiclient,
+ cls.acldata["domain1"]
+ )
+ cls.domain_11 = Domain.create(
+ cls.apiclient,
+ cls.acldata["domain11"],
+ parentdomainid=cls.domain_1.id
+ )
+ cls.domain_111 = Domain.create(
+ cls.apiclient,
+ cls.acldata["domain111"],
+ parentdomainid=cls.domain_11.id,
+ )
+ cls.domain_12 = Domain.create(
+ cls.apiclient,
+ cls.acldata["domain12"],
+ parentdomainid=cls.domain_1.id
+ )
+ cls.domain_2 = Domain.create(
+ cls.apiclient,
+ cls.acldata["domain2"]
+ )
+ # Create 1 admin account and 2 user accounts for doamin_1
+ cls.account_d1 = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD1"],
+ admin=True,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1)
+ cls.user_d1_apikey = user.apikey
+ cls.user_d1_secretkey = user.secretkey
+
+ cls.account_d1a = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD1A"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1a)
+ cls.user_d1a_apikey = user.apikey
+ cls.user_d1a_secretkey = user.secretkey
+
+ cls.account_d1b = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD1B"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1b)
+ cls.user_d1b_apikey = user.apikey
+ cls.user_d1b_secretkey = user.secretkey
+
+ # Create 1 admin and 2 user accounts for doamin_11
+ cls.account_d11 = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD11"],
+ admin=True,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11)
+ cls.user_d11_apikey = user.apikey
+ cls.user_d11_secretkey = user.secretkey
+
+ cls.account_d11a = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD11A"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11a)
+ cls.user_d11a_apikey = user.apikey
+ cls.user_d11a_secretkey = user.secretkey
+
+ cls.account_d11b = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD11B"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11b)
+ cls.user_d11b_apikey = user.apikey
+ cls.user_d11b_secretkey = user.secretkey
+
+ # Create 1 user account for doamin_111
+
+ cls.account_d111a = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD111A"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111a)
+ cls.user_d111a_apikey = user.apikey
+ cls.user_d111a_secretkey = user.secretkey
+
+ # Create 2 user accounts for doamin_12
+ cls.account_d12a = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD12A"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12a)
+ cls.user_d12a_apikey = user.apikey
+ cls.user_d12a_secretkey = user.secretkey
+
+ cls.account_d12b = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD12B"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12b)
+ cls.user_d12b_apikey = user.apikey
+ cls.user_d12b_secretkey = user.secretkey
+
+ # Create 1 user account for domain_2
+
+ cls.account_d2a = Account.create(
+ cls.apiclient,
+ cls.acldata["accountD2"],
+ admin=False,
+ domainid=cls.domain_2.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d2a)
+ cls.user_d2a_apikey = user.apikey
+ cls.user_d2a_secretkey = user.secretkey
+
+ # Create admin user account
+
+ cls.account_a = Account.create(
+ cls.apiclient,
+ cls.acldata["accountROOTA"],
+ admin=True,
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_a)
+ cls.user_a_apikey = user.apikey
+ cls.user_a_secretkey = user.secretkey
+ # create service offering
+ cls.service_offering = ServiceOffering.create(
+ cls.apiclient,
+ cls.acldata["service_offering"]["small"]
+ )
+
+ cls.zone = get_zone(cls.apiclient, cls.testclient.getZoneForTests())
+ cls.acldata['mode'] = cls.zone.networktype
+ cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
+
+ # deploy VM
+
+ cls.apiclient.connection.apiKey = cls.user_d1_apikey
+ cls.apiclient.connection.securityKey = cls.user_d1_secretkey
+ cls.vm_d1 = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD1"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d1a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
+ cls.vm_d1a = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD1A"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d1b_apikey
+ cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
+ cls.vm_d1b = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD1B"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d11_apikey
+ cls.apiclient.connection.securityKey = cls.user_d11_secretkey
+ cls.vm_d11 = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD11"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d11a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
+ cls.vm_d11a = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD11A"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d11b_apikey
+ cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
+ cls.vm_d11b = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD11B"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d111a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
+ cls.vm_d111a = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD111A"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d12a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
+ cls.vm_d12a = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD12A"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d12b_apikey
+ cls.apiclient.connection.securityKey = cls.user_d12b_secretkey
+ cls.vm_d12b = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD12B"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_d2a_apikey
+ cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
+ cls.vm_d2 = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmD2A"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+
+ cls.apiclient.connection.apiKey = cls.user_a_apikey
+ cls.apiclient.connection.securityKey = cls.user_a_secretkey
+ cls.vm_a = VirtualMachine.create(
+ cls.apiclient,
+ cls.acldata["vmROOTA"],
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ templateid=cls.template.id
+ )
+ cls.cleanup = [
+ cls.account_a,
+ cls.service_offering,
+ ]
+ except Exception as e:
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
@@ -344,9 +342,10 @@ class TestVMList(cloudstackTestCase):
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
try:
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- except: pass
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ except:
+ pass
cleanup_resources(cls.apiclient, cls.cleanup)
def setUp(cls):
@@ -359,2473 +358,2433 @@ class TestVMList(cloudstackTestCase):
cls.apiclient.connection.securityKey = cls.default_secretkey
return
-## Domain Admin - Test cases with listall =true
+ ## Domain Admin - Test cases with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_listall_true(self):
- """
- # Test listing of Vms by passing listall="true" parameter as domain admin
- # Validate that it returns all the Vms that is owned by accounts in this domain and all its subdomain
- """
+ """
+ # Test listing of Vms by passing listall="true" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true")
- self.debug ("List as Domain Admin - listall=true - %s" % vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true")
+ self.debug("List as Domain Admin - listall=true - %s" % vmList)
- self.assertEqual(len(vmList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id),
- self.checkForExistenceOfValue(vmList,self.vm_d1a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d1b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id),
+ self.checkForExistenceOfValue(vmList, self.vm_d1a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d1b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing listall="true"i and isrecusriv="true" parameter as domain admin
- # Validate that it returns all the Vms that is owned by accounts in this domain and all its subdomain
- """
+ """
+ # Test listing of Vms by passing listall="true"i and isrecusriv="true" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id),
- self.checkForExistenceOfValue(vmList,self.vm_d1a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d1b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id),
+ self.checkForExistenceOfValue(vmList, self.vm_d1a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d1b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing listall="true" and isrecusriv="false" parameter as domain admin
- # Validate that it returns all the Vms that is owned by accounts in this domain and all its subdomain
- """
+ """
+ # Test listing of Vms by passing listall="true" and isrecusriv="false" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id),
- self.checkForExistenceOfValue(vmList,self.vm_d1a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d1b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id),
+ self.checkForExistenceOfValue(vmList, self.vm_d1a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d1b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases with listall=false
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_listall_false(self):
- """
- # Test listing of Vms by passing listall="false" parameter as domain admin
- # Validate that it returns all the Vms that is owned by the domain admin
- """
+ """
+ # Test listing of Vms by passing listall="false" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false")
- self.debug ("List as Domain Admin - listall=false - %s" % vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false")
+ self.debug("List as Domain Admin - listall=false - %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing listall="false" and isrecusrive="true" parameter as domain admin
- # Validate that it returns all the Vms that is owned by the domain admin
- """
+ """
+ # Test listing of Vms by passing listall="false" and isrecusrive="true" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing listall="false" and isrecusrive="false" parameter as domain admin
- # Validate that it returns all the Vms that is owned by the domain admin
- """
+ """
+ # Test listing of Vms by passing listall="false" and isrecusrive="false" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases without passing listall paramter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases without passing listall paramter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin(self):
- """
- # Test listing of Vms by passing no parameter as domain admin
- # Validate that it returns all the Vms that is owned by the domain admin
- """
+ """
+ # Test listing of Vms by passing no parameter as domain admin
+ # Validate that it returns all the Vms that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient)
- self.debug ("List as Domain Admin - %s" % vmList)
+ vmList = VirtualMachine.list(self.apiclient)
+ self.debug("List as Domain Admin - %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_rec_true(self):
- """
- # Test listing of Vms by passing isrecusrive="true" parameter as domain admin
- # Validate that it returns all the Vms that is owned by the domain admin
- """
+ """
+ # Test listing of Vms by passing isrecusrive="true" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,isrecursive="true")
- self.debug ("List as Domain Admin - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, isrecursive="true")
+ self.debug("List as Domain Admin - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_true_rec_false(self):
- """
- # Test listing of Vms by passing isrecusrive="false" parameter as domain admin
- # Validate that it returns all the Vms that is owned by the domain admin
- """
+ """
+ # Test listing of Vms by passing isrecusrive="false" parameter as domain admin
+ # Validate that it returns all the Vms that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,isrecursive="false")
- self.debug ("List as Domain Admin - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, isrecursive="false")
+ self.debug("List as Domain Admin - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_listall_true(self):
- """
- # Test listing of Vms by passing domainId and listall="true" parameter as domain admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId and listall="true" parameter as domain admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="true")
- self.debug ("List as Domain Admin passing domainId - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="true")
+ self.debug("List as Domain Admin passing domainId - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing domainId ,listall="true" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Vms in the subdomain and the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId ,listall="true" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Vms in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing domainId ,listall="true" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId ,listall="true" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when domainId is passed with listall=false
+ ## Domain Admin - Test cases when domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_listall_false(self):
- """
- # Test listing of Vms by passing domainId ,listall="false" parameter as domain admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId ,listall="false" parameter as domain admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="false")
- self.debug ("List as Domain Admin passing domainId - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="false")
+ self.debug("List as Domain Admin passing domainId - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing domainId ,listall="false" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Vms in the subdomain and the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId ,listall="false" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Vms in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing domainId ,listall="false" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId ,listall="false" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when domainId is passed with no listall parameter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when domainId is passed with no listall parameter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid(self):
- """
- # Test listing of Vms by passing domainId parameter as domain admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainId parameter as domain admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id)
- self.debug ("List as Domain Admin passing domainId - %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id)
+ self.debug("List as Domain Admin passing domainId - %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_rec_true(self):
- """
- # Test listing of Vms by passing domainId and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Vms in the subdomain and domain passed
- """
+ """
+ # Test listing of Vms by passing domainId and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Vms in the subdomain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_rec_false(self):
- """
- # Test listing of Vms by passing domainId and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Vms in the subdomain and domain passed
- """
+ """
+ # Test listing of Vms by passing domainId and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Vms in the subdomain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when account and domainId is passed with listall =true
+ ## Domain Admin - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_listall_true(self):
- """
- # Test listing of Vms by passing account ,domainId and listall="true" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId and listall="true" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing account ,domainId and listall="true" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId and listall="true" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing account ,domainId , listall="true" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId , listall="true" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when account and domainId is passed with listall=false
+ ## Domain Admin - Test cases when account and domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_listall_false(self):
- """
- # Test listing of Vms by passing account ,domainId and listall="false" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId and listall="false" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing account ,domainId and listall="false" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId and listall="false" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing account ,domainId , listall="false" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId , listall="false" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when account and domainId is passed with listall not passed
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when account and domainId is passed with listall not passed
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid(self):
- """
- # Test listing of Vms by passing account ,domainId parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id)
- self.debug ("List as Domain Admin passing domainId and accountId - %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id)
+ self.debug("List as Domain Admin passing domainId and accountId - %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_rec_true(self):
- """
- # Test listing of Vms by passing account ,domainId and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_domainid_accountid_rec_false(self):
- """
- # Test listing of Vms by passing account ,domainId and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Vms owned by the account passed in account parameter
- """
+ """
+ # Test listing of Vms by passing account ,domainId and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Vms owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_true(self):
- """
- # Test listing of Vms by passing listall="true" parameter as admin
- # Validate that it returns all the Vms
- """
+ """
+ # Test listing of Vms by passing listall="true" parameter as admin
+ # Validate that it returns all the Vms
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true")
- self.debug ("List as ROOT Admin - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true")
+ self.debug("List as ROOT Admin - listall=true %s" % vmList)
- self.assertEqual(len(vmList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id),
- self.checkForExistenceOfValue(vmList,self.vm_d1a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d1b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d2.id) and
- self.checkForExistenceOfValue(vmList,self.vm_a.id)):
-
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id),
+ self.checkForExistenceOfValue(vmList, self.vm_d1a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d1b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d2.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_a.id)):
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ accountAccess = True
+ else:
+ accountAccess = False
+
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing listall="true" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms
- """
+ """
+ # Test listing of Vms by passing listall="true" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id),
- self.checkForExistenceOfValue(vmList,self.vm_d1a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d1b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d2.id) and
- self.checkForExistenceOfValue(vmList,self.vm_a.id)):
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id),
+ self.checkForExistenceOfValue(vmList, self.vm_d1a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d1b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d2.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_a.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing listall="true" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms
- """
+ """
+ # Test listing of Vms by passing listall="true" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(vmList,self.vm_d1.id),
- self.checkForExistenceOfValue(vmList,self.vm_d1a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d1b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d12b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d2.id) and
- self.checkForExistenceOfValue(vmList,self.vm_a.id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d1.id),
+ self.checkForExistenceOfValue(vmList, self.vm_d1a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d1b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d12b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d2.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ ## ROOT Admin - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_false(self):
- """
- # Test listing of Vms by passing listall="false" parameter as admin
- # Validate that it returns all the Vms owned by admin
- """
+ """
+ # Test listing of Vms by passing listall="false" parameter as admin
+ # Validate that it returns all the Vms owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false")
- self.debug ("List as ROOT Admin - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false")
+ self.debug("List as ROOT Admin - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing listall="false" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms owned by admin
- """
+ """
+ # Test listing of Vms by passing listall="false" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing listall="false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms owned by admin
- """
+ """
+ # Test listing of Vms by passing listall="false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin - listall=false,isrecursive=false %s" % vmList)
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(vmList,self.vm_a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+ ## ROOT Admin - Test cases without passing listall paramter
-## ROOT Admin - Test cases without passing listall paramter
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin(self):
- """
- # Test listing of Vms by passing no parameter as admin
- # Validate that it returns all the Vms owned by admin
- """
+ """
+ # Test listing of Vms by passing no parameter as admin
+ # Validate that it returns all the Vms owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient)
- self.debug ("List as ROOT Admin %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient)
+ self.debug("List as ROOT Admin %s" % vmList)
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(vmList,self.vm_a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_rec_true(self):
- """
- # Test listing of Vms by passing isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms owned by admin
- """
+ """
+ # Test listing of Vms by passing isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,isrecursive="true")
- self.debug ("List as ROOT Admin - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, isrecursive="true")
+ self.debug("List as ROOT Admin - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_rec_false(self):
- """
- # Test listing of Vms by passing isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms owned by admin
- """
+ """
+ # Test listing of Vms by passing isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_listall_true(self):
- """
- # Test listing of Vms by passing domainid and listall="true" parameter as admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid and listall="true" parameter as admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="true")
- self.debug ("List as ROOT Admin passing domainId - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="true")
+ self.debug("List as ROOT Admin passing domainId - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing domainid , listall="true" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms in the subdomain and the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid , listall="true" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing domainid, listall="true" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid, listall="true" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when domainId is passed with listall=false
+ ## ROOT Admin - Test cases when domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_listall_false(self):
- """
- # Test listing of Vms by passing domainid, listall="false" parameter as admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid, listall="false" parameter as admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="false")
- self.debug ("List as ROOT Admin passing domainId - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="false")
+ self.debug("List as ROOT Admin passing domainId - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing domainid, listall="false" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms in the subdoamin and domain passed
- """
+ """
+ # Test listing of Vms by passing domainid, listall="false" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms in the subdoamin and domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing domainid, listall="false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid, listall="false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when domainId is passed with no listall parameter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when domainId is passed with no listall parameter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid(self):
- """
- # Test listing of Vms by passing domainid parameter as admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid parameter as admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id)
- self.debug ("List as ROOT Admin passing domainId - %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id)
+ self.debug("List as ROOT Admin passing domainId - %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_rec_true(self):
- """
- # Test listing of Vms by passing domainid and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms in the subdmain and domain passed
- """
+ """
+ # Test listing of Vms by passing domainid and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms in the subdmain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d111a.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d111a.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_rec_false(self):
- """
- # Test listing of Vms by passing domainid and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms in the domain passed
- """
+ """
+ # Test listing of Vms by passing domainid and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(vmList,self.vm_d11.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11a.id) and
- self.checkForExistenceOfValue(vmList,self.vm_d11b.id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(vmList, self.vm_d11.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11a.id) and
+ self.checkForExistenceOfValue(vmList, self.vm_d11b.id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when account and domainId is passed with listall =true
+ ## ROOT Admin - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_listall_true(self):
- """
- # Test listing of Vms by passing domainid,account ,listall = "true" parameter as admin
- # Validate that it returns all the Vms of account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account ,listall = "true" parameter as admin
+ # Validate that it returns all the Vms of account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing domainid,account ,listall = "true" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account ,listall = "true" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing domainid,account ,listall = "true" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account ,listall = "true" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when account and domainId is passed with listall=false
+ ## ROOT Admin - Test cases when account and domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_listall_false(self):
- """
- # Test listing of Vms by passing domainid,account ,listall = "false" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account ,listall = "false" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when account and domainId is passed with listall not passed
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when account and domainId is passed with listall not passed
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid(self):
- """
- # Test listing of Vms by passing domainid,account parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id)
- self.debug ("List as ROOT Admin passing domainId and accountId - %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id)
+ self.debug("List as ROOT Admin passing domainId and accountId - %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_rec_true(self):
- """
- # Test listing of Vms by passing domainid,account and isrecusrive="true" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_domainid_accountid_rec_false(self):
- """
- # Test listing of Vms by passing domainid,account and isrecusrive="false" parameter as admin
- # Validate that it returns all the Vms of the account that is passed
- """
+ """
+ # Test listing of Vms by passing domainid,account and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Vms of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d11.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d11.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases with listall =true
+ ## Regular User - Test cases with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_true(self):
- """
- # Test listing of Vms by passing listall="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing listall="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true")
- self.debug ("List as Regular User - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true")
+ self.debug("List as Regular User - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing listall="true" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing listall="true" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as Regular User - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as Regular User - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing listall="true" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing listall="true" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as Regular User - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as Regular User - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Regular User - Test cases with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ ## Regular User - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_false(self):
- """
- # Test listing of Vms by passing domainid,account,listall="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false")
- self.debug ("List as Regular User - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false")
+ self.debug("List as Regular User - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing listall="false" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing listall="false" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as Regular User - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as Regular User - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing listall="false" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing listall="false" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as Regular User - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as Regular User - listall=false,isrecursive=false %s" % vmList)
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+ ## Regular User - Test cases without passing listall paramter
-## Regular User - Test cases without passing listall paramter
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser(self):
- """
- # Test listing of Vms by passing no parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing no parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient)
- self.debug ("List as Regular User %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient)
+ self.debug("List as Regular User %s" % vmList)
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_rec_true(self):
- """
- # Test listing of Vms by passing isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,isrecursive="true")
- self.debug ("List as Regular User - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, isrecursive="true")
+ self.debug("List as Regular User - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_rec_false(self):
- """
- # Test listing of Vms by passing isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,isrecursive="false")
- self.debug ("List as Regular User passing domainId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, isrecursive="false")
+ self.debug("List as Regular User passing domainId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Regular User - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_true(self):
- """
- # Test listing of Vms by passing domainid,listall="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,listall="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,listall="true")
- self.debug ("List as Regular User passing domainId - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, listall="true")
+ self.debug("List as Regular User passing domainId - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing domainid,listall="true" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,listall="true" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,listall="true",isrecursive="true")
- self.debug ("List as Regular User passing domainId - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, listall="true", isrecursive="true")
+ self.debug("List as Regular User passing domainId - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing domainid,listall="true" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,listall="true" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,listall="true",isrecursive="false")
- self.debug ("List as Regular User passing domainId - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, listall="true", isrecursive="false")
+ self.debug("List as Regular User passing domainId - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when domainId is passed with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when domainId is passed with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_false(self):
- """
- # Test listing of Vms by passing domainid,listall="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,listall="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,listall="false")
- self.debug ("List as Regular User passing domainId - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, listall="false")
+ self.debug("List as Regular User passing domainId - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing domainid,listall="false" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,listall="false" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,listall="false",isrecursive="true")
- self.debug ("List as Regular User passing domainId - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, listall="false", isrecursive="true")
+ self.debug("List as Regular User passing domainId - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing domainid,listall="false" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,listall="false" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,listall="false",isrecursive="false")
- self.debug ("List as Regular User passing domainId - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, listall="false", isrecursive="false")
+ self.debug("List as Regular User passing domainId - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when domainId is passed with no listall parameter
+ ## Regular User - Test cases when domainId is passed with no listall parameter
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid(self):
- """
- # Test listing of Vms by passing domainid parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id)
- self.debug ("List as Regular User passing domainId %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id)
+ self.debug("List as Regular User passing domainId %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_true_rec_true(self):
- """
- # Test listing of Vms by passing domainid and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,isrecursive="true")
- self.debug ("List as Regular User passing domainId - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, isrecursive="true")
+ self.debug("List as Regular User passing domainId - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid__rec_false(self):
- """
- # Test listing of Vms by passing domainid,isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_1.id,isrecursive="false")
- self.debug ("List as Regular User passing domainId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_1.id, isrecursive="false")
+ self.debug("List as Regular User passing domainId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall =true
+ ## Regular User - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_true(self):
- """
- # Test listing of Vms by passing domainid,account,listall="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_true_rec_true(self):
- """
- # Test listing of Vms by passing domainid,account,listall="true" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="true" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true",isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=true,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true", isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=true,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_true_rec_false(self):
- """
- # Test listing of Vms by passing domainid,account,listall="true" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="true" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true",isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=true,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true", isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=true,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when account and domainId is passed with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_false(self):
- """
- # Test listing of Vms by passing domainid,account,listall="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_false_rec_true(self):
- """
- # Test listing of Vms by passing domainid,account,listall="false" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="false" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false",isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=false,isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false", isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=false,isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_false_rec_false(self):
- """
- # Test listing of Vms by passing domainid,account,listall="false" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account,listall="false" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false",isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=false,isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false", isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=false,isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall not passed
+ ## Regular User - Test cases when account and domainId is passed with listall not passed
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid(self):
- """
- # Test listing of Vms by passing domainid,account parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id)
- self.debug ("List as Regular User passing domainId and accountId %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id)
+ self.debug("List as Regular User passing domainId and accountId %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_rec_true(self):
- """
- # Test listing of Vms by passing domainid,account and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - isrecursive=true %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - isrecursive=true %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_rec_false(self):
- """
- # Test listing of Vms by passing domainid,account isrecusrive="false" parameter as regular user
- # Validate that it returns all the Vms of the account the user belongs to
- """
+ """
+ # Test listing of Vms by passing domainid,account isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Vms of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - isrecursive=false %s" %vmList)
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - isrecursive=false %s" % vmList)
- self.assertEqual(len(vmList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(vmList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(vmList,self.vm_d1a.id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(vmList, self.vm_d1a.id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Cross Domain access check
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Cross Domain access check
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_cross_domainid_accountid(self):
- """
- # Regular User should not be allowed to list Vms of other accounts in the same domain
- """
+ """
+ # Regular User should not be allowed to list Vms of other accounts in the same domain
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d1b.user[0].username,domainid=self.domain_1.id)
- self.fail("Regular User is able to use another account with in the same domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as Regular User passing domainId and accountId of another account %s" %e)
+ try:
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d1b.user[0].username, domainid=self.domain_1.id)
+ self.fail("Regular User is able to use another account with in the same domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as Regular User passing domainId and accountId of another account %s" % e)
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_cross_domainid(self):
- """
- # Regular User should not be allowed to list Vms of other accounts in other domains
- """
+ """
+ # Regular User should not be allowed to list Vms of other accounts in other domains
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_2.id)
- self.fail("Regular User is able to use another domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as Regular User passing domainId of a domain that user does not belong to %s" %e)
+ try:
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_2.id)
+ self.fail("Regular User is able to use another domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as Regular User passing domainId of a domain that user does not belong to %s" % e)
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_cross_domainid_accountid(self):
- """
- # Domain admin should not be allowed to list Vms of accounts in other domains
- """
+ """
+ # Domain admin should not be allowed to list Vms of accounts in other domains
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- try:
- vmList = VirtualMachine.list(self.apiclient,account=self.account_d2a.user[0].username,domainid=self.domain_2.id)
- self.fail("Domain admin user is able to use another domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as domain admin passing domainId and accountId of another account %s" %e)
+ try:
+ vmList = VirtualMachine.list(self.apiclient, account=self.account_d2a.user[0].username, domainid=self.domain_2.id)
+ self.fail("Domain admin user is able to use another domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as domain admin passing domainId and accountId of another account %s" % e)
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_domainadmin_cross_domainid(self):
- """
- # Domain admin should not be allowed to list Vms from other domains
- """
+ """
+ # Domain admin should not be allowed to list Vms from other domains
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- vmList = VirtualMachine.list(self.apiclient,domainid=self.domain_2.id)
- self.fail("Domain admin User is able to use another domain in listVirtualMachine call")
- except Exception as e:
- self.debug ("List as domain admin passing domainId of a domain that user does not belong to %s" %e)
+ try:
+ vmList = VirtualMachine.list(self.apiclient, domainid=self.domain_2.id)
+ self.fail("Domain admin User is able to use another domain in listVirtualMachine call")
+ except Exception as e:
+ self.debug("List as domain admin passing domainId of a domain that user does not belong to %s" % e)
-
-## List test cases relating to filter - id
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## List test cases relating to filter - id
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_domainadmin_owns(self):
- """
- # Domain admin should be able to list Vm that he owns by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Vm that he owns by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList = VirtualMachine.list(self.apiclient,id=self.vm_d1.id)
+ VMList = VirtualMachine.list(self.apiclient, id=self.vm_d1.id)
self.assertNotEqual(VMList,
- None,
- "Domain Admin is not able to list Vms that he owns")
+ None,
+ "Domain Admin is not able to list Vms that he owns")
self.assertEqual(len(VMList),
1,
- "Domain Admin is not able to list Vms that belongs to him")
+ "Domain Admin is not able to list Vms that belongs to him")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_domainadmin_ownedbyusersindomain(self):
- """
- # Domain admin should be able to list Vm that is owned by any account in his domain by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Vm that is owned by any account in his domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList1 = VirtualMachine.list(self.apiclient,id=self.vm_d1a.id)
+ VMList1 = VirtualMachine.list(self.apiclient, id=self.vm_d1a.id)
self.assertNotEqual(VMList1,
- None,
- "Domain Admin is not able to list Vms from his domain")
+ None,
+ "Domain Admin is not able to list Vms from his domain")
self.assertEqual(len(VMList1),
1,
- "Domain Admin is not able to list Vms from his domain")
+ "Domain Admin is not able to list Vms from his domain")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_domainadmin_ownedbyusersinsubdomain(self):
- """
- # Domain admin should be able to list Vm that is owned by any account in his sub-domain by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Vm that is owned by any account in his sub-domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList2 = VirtualMachine.list(self.apiclient,id=self.vm_d12b.id)
+ VMList2 = VirtualMachine.list(self.apiclient, id=self.vm_d12b.id)
self.assertNotEqual(VMList2,
- None,
- "Domain Admin is not able to list Vms from his sub domain")
+ None,
+ "Domain Admin is not able to list Vms from his sub domain")
self.assertEqual(len(VMList2),
1,
- "Domain Admin is not able to list Vms from his sub domain")
+ "Domain Admin is not able to list Vms from his sub domain")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_domainadmin_ownedbyusersnotindomain(self):
- """
- # Domain admin should not be able to list Vm that is owned by account that is not in his domain by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should not be able to list Vm that is owned by account that is not in his domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList3 = VirtualMachine.list(self.apiclient,id=self.vm_d2.id)
+ VMList3 = VirtualMachine.list(self.apiclient, id=self.vm_d2.id)
self.assertEqual(VMList3,
None,
- "Domain Admin is able to list Vms from other domains!!!")
+ "Domain Admin is able to list Vms from other domains!!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_domainadmin_ownedbyusersinsubdomain2(self):
- """
- # Domain admin should be able to list Vm that is owned by account that is in his sub domains by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Vm that is owned by account that is in his sub domains by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList4 = VirtualMachine.list(self.apiclient,id=self.vm_d111a.id)
+ VMList4 = VirtualMachine.list(self.apiclient, id=self.vm_d111a.id)
self.assertNotEqual(VMList4,
- None,
- "Domain Admin is not able to list Vms from his subdomain")
+ None,
+ "Domain Admin is not able to list Vms from his subdomain")
self.assertEqual(len(VMList4),
1,
- "Domain Admin is not able to list Vms from his sub domains")
+ "Domain Admin is not able to list Vms from his sub domains")
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_rootadmin_owns(self):
- """
- # Domain admin should be able to list Vm that is owned by account that is in his sub domains by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Vm that is owned by account that is in his sub domains by passing uuid in "id" parameter
+ """
- self.apiclient.connection.apiKey = self.user_a_apikey
+ self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- VMList1 = VirtualMachine.list(self.apiclient,id=self.vm_a.id)
+ VMList1 = VirtualMachine.list(self.apiclient, id=self.vm_a.id)
self.assertNotEqual(VMList1,
- None,
- "ROOT Admin not able to list Vms that he owns")
+ None,
+ "ROOT Admin not able to list Vms that he owns")
self.assertEqual(len(VMList1),
1,
- "ROOT Admin not able to list Vms that he owns")
+ "ROOT Admin not able to list Vms that he owns")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_rootadmin_Vmsownedbyothers(self):
- """
- # ROOT admin should be able to list Vm that is owned by any account iby passing uuid in "id" parameter
- """
+ """
+ # ROOT admin should be able to list Vm that is owned by any account iby passing uuid in "id" parameter
+ """
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- VMList1 = VirtualMachine.list(self.apiclient,id=self.vm_d2.id)
- VMList2 = VirtualMachine.list(self.apiclient,id=self.vm_d11a.id)
+ VMList1 = VirtualMachine.list(self.apiclient, id=self.vm_d2.id)
+ VMList2 = VirtualMachine.list(self.apiclient, id=self.vm_d11a.id)
self.assertNotEqual(VMList1,
- None,
- "ROOT Admin not able to list Vms from other domains")
+ None,
+ "ROOT Admin not able to list Vms from other domains")
self.assertNotEqual(VMList2,
- None,
- "ROOT Admin not able to list Vms from other domains")
+ None,
+ "ROOT Admin not able to list Vms from other domains")
self.assertEqual(len(VMList1),
1,
- "ROOT Admin not able to list Vms from other domains")
+ "ROOT Admin not able to list Vms from other domains")
self.assertEqual(len(VMList2),
1,
- "ROOT Admin not able to list Vms from other domains")
+ "ROOT Admin not able to list Vms from other domains")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_user_own(self):
- """
- # Regular user should be able to list Vm that is owned by him by passing uuid in "id" parameter
- """
+ """
+ # Regular user should be able to list Vm that is owned by him by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- VMList1 = VirtualMachine.list(self.apiclient,id=self.vm_d11a.id)
-
+ VMList1 = VirtualMachine.list(self.apiclient, id=self.vm_d11a.id)
self.assertNotEqual(VMList1,
- None,
- "Regular User is not able to list Vms that he owns")
+ None,
+ "Regular User is not able to list Vms that he owns")
self.assertEqual(len(VMList1),
1,
- "Regular User is not able to list Vms that he owns")
+ "Regular User is not able to list Vms that he owns")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_user_vmfromsamedomaindifferentaccount(self):
- """
- # Regular user should not be able to list Vm that is owned by different account in the same domain by passing uuid in "id" parameter
- """
+ """
+ # Regular user should not be able to list Vm that is owned by different account in the same domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- VMList2 = VirtualMachine.list(self.apiclient,id=self.vm_d11b.id)
+ VMList2 = VirtualMachine.list(self.apiclient, id=self.vm_d11b.id)
self.assertEqual(VMList2,
None,
- "Regular User is able to list Vms from other accounts")
+ "Regular User is able to list Vms from other accounts")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_user_vmsfromotherdomain(self):
- """
- # Regular user should not be able to list Vm that is owned by different account in the different domain by passing uuid in "id" parameter
- """
+ """
+ # Regular user should not be able to list Vm that is owned by different account in the different domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- VMList3 = VirtualMachine.list(self.apiclient,id=self.vm_d2.id)
+ VMList3 = VirtualMachine.list(self.apiclient, id=self.vm_d2.id)
self.assertEqual(VMList3,
None,
- "Regular User is able to list Vms from other domains")
-
+ "Regular User is able to list Vms from other domains")
@staticmethod
- def generateKeysForUser(apiclient,account):
+ def generateKeysForUser(apiclient, account):
user = User.list(
- apiclient,
- account=account.name,
- domainid=account.domainid
- )[0]
-
+ apiclient,
+ account=account.name,
+ domainid=account.domainid
+ )[0]
+
return (User.registerUserKeys(
- apiclient,
- user.id
- ))
+ apiclient,
+ user.id
+ ))
@staticmethod
- def checkForExistenceOfValue(list,attributeValue):
- if list is None:
- return False
- rowCount=len(list)
- for num in range (rowCount):
- if list[num].id == attributeValue:
- return True
- return False
-
+ def checkForExistenceOfValue(list, attributeValue):
+ if list is None:
+ return False
+ rowCount = len(list)
+ for num in range(rowCount):
+ if list[num].id == attributeValue:
+ return True
+ return False
diff --git a/test/integration/component/test_acl_listvolume.py b/test/integration/component/test_acl_listvolume.py
index 05cabebf193..463bba310d2 100644
--- a/test/integration/component/test_acl_listvolume.py
+++ b/test/integration/component/test_acl_listvolume.py
@@ -17,7 +17,7 @@
"""
Test cases relating to listVolumes() relating to parameters - id,listall,isrecursive,account and domainid
"""
-#Import Local Modules
+# Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@@ -25,25 +25,26 @@ from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
-#Import System modules
+# Import System modules
import time
_multiprocess_shared_ = True
+
class TestVolumeList(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- """
- Create the following domain tree and accounts that are reqiured for executing listVolume test cases:
- Under ROOT - create 2 domaind D1 and D2
- Under D1 - Create 2 subdomain D11 and D12
- Under D11 - Create subdimain D111
+ """
+ Create the following domain tree and accounts that are reqiured for executing listVolume test cases:
+ Under ROOT - create 2 domaind D1 and D2
+ Under D1 - Create 2 subdomain D11 and D12
+ Under D11 - Create subdimain D111
- Under each of the domain create 1 admin user and couple of regular users.
+ Under each of the domain create 1 admin user and couple of regular users.
- As each of these users , deploy Virtual machines.
+ As each of these users , deploy Virtual machines.
- """
+ """
cls.testclient = super(TestVolumeList, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
cls.testdata = cls.testClient.getParsedTestDataConfig()
@@ -53,173 +54,171 @@ class TestVolumeList(cloudstackTestCase):
cls.domain_2 = None
cls.cleanup = []
- try:
+ try:
# backup default apikey and secretkey
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
-
+
# Create domains
cls.domain_1 = Domain.create(
- cls.apiclient,
- cls.acldata["domain1"]
- )
+ cls.apiclient,
+ cls.acldata["domain1"]
+ )
cls.domain_11 = Domain.create(
- cls.apiclient,
- cls.acldata["domain11"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain11"],
+ parentdomainid=cls.domain_1.id
+ )
cls.domain_111 = Domain.create(
- cls.apiclient,
- cls.acldata["domain111"],
- parentdomainid=cls.domain_11.id,
- )
+ cls.apiclient,
+ cls.acldata["domain111"],
+ parentdomainid=cls.domain_11.id,
+ )
cls.domain_12 = Domain.create(
- cls.apiclient,
- cls.acldata["domain12"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain12"],
+ parentdomainid=cls.domain_1.id
+ )
cls.domain_2 = Domain.create(
- cls.apiclient,
- cls.acldata["domain2"]
- )
+ cls.apiclient,
+ cls.acldata["domain2"]
+ )
# Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create(
- cls.apiclient,
- cls.acldata["accountD1"],
- admin=True,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
+ cls.apiclient,
+ cls.acldata["accountD1"],
+ admin=True,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1)
cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey
-
+
cls.account_d1a = Account.create(
- cls.apiclient,
- cls.acldata["accountD1A"],
- admin=False,
- domainid=cls.domain_1.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
+ cls.apiclient,
+ cls.acldata["accountD1A"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
-
+
cls.account_d1b = Account.create(
- cls.apiclient,
- cls.acldata["accountD1B"],
- admin=False,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
+ cls.apiclient,
+ cls.acldata["accountD1B"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
-
+
# Create 1 admin and 2 user accounts for doamin_11
cls.account_d11 = Account.create(
- cls.apiclient,
- cls.acldata["accountD11"],
- admin=True,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
+ cls.apiclient,
+ cls.acldata["accountD11"],
+ admin=True,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
-
+
cls.account_d11a = Account.create(
- cls.apiclient,
- cls.acldata["accountD11A"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
+ cls.apiclient,
+ cls.acldata["accountD11A"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
-
+
cls.account_d11b = Account.create(
- cls.apiclient,
- cls.acldata["accountD11B"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
+ cls.apiclient,
+ cls.acldata["accountD11B"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
-
+
# Create 1 user account for doamin_111
-
+
cls.account_d111a = Account.create(
- cls.apiclient,
- cls.acldata["accountD111A"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
+ cls.apiclient,
+ cls.acldata["accountD111A"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
-
+
# Create 2 user accounts for doamin_12
cls.account_d12a = Account.create(
- cls.apiclient,
- cls.acldata["accountD12A"],
- admin=False,
- domainid=cls.domain_12.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
+ cls.apiclient,
+ cls.acldata["accountD12A"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
-
+
cls.account_d12b = Account.create(
- cls.apiclient,
- cls.acldata["accountD12B"],
- admin=False,
- domainid=cls.domain_12.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
+ cls.apiclient,
+ cls.acldata["accountD12B"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
-
+
# Create 1 user account for domain_2
-
+
cls.account_d2a = Account.create(
- cls.apiclient,
- cls.acldata["accountD2"],
- admin=False,
- domainid=cls.domain_2.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
+ cls.apiclient,
+ cls.acldata["accountD2"],
+ admin=False,
+ domainid=cls.domain_2.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d2a)
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
-
-
+
# Create admin user account
-
+
cls.account_a = Account.create(
- cls.apiclient,
- cls.acldata["accountROOTA"],
- admin=True,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_a)
+ cls.apiclient,
+ cls.acldata["accountROOTA"],
+ admin=True,
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_a)
cls.user_a_apikey = user.apikey
cls.user_a_secretkey = user.secretkey
# create service offering
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
- cls.acldata["service_offering"]["small"]
- )
-
- cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
+ cls.apiclient,
+ cls.acldata["service_offering"]["small"]
+ )
+
+ cls.zone = get_zone(cls.apiclient, cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
+
# deploy VM
-
- cls.apiclient.connection.apiKey = cls.user_d1_apikey
+
+ cls.apiclient.connection.apiKey = cls.user_d1_apikey
cls.apiclient.connection.securityKey = cls.user_d1_secretkey
cls.vm_d1 = VirtualMachine.create(
cls.apiclient,
@@ -228,9 +227,9 @@ class TestVolumeList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d1_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d1.id)
-
- cls.apiclient.connection.apiKey = cls.user_d1a_apikey
+ cls.vm_d1_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d1.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1a_apikey
cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
cls.vm_d1a = VirtualMachine.create(
cls.apiclient,
@@ -239,9 +238,9 @@ class TestVolumeList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d1a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d1a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d1b_apikey
+ cls.vm_d1a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d1a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d1b_apikey
cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
cls.vm_d1b = VirtualMachine.create(
cls.apiclient,
@@ -249,10 +248,10 @@ class TestVolumeList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d1b_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d1b.id)
-
- cls.apiclient.connection.apiKey = cls.user_d11_apikey
+ )
+ cls.vm_d1b_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d1b.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11_apikey
cls.apiclient.connection.securityKey = cls.user_d11_secretkey
cls.vm_d11 = VirtualMachine.create(
cls.apiclient,
@@ -260,10 +259,10 @@ class TestVolumeList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d11_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d11.id)
-
- cls.apiclient.connection.apiKey = cls.user_d11a_apikey
+ )
+ cls.vm_d11_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d11.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11a_apikey
cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
cls.vm_d11a = VirtualMachine.create(
cls.apiclient,
@@ -271,10 +270,10 @@ class TestVolumeList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d11a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d11a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d11b_apikey
+ )
+ cls.vm_d11a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d11a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d11b_apikey
cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
cls.vm_d11b = VirtualMachine.create(
cls.apiclient,
@@ -283,9 +282,9 @@ class TestVolumeList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d11b_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d11b.id)
-
- cls.apiclient.connection.apiKey = cls.user_d111a_apikey
+ cls.vm_d11b_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d11b.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d111a_apikey
cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
cls.vm_d111a = VirtualMachine.create(
cls.apiclient,
@@ -293,10 +292,10 @@ class TestVolumeList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d111a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d111a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d12a_apikey
+ )
+ cls.vm_d111a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d111a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d12a_apikey
cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
cls.vm_d12a = VirtualMachine.create(
cls.apiclient,
@@ -304,10 +303,10 @@ class TestVolumeList(cloudstackTestCase):
zoneid=cls.zone.id,
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
- )
- cls.vm_d12a_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d12a.id)
-
- cls.apiclient.connection.apiKey = cls.user_d12b_apikey
+ )
+ cls.vm_d12a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d12a.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d12b_apikey
cls.apiclient.connection.securityKey = cls.user_d12b_secretkey
cls.vm_d12b = VirtualMachine.create(
cls.apiclient,
@@ -316,9 +315,9 @@ class TestVolumeList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d12b_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d12b.id)
-
- cls.apiclient.connection.apiKey = cls.user_d2a_apikey
+ cls.vm_d12b_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d12b.id)
+
+ cls.apiclient.connection.apiKey = cls.user_d2a_apikey
cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
cls.vm_d2 = VirtualMachine.create(
cls.apiclient,
@@ -327,9 +326,9 @@ class TestVolumeList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_d2_volume=Volume.list(cls.apiclient,virtualmachineid=cls.vm_d2.id)
-
- cls.apiclient.connection.apiKey = cls.user_a_apikey
+ cls.vm_d2_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_d2.id)
+
+ cls.apiclient.connection.apiKey = cls.user_a_apikey
cls.apiclient.connection.securityKey = cls.user_a_secretkey
cls.vm_a = VirtualMachine.create(
cls.apiclient,
@@ -338,19 +337,17 @@ class TestVolumeList(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
templateid=cls.template.id
)
- cls.vm_a_volume =Volume.list(cls.apiclient,virtualmachineid=cls.vm_a.id)
-
+ cls.vm_a_volume = Volume.list(cls.apiclient, virtualmachineid=cls.vm_a.id)
+
cls.cleanup = [
- cls.account_a,
- cls.service_offering,
- ]
+ cls.account_a,
+ cls.service_offering,
+ ]
except Exception as e:
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
-
-
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
@@ -359,9 +356,10 @@ class TestVolumeList(cloudstackTestCase):
cls.apiclient.connection.securityKey = cls.default_secretkey
cleanup_resources(cls.apiclient, cls.cleanup)
try:
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- except: pass
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ except:
+ pass
def setUp(cls):
cls.apiclient = cls.testClient.getApiClient()
@@ -373,2465 +371,2426 @@ class TestVolumeList(cloudstackTestCase):
cls.apiclient.connection.securityKey = cls.default_secretkey
return
-## Domain Admin - Test cases with listall =true
+ ## Domain Admin - Test cases with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_listall_true(self):
- """
- # Test listing of Volumes by passing listall="true" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by accounts in this domain and all its subdomain
- """
+ """
+ # Test listing of Volumes by passing listall="true" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,listall="true")
- self.debug ("List as Domain Admin - listall=true - %s" % volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true")
+ self.debug("List as Domain Admin - listall=true - %s" % volumeList)
- self.assertEqual(len(volumeList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id),
- self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d1b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id),
+ self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d1b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing listall="true"i and isrecusriv="true" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by accounts in this domain and all its subdomain
- """
+ """
+ # Test listing of Volumes by passing listall="true"i and isrecusriv="true" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id),
- self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d1b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id),
+ self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d1b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing listall="true" and isrecusriv="false" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by accounts in this domain and all its subdomain
- """
+ """
+ # Test listing of Volumes by passing listall="true" and isrecusriv="false" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by accounts in this domain and all its subdomain
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 9,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 9,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id),
- self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d1b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id),
+ self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d1b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases with listall=false
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_listall_false(self):
- """
- # Test listing of Volumes by passing listall="false" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by the domain admin
- """
+ """
+ # Test listing of Volumes by passing listall="false" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,listall="false")
- self.debug ("List as Domain Admin - listall=false - %s" % volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false")
+ self.debug("List as Domain Admin - listall=false - %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing listall="false" and isrecusrive="true" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by the domain admin
- """
+ """
+ # Test listing of Volumes by passing listall="false" and isrecusrive="true" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing listall="false" and isrecusrive="false" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by the domain admin
- """
+ """
+ # Test listing of Volumes by passing listall="false" and isrecusrive="false" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases without passing listall paramter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases without passing listall paramter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin(self):
- """
- # Test listing of Volumes by passing no parameter as domain admin
- # Validate that it returns all the Volumes that is owned by the domain admin
- """
+ """
+ # Test listing of Volumes by passing no parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient)
- self.debug ("List as Domain Admin - %s" % volumeList)
+ volumeList = Volume.list(self.apiclient)
+ self.debug("List as Domain Admin - %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_rec_true(self):
- """
- # Test listing of Volumes by passing isrecusrive="true" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by the domain admin
- """
+ """
+ # Test listing of Volumes by passing isrecusrive="true" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,isrecursive="true")
- self.debug ("List as Domain Admin - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, isrecursive="true")
+ self.debug("List as Domain Admin - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_true_rec_false(self):
- """
- # Test listing of Volumes by passing isrecusrive="false" parameter as domain admin
- # Validate that it returns all the Volumes that is owned by the domain admin
- """
+ """
+ # Test listing of Volumes by passing isrecusrive="false" parameter as domain admin
+ # Validate that it returns all the Volumes that is owned by the domain admin
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,isrecursive="false")
- self.debug ("List as Domain Admin - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, isrecursive="false")
+ self.debug("List as Domain Admin - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_listall_true(self):
- """
- # Test listing of Volumes by passing domainId and listall="true" parameter as domain admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId and listall="true" parameter as domain admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="true")
- self.debug ("List as Domain Admin passing domainId - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="true")
+ self.debug("List as Domain Admin passing domainId - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing domainId ,listall="true" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Volumes in the subdomain and the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId ,listall="true" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Volumes in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing domainId ,listall="true" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId ,listall="true" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when domainId is passed with listall=false
+ ## Domain Admin - Test cases when domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_listall_false(self):
- # Test listing of Volumes by passing domainId ,listall="false" parameter as domain admin
- # Validate that it returns all the Volumes in the domain passed
+ # Test listing of Volumes by passing domainId ,listall="false" parameter as domain admin
+ # Validate that it returns all the Volumes in the domain passed
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="false")
- self.debug ("List as Domain Admin passing domainId - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="false")
+ self.debug("List as Domain Admin passing domainId - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing domainId ,listall="false" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Volumes in the subdomain and the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId ,listall="false" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Volumes in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing domainId ,listall="false" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId ,listall="false" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when domainId is passed with no listall parameter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when domainId is passed with no listall parameter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid(self):
- """
- # Test listing of Volumes by passing domainId parameter as domain admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId parameter as domain admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id)
- self.debug ("List as Domain Admin passing domainId - %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id)
+ self.debug("List as Domain Admin passing domainId - %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_rec_true(self):
- """
- # Test listing of Volumes by passing domainId and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Volumes in the subdomain and domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Volumes in the subdomain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as Domain Admin passing domainId - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as Domain Admin passing domainId - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_rec_false(self):
- """
- # Test listing of Volumes by passing domainId and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Volumes in the subdomain and domain passed
- """
+ """
+ # Test listing of Volumes by passing domainId and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Volumes in the subdomain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as Domain Admin passing domainId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as Domain Admin passing domainId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when account and domainId is passed with listall =true
+ ## Domain Admin - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_listall_true(self):
- """
- # Test listing of Volumes by passing account ,domainId and listall="true" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId and listall="true" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing account ,domainId and listall="true" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId and listall="true" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing account ,domainId , listall="true" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId , listall="true" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Domain Admin - Test cases when account and domainId is passed with listall=false
+ ## Domain Admin - Test cases when account and domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_listall_false(self):
- """
- # Test listing of Volumes by passing account ,domainId and listall="false" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId and listall="false" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing account ,domainId and listall="false" and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId and listall="false" and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing account ,domainId , listall="false" and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId , listall="false" and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Domain Admin - Test cases when account and domainId is passed with listall not passed
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Domain Admin - Test cases when account and domainId is passed with listall not passed
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid(self):
- """
- # Test listing of Volumes by passing account ,domainId parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id)
- self.debug ("List as Domain Admin passing domainId and accountId - %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id)
+ self.debug("List as Domain Admin passing domainId and accountId - %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_rec_true(self):
- """
- # Test listing of Volumes by passing account ,domainId and isrecursive="true" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId and isrecursive="true" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as Domain Admin passing domainId and accountId - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as Domain Admin passing domainId and accountId - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_domainid_accountid_rec_false(self):
- """
- # Test listing of Volumes by passing account ,domainId and isrecursive="false" parameter as domain admin
- # Validate that it returns all the Volumes owned by the account passed in account parameter
- """
+ """
+ # Test listing of Volumes by passing account ,domainId and isrecursive="false" parameter as domain admin
+ # Validate that it returns all the Volumes owned by the account passed in account parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as Domain Admin passing domainId and accountId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as Domain Admin passing domainId and accountId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_true(self):
- """
- # Test listing of Volumes by passing listall="true" parameter as admin
- # Validate that it returns all the Volumes
- """
+ """
+ # Test listing of Volumes by passing listall="true" parameter as admin
+ # Validate that it returns all the Volumes
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,listall="true")
- self.debug ("List as ROOT Admin - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true")
+ self.debug("List as ROOT Admin - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id),
- self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d1b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d2_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id)):
-
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id),
+ self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d1b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d2_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id)):
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ accountAccess = True
+ else:
+ accountAccess = False
+
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing listall="true" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes
- """
+ """
+ # Test listing of Volumes by passing listall="true" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id),
- self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d1b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d2_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id)):
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id),
+ self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d1b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d2_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing listall="true" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes
- """
+ """
+ # Test listing of Volumes by passing listall="true" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) >= 11,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) >= 11,
+ True,
+ "Number of items in list response check failed!!")
- if (self.checkForExistenceOfValue(volumeList,self.vm_d1_volume[0].id),
- self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d1b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d12b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d2_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id)):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d1_volume[0].id),
+ self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d1b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d12b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d2_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ ## ROOT Admin - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_false(self):
- """
- # Test listing of Volumes by passing listall="false" parameter as admin
- # Validate that it returns all the Volumes owned by admin
- """
+ """
+ # Test listing of Volumes by passing listall="false" parameter as admin
+ # Validate that it returns all the Volumes owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,listall="false")
- self.debug ("List as ROOT Admin - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false")
+ self.debug("List as ROOT Admin - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing listall="false" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes owned by admin
- """
+ """
+ # Test listing of Volumes by passing listall="false" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing listall="false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes owned by admin
- """
+ """
+ # Test listing of Volumes by passing listall="false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin - listall=false,isrecursive=false %s" % volumeList)
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+ ## ROOT Admin - Test cases without passing listall paramter
-## ROOT Admin - Test cases without passing listall paramter
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin(self):
- """
- # Test listing of Volumes by passing no parameter as admin
- # Validate that it returns all the Volumes owned by admin
- """
+ """
+ # Test listing of Volumes by passing no parameter as admin
+ # Validate that it returns all the Volumes owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient)
- self.debug ("List as ROOT Admin %s" %volumeList)
+ volumeList = Volume.list(self.apiclient)
+ self.debug("List as ROOT Admin %s" % volumeList)
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_rec_true(self):
- """
- # Test listing of Volumes by passing isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes owned by admin
- """
+ """
+ # Test listing of Volumes by passing isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,isrecursive="true")
- self.debug ("List as ROOT Admin - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, isrecursive="true")
+ self.debug("List as ROOT Admin - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_rec_false(self):
- """
- # Test listing of Volumes by passing isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes owned by admin
- """
+ """
+ # Test listing of Volumes by passing isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes owned by admin
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_listall_true(self):
- """
- # Test listing of Volumes by passing domainid and listall="true" parameter as admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid and listall="true" parameter as admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="true")
- self.debug ("List as ROOT Admin passing domainId - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="true")
+ self.debug("List as ROOT Admin passing domainId - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing domainid , listall="true" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes in the subdomain and the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid , listall="true" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes in the subdomain and the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing domainid, listall="true" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid, listall="true" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when domainId is passed with listall=false
+ ## ROOT Admin - Test cases when domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_listall_false(self):
- """
- # Test listing of Volumes by passing domainid, listall="false" parameter as admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid, listall="false" parameter as admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="false")
- self.debug ("List as ROOT Admin passing domainId - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="false")
+ self.debug("List as ROOT Admin passing domainId - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing domainid, listall="false" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes in the subdoamin and domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid, listall="false" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes in the subdoamin and domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing domainid, listall="false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid, listall="false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when domainId is passed with no listall parameter
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when domainId is passed with no listall parameter
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid(self):
- """
- # Test listing of Volumes by passing domainid parameter as admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid parameter as admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id)
- self.debug ("List as ROOT Admin passing domainId - %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id)
+ self.debug("List as ROOT Admin passing domainId - %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_rec_true(self):
- """
- # Test listing of Volumes by passing domainid and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes in the subdmain and domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes in the subdmain and domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 4,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 4,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d111a_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d111a_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_rec_false(self):
- """
- # Test listing of Volumes by passing domainid and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes in the domain passed
- """
+ """
+ # Test listing of Volumes by passing domainid and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes in the domain passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 3,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 3,
+ True,
+ "Number of items in list response check failed!!")
- if ( self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11a_volume[0].id) and
- self.checkForExistenceOfValue(volumeList,self.vm_d11b_volume[0].id) ):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if (self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11a_volume[0].id) and
+ self.checkForExistenceOfValue(volumeList, self.vm_d11b_volume[0].id)):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when account and domainId is passed with listall =true
+ ## ROOT Admin - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_listall_true(self):
- """
- # Test listing of Volumes by passing domainid,account ,listall = "true" parameter as admin
- # Validate that it returns all the Volumes of account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account ,listall = "true" parameter as admin
+ # Validate that it returns all the Volumes of account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,account ,listall = "true" and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account ,listall = "true" and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,account ,listall = "true" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account ,listall = "true" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="true",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="true", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## ROOT Admin - Test cases when account and domainId is passed with listall=false
+ ## ROOT Admin - Test cases when account and domainId is passed with listall=false
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_listall_false(self):
- """
- # Test listing of Volumes by passing domainid,account ,listall = "false" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account ,listall = "false" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account ,listall = "false" and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,listall="false",isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, listall="false", isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
-
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## ROOT Admin - Test cases when account and domainId is passed with listall not passed
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## ROOT Admin - Test cases when account and domainId is passed with listall not passed
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid(self):
- """
- # Test listing of Volumes by passing domainid,account parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id)
- self.debug ("List as ROOT Admin passing domainId and accountId - %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id)
+ self.debug("List as ROOT Admin passing domainId and accountId - %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,account and isrecusrive="true" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account and isrecusrive="true" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="true")
- self.debug ("List as ROOT Admin passing domainId and accountId - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="true")
+ self.debug("List as ROOT Admin passing domainId and accountId - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_domainid_accountid_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,account and isrecusrive="false" parameter as admin
- # Validate that it returns all the Volumes of the account that is passed
- """
+ """
+ # Test listing of Volumes by passing domainid,account and isrecusrive="false" parameter as admin
+ # Validate that it returns all the Volumes of the account that is passed
+ """
self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d11.user[0].username,domainid=self.domain_11.id,isrecursive="false")
- self.debug ("List as ROOT Admin passing domainId and accountId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d11.user[0].username, domainid=self.domain_11.id, isrecursive="false")
+ self.debug("List as ROOT Admin passing domainId and accountId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d11_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d11_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases with listall =true
+ ## Regular User - Test cases with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_true(self):
- """
- # Test listing of Volumes by passing listall="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing listall="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,listall="true")
- self.debug ("List as Regular User - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true")
+ self.debug("List as Regular User - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing listall="true" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing listall="true" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,listall="true",isrecursive="true")
- self.debug ("List as Regular User - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true", isrecursive="true")
+ self.debug("List as Regular User - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing listall="true" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing listall="true" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,listall="true",isrecursive="false")
- self.debug ("List as Regular User - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="true", isrecursive="false")
+ self.debug("List as Regular User - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Regular User - Test cases with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ ## Regular User - Test cases with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_false(self):
- """
- # Test listing of Volumes by passing domainid,account,listall="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account,listall="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,listall="false")
- self.debug ("List as Regular User - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false")
+ self.debug("List as Regular User - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing listall="false" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing listall="false" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,listall="false",isrecursive="true")
- self.debug ("List as Regular User - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false", isrecursive="true")
+ self.debug("List as Regular User - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing listall="false" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing listall="false" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,listall="false",isrecursive="false")
- self.debug ("List as Regular User - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, listall="false", isrecursive="false")
+ self.debug("List as Regular User - listall=false,isrecursive=false %s" % volumeList)
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+ ## Regular User - Test cases without passing listall paramter
-## Regular User - Test cases without passing listall paramter
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser(self):
- """
- # Test listing of Volumes by passing no parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing no parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient)
- self.debug ("List as Regular User %s" %volumeList)
+ volumeList = Volume.list(self.apiclient)
+ self.debug("List as Regular User %s" % volumeList)
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_rec_true(self):
- """
- # Test listing of Volumes by passing isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,isrecursive="true")
- self.debug ("List as Regular User - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, isrecursive="true")
+ self.debug("List as Regular User - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_rec_false(self):
- """
- # Test listing of Volumes by passing isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,isrecursive="false")
- self.debug ("List as Regular User passing domainId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, isrecursive="false")
+ self.debug("List as Regular User passing domainId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Regular User - Test cases when domainId is passed with listall =true
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when domainId is passed with listall =true
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_true(self):
- """
- # Test listing of Volumes by passing domainid,listall="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,listall="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,listall="true")
- self.debug ("List as Regular User passing domainId - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, listall="true")
+ self.debug("List as Regular User passing domainId - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,listall="true" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,listall="true" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,listall="true",isrecursive="true")
- self.debug ("List as Regular User passing domainId - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, listall="true", isrecursive="true")
+ self.debug("List as Regular User passing domainId - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,listall="true" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,listall="true" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,listall="true",isrecursive="false")
- self.debug ("List as Regular User passing domainId - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, listall="true", isrecursive="false")
+ self.debug("List as Regular User passing domainId - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when domainId is passed with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when domainId is passed with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_false(self):
- """
- # Test listing of Volumes by passing domainid,listall="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,listall="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,listall="false")
- self.debug ("List as Regular User passing domainId - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, listall="false")
+ self.debug("List as Regular User passing domainId - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_false_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,listall="false" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,listall="false" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,listall="false",isrecursive="true")
- self.debug ("List as Regular User passing domainId - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, listall="false", isrecursive="true")
+ self.debug("List as Regular User passing domainId - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,listall="false" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,listall="false" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,listall="false",isrecursive="false")
- self.debug ("List as Regular User passing domainId - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, listall="false", isrecursive="false")
+ self.debug("List as Regular User passing domainId - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when domainId is passed with no listall parameter
+ ## Regular User - Test cases when domainId is passed with no listall parameter
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid(self):
- """
- # Test listing of Volumes by passing domainid parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id)
- self.debug ("List as Regular User passing domainId %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id)
+ self.debug("List as Regular User passing domainId %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_true_rec_true(self):
- """
- # Test listing of Volumes by passing domainid and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,isrecursive="true")
- self.debug ("List as Regular User passing domainId - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, isrecursive="true")
+ self.debug("List as Regular User passing domainId - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid__rec_false(self):
- """
- # Test listing of Volumes by passing domainid,isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,domainid=self.domain_1.id,isrecursive="false")
- self.debug ("List as Regular User passing domainId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_1.id, isrecursive="false")
+ self.debug("List as Regular User passing domainId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall =true
+ ## Regular User - Test cases when account and domainId is passed with listall =true
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_listall_true(self):
- """
- # Test listing of Volumes by passing domainid,account,listall="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account,listall="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_listall_true_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,account,listall="true" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account,listall="true" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true",isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=true,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true", isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=true,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_listall_true_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,account,listall="true" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account,listall="true" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="true",isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=true,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="true", isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=true,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall=false
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Regular User - Test cases when account and domainId is passed with listall=false
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_listall_false(self):
- """
- # Test listing of Volumes by passing domainid,account,listall="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account,listall="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_listall_false_rec_true(self):
- # Test listing of Volumes by passing domainid,account,listall="false" and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
+ # Test listing of Volumes by passing domainid,account,listall="false" and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false",isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - listall=false,isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false", isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - listall=false,isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_listall_false_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,account,listall="false" and isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account,listall="false" and isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,listall="false",isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - listall=false,isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, listall="false", isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - listall=false,isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
-## Regular User - Test cases when account and domainId is passed with listall not passed
+ ## Regular User - Test cases when account and domainId is passed with listall not passed
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid(self):
- """
- # Test listing of Volumes by passing domainid,account parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id)
- self.debug ("List as Regular User passing domainId and accountId %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id)
+ self.debug("List as Regular User passing domainId and accountId %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_rec_true(self):
- """
- # Test listing of Volumes by passing domainid,account and isrecusrive="true" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account and isrecusrive="true" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,isrecursive="true")
- self.debug ("List as Regular User passing domainId and accountId - isrecursive=true %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, isrecursive="true")
+ self.debug("List as Regular User passing domainId and accountId - isrecursive=true %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_rec_false(self):
- """
- # Test listing of Volumes by passing domainid,account isrecusrive="false" parameter as regular user
- # Validate that it returns all the Volumes of the account the user belongs to
- """
+ """
+ # Test listing of Volumes by passing domainid,account isrecusrive="false" parameter as regular user
+ # Validate that it returns all the Volumes of the account the user belongs to
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- volumeList = Volume.list(self.apiclient,account=self.account_d1a.user[0].username,domainid=self.domain_1.id,isrecursive="false")
- self.debug ("List as Regular User passing domainId and accountId - isrecursive=false %s" %volumeList)
+ volumeList = Volume.list(self.apiclient, account=self.account_d1a.user[0].username, domainid=self.domain_1.id, isrecursive="false")
+ self.debug("List as Regular User passing domainId and accountId - isrecursive=false %s" % volumeList)
- self.assertEqual(len(volumeList) == 1,
- True,
- "Number of items in list response check failed!!")
+ self.assertEqual(len(volumeList) == 1,
+ True,
+ "Number of items in list response check failed!!")
- if self.checkForExistenceOfValue(volumeList,self.vm_d1a_volume[0].id):
- accountAccess = True
- else:
- accountAccess = False
-
- self.assertEqual(accountAccess,
- True,
- "Account access check failed!!")
+ if self.checkForExistenceOfValue(volumeList, self.vm_d1a_volume[0].id):
+ accountAccess = True
+ else:
+ accountAccess = False
-## Cross Domain access check
+ self.assertEqual(accountAccess,
+ True,
+ "Account access check failed!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## Cross Domain access check
+
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_cross_domainid_accountid(self):
- """
- # Regular User should not be allowed to list Volumes of other accounts in the same domain
- """
+ """
+ # Regular User should not be allowed to list Volumes of other accounts in the same domain
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- volumeList = Volume.list(self.apiclient,account=self.account_d1b.user[0].username,domainid=self.domain_1.id)
- self.fail("Regular User is able to use another account with in the same domain in listVolume call")
- except Exception as e:
- self.debug ("List as Regular User passing domainId and accountId of another account %s" %e)
+ try:
+ volumeList = Volume.list(self.apiclient, account=self.account_d1b.user[0].username, domainid=self.domain_1.id)
+ self.fail("Regular User is able to use another account with in the same domain in listVolume call")
+ except Exception as e:
+ self.debug("List as Regular User passing domainId and accountId of another account %s" % e)
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_cross_domainid(self):
- """
- # Regular User should not be allowed to list Volumes of other accounts in other domains
- """
+ """
+ # Regular User should not be allowed to list Volumes of other accounts in other domains
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- volumeList = Volume.list(self.apiclient,domainid=self.domain_2_volume[0].id)
- self.fail("Regular User is able to use another domain in listVolume call")
- except Exception as e:
- self.debug ("List as Regular User passing domainId of a domain that user does not belong to %s" %e)
+ try:
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_2_volume[0].id)
+ self.fail("Regular User is able to use another domain in listVolume call")
+ except Exception as e:
+ self.debug("List as Regular User passing domainId of a domain that user does not belong to %s" % e)
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_cross_domainid_accountid(self):
- """
- # Domain admin should not be allowed to list Volumes of accounts in other domains
- """
+ """
+ # Domain admin should not be allowed to list Volumes of accounts in other domains
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- try:
- volumeList = Volume.list(self.apiclient,account=self.account_d2a.user[0].username,domainid=self.domain_2_volume[0].id)
- self.fail("Domain admin user is able to use another domain in listVolume call")
- except Exception as e:
- self.debug ("List as domain admin passing domainId and accountId of another account %s" %e)
+ try:
+ volumeList = Volume.list(self.apiclient, account=self.account_d2a.user[0].username, domainid=self.domain_2_volume[0].id)
+ self.fail("Domain admin user is able to use another domain in listVolume call")
+ except Exception as e:
+ self.debug("List as domain admin passing domainId and accountId of another account %s" % e)
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_domainadmin_cross_domainid(self):
- """
- # Domain admin should not be allowed to list Volumes from other domains
- """
+ """
+ # Domain admin should not be allowed to list Volumes from other domains
+ """
self.apiclient.connection.apiKey = self.user_d1a_apikey
self.apiclient.connection.securityKey = self.user_d1a_secretkey
- try:
- volumeList = Volume.list(self.apiclient,domainid=self.domain_2_volume[0].id)
- self.fail("Domain admin User is able to use another domain in listVolume call")
- except Exception as e:
- self.debug ("List as domain admin passing domainId of a domain that user does not belong to %s" %e)
+ try:
+ volumeList = Volume.list(self.apiclient, domainid=self.domain_2_volume[0].id)
+ self.fail("Domain admin User is able to use another domain in listVolume call")
+ except Exception as e:
+ self.debug("List as domain admin passing domainId of a domain that user does not belong to %s" % e)
-
-## List test cases relating to filter - id
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ ## List test cases relating to filter - id
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_domainadmin_owns(self):
- """
- # Domain admin should be able to list Volumes that he owns by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Volumes that he owns by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList = Volume.list(self.apiclient,id=self.vm_d1_volume[0].id)
+ VMList = Volume.list(self.apiclient, id=self.vm_d1_volume[0].id)
self.assertNotEqual(VMList,
- None,
- "Domain Admin is not able to list Volumes that he owns")
+ None,
+ "Domain Admin is not able to list Volumes that he owns")
self.assertEqual(len(VMList),
1,
- "Domain Admin is not able to list Volumes that belongs to him")
+ "Domain Admin is not able to list Volumes that belongs to him")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_domainadmin_ownedbyusersindomain(self):
- """
- # Domain admin should be able to list Volumes that is owned by any account in his domain by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Volumes that is owned by any account in his domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList1 = Volume.list(self.apiclient,id=self.vm_d1a_volume[0].id)
+ VMList1 = Volume.list(self.apiclient, id=self.vm_d1a_volume[0].id)
self.assertNotEqual(VMList1,
- None,
- "Domain Admin is not able to list Volumes from his domain")
+ None,
+ "Domain Admin is not able to list Volumes from his domain")
self.assertEqual(len(VMList1),
1,
- "Domain Admin is not able to list Volumes from his domain")
+ "Domain Admin is not able to list Volumes from his domain")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_domainadmin_ownedbyusersinsubdomain(self):
- """
- # Domain admin should be able to list Volumes that is owned by any account in his sub-domain by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Volumes that is owned by any account in his sub-domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList2 = Volume.list(self.apiclient,id=self.vm_d12b_volume[0].id)
+ VMList2 = Volume.list(self.apiclient, id=self.vm_d12b_volume[0].id)
self.assertNotEqual(VMList2,
- None,
- "Domain Admin is not able to list Volumes from his sub domain")
+ None,
+ "Domain Admin is not able to list Volumes from his sub domain")
self.assertEqual(len(VMList2),
1,
- "Domain Admin is not able to list Volumes from his sub domain")
+ "Domain Admin is not able to list Volumes from his sub domain")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_domainadmin_ownedbyusersnotindomain(self):
- """
- # Domain admin should not be able to list Volumes that is owned by account that is not in his domain by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should not be able to list Volumes that is owned by account that is not in his domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList3 = Volume.list(self.apiclient,id=self.vm_d2_volume[0].id)
+ VMList3 = Volume.list(self.apiclient, id=self.vm_d2_volume[0].id)
self.assertEqual(VMList3,
None,
- "Domain Admin is able to list Volumes from other domains!!!")
+ "Domain Admin is able to list Volumes from other domains!!!")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_domainadmin_ownedbyusersinsubdomain2(self):
- """
- # Domain admin should be able to list Volumes that is owned by account that is in his sub domains by passing uuid in "id" parameter
- """
+ """
+ # Domain admin should be able to list Volumes that is owned by account that is in his sub domains by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- VMList4 = Volume.list(self.apiclient,id=self.vm_d111a_volume[0].id)
+ VMList4 = Volume.list(self.apiclient, id=self.vm_d111a_volume[0].id)
self.assertNotEqual(VMList4,
- None,
- "Domain Admin is not able to list Volumes from his subdomain")
+ None,
+ "Domain Admin is not able to list Volumes from his subdomain")
self.assertEqual(len(VMList4),
1,
- "Domain Admin is not able to list Volumes from his sub domains")
+ "Domain Admin is not able to list Volumes from his sub domains")
-
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_rootadmin_owns(self):
- """
- # ROOT admin should be able to list Volumes that is owned by accounts in his domain by passing uuid in "id" parameter
- """
+ """
+ # ROOT admin should be able to list Volumes that is owned by accounts in his domain by passing uuid in "id" parameter
+ """
- self.apiclient.connection.apiKey = self.user_a_apikey
+ self.apiclient.connection.apiKey = self.user_a_apikey
self.apiclient.connection.securityKey = self.user_a_secretkey
- VMList1 = Volume.list(self.apiclient,id=self.vm_a_volume[0].id)
+ VMList1 = Volume.list(self.apiclient, id=self.vm_a_volume[0].id)
self.assertNotEqual(VMList1,
- None,
- "ROOT Admin not able to list Volumes that he owns")
+ None,
+ "ROOT Admin not able to list Volumes that he owns")
self.assertEqual(len(VMList1),
1,
- "ROOT Admin not able to list Volumes that he owns")
+ "ROOT Admin not able to list Volumes that he owns")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_rootadmin_Volumesownedbyothers(self):
- """
- # ROOT admin should be able to list Volumes that is owned by any account by passing uuid in "id" parameter
- """
+ """
+ # ROOT admin should be able to list Volumes that is owned by any account by passing uuid in "id" parameter
+ """
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- VMList1 = Volume.list(self.apiclient,id=self.vm_d2_volume[0].id)
- VMList2 = Volume.list(self.apiclient,id=self.vm_d11a_volume[0].id)
+ VMList1 = Volume.list(self.apiclient, id=self.vm_d2_volume[0].id)
+ VMList2 = Volume.list(self.apiclient, id=self.vm_d11a_volume[0].id)
self.assertNotEqual(VMList1,
- None,
- "ROOT Admin not able to list Volumes from other domains")
+ None,
+ "ROOT Admin not able to list Volumes from other domains")
self.assertNotEqual(VMList2,
- None,
- "ROOT Admin not able to list Volumes from other domains")
+ None,
+ "ROOT Admin not able to list Volumes from other domains")
self.assertEqual(len(VMList1),
1,
- "ROOT Admin not able to list Volumes from other domains")
+ "ROOT Admin not able to list Volumes from other domains")
self.assertEqual(len(VMList2),
1,
- "ROOT Admin not able to list Volumes from other domains")
+ "ROOT Admin not able to list Volumes from other domains")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_user_own(self):
- """
- # Regular user should be able to list Volumes that is owned by him by passing uuid in "id" parameter
- """
+ """
+ # Regular user should be able to list Volumes that is owned by him by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- VMList1 = Volume.list(self.apiclient,id=self.vm_d11a_volume[0].id)
-
+ VMList1 = Volume.list(self.apiclient, id=self.vm_d11a_volume[0].id)
self.assertNotEqual(VMList1,
- None,
- "Regular User is not able to list Volumes that he owns")
+ None,
+ "Regular User is not able to list Volumes that he owns")
self.assertEqual(len(VMList1),
1,
- "Regular User is not able to list Volumes that he owns")
+ "Regular User is not able to list Volumes that he owns")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_user_volumefromsamedomaindifferentaccount(self):
- """
- # Regular user should not be able to list Volumes that is owned by different account in the same domain by passing uuid in "id" parameter
- """
+ """
+ # Regular user should not be able to list Volumes that is owned by different account in the same domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- VMList2 = Volume.list(self.apiclient,id=self.vm_d11b_volume[0].id)
+ VMList2 = Volume.list(self.apiclient, id=self.vm_d11b_volume[0].id)
self.assertEqual(VMList2,
None,
- "Regular User is able to list Volumes from other accounts")
+ "Regular User is able to list Volumes from other accounts")
- @attr("simulator_only", tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_user_volumefromotherdomain(self):
- """
- # Regular user should not be able to list Volumes that is owned by different account in the different domain by passing uuid in "id" parameter
- """
+ """
+ # Regular user should not be able to list Volumes that is owned by different account in the different domain by passing uuid in "id" parameter
+ """
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- VMList3 = Volume.list(self.apiclient,id=self.vm_d2_volume[0].id)
+ VMList3 = Volume.list(self.apiclient, id=self.vm_d2_volume[0].id)
self.assertEqual(VMList3,
None,
- "Regular User is able to list Volumes from other domains")
-
+ "Regular User is able to list Volumes from other domains")
@staticmethod
- def generateKeysForUser(apiclient,account):
+ def generateKeysForUser(apiclient, account):
user = User.list(
- apiclient,
- account=account.name,
- domainid=account.domainid
- )[0]
-
+ apiclient,
+ account=account.name,
+ domainid=account.domainid
+ )[0]
+
return (User.registerUserKeys(
- apiclient,
- user.id
- ))
+ apiclient,
+ user.id
+ ))
@staticmethod
- def checkForExistenceOfValue(list,attributeValue):
- if list is None:
- return False
- rowCount=len(list)
- for num in range (rowCount):
- if list[num].id == attributeValue:
- return True
- return False
-
+ def checkForExistenceOfValue(list, attributeValue):
+ if list is None:
+ return False
+ rowCount = len(list)
+ for num in range(rowCount):
+ if list[num].id == attributeValue:
+ return True
+ return False
diff --git a/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py b/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
index 09347bac6be..d59ccb6165d 100644
--- a/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
+++ b/test/integration/component/test_acl_sharednetwork_deployVM-impersonation.py
@@ -17,7 +17,7 @@
"""
Test cases for deploying Virtual Machine using impersonation (passing account and domainId parameters) for shared network
"""
-#Import Local Modules
+# Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
@@ -26,11 +26,12 @@ from marvin.lib.base import *
from marvin.lib.common import *
from marvin.cloudstackException import CloudstackAclException
from nose.plugins.attrib import attr
-#Import System modules
+# Import System modules
import time
_multiprocess_shared_ = True
+
class TestSharedNetworkImpersonation(cloudstackTestCase):
@classmethod
@@ -52,281 +53,279 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
"""
- cls.testclient = super(TestSharedNetworkImpersonation, cls).getClsTestClient()
+ cls.testclient = super(TestSharedNetworkImpersonation, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
- cls.testdata = cls.testClient.getParsedTestDataConfig()
- cls.acldata = cls.testdata["acl"]
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+ cls.acldata = cls.testdata["acl"]
- cls.domain_1 = None
- cls.domain_2 = None
- cleanup = []
+ cls.domain_1 = None
+ cls.domain_2 = None
+ cleanup = []
- try:
+ try:
# backup default apikey and secretkey
cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey
-
+
# Create domains
cls.domain_1 = Domain.create(
- cls.apiclient,
- cls.acldata["domain1"]
- )
+ cls.apiclient,
+ cls.acldata["domain1"]
+ )
cls.domain_11 = Domain.create(
- cls.apiclient,
- cls.acldata["domain11"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain11"],
+ parentdomainid=cls.domain_1.id
+ )
cls.domain_111 = Domain.create(
- cls.apiclient,
- cls.acldata["domain111"],
- parentdomainid=cls.domain_11.id,
- )
+ cls.apiclient,
+ cls.acldata["domain111"],
+ parentdomainid=cls.domain_11.id,
+ )
cls.domain_12 = Domain.create(
- cls.apiclient,
- cls.acldata["domain12"],
- parentdomainid=cls.domain_1.id
- )
+ cls.apiclient,
+ cls.acldata["domain12"],
+ parentdomainid=cls.domain_1.id
+ )
cls.domain_2 = Domain.create(
- cls.apiclient,
- cls.acldata["domain2"]
- )
+ cls.apiclient,
+ cls.acldata["domain2"]
+ )
# Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create(
- cls.apiclient,
- cls.acldata["accountD1"],
- admin=True,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
+ cls.apiclient,
+ cls.acldata["accountD1"],
+ admin=True,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1)
cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey
-
+
cls.account_d1a = Account.create(
- cls.apiclient,
- cls.acldata["accountD1A"],
- admin=False,
- domainid=cls.domain_1.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
+ cls.apiclient,
+ cls.acldata["accountD1A"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1a)
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
-
-
+
cls.account_d1b = Account.create(
- cls.apiclient,
- cls.acldata["accountD1B"],
- admin=False,
- domainid=cls.domain_1.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
+ cls.apiclient,
+ cls.acldata["accountD1B"],
+ admin=False,
+ domainid=cls.domain_1.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d1b)
cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey
-
+
# Create 1 admin and 2 user accounts for doamin_11
cls.account_d11 = Account.create(
- cls.apiclient,
- cls.acldata["accountD11"],
- admin=True,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
+ cls.apiclient,
+ cls.acldata["accountD11"],
+ admin=True,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11)
cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey
-
+
cls.account_d11a = Account.create(
- cls.apiclient,
- cls.acldata["accountD11A"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
+ cls.apiclient,
+ cls.acldata["accountD11A"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11a)
cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey
-
+
cls.account_d11b = Account.create(
- cls.apiclient,
- cls.acldata["accountD11B"],
- admin=False,
- domainid=cls.domain_11.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
+ cls.apiclient,
+ cls.acldata["accountD11B"],
+ admin=False,
+ domainid=cls.domain_11.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d11b)
cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey
-
+
# Create 2 user accounts and 1 admin account for doamin_111
-
+
cls.account_d111 = Account.create(
- cls.apiclient,
- cls.acldata["accountD111"],
- admin=True,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
+ cls.apiclient,
+ cls.acldata["accountD111"],
+ admin=True,
+ domainid=cls.domain_111.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111)
cls.user_d111_apikey = user.apikey
cls.user_d111_secretkey = user.secretkey
-
+
cls.account_d111a = Account.create(
- cls.apiclient,
- cls.acldata["accountD111A"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
+ cls.apiclient,
+ cls.acldata["accountD111A"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111a)
cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey
-
+
cls.account_d111b = Account.create(
- cls.apiclient,
- cls.acldata["accountD111B"],
- admin=False,
- domainid=cls.domain_111.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
+ cls.apiclient,
+ cls.acldata["accountD111B"],
+ admin=False,
+ domainid=cls.domain_111.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d111b)
cls.user_d111b_apikey = user.apikey
cls.user_d111b_secretkey = user.secretkey
-
+
# Create 2 user accounts for doamin_12
cls.account_d12a = Account.create(
- cls.apiclient,
- cls.acldata["accountD12A"],
- admin=False,
- domainid=cls.domain_12.id
- )
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
+ cls.apiclient,
+ cls.acldata["accountD12A"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12a)
cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey
-
+
cls.account_d12b = Account.create(
- cls.apiclient,
- cls.acldata["accountD12B"],
- admin=False,
- domainid=cls.domain_12.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
+ cls.apiclient,
+ cls.acldata["accountD12B"],
+ admin=False,
+ domainid=cls.domain_12.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d12b)
cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey
-
+
# Create 1 user account for domain_2
-
+
cls.account_d2a = Account.create(
- cls.apiclient,
- cls.acldata["accountD2"],
- admin=False,
- domainid=cls.domain_2.id
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
+ cls.apiclient,
+ cls.acldata["accountD2"],
+ admin=False,
+ domainid=cls.domain_2.id
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_d2a)
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
-
-
+
# Create 1 user account and admin account in "ROOT" domain
-
+
cls.account_roota = Account.create(
- cls.apiclient,
- cls.acldata["accountROOTA"],
- admin=False,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
+ cls.apiclient,
+ cls.acldata["accountROOTA"],
+ admin=False,
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_roota)
cls.user_roota_apikey = user.apikey
cls.user_roota_secretkey = user.secretkey
-
+
cls.account_root = Account.create(
- cls.apiclient,
- cls.acldata["accountROOTA"],
- admin=True,
- )
-
- user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
+ cls.apiclient,
+ cls.acldata["accountROOTA"],
+ admin=True,
+ )
+
+ user = cls.generateKeysForUser(cls.apiclient, cls.account_root)
cls.user_root_apikey = user.apikey
cls.user_root_secretkey = user.secretkey
-
+
# create service offering
cls.service_offering = ServiceOffering.create(
- cls.apiclient,
- cls.acldata["service_offering"]["small"]
- )
- cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
+ cls.apiclient,
+ cls.acldata["service_offering"]["small"]
+ )
+ cls.zone = get_zone(cls.apiclient, cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
-
- ## As admin user , create shared network with scope "all","domain" with subdomain access , "domain" without subdomain access and "account"
-
- cls.apiclient.connection.apiKey = cls.default_apikey
- cls.apiclient.connection.securityKey = cls.default_secretkey
-
- list_shared_network_offerings_response = NetworkOffering.list(
- cls.apiclient,
- name="DefaultSharedNetworkOffering",
- displayText="Offering for Shared networks"
- )
- #Override name parameter so that there is no overlap with names being used in other shared network test suites
- cls.acldata["network_all"]["name"]=cls.acldata["network_all"]["name"]+"-impersonation"
- cls.acldata["network_domain_with_no_subdomain_access"]["name"]=cls.acldata["network_domain_with_no_subdomain_access"]["name"]+"-impersonation"
- cls.acldata["network_domain_with_subdomain_access"]["name"]=cls.acldata["network_domain_with_subdomain_access"]["name"]+"-impersonation"
- cls.acldata["network_account"]["name"]=cls.acldata["network_account"]["name"]+"-impersonation"
- cls.shared_network_offering_id = list_shared_network_offerings_response[0].id
+ ## As admin user , create shared network with scope "all","domain" with subdomain access , "domain" without subdomain access and "account"
+
+ cls.apiclient.connection.apiKey = cls.default_apikey
+ cls.apiclient.connection.securityKey = cls.default_secretkey
+
+ list_shared_network_offerings_response = NetworkOffering.list(
+ cls.apiclient,
+ name="DefaultSharedNetworkOffering",
+ displayText="Offering for Shared networks"
+ )
+ # Override name parameter so that there is no overlap with names being used in other shared network test suites
+ cls.acldata["network_all"]["name"] = cls.acldata["network_all"]["name"] + "-impersonation"
+ cls.acldata["network_domain_with_no_subdomain_access"]["name"] = cls.acldata["network_domain_with_no_subdomain_access"]["name"] + "-impersonation"
+ cls.acldata["network_domain_with_subdomain_access"]["name"] = cls.acldata["network_domain_with_subdomain_access"]["name"] + "-impersonation"
+ cls.acldata["network_account"]["name"] = cls.acldata["network_account"]["name"] + "-impersonation"
+
+ cls.shared_network_offering_id = list_shared_network_offerings_response[0].id
cls.shared_network_all = Network.create(
- cls.apiclient,
- cls.acldata["network_all"],
- networkofferingid=cls.shared_network_offering_id,
- zoneid=cls.zone.id
- )
-
- cls.shared_network_domain_d11 = Network.create(
- cls.apiclient,
- cls.acldata["network_domain_with_no_subdomain_access"],
- networkofferingid=cls.shared_network_offering_id,
- zoneid=cls.zone.id,
- domainid=cls.domain_11.id,
- subdomainaccess=False
- )
-
- cls.shared_network_domain_with_subdomain_d11 = Network.create(
- cls.apiclient,
- cls.acldata["network_domain_with_subdomain_access"],
- networkofferingid=cls.shared_network_offering_id,
- zoneid=cls.zone.id,
- domainid=cls.domain_11.id,
- subdomainaccess=True
- )
-
- cls.shared_network_account_d111a = Network.create(
- cls.apiclient,
- cls.acldata["network_account"],
- networkofferingid=cls.shared_network_offering_id,
- zoneid=cls.zone.id,
- domainid=cls.domain_111.id,
- accountid=cls.account_d111a.user[0].username
- )
- cls.vmdata = {"name": "test",
- "displayname" : "test"
- }
-
+ cls.apiclient,
+ cls.acldata["network_all"],
+ networkofferingid=cls.shared_network_offering_id,
+ zoneid=cls.zone.id
+ )
+
+ cls.shared_network_domain_d11 = Network.create(
+ cls.apiclient,
+ cls.acldata["network_domain_with_no_subdomain_access"],
+ networkofferingid=cls.shared_network_offering_id,
+ zoneid=cls.zone.id,
+ domainid=cls.domain_11.id,
+ subdomainaccess=False
+ )
+
+ cls.shared_network_domain_with_subdomain_d11 = Network.create(
+ cls.apiclient,
+ cls.acldata["network_domain_with_subdomain_access"],
+ networkofferingid=cls.shared_network_offering_id,
+ zoneid=cls.zone.id,
+ domainid=cls.domain_11.id,
+ subdomainaccess=True
+ )
+
+ cls.shared_network_account_d111a = Network.create(
+ cls.apiclient,
+ cls.acldata["network_account"],
+ networkofferingid=cls.shared_network_offering_id,
+ zoneid=cls.zone.id,
+ domainid=cls.domain_111.id,
+ accountid=cls.account_d111a.user[0].username
+ )
+ cls.vmdata = {"name": "test",
+ "displayname": "test"
+ }
+
cls.cleanup = [
- cls.account_root,
- cls.account_roota,
- cls.shared_network_all,
- cls.service_offering,
- ]
+ cls.account_root,
+ cls.account_roota,
+ cls.shared_network_all,
+ cls.service_offering,
+ ]
except Exception as e:
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cls.domain_2.delete(cls.apiclient,cleanup="true")
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
cls.apiclient = super(TestSharedNetworkImpersonation, cls).getClsTestClient().getApiClient()
cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey
- cls.domain_1.delete(cls.apiclient,cleanup="true")
- cls.domain_2.delete(cls.apiclient,cleanup="true")
+ cls.domain_1.delete(cls.apiclient, cleanup="true")
+ cls.domain_2.delete(cls.apiclient, cleanup="true")
cleanup_resources(cls.apiclient, cls.cleanup)
return
@@ -340,20 +339,20 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
cls.apiclient.connection.securityKey = cls.default_secretkey
return
-## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=all
+ ## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=all
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_domainuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for other users in a shared network with scope=all
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for other users in a shared network with scope=all
+ """
# Deploy VM for a user in a domain under ROOT as admin
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-all-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-all-root-admin"
+ self.vmdata["name"] = self.acldata["vmD1A"]["name"] + "-shared-scope-all-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] + "-shared-scope-all-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -361,28 +360,27 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
- True,
- "ROOT admin is not able to deploy a VM for other users in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for other users in a shared network with scope=all")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_domainadminuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for a domain admin users in a shared network with scope=all
+ """
+ Valiate that ROOT admin is able to deploy a VM for a domain admin users in a shared network with scope=all
- """
+ """
# Deploy VM for an admin user in a domain under ROOT as admin
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-all-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-all-root-admin"
+ self.vmdata["name"] = self.acldata["vmD1"]["name"] + "-shared-scope-all-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] + "-shared-scope-all-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -390,110 +388,109 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d1.name,
- domainid=self.account_d1.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d1.name,
+ domainid=self.account_d1.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d1.name and vm.domainid == self.account_d1.domainid,
- True,
- "ROOT admin is not able to deploy a VM for a domain admin users in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d1.name and vm.domainid == self.account_d1.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for a domain admin users in a shared network with scope=all")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_subdomainuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for any user in a subdomain in a shared network with scope=all
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for any user in a subdomain in a shared network with scope=all
+ """
# Deploy VM as user in a subdomain under ROOT
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-all-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-all-root-admin"
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-all-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-all-root-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "ROOT admin is not able to deploy a VM for any user in a subdomain in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for any user in a subdomain in a shared network with scope=all")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_subdomainadminuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for admin user in a domain in a shared network with scope=all
+ """
+ Valiate that ROOT admin is able to deploy a VM for admin user in a domain in a shared network with scope=all
- """
- #Deploy VM as an admin user in a subdomain under ROOT
+ """
+ # Deploy VM as an admin user in a subdomain under ROOT
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-all-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] +"-shared-scope-all-root-admin"
+ self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-all-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] + "-shared-scope-all-root-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d11.name,
- domainid=self.account_d11.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d11.name,
+ domainid=self.account_d11.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
- True,
- "ROOT admin is not able to deploy a VM for admin user in a domain in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for admin user in a domain in a shared network with scope=all")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_ROOTuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for user in ROOT domain in a shared network with scope=all
+ """
+ Valiate that ROOT admin is able to deploy a VM for user in ROOT domain in a shared network with scope=all
- """
- #Deploy VM as user in ROOT domain
+ """
+ # Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-all-root-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-all-root-admin"
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-all-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-all-root-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_roota.name and vm.domainid == self.account_roota.domainid,
- True,
- "ROOT admin is not able to deploy a VM for user in ROOT domain in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_roota.name and vm.domainid == self.account_roota.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for user in ROOT domain in a shared network with scope=all")
-## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=Domain and no subdomain access
+ ## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=Domain and no subdomain access
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_domainuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for domain user in a shared network with scope=domain with no subdomain access
+ """
+ Valiate that ROOT admin is able to deploy a VM for domain user in a shared network with scope=domain with no subdomain access
- """
+ """
# Deploy VM as user in a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -501,28 +498,27 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "ROOT admin is not able to deploy a VM for domain user in a shared network with scope=domain with no subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for domain user in a shared network with scope=domain with no subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_domainadminuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for domain admin user in a shared network with scope=domain with no subdomain access
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for domain admin user in a shared network with scope=domain with no subdomain access
+ """
# Deploy VM as an admin user in a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -530,180 +526,180 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d11.name,
- domainid=self.account_d11.domainid
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d11.name,
+ domainid=self.account_d11.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
- True,
- "ROOT admin is not able to deploy a VM for domain admin user in a shared network with scope=domain with no subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for domain admin user in a shared network with scope=domain with no subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_subdomainuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for sub domain user in a shared network with scope=domain with no subdomain access
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for sub domain user in a shared network with scope=domain with no subdomain access
- """
+ """
# Deploy VM as user in a subdomain under a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d111a.name,
- domainid=self.account_d111a.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for sub domain user in a shared network with scope=domain with no subdomain access")
-
- except Exception as e:
- self.debug ("When a user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for sub domain user in a shared network with scope=domain with no subdomain access ")
+ self.vmdata["name"] = self.acldata["vmD111A"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d111a.name,
+ domainid=self.account_d111a.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for sub domain user in a shared network with scope=domain with no subdomain access")
+ except Exception as e:
+ self.debug("When a user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for sub domain user in a shared network with scope=domain with no subdomain access ")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_subdomainadminuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for sub domain admin user in a shared network with scope=domain with no subdomain access
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for sub domain admin user in a shared network with scope=domain with no subdomain access
+ """
# Deploy VM as an admin user in a subdomain under a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d111.name,
- domainid=self.account_d111.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for sub domain admin user in a shared network with scope=domain with no subdomain access")
- except Exception as e:
- self.debug ("When a admin user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for sub domain admin user in a shared network with scope=domain with no subdomain access")
+ self.vmdata["name"] = self.acldata["vmD111"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d111.name,
+ domainid=self.account_d111.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for sub domain admin user in a shared network with scope=domain with no subdomain access")
+ except Exception as e:
+ self.debug("When a admin user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for sub domain admin user in a shared network with scope=domain with no subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_parentdomainuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for parent domain user in a shared network with scope=domain with no subdomain access
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for parent domain user in a shared network with scope=domain with no subdomain access
- """
+ """
# Deploy VM as user in parentdomain of a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD1A"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
- )
- self.fail(" ROOT admin is able to deploy a VM for parent domain user in a shared network with scope=domain with no subdomain access")
- except Exception as e:
- self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for parent domain user in a shared network with scope=domain with no subdomain access")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
+ )
+ self.fail(" ROOT admin is able to deploy a VM for parent domain user in a shared network with scope=domain with no subdomain access")
+ except Exception as e:
+ self.debug("When a user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for parent domain user in a shared network with scope=domain with no subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_parentdomainadminuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access
+ """
# Deploy VM as an admin user in parentdomain of a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD1"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d1.name,
- domainid=self.account_d1.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access")
- except Exception as e:
- self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access ")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d1.name,
+ domainid=self.account_d1.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access")
+ except Exception as e:
+ self.debug("When an admin user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access ")
-
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_ROOTuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access
+ """
# Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access")
- except Exception as e:
- self.debug ("When a regular user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access")
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-root-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access")
+ except Exception as e:
+ self.debug("When a regular user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for parent domain admin user in a shared network with scope=domain with no subdomain access")
-## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=Domain and with subdomain access
+ ## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=Domain and with subdomain access
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_domainuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for domain user in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for domain user in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as user in a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -711,28 +707,27 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "ROOT admin is NOT able to deploy a VM for domain user in a shared network with scope=domain with subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "ROOT admin is NOT able to deploy a VM for domain user in a shared network with scope=domain with subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_domainadminuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for domain admin user in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for domain admin user in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as an admin user in a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -740,231 +735,233 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d11.name,
- domainid=self.account_d11.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d11.name,
+ domainid=self.account_d11.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
- True,
- "ROOT admin is not able to deploy a VM for domain admin user in a shared network with scope=domain with subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for domain admin user in a shared network with scope=domain with subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_subdomainuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for subdomain user in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for subdomain user in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as user in a subdomain under a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD111A"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d111a.name,
- domainid=self.account_d111a.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d111a.name,
+ domainid=self.account_d111a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
- True,
- "ROOT admin is not able to deploy a VM for subdomain user in a shared network with scope=domain with subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for subdomain user in a shared network with scope=domain with subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_subdomainadminuser(self):
- """
- Valiate that ROOT admin is able to deploy a VM for subdomain admin user in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for subdomain admin user in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as an admin user in a subdomain under a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD111"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d111.name,
- domainid=self.account_d111.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d111.name,
+ domainid=self.account_d111.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d111.name and vm.domainid == self.account_d111.domainid,
- True,
- "ROOT admin is not able to deploy a VM for subdomain admin user in a shared network with scope=domain with subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d111.name and vm.domainid == self.account_d111.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for subdomain admin user in a shared network with scope=domain with subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_parentdomainuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for parent domain user in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for parent domain user in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as user in parentdomain of a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
- )
- self.fail("ROOT admin is NOT able to deploy a VM for parent domain user in a shared network with scope=domain with subdomain access")
- except Exception as e:
- self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for parent domain user in a shared network with scope=domain with subdomain access ")
+ self.vmdata["name"] = self.acldata["vmD1A"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
+ )
+ self.fail("ROOT admin is NOT able to deploy a VM for parent domain user in a shared network with scope=domain with subdomain access")
+ except Exception as e:
+ self.debug("When a user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for parent domain user in a shared network with scope=domain with subdomain access ")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_parentdomainadminuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as an admin user in parentdomain of a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD1"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d1.name,
- domainid=self.account_d1.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for parent domain admin user in a shared network with scope=domain with subdomain access ")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d1.name,
+ domainid=self.account_d1.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for parent domain admin user in a shared network with scope=domain with subdomain access ")
except Exception as e:
- self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for parent domain admin user in a shared network with scope=domain with subdomain access ")
+ self.debug("When an admin user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for parent domain admin user in a shared network with scope=domain with subdomain access ")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_ROOTuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=domain with subdomain access
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=domain with subdomain access
+ """
# Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.user_roota_apikey
+ self.apiclient.connection.apiKey = self.user_roota_apikey
self.apiclient.connection.securityKey = self.user_roota_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for user in ROOT domain in a shared network with scope=domain with subdomain access")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for user in ROOT domain in a shared network with scope=domain with subdomain access")
except Exception as e:
- self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for user in ROOT domain in a shared network with scope=domain with subdomain access")
+ self.debug("When a user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for user in ROOT domain in a shared network with scope=domain with subdomain access")
+ ## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=account
-## Test cases relating to deploying Virtual Machine as ROOT admin for other users in shared network with scope=account
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_domainuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for user in the same domain but in a different account in a shared network with scope=account
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for user in the same domain but in a different account in a shared network with scope=account
+ """
# Deploy VM as user in a domain under the same domain but different account from the account that has a shared network with scope=account
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111B"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111B"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d111b.name,
- domainid=self.account_d111b.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for user in the same domain but in a different account in a shared network with scope=account")
+ self.vmdata["name"] = self.acldata["vmD111B"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111B"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d111b.name,
+ domainid=self.account_d111b.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for user in the same domain but in a different account in a shared network with scope=account")
except Exception as e:
- self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for user in the same domain but in a different account in a shared network with scope=account")
+ self.debug("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for user in the same domain but in a different account in a shared network with scope=account")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_domainadminuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for admin user in the same domain but in a different account in a shared network with scope=account
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for admin user in the same domain but in a different account in a shared network with scope=account
- """
+ """
# Deploy VM as admin user for a domain that has an account with shared network with scope=account
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d111.name,
- domainid=self.account_d111.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for admin user in the same domain but in a different account in a shared network with scope=account")
+ self.vmdata["name"] = self.acldata["vmD111"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d111.name,
+ domainid=self.account_d111.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for admin user in the same domain but in a different account in a shared network with scope=account")
except Exception as e:
- self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for admin user in the same domain but in a different account in a shared network with scope=account")
+ self.debug("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for admin user in the same domain but in a different account in a shared network with scope=account")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_user(self):
- """
- Valiate that ROOT admin is able to deploy a VM for regular user in a shared network with scope=account
- """
+ """
+ Valiate that ROOT admin is able to deploy a VM for regular user in a shared network with scope=account
+ """
# Deploy VM as account with shared network with scope=account
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["name"] = self.acldata["vmD111A"]["name"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-root-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -972,87 +969,88 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d111a.name,
- domainid=self.account_d111a.domainid
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d111a.name,
+ domainid=self.account_d111a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
- True,
- "ROOT admin is not able to deploy a VM for regular user in a shared network with scope=account")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
+ True,
+ "ROOT admin is not able to deploy a VM for regular user in a shared network with scope=account")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_differentdomain(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to
+ """
# Deploy VM as an admin user in a subdomain under ROOT
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmD2A"]["name"] +"-shared-scope-account-root-admin"
- self.vmdata["displayname"] = self.acldata["vmD2A"]["displayname"] +"-shared-scope-account-root-admin"
+ self.vmdata["name"] = self.acldata["vmD2A"]["name"] + "-shared-scope-account-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmD2A"]["displayname"] + "-shared-scope-account-root-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to")
except Exception as e:
- self.debug ("account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to ")
+ self.debug("account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for a admin user in a shared network with scope=account which the admin user does not have access to ")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_ROOTuser(self):
- """
- Valiate that ROOT admin is NOT able to deploy a VM for a user in ROOT domain in a shared network with scope=account which the user does not have access to
- """
+ """
+ Valiate that ROOT admin is NOT able to deploy a VM for a user in ROOT domain in a shared network with scope=account which the user does not have access to
+ """
# Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.default_apikey
+ self.apiclient.connection.apiKey = self.default_apikey
self.apiclient.connection.securityKey = self.default_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-account-root-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-account-root-admin"
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-account-root-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-account-root-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("ROOT admin is able to deploy a VM for a user in ROOT domain in a shared network with scope=account which the user does not have access to")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("ROOT admin is able to deploy a VM for a user in ROOT domain in a shared network with scope=account which the user does not have access to")
except Exception as e:
- self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when ROOT admin tries to deploy a VM for a user in ROOT domain in a shared network with scope=account which the user does not have access to ")
+ self.debug("When a user from ROOT domain deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail(
+ "Error message validation failed when ROOT admin tries to deploy a VM for a user in ROOT domain in a shared network with scope=account which the user does not have access to ")
-## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=all
+ ## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=all
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_domainuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for a domain user in a shared network with scope=all
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for a domain user in a shared network with scope=all
+ """
# Deploy VM for a user in a domain under ROOT as admin
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-all-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-all-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD1A"]["name"] + "-shared-scope-all-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] + "-shared-scope-all-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1060,27 +1058,26 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
- True,
- "Domain admin is not able to deploy a VM for a domain user in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d1a.name and vm.domainid == self.account_d1a.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for a domain user in a shared network with scope=all")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_domainadminuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for a domain admin user in a shared network with scope=all
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for a domain admin user in a shared network with scope=all
+ """
# Deploy VM for an admin user in a domain under ROOT as admin
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-all-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-all-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD1"]["name"] + "-shared-scope-all-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] + "-shared-scope-all-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1088,138 +1085,137 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d1.name,
- domainid=self.account_d1.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d1.name,
+ domainid=self.account_d1.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d1.name and vm.domainid == self.account_d1.domainid,
- True,
- "Domain admin is not able to deploy a VM for a domain admin user in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d1.name and vm.domainid == self.account_d1.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for a domain admin user in a shared network with scope=all")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_subdomainuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for a sub domain user in a shared network with scope=all
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for a sub domain user in a shared network with scope=all
+ """
# Deploy VM as user in a subdomain under ROOT
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-all-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-all-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-all-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-all-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "Domain admin is not able to deploy a VM for a sub domain user in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for a sub domain user in a shared network with scope=all")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_subdomainadminuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for a sub domain admin user in a shared network with scope=all
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for a sub domain admin user in a shared network with scope=all
+ """
# Deploy VM as an admin user in a subdomain under ROOT
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-all-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] +"-shared-scope-all-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-all-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] + "-shared-scope-all-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d11.name,
- domainid=self.account_d11.domainid
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d11.name,
+ domainid=self.account_d11.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
- True,
- "Domain admin is not able to deploy a VM for a sub domain admin user in a shared network with scope=all")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for a sub domain admin user in a shared network with scope=all")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_ROOTuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=all
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=all
+ """
# Deploy VM as user in ROOT domain
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-all"
self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-all"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=all")
- except Exception as e:
- self.debug ("When a Domain admin user deploys a VM for ROOT user in a shared network with scope=all %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=all")
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_all.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=all")
+ except Exception as e:
+ self.debug("When a Domain admin user deploys a VM for ROOT user in a shared network with scope=all %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail("Error message validation failed when Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=all")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_crossdomainuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for user in other domain in a shared network with scope=all
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for user in other domain in a shared network with scope=all
+ """
# Deploy VM as user in ROOT domain
self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-all"
self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-all"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("Domain admin user is able to Deploy VM for a domain user he does not have access to in a shared network with scope=domain with no subdomain access ")
- except Exception as e:
- self.debug ("When a Domain admin user deploys a VM for a domain user he does not have access to in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error mesage validation failed when Domain admin user tries to Deploy VM for a domain user he does not have access to in a shared network with scope=domain with no subdomain access ")
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.fail("Domain admin user is able to Deploy VM for a domain user he does not have access to in a shared network with scope=domain with no subdomain access ")
+ except Exception as e:
+ self.debug("When a Domain admin user deploys a VM for a domain user he does not have access to in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail(
+ "Error mesage validation failed when Domain admin user tries to Deploy VM for a domain user he does not have access to in a shared network with scope=domain with no subdomain access ")
-## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=Domain and no subdomain access
+ ## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=Domain and no subdomain access
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_domainuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for domain user in a shared network with scope=Domain and no subdomain access
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for domain user in a shared network with scope=Domain and no subdomain access
+ """
# Deploy VM as user in a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1227,28 +1223,27 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "Domain admin is not able to deploy a VM for domain user in a shared network with scope=Domain and no subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for domain user in a shared network with scope=Domain and no subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_domainadminuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for domain admin user in a shared network with scope=Domain and no subdomain access
+ """
+ Valiate that Domain admin is able to deploy a VM for domain admin user in a shared network with scope=Domain and no subdomain access
- """
+ """
# Deploy VM as an admin user in a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1256,179 +1251,177 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d11.name,
- domainid=self.account_d11.domainid
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d11.name,
+ domainid=self.account_d11.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
- True,
- "Admin User in a domain that has a shared network with no subdomain access failed to Deploy VM in a shared network with scope=domain with no subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
+ True,
+ "Admin User in a domain that has a shared network with no subdomain access failed to Deploy VM in a shared network with scope=domain with no subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_subdomainuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for sub domain user in a shared network with scope=Domain and no subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for sub domain user in a shared network with scope=Domain and no subdomain access
+ """
# Deploy VM as user in a subdomain under a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d111a.name,
- domainid=self.account_d111a.domainid
- )
- self.fail("Domain admin is able to deploy a VM for sub domain user in a shared network with scope=Domain and no subdomain access")
- except Exception as e:
- self.debug ("When a user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for sub domain user in a shared network with scope=Domain and no subdomain access")
+ self.vmdata["name"] = self.acldata["vmD111A"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d111a.name,
+ domainid=self.account_d111a.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for sub domain user in a shared network with scope=Domain and no subdomain access")
+ except Exception as e:
+ self.debug("When a user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for sub domain user in a shared network with scope=Domain and no subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_subdomainadminuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for sub domain admin user in a shared network with scope=Domain and no subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for sub domain admin user in a shared network with scope=Domain and no subdomain access
+ """
# Deploy VM as an admin user in a subdomain under a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d111.name,
- domainid=self.account_d111.domainid
- )
- self.fail("Domain admin is able to deploy a VM for sub domain admin user in a shared network with scope=Domain and no subdomain access")
- except Exception as e:
- self.debug ("When a admin user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for sub domain admin user in a shared network with scope=Domain and no subdomain access ")
+ self.vmdata["name"] = self.acldata["vmD111"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d111.name,
+ domainid=self.account_d111.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for sub domain admin user in a shared network with scope=Domain and no subdomain access")
+ except Exception as e:
+ self.debug("When a admin user from a subdomain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for sub domain admin user in a shared network with scope=Domain and no subdomain access ")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_parentdomainuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for parent domain user in a shared network with scope=Domain and no subdomain access
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for parent domain user in a shared network with scope=Domain and no subdomain access
- """
+ """
# Deploy VM as user in parentdomain of a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD1A"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
- )
- self.fail("Domain admin is able to deploy a VM for parent domain user in a shared network with scope=Domain and no subdomain access")
- except Exception as e:
- self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for parent domain user in a shared network with scope=Domain and no subdomain access ")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for parent domain user in a shared network with scope=Domain and no subdomain access")
+ except Exception as e:
+ self.debug("When a user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for parent domain user in a shared network with scope=Domain and no subdomain access ")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_parentdomainadminuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=Domain and no subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for parent domain admin user in a shared network with scope=Domain and no subdomain access
+ """
# Deploy VM as an admin user in parentdomain of a domain that has shared network with no subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD1"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_d1.name,
- domainid=self.account_d1.domainid
- )
- self.fail("Domain admin is able to deploy a VM for parent domain admin user in a shared network with scope=Domain and no subdomain access")
- except Exception as e:
- self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for parent domain admin user in a shared network with scope=Domain and no subdomain access ")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_d1.name,
+ domainid=self.account_d1.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for parent domain admin user in a shared network with scope=Domain and no subdomain access")
+ except Exception as e:
+ self.debug("When an admin user from parent domain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for parent domain admin user in a shared network with scope=Domain and no subdomain access ")
-
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_ROOTuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and no subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and no subdomain access
+ """
# Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_d11.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("Domain admin is able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and no subdomain access")
- except Exception as e:
- self.debug ("When a regular user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for user in ROOT domain in a shared network with scope=Domain and no subdomain access")
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-nosubdomainaccess-domain-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_d11.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and no subdomain access")
+ except Exception as e:
+ self.debug("When a regular user from ROOT domain deploys a VM in a shared network with scope=domain with no subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for user in ROOT domain in a shared network with scope=Domain and no subdomain access")
+ ## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=Domain and with subdomain access
-
-## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=Domain and with subdomain access
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_domainuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for regular user in domain in a shared network with scope=Domain and subdomain access
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for regular user in domain in a shared network with scope=Domain and subdomain access
+ """
# Deploy VM as user in a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1436,27 +1429,26 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d11a.name,
- domainid=self.account_d11a.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d11a.name,
+ domainid=self.account_d11a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
- True,
- "Domain admin is not able to deploy a VM for regular user in domain in a shared network with scope=Domain and subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11a.name and vm.domainid == self.account_d11a.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for regular user in domain in a shared network with scope=Domain and subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_domainadminuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for admin user in domain in a shared network with scope=Domain and subdomain access
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for admin user in domain in a shared network with scope=Domain and subdomain access
+ """
# Deploy VM as an admin user in a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD11"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD11"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1464,225 +1456,226 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d11.name,
- domainid=self.account_d11.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d11.name,
+ domainid=self.account_d11.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
- True,
- "Domain admin is not able to deploy a VM for admin user in domain in a shared network with scope=Domain and subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d11.name and vm.domainid == self.account_d11.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for admin user in domain in a shared network with scope=Domain and subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_subdomainuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for regular user in subdomain in a shared network with scope=Domain and subdomain access
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for regular user in subdomain in a shared network with scope=Domain and subdomain access
+ """
# Deploy VM as user in a subdomain under a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD111A"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d111a.name,
- domainid=self.account_d111a.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d111a.name,
+ domainid=self.account_d111a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
- True,
- "Domain admin is not able to deploy a VM for regular user in subdomain in a shared network with scope=Domain and subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for regular user in subdomain in a shared network with scope=Domain and subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_subdomainadminuser(self):
- """
- Valiate that Domain admin is able to deploy a VM for admin user in subdomain in a shared network with scope=Domain and subdomain access
- """
-
+ """
+ Valiate that Domain admin is able to deploy a VM for admin user in subdomain in a shared network with scope=Domain and subdomain access
+ """
+
# Deploy VM as an admin user in a subdomain under a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD111"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
self.vmdata,
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d111.name,
- domainid=self.account_d111.domainid
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d111.name,
+ domainid=self.account_d111.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d111.name and vm.domainid == self.account_d111.domainid,
- True,
- "Domain admin is not able to deploy a VM for admin user in subdomain in a shared network with scope=Domain and subdomain access")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d111.name and vm.domainid == self.account_d111.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for admin user in subdomain in a shared network with scope=Domain and subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_parentdomainuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for regular user in parent domain in a shared network with scope=Domain and subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for regular user in parent domain in a shared network with scope=Domain and subdomain access
+ """
# Deploy VM as user in parentdomain of a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD1A"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d1a.name,
- domainid=self.account_d1a.domainid
- )
- self.fail(" Domain admin is able to deploy a VM for regular user in parent domain in a shared network with scope=Domain and subdomain access")
- except Exception as e:
- self.debug ("When a user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for regular user in parent domain in a shared network with scope=Domain and subdomain access")
+ self.vmdata["name"] = self.acldata["vmD1A"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d1a.name,
+ domainid=self.account_d1a.domainid
+ )
+ self.fail(" Domain admin is able to deploy a VM for regular user in parent domain in a shared network with scope=Domain and subdomain access")
+ except Exception as e:
+ self.debug("When a user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for regular user in parent domain in a shared network with scope=Domain and subdomain access")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_parentdomainadminuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for admin user in parent domain in a shared network with scope=Domain and subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for admin user in parent domain in a shared network with scope=Domain and subdomain access
+ """
# Deploy VM as an admin user in parentdomain of a domain that has shared network with subdomain access
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD1"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD1"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD1"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_d1.name,
- domainid=self.account_d1.domainid
- )
- self.fail("Domain admin is able to deploy a VM for admin user in parent domain in a shared network with scope=Domain and subdomain access")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_d1.name,
+ domainid=self.account_d1.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for admin user in parent domain in a shared network with scope=Domain and subdomain access")
except Exception as e:
- self.debug ("When an admin user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for admin user in parent domain in a shared network with scope=Domain and subdomain access")
+ self.debug("When an admin user from parent domain deploys a VM in a shared network with scope=domain with subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NOT_AVAILABLE_IN_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for admin user in parent domain in a shared network with scope=Domain and subdomain access")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_ROOTuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and subdomain access
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and subdomain access
+ """
# Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_domain_with_subdomain_d11.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("Domain admin is able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and subdomain access")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_domain_with_subdomain_d11.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for user in ROOT domain in a shared network with scope=Domain and subdomain access")
except Exception as e:
- self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for user in ROOT domain in a shared network with scope=Domain and subdomain access")
+ self.debug("When a user from ROOT domain deploys a VM in a shared network with scope=domain with subdomain access %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for user in ROOT domain in a shared network with scope=Domain and subdomain access")
+ ## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=account
-## Test cases relating to deploying Virtual Machine as Domain admin for other users in shared network with scope=account
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_domainuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account
+ """
# Deploy VM as user in a domain under the same domain but different account from the acount that has a shared network with scope=account
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111B"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111B"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d111b.name,
- domainid=self.account_d111b.domainid
- )
- self.fail("Domain admin is able to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
+ self.vmdata["name"] = self.acldata["vmD111B"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111B"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d111b.name,
+ domainid=self.account_d111b.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
except Exception as e:
- self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
+ self.debug("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_domainadminuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for an admin user in the same domain but belonging to a different account in a shared network with scope=account
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for an admin user in the same domain but belonging to a different account in a shared network with scope=account
+ """
# Deploy VM as admin user for a domain that has an account with shared network with scope=account
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d111.name,
- domainid=self.account_d111.domainid
- )
- self.fail("Domain admin is able to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
+ self.vmdata["name"] = self.acldata["vmD111"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ try:
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d111.name,
+ domainid=self.account_d111.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
except Exception as e:
- self.debug ("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.UNABLE_TO_USE_NETWORK):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
+ self.debug("When a user from same domain but different account deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.UNABLE_TO_USE_NETWORK):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for user in the same domain but belonging to a different account in a shared network with scope=account")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_user(self):
- """
- Valiate that Domain admin is able to deploy a VM for an regular user in a shared network with scope=account
- """
+ """
+ Valiate that Domain admin is able to deploy a VM for an regular user in a shared network with scope=account
+ """
# Deploy VM as account with shared network with scope=account
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD111A"]["name"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] +"-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD111A"]["name"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD111A"]["displayname"] + "-shared-scope-domain-withsubdomainaccess-domain-admin"
vm = VirtualMachine.create(
self.apiclient,
@@ -1690,142 +1683,139 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
zoneid=self.zone.id,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d111a.name,
- domainid=self.account_d111a.domainid
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d111a.name,
+ domainid=self.account_d111a.domainid
)
- self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
- True,
- "Domain admin is not able to deploy a VM for an regular user in a shared network with scope=account")
+ self.assertEqual(vm.state == "Running" and vm.account == self.account_d111a.name and vm.domainid == self.account_d111a.domainid,
+ True,
+ "Domain admin is not able to deploy a VM for an regular user in a shared network with scope=account")
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_differentdomain(self):
- """
- Valiate that Domain admin is able NOT able to deploy a VM for an regular user from a differnt domain in a shared network with scope=account
- """
+ """
+ Valiate that Domain admin is able NOT able to deploy a VM for an regular user from a differnt domain in a shared network with scope=account
+ """
# Deploy VM as an admin user in a subdomain under ROOT
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmD2A"]["name"] +"-shared-scope-account-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD2A"]["displayname"] +"-shared-scope-account-domain-admin"
+ self.vmdata["name"] = self.acldata["vmD2A"]["name"] + "-shared-scope-account-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD2A"]["displayname"] + "-shared-scope-account-domain-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("Domain admin is able able to deploy a VM for an regular user from a differnt domain in a shared network with scope=account")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.fail("Domain admin is able able to deploy a VM for an regular user from a differnt domain in a shared network with scope=account")
except Exception as e:
- self.debug ("When a user from different domain deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for an regular user from a differnt domain in a shared network with scope=account")
+ self.debug("When a user from different domain deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail(
+ "Error message validation failed when Domain admin tries to deploy a VM for an regular user from a differnt domain in a shared network with scope=account")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_ROOTuser(self):
- """
- Valiate that Domain admin is NOT able to deploy a VM for an regular user in ROOT domain in a shared network with scope=account
- """
+ """
+ Valiate that Domain admin is NOT able to deploy a VM for an regular user in ROOT domain in a shared network with scope=account
+ """
# Deploy VM as user in ROOT domain
- self.apiclient.connection.apiKey = self.user_d1_apikey
+ self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey
- self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-account-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-account-domain-admin"
+ self.vmdata["name"] = self.acldata["vmROOTA"]["name"] + "-shared-scope-account-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmROOTA"]["displayname"] + "-shared-scope-account-domain-admin"
try:
- vm = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_account_d111a.id,
- accountid=self.account_roota.name,
- domainid=self.account_roota.domainid
- )
- self.fail("Domain admin is able to deploy a VM for an regular user in ROOT domain in a shared network with scope=account")
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_account_d111a.id,
+ accountid=self.account_roota.name,
+ domainid=self.account_roota.domainid
+ )
+ self.fail("Domain admin is able to deploy a VM for an regular user in ROOT domain in a shared network with scope=account")
except Exception as e:
- self.debug ("When a user from ROOT domain deploys a VM in a shared network with scope=account %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
- self.fail("Error message validation failed when Domain admin tries to deploy a VM for an regular user in ROOT domain in a shared network with scope=account")
+ self.debug("When a user from ROOT domain deploys a VM in a shared network with scope=account %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
+ self.fail("Error message validation failed when Domain admin tries to deploy a VM for an regular user in ROOT domain in a shared network with scope=account")
-## Test cases relating to deploying Virtual Machine as Regular user for other users in shared network with scope=all
+ ## Test cases relating to deploying Virtual Machine as Regular user for other users in shared network with scope=all
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_regularuser_scope_all_anotherusersamedomain(self):
- """
- Valiate that regular user is able NOT able to deploy a VM for another user in the same domain in a shared network with scope=all
- """
+ """
+ Valiate that regular user is able NOT able to deploy a VM for another user in the same domain in a shared network with scope=all
+ """
# Deploy VM for a user in a domain under ROOT as admin
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-all-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-all-domain-admin"
- try:
- vm_d1a = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d12a.name,
- domainid=self.account_d12a.domainid
- )
- self.fail("Regular user is allowed to deploy a VM for another user in the same domain in a shared network with scope=all")
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-all-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-all-domain-admin"
+ try:
+ vm_d1a = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d12a.name,
+ domainid=self.account_d12a.domainid
+ )
+ self.fail("Regular user is allowed to deploy a VM for another user in the same domain in a shared network with scope=all")
except Exception as e:
- self.debug ("When a regular user deploys a VM for another user in the same domain in a shared network with scope=all %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user tries to deploy a VM for another user in the same domain in a shared network with scope=all")
+ self.debug("When a regular user deploys a VM for another user in the same domain in a shared network with scope=all %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user tries to deploy a VM for another user in the same domain in a shared network with scope=all")
-
- @attr("simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_deployVM_in_sharedNetwork_as_regularuser_scope_all_crossdomain(self):
- """
- Valiate that regular user is able NOT able to deploy a VM for another user in a different domain in a shared network with scope=all
- """
+ """
+ Valiate that regular user is able NOT able to deploy a VM for another user in a different domain in a shared network with scope=all
+ """
# Deploy VM for a user in a domain under ROOT as admin
self.apiclient.connection.apiKey = self.user_d11a_apikey
self.apiclient.connection.securityKey = self.user_d11a_secretkey
- self.vmdata["name"] = self.acldata["vmD11A"]["name"] +"-shared-scope-all-domain-admin"
- self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] +"-shared-scope-all-domain-admin"
- try:
- vm_d1a = VirtualMachine.create(
- self.apiclient,
- self.vmdata,
- zoneid=self.zone.id,
- serviceofferingid=self.service_offering.id,
- templateid=self.template.id,
- networkids=self.shared_network_all.id,
- accountid=self.account_d2a.name,
- domainid=self.account_d2a.domainid
- )
- self.fail("Regular user is allowed to deploy a VM for another user in the same domain in a shared network with scope=all")
+ self.vmdata["name"] = self.acldata["vmD11A"]["name"] + "-shared-scope-all-domain-admin"
+ self.vmdata["displayname"] = self.acldata["vmD11A"]["displayname"] + "-shared-scope-all-domain-admin"
+ try:
+ vm_d1a = VirtualMachine.create(
+ self.apiclient,
+ self.vmdata,
+ zoneid=self.zone.id,
+ serviceofferingid=self.service_offering.id,
+ templateid=self.template.id,
+ networkids=self.shared_network_all.id,
+ accountid=self.account_d2a.name,
+ domainid=self.account_d2a.domainid
+ )
+ self.fail("Regular user is allowed to deploy a VM for another user in the same domain in a shared network with scope=all")
except Exception as e:
- self.debug ("When a regular user deploys a VM for another user in the same domain in a shared network with scope=all %s" %e)
- if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
- self.fail("Error message validation failed when Regular user tries to deploy a VM for another user in the same domain in a shared network with scope=all")
+ self.debug("When a regular user deploys a VM for another user in the same domain in a shared network with scope=all %s" % e)
+ if not CloudstackAclException.verifyMsginException(e, CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
+ self.fail("Error message validation failed when Regular user tries to deploy a VM for another user in the same domain in a shared network with scope=all")
@staticmethod
- def generateKeysForUser(apiclient,account):
+ def generateKeysForUser(apiclient, account):
user = User.list(
- apiclient,
- account=account.name,
- domainid=account.domainid
- )[0]
+ apiclient,
+ account=account.name,
+ domainid=account.domainid
+ )[0]
return (User.registerUserKeys(
- apiclient,
- user.id
- ))
-
-
+ apiclient,
+ user.id
+ ))
diff --git a/test/integration/component/test_acquire_specified_public_ip.py b/test/integration/component/test_acquire_specified_public_ip.py
index 01a4470f161..4482e16ea85 100644
--- a/test/integration/component/test_acquire_specified_public_ip.py
+++ b/test/integration/component/test_acquire_specified_public_ip.py
@@ -21,7 +21,8 @@ Tests of acquiring a specified public IP for isolated network or vpc
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import createVlanIpRange
from marvin.lib.utils import (validateList,
cleanup_resources)
diff --git a/test/integration/component/test_add_remove_network.py b/test/integration/component/test_add_remove_network.py
index 38aeee42dd6..91baa3fdb31 100644
--- a/test/integration/component/test_add_remove_network.py
+++ b/test/integration/component/test_add_remove_network.py
@@ -27,36 +27,37 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from ddt import ddt, data
from marvin.lib.base import (
- Account,
- Domain,
- ServiceOffering,
- VirtualMachine,
- NetworkOffering,
- Network,
- VpcOffering,
- VPC,
- PublicIPAddress,
- FireWallRule,
- NATRule
- )
+ Account,
+ Domain,
+ ServiceOffering,
+ VirtualMachine,
+ NetworkOffering,
+ Network,
+ VpcOffering,
+ VPC,
+ PublicIPAddress,
+ FireWallRule,
+ NATRule
+)
from marvin.lib.common import (get_domain,
- get_zone,
- get_template,
- list_virtual_machines,
- list_events,
- list_zones,
- get_free_vlan,
- update_resource_limit,
- list_nat_rules
- )
+ get_zone,
+ get_template,
+ list_virtual_machines,
+ list_events,
+ list_zones,
+ get_free_vlan,
+ update_resource_limit,
+ list_nat_rules
+ )
from marvin.lib.utils import (validateList,
- random_gen,
- get_hypervisor_type,
- cleanup_resources)
+ random_gen,
+ get_hypervisor_type,
+ cleanup_resources)
from marvin.cloudstackAPI import (addNicToVirtualMachine,
removeNicFromVirtualMachine,
@@ -66,6 +67,7 @@ from marvin.codes import PASS
import random
import time
+
class Services:
"""Test Add Remove Network Services
"""
@@ -77,106 +79,107 @@ class Services:
# Cent OS 5.3 (64 bit)
"isolated_network_offering": {
- "name": 'Test Isolated Network offering',
- "displaytext": 'Test Isolated Network offering',
- "guestiptype": 'Isolated',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
- "traffictype": 'GUEST',
- "availability": 'Optional',
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "SourceNat": 'VirtualRouter',
- "PortForwarding": 'VirtualRouter',
- },
- },
+ "name": 'Test Isolated Network offering',
+ "displaytext": 'Test Isolated Network offering',
+ "guestiptype": 'Isolated',
+ "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
+ "traffictype": 'GUEST',
+ "availability": 'Optional',
+ "serviceProviderList": {
+ "Dhcp": 'VirtualRouter',
+ "Dns": 'VirtualRouter',
+ "SourceNat": 'VirtualRouter',
+ "PortForwarding": 'VirtualRouter',
+ },
+ },
- "shared_network_offering": {
- "name": 'Test Shared Network Offering',
- "displaytext": 'Test Shared Network Offering',
- "guestiptype": 'Shared',
- "supportedservices": 'Dhcp,Dns,UserData',
- "specifyVlan" : "True",
- "specifyIpRanges" : "True",
- "traffictype": 'GUEST',
- "serviceProviderList" : {
- "Dhcp": 'VirtualRouter',
- "Dns": 'VirtualRouter',
- "UserData": 'VirtualRouter'
- },
- },
+ "shared_network_offering": {
+ "name": 'Test Shared Network Offering',
+ "displaytext": 'Test Shared Network Offering',
+ "guestiptype": 'Shared',
+ "supportedservices": 'Dhcp,Dns,UserData',
+ "specifyVlan": "True",
+ "specifyIpRanges": "True",
+ "traffictype": 'GUEST',
+ "serviceProviderList": {
+ "Dhcp": 'VirtualRouter',
+ "Dns": 'VirtualRouter',
+ "UserData": 'VirtualRouter'
+ },
+ },
- "shared_network": {
- "name": "Test Shared Network",
- "displaytext": "Test Shared Network",
- "gateway" :"172.16.17.1",
- "netmask" :"255.255.255.0",
- "startip" :"172.16.17.2",
- "endip" :"172.16.17.20",
- },
+ "shared_network": {
+ "name": "Test Shared Network",
+ "displaytext": "Test Shared Network",
+ "gateway": "172.16.17.1",
+ "netmask": "255.255.255.0",
+ "startip": "172.16.17.2",
+ "endip": "172.16.17.20",
+ },
- "shared_network_2": {
- "name": "Test Shared Network",
- "displaytext": "Test Shared Network",
- "gateway" :"172.16.18.1",
- "netmask" :"255.255.255.0",
- "startip" :"172.16.18.2",
- "endip" :"172.16.18.20",
- },
+ "shared_network_2": {
+ "name": "Test Shared Network",
+ "displaytext": "Test Shared Network",
+ "gateway": "172.16.18.1",
+ "netmask": "255.255.255.0",
+ "startip": "172.16.18.2",
+ "endip": "172.16.18.20",
+ },
- "isolated_network": {
- "name": "Test Isolated Network",
- "displaytext": "Test Isolated Network",
- },
+ "isolated_network": {
+ "name": "Test Isolated Network",
+ "displaytext": "Test Isolated Network",
+ },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- # in MHz
- "memory": 256,
- # In MBs
- },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ # in MHz
+ "memory": 256,
+ # In MBs
+ },
- "account": {
- "email": "test@test.com",
- "firstname": "Test_add_remove_network_vm",
- "lastname": "User",
- "username": "test_add_remove_network_vm",
- "password": "password",
- },
- "domain": {
- "name": "Domain_add_nw_to_vm",
- },
- "virtual_machine": {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test_add_remove_network_vm",
+ "lastname": "User",
+ "username": "test_add_remove_network_vm",
+ "password": "password",
+ },
+ "domain": {
+ "name": "Domain_add_nw_to_vm",
+ },
+ "virtual_machine": {
+ "displayname": "testserver",
+ "username": "root", # VM creds for SSH
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'XenServer',
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
- "vpc_offering": {
- "name": 'VPC off add remove network',
- "displaytext": 'VPC off add remove network',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL',
- },
+ "vpc_offering": {
+ "name": 'VPC off add remove network',
+ "displaytext": 'VPC off add remove network',
+ "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL',
+ },
+
+ "vpc": {
+ "name": "TestVPC add remove network",
+ "displaytext": "TestVPC add remove network",
+ "cidr": '10.0.0.1/24'
+ },
+ "natrule": {
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": "TCP"
+ },
+ }
- "vpc": {
- "name": "TestVPC add remove network",
- "displaytext": "TestVPC add remove network",
- "cidr": '10.0.0.1/24'
- },
- "natrule": {
- "privateport": 22,
- "publicport": 22,
- "protocol": "TCP"
- },
- }
@ddt
class TestAddNetworkToVirtualMachine(cloudstackTestCase):
@@ -189,7 +192,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
- if hypervisor.lower() not in ["xenserver","kvm"]:
+ if hypervisor.lower() not in ["xenserver", "kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
cls.services = Services().services
@@ -207,13 +210,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
cls.services["shared_network"]["zoneid"] = cls.zone.id
cls._cleanup = []
- cls.account = Account.create(cls.api_client, cls.services["account"], domainid = cls.domain.id)
+ cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls._cleanup.append(cls.account)
- cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+ cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
- cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],accountid=cls.account.name,
+ cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name,
domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id,
mode=cls.zone.networktype)
@@ -226,25 +229,25 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
cls.isolated_network_offering.update(cls.api_client, state='Enabled')
# Create Shared Network Offering
- cls.shared_network_offering = NetworkOffering.create(cls.api_client,cls.services["shared_network_offering"])
+ cls.shared_network_offering = NetworkOffering.create(cls.api_client, cls.services["shared_network_offering"])
# Enable shared Network offering
cls.shared_network_offering.update(cls.api_client, state='Enabled')
- cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
- cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
+ cls.isolated_network = Network.create(cls.api_client, cls.services["isolated_network"], cls.account.name,
+ cls.account.domainid, networkofferingid=cls.isolated_network_offering.id)
cls.services["shared_network"]["vlan"] = get_free_vlan(cls.api_client, cls.zone.id)[1]
- shared_network_subnet_number = random.randrange(1,254)
+ shared_network_subnet_number = random.randrange(1, 254)
- cls.services["shared_network"]["gateway"] = "172.16."+str(shared_network_subnet_number)+".1"
- cls.services["shared_network"]["startip"] = "172.16."+str(shared_network_subnet_number)+".2"
- cls.services["shared_network"]["endip"] = "172.16."+str(shared_network_subnet_number)+".20"
+ cls.services["shared_network"]["gateway"] = "172.16." + str(shared_network_subnet_number) + ".1"
+ cls.services["shared_network"]["startip"] = "172.16." + str(shared_network_subnet_number) + ".2"
+ cls.services["shared_network"]["endip"] = "172.16." + str(shared_network_subnet_number) + ".20"
cls.shared_nw_endip = cls.services["shared_network"]["endip"]
- cls.shared_network = Network.create(cls.api_client,cls.services["shared_network"],cls.account.name,
- cls.account.domainid,networkofferingid=cls.shared_network_offering.id)
+ cls.shared_network = Network.create(cls.api_client, cls.services["shared_network"], cls.account.name,
+ cls.account.domainid, networkofferingid=cls.shared_network_offering.id)
cls._cleanup.append(cls.shared_network)
cls._cleanup.append(cls.shared_network_offering)
return
@@ -254,22 +257,22 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
self.addednics = []
- shared_network_subnet_number = random.randrange(1,254)
+ shared_network_subnet_number = random.randrange(1, 254)
- self.services["shared_network"]["gateway"] = "172.16."+str(shared_network_subnet_number)+".1"
- self.services["shared_network"]["startip"] = "172.16."+str(shared_network_subnet_number)+".2"
- self.services["shared_network"]["endip"] = "172.16."+str(shared_network_subnet_number)+".20"
+ self.services["shared_network"]["gateway"] = "172.16." + str(shared_network_subnet_number) + ".1"
+ self.services["shared_network"]["startip"] = "172.16." + str(shared_network_subnet_number) + ".2"
+ self.services["shared_network"]["endip"] = "172.16." + str(shared_network_subnet_number) + ".20"
- self.services["shared_network_2"]["gateway"] = "172.16."+str(shared_network_subnet_number + 1)+".1"
- self.services["shared_network_2"]["startip"] = "172.16."+str(shared_network_subnet_number + 1)+".2"
- self.services["shared_network_2"]["endip"] = "172.16."+str(shared_network_subnet_number + 1)+".20"
+ self.services["shared_network_2"]["gateway"] = "172.16." + str(shared_network_subnet_number + 1) + ".1"
+ self.services["shared_network_2"]["startip"] = "172.16." + str(shared_network_subnet_number + 1) + ".2"
+ self.services["shared_network_2"]["endip"] = "172.16." + str(shared_network_subnet_number + 1) + ".20"
self.cleanup = []
def tearDown(self):
try:
for nic in self.addednics:
self.virtual_machine.remove_nic(self.apiclient, nic.id)
- #Clean up, terminate the created accounts, domains etc
+ # Clean up, terminate the created accounts, domains etc
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -293,13 +296,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
"""Add network to VM and check if new nic added in the VM"""
self.debug("Adding %s Network: %s to virtual machine %s" %
- (network.type, network.id, vm.id))
+ (network.type, network.id, vm.id))
vm.add_nic(self.apiclient, network.id, ipaddress=ipaddress)
vm_list = list_virtual_machines(self.apiclient, id=vm.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
self.debug("virtual machine nics: %s" % vm_list[0].nic)
nics = [x for x in vm_list[0].nic if x.networkid == network.id]
@@ -324,8 +327,8 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
return
- @attr(tags = ["advanced", "dvs"])
- @data("isolated","shared")
+ @attr(tags=["advanced", "dvs"])
+ @data("isolated", "shared")
def test_01_add_nw_running_vm(self, value):
"""Add network to running VM"""
@@ -336,7 +339,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
# 1. New nic is generated for the added network
# 2. Event NIC.CREATE is generated
- network = None #The network which we are adding to the vm
+ network = None # The network which we are adding to the vm
if value == "isolated":
network = self.isolated_network
@@ -351,13 +354,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
type='NIC.CREATE')
event_list_validation_result = validateList(events)
self.assertEqual(event_list_validation_result[0], PASS, "event list validation failed due to %s" %
- event_list_validation_result[2])
+ event_list_validation_result[2])
self.debug("Events list contains event NIC.CREATE")
return
- @attr(tags = ["advanced", "dvs"])
- @data("isolated","shared")
+ @attr(tags=["advanced", "dvs"])
+ @data("isolated", "shared")
def test_02_add_nw_stopped_vm(self, value):
"""Add network to stopped VM"""
@@ -373,7 +376,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
except Exception as e:
self.fail("Failed to stop VM: %s" % e)
- network = None #The network which we are adding to the vm
+ network = None # The network which we are adding to the vm
if value == "isolated":
network = self.isolated_network
elif value == "shared":
@@ -387,8 +390,8 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
return
- @attr(tags = ["advanced", "dvs"])
- @data("isolated","shared")
+ @attr(tags=["advanced", "dvs"])
+ @data("isolated", "shared")
def test_03_add_nw_multiple_times(self, value):
"""Add same network multiple times to running VM"""
@@ -399,7 +402,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
# Validate the following:
# 1. Adding same network to vm multiple times fails
- network = None #The network which we are adding to the vm
+ network = None # The network which we are adding to the vm
if value == "isolated":
network = self.isolated_network
elif value == "shared":
@@ -428,7 +431,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
@data("isolated")
def test_04_vpc_nw_running_vm(self, value):
"""Add VPC network to running VM belonging to isolated network"""
@@ -456,13 +459,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
self.addNetworkToVm(network, virtual_machine)
self.debug("Creating VPC offering")
- vpc_off = VpcOffering.create(self.api_client,self.services["vpc_offering"])
+ vpc_off = VpcOffering.create(self.api_client, self.services["vpc_offering"])
self.debug("Created VPC offering: %s" % vpc_off.id)
self.debug("Enabling the VPC offering")
vpc_off.update(self.apiclient, state='Enabled')
self.debug("Creating VPC")
vpc = VPC.create(self.apiclient, self.services["vpc"], vpcofferingid=vpc_off.id, zoneid=self.zone.id,
- account=self.account.name,domainid=self.account.domainid)
+ account=self.account.name, domainid=self.account.domainid)
# Appending to cleanup list
self.cleanup.append(vpc)
self.cleanup.append(vpc_off)
@@ -475,7 +478,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
vpc_off.update(self.apiclient, state='Disabled')
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
@data("isolated")
def test_05_add_vpc_nw_stopped_vm(self, value):
"""Add VPC network to stopped VM belonging to isolated network"""
@@ -497,13 +500,13 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
self.addNetworkToVm(self.isolated_network, self.virtual_machine)
self.debug("Creating VPC offering")
- vpc_off = VpcOffering.create(self.api_client,self.services["vpc_offering"])
+ vpc_off = VpcOffering.create(self.api_client, self.services["vpc_offering"])
self.debug("Created VPC offering: %s" % vpc_off.id)
self.debug("Enabling the VPC offering")
vpc_off.update(self.apiclient, state='Enabled')
self.debug("Creating VPC")
- vpc = VPC.create(self.apiclient,self.services["vpc"],vpcofferingid=vpc_off.id,zoneid=self.zone.id,
- account=self.account.name,domainid=self.account.domainid)
+ vpc = VPC.create(self.apiclient, self.services["vpc"], vpcofferingid=vpc_off.id, zoneid=self.zone.id,
+ account=self.account.name, domainid=self.account.domainid)
# Appending to cleanup list
self.cleanup.append(vpc)
self.cleanup.append(vpc_off)
@@ -517,7 +520,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_06_add_nw_ipaddress_running_vm(self):
"""Add network and ip address to running VM"""
@@ -542,10 +545,10 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
ipaddress = self.shared_nw_endip
self.debug("Adding network to vm with ip address %s: " % ipaddress)
- self.addNetworkToVm(self.shared_network, virtual_machine,ipaddress = ipaddress)
+ self.addNetworkToVm(self.shared_network, virtual_machine, ipaddress=ipaddress)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_10_add_nw_invalid_ipaddress_running_vm(self):
"""Add network with invalid ip address to running VM"""
@@ -555,17 +558,17 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
# Validate the following:
# 1. Adding network to VM should fail because of invalid ip address
- ipaddress = "257.257.257.257" #Invalid ip address
+ ipaddress = "257.257.257.257" # Invalid ip address
self.debug("Adding network to vm with ip address %s: " % ipaddress)
with self.assertRaises(Exception) as e:
self.addNetworkToVm(self.shared_network, self.virtual_machine,
- ipaddress = ipaddress)
+ ipaddress=ipaddress)
self.debug("API failed with exception: %s" % e.exception)
return
- @attr(tags = ["advanced", "dvs"])
- @data("isolated","shared")
+ @attr(tags=["advanced", "dvs"])
+ @data("isolated", "shared")
def test_14_add_nw_different_account(self, value):
"""Add network to running VM"""
@@ -576,17 +579,17 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
# Validate the following:
# 1. Adding network should fail
- network = None #The network which we are adding to the vm
- account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id)
+ network = None # The network which we are adding to the vm
+ account = Account.create(self.apiclient, self.services["account"], domainid=self.domain.id)
self.cleanup.append(account)
if value == "isolated":
- network = Network.create(self.api_client,self.services["isolated_network"],account.name,
- account.domainid,networkofferingid=self.isolated_network_offering.id)
+ network = Network.create(self.api_client, self.services["isolated_network"], account.name,
+ account.domainid, networkofferingid=self.isolated_network_offering.id)
elif value == "shared":
self.services["shared_network_2"]["zoneid"] = self.zone.id
self.services["shared_network_2"]["vlan"] = get_free_vlan(self.apiclient, self.zone.id)[1]
- network = Network.create(self.api_client,self.services["shared_network_2"],account.name,
+ network = Network.create(self.api_client, self.services["shared_network_2"], account.name,
account.domainid, networkofferingid=self.shared_network_offering.id)
self.cleanup.append(network)
@@ -604,7 +607,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
self.fail("User was able to add NIC, test failed! This issue has been hit: CLOUDSTACK-10071")
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_24_add_nw_different_domain(self):
"""Add network to running VM"""
@@ -615,33 +618,33 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
# Validate the following:
# 1. Adding network should fail
- network = None #The network which we are adding to the vm
+ network = None # The network which we are adding to the vm
try:
tempCleanupList = []
self.child_domain_1 = Domain.create(self.apiclient,
- services=self.services["domain"],
- parentdomainid=self.domain.id)
+ services=self.services["domain"],
+ parentdomainid=self.domain.id)
tempCleanupList.append(self.child_domain_1)
self.child_do_admin_1 = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True,
- domainid=self.child_domain_1.id
- )
+ self.apiclient,
+ self.services["account"],
+ admin=True,
+ domainid=self.child_domain_1.id
+ )
tempCleanupList.append(self.child_do_admin_1)
self.child_domain_2 = Domain.create(self.apiclient,
- services=self.services["domain"],
- parentdomainid=self.domain.id)
+ services=self.services["domain"],
+ parentdomainid=self.domain.id)
tempCleanupList.append(self.child_domain_2)
self.child_do_admin_2 = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True,
- domainid=self.child_domain_2.id)
+ self.apiclient,
+ self.services["account"],
+ admin=True,
+ domainid=self.child_domain_2.id)
tempCleanupList.append(self.child_do_admin_2)
except Exception as e:
self.fail(e)
@@ -649,12 +652,12 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
tempCleanupList.reverse()
self.cleanup += tempCleanupList
- network = Network.create(self.api_client,self.services["isolated_network"],self.child_do_admin_1.name,
- self.child_do_admin_1.domainid,networkofferingid=self.isolated_network_offering.id)
+ network = Network.create(self.api_client, self.services["isolated_network"], self.child_do_admin_1.name,
+ self.child_do_admin_1.domainid, networkofferingid=self.isolated_network_offering.id)
- virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"],accountid=self.child_do_admin_2.name,
- domainid=self.child_do_admin_2.domainid, serviceofferingid=self.service_offering.id,
- mode=self.zone.networktype)
+ virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"], accountid=self.child_do_admin_2.name,
+ domainid=self.child_do_admin_2.domainid, serviceofferingid=self.service_offering.id,
+ mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Trying to %s network in domain %s to a vm in domain %s, This should fail" %
@@ -665,7 +668,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
self.debug("Operation failed with exception %s" % e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_25_add_nw_above_account_limit(self):
"""Add network to VM with maximum network limit reached"""
@@ -678,51 +681,51 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
self.debug("Creating account 1")
account_1 = Account.create(
- self.apiclient,
- self.services["account"],
- domainid=self.domain.id
- )
+ self.apiclient,
+ self.services["account"],
+ domainid=self.domain.id
+ )
self.cleanup.append(account_1)
self.debug("setting network limit of account: %s as 1" % account_1.name)
update_resource_limit(
- self.apiclient,
- 6, # Network
- max=1,
- account=account_1.name,
- domainid=account_1.domainid
- )
+ self.apiclient,
+ 6, # Network
+ max=1,
+ account=account_1.name,
+ domainid=account_1.domainid
+ )
self.debug("Creating isolated network in account: %s" % account_1.name)
- network_1 = Network.create(self.api_client,self.services["isolated_network"],account_1.name,
- account_1.domainid,networkofferingid=self.isolated_network_offering.id)
+ network_1 = Network.create(self.api_client, self.services["isolated_network"], account_1.name,
+ account_1.domainid, networkofferingid=self.isolated_network_offering.id)
self.debug("created network %s" % network_1.name)
self.debug("Deploying virtual machine in account: %s" % account_1.name)
- virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"],accountid=account_1.name,
- domainid=account_1.domainid, serviceofferingid=self.service_offering.id,
- mode=self.zone.networktype)
+ virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"], accountid=account_1.name,
+ domainid=account_1.domainid, serviceofferingid=self.service_offering.id,
+ mode=self.zone.networktype)
self.debug("Deployed virtual machine : %s" % virtual_machine.id)
self.debug("Creating another account")
account_2 = Account.create(
- self.apiclient,
- self.services["account"],
- domainid=self.domain.id
- )
+ self.apiclient,
+ self.services["account"],
+ domainid=self.domain.id
+ )
self.debug("Created account %s" % account_2.name)
self.cleanup.append(account_2)
self.debug("Creating network in account %s" % account_2.name)
- network_2 = Network.create(self.api_client,self.services["isolated_network"],account_2.name,
- account_2.domainid,networkofferingid=self.isolated_network_offering.id)
+ network_2 = Network.create(self.api_client, self.services["isolated_network"], account_2.name,
+ account_2.domainid, networkofferingid=self.isolated_network_offering.id)
self.debug("Created network %s" % network_2.name)
@@ -735,6 +738,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
return
+
class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
@classmethod
@@ -745,14 +749,14 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
- if hypervisor.lower() not in ["xenserver","kvm"]:
+ if hypervisor.lower() not in ["xenserver", "kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
- template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
+ template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
# Set Zones and disk offerings
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
@@ -762,23 +766,23 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
cls.services["shared_network"]["zoneid"] = cls.zone.id
cls._cleanup = []
- cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
+ cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls._cleanup.append(cls.account)
- cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+ cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
- cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],accountid=cls.account.name,
- domainid=cls.account.domainid,serviceofferingid=cls.service_offering.id,
+ cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name,
+ domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id,
mode=cls.zone.networktype)
# Create Shared Network Offering
- cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"])
+ cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"])
cls._cleanup.append(cls.isolated_network_offering)
# Enable Isolated Network offering
cls.isolated_network_offering.update(cls.api_client, state='Enabled')
- cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
- cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
+ cls.isolated_network = Network.create(cls.api_client, cls.services["isolated_network"], cls.account.name,
+ cls.account.domainid, networkofferingid=cls.isolated_network_offering.id)
return
def setUp(self):
@@ -788,7 +792,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
def tearDown(self):
try:
- #Clean up, terminate the created accounts, domains etc
+ # Clean up, terminate the created accounts, domains etc
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -809,12 +813,12 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
"""Add network to VM and check if new nic added in the VM"""
self.debug("Adding %s Network: %s to virtual machine %s" %
- (network.type, network.id, vm.id))
+ (network.type, network.id, vm.id))
vm.add_nic(self.apiclient, network.id)
vm_list = list_virtual_machines(self.apiclient, id=vm.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
self.debug("virtual machine nics: %s" % vm_list[0].nic)
# Add nic of network to list so that it can be deleted later accessing its id from this list
self.nics = [x for x in vm_list[0].nic if x.networkid == network.id]
@@ -824,7 +828,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
len(self.nics))
return self.nics
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_07_remove_nic_running_vm(self):
"""Remove nic from running VM"""
@@ -845,28 +849,28 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
self.debug("virtual machine nics: %s" % vm_list[0].nic)
# Verify the nic is removed from the virtual machine
self.debug("Verifying the nic is removed from the virtual machine")
self.assertFalse(any(x.networkid == self.isolated_network.id for x in vm_list[0].nic),
- "nic still present in the virtual machine nic list")
+ "nic still present in the virtual machine nic list")
self.debug("nic removed successfully")
self.debug("Retrieving events list matching events 'NIC.DELETE'")
events = list_events(
- self.apiclient,
- account=self.account.name,
- domainid=self.account.domainid,
- type='NIC.DELETE'
- )
+ self.apiclient,
+ account=self.account.name,
+ domainid=self.account.domainid,
+ type='NIC.DELETE'
+ )
event_list_validation_result = validateList(events)
self.assertEqual(event_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- event_list_validation_result[2])
+ event_list_validation_result[2])
self.debug("Events list contains event NIC.DELETE")
self.debug("events: %s" % events)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_08_remove_default_nic(self):
"""Test Remove default nic of running VM"""
@@ -879,17 +883,17 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
self.debug("virtual machine nics: %s" % vm_list[0].nic)
self.assertEqual(len(vm_list[0].nic), 1, "There should only be default nic present in the vm")
self.debug("Trying to remove the default nic of vm : %s, this should fail" %
- self.virtual_machine.id)
+ self.virtual_machine.id)
with self.assertRaises(Exception):
self.virtual_machine.remove_nic(self.apiclient, vm_list[0].nic[0].id)
self.debug("Removing default nic of vm failed")
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_09_remove_foreign_nic(self):
"""Remove nic which does not belong to VM"""
@@ -904,13 +908,13 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
account = Account.create(
self.api_client,
self.services["account"],
- domainid = self.domain.id
+ domainid=self.domain.id
)
self.cleanup.append(account)
self.debug("created new account : %s" % account.name)
self.debug("Deploying virtual machine in this account")
- virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],accountid=account.name,
- domainid=account.domainid,serviceofferingid=self.service_offering.id,
+ virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"], accountid=account.name,
+ domainid=account.domainid, serviceofferingid=self.service_offering.id,
mode=self.zone.networktype)
self.debug("Deployed virtual machine: %s" % virtual_machine.id)
self.debug("Trying to remove nic of new virtual machine from existing virtual machine, This \
@@ -920,7 +924,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
self.debug("Operation failed with exception: %s" % e.exception)
return
- @attr(tags = ["advanced"], required_hardware="true")
+ @attr(tags=["advanced"], required_hardware="true")
def test_29_remove_nic_CS22503(self):
"""Test to verify remove nic from vm if the nic ip is same as another vm ip in another network"""
@@ -935,10 +939,10 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
vm1 = self.virtual_machine
nic2 = self.addNetworkToVm(self.isolated_network, vm1)
- #get the ip address of the nic added in 2nd network
+ # get the ip address of the nic added in 2nd network
vm1_ip = nic2[0].ipaddress
self.assertIsNotNone(vm1_ip, "New nic did not get the ip address")
- #Create network n3
+ # Create network n3
self.network3 = Network.create(
self.api_client,
self.services["isolated_network"],
@@ -1009,7 +1013,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
nat_rule.id,
"Check Correct Port forwarding Rule is returned"
)
- #Try to remove nic 2 from vm1
+ # Try to remove nic 2 from vm1
try:
vm1.remove_nic(self.apiclient, self.nics[0].id)
vm1_res = VirtualMachine.list(self.apiclient, id=vm1.id)
@@ -1058,7 +1062,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
networkids=[self.isolated_network.id, self.ntwk2.id, self.ntwk3.id]
)
self.assertIsNotNone(self.test_vm, "Failed to create vm with 3 nics")
- map(lambda x: self.cleanup.append(x), [self.test_vm, self.ntwk2, self.ntwk3])
+ list(map(lambda x: self.cleanup.append(x), [self.test_vm, self.ntwk2, self.ntwk3]))
vm_res = VirtualMachine.list(
self.apiclient,
id=self.test_vm.id
@@ -1087,7 +1091,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
get the network id of the nic which we are remove from the nic, so that we can
use that network id for reattach
"""
- nic_to_attach = [x for x in [self.isolated_network, self.ntwk2, self.ntwk3]\
+ nic_to_attach = [x for x in [self.isolated_network, self.ntwk2, self.ntwk3] \
if x.id == self.nics[1].networkid]
self.assertEqual(validateList(nic_to_attach)[0], PASS, "No matching nics")
self.assertEqual(len(nic_to_attach), 1, "More than one nic in same network")
@@ -1120,6 +1124,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
)
return
+
class TestUpdateVirtualMachineNIC(cloudstackTestCase):
@classmethod
@@ -1130,14 +1135,14 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
- if hypervisor.lower() not in ["xenserver","kvm"]:
+ if hypervisor.lower() not in ["xenserver", "kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
- template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
+ template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
# Set Zones and disk offerings
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
@@ -1147,23 +1152,23 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
cls.services["shared_network"]["zoneid"] = cls.zone.id
cls._cleanup = []
- cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
+ cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls._cleanup.append(cls.account)
- cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+ cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
- cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
- accountid=cls.account.name,domainid=cls.account.domainid,
+ cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],
+ accountid=cls.account.name, domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
mode=cls.zone.networktype)
# Create Shared Network Offering
- cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"])
+ cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"])
cls._cleanup.append(cls.isolated_network_offering)
# Enable Isolated Network offering
cls.isolated_network_offering.update(cls.api_client, state='Enabled')
- cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
- cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
+ cls.isolated_network = Network.create(cls.api_client, cls.services["isolated_network"], cls.account.name,
+ cls.account.domainid, networkofferingid=cls.isolated_network_offering.id)
return
def setUp(self):
@@ -1173,7 +1178,7 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
def tearDown(self):
try:
- #Clean up, terminate the created accounts, domains etc
+ # Clean up, terminate the created accounts, domains etc
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1195,12 +1200,12 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
"""Add network to VM and check if new nic added in the VM"""
self.debug("Adding %s Network: %s to virtual machine %s" %
- (network.type, network.id, vm.id))
+ (network.type, network.id, vm.id))
vm.add_nic(self.apiclient, network.id)
vm_list = list_virtual_machines(self.apiclient, id=vm.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
self.debug("virtual machine nics: %s" % vm_list[0].nic)
# Add nic of network to list so that it can be deleted later accessing its id from this list
self.nics = [x for x in vm_list[0].nic if x.networkid == network.id]
@@ -1210,7 +1215,7 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
len(self.nics))
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_11_update_nic_running_vm(self):
"""update default nic of running VM"""
@@ -1228,7 +1233,7 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
if len(vm_list[0].nic) != 2:
self.fail("VM should have exactly two NICs")
@@ -1242,15 +1247,15 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
nonDefaultNicIdBeforeUpdate = nic.id
self.debug("Default nic of VM is %s and non default nic of VM is %s"
- % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
+ % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
self.debug("Making non default nic as default nic")
- self.virtual_machine.update_default_nic(self.apiclient, nicId = nonDefaultNicIdBeforeUpdate)
+ self.virtual_machine.update_default_nic(self.apiclient, nicId=nonDefaultNicIdBeforeUpdate)
self.debug("Again listing the NIC list of VM to verify the update operation was successful")
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
if len(vm_list[0].nic) != 2:
self.fail("VM should have exactly two NICs")
@@ -1263,19 +1268,19 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
default one, update_default_nic API failed")
self.debug("Retrieving events list matching events 'NIC.UPDATE'")
events = list_events(
- self.apiclient,
- account=self.account.name,
- domainid=self.account.domainid,
- type='NIC.UPDATE'
- )
+ self.apiclient,
+ account=self.account.name,
+ domainid=self.account.domainid,
+ type='NIC.UPDATE'
+ )
event_list_validation_result = validateList(events)
self.assertEqual(event_list_validation_result[0], PASS, "event list validation failed due to %s" %
- event_list_validation_result[2])
+ event_list_validation_result[2])
self.debug("Events list contains event NIC.UPDATE")
self.debug("events: %s" % events)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_12_make_default_nic_as_default(self):
"""Try to set default nic of vm again as default"""
@@ -1289,7 +1294,7 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
defaultNicId = None
@@ -1299,13 +1304,13 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
self.debug("Trying to set default nic again as default nic, This should fail")
with self.assertRaises(Exception) as e:
- self.virtual_machine.update_default_nic(self.apiclient, nicId = defaultNicId)
+ self.virtual_machine.update_default_nic(self.apiclient, nicId=defaultNicId)
self.debug("updateDefaultNic operation failed as expected with exception: %s" %
- e.exception)
+ e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_13_set_foreign_nic_as_default(self):
"""set nic which does not belong to VM as its default one"""
@@ -1318,13 +1323,13 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
self.debug("Creating new account")
- account = Account.create(self.api_client,self.services["account"],domainid = self.domain.id)
+ account = Account.create(self.api_client, self.services["account"], domainid=self.domain.id)
self.cleanup.append(account)
self.debug("created new account : %s" % account.name)
self.debug("Deploying virtual machine in this account")
- virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
- accountid=account.name,domainid=account.domainid,
- serviceofferingid=self.service_offering.id,mode=self.zone.networktype)
+ virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"],
+ accountid=account.name, domainid=account.domainid,
+ serviceofferingid=self.service_offering.id, mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Deployed virtual machine: %s" % virtual_machine.id)
foreignNicId = virtual_machine.nic[0].id
@@ -1332,12 +1337,13 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
self.debug("Trying to set nic of new virtual machine as default nic of existing virtual machine, This \
operation should fail")
with self.assertRaises(Exception) as e:
- self.virtual_machine.update_default_nic(self.apiclient, nicId = foreignNicId)
+ self.virtual_machine.update_default_nic(self.apiclient, nicId=foreignNicId)
self.debug("updateDefaultNic operation failed as expected with exception: %s" %
- e.exception)
+ e.exception)
return
+
class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
@classmethod
@@ -1348,37 +1354,37 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
- if hypervisor.lower() not in ["xenserver","kvm"]:
+ if hypervisor.lower() not in ["xenserver", "kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
- template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
+ template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
# Set Zones and disk offerings
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
# Create Accounts & networks
cls.services["isolated_network"]["zoneid"] = cls.zone.id
cls._cleanup = []
- cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
+ cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls._cleanup.append(cls.account)
- cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
+ cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
- cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
- accountid=cls.account.name,domainid=cls.account.domainid,
- serviceofferingid=cls.service_offering.id,mode=cls.zone.networktype)
+ cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],
+ accountid=cls.account.name, domainid=cls.account.domainid,
+ serviceofferingid=cls.service_offering.id, mode=cls.zone.networktype)
# Create Shared Network Offering
- cls.isolated_network_offering = NetworkOffering.create(cls.api_client,cls.services["isolated_network_offering"],)
+ cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"], )
cls._cleanup.append(cls.isolated_network_offering)
# Enable Isolated Network offering
cls.isolated_network_offering.update(cls.api_client, state='Enabled')
- cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
- cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
+ cls.isolated_network = Network.create(cls.api_client, cls.services["isolated_network"], cls.account.name,
+ cls.account.domainid, networkofferingid=cls.isolated_network_offering.id)
return
def setUp(self):
@@ -1388,7 +1394,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
def tearDown(self):
try:
- #Clean up, terminate the created accounts, domains etc
+ # Clean up, terminate the created accounts, domains etc
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1406,7 +1412,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_15_add_nic_wrong_vm_id(self):
"""Add network to vm with wrong vm id"""
@@ -1416,16 +1422,16 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
# 1. API should throw exception saying unable to find virtual machine
cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd()
- cmd.virtualmachineid = random_gen(id="virtual_machine", size=30)
+ cmd.virtualmachineid = random_gen(id="virtual_machine", size=30)
cmd.networkid = self.isolated_network.id
with self.assertRaises(Exception) as e:
self.apiclient.addNicToVirtualMachine(cmd)
- self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
+ self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_16_add_nic_wrong_network_id(self):
"""Add network to vm with wrong network id"""
@@ -1435,22 +1441,22 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
# 1. API should throw exception saying unable to find a network
cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
+ cmd.virtualmachineid = self.virtual_machine.id
cmd.networkid = random_gen(id="network_id", size=30)
with self.assertRaises(Exception) as e:
self.apiclient.addNicToVirtualMachine(cmd)
- self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
+ self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_17_add_nic_different_zone(self):
"""Add network to vm where both belong to different zones"""
# 1. Deploy a VM in zone 1
- # 2. Create a network in zone 2
- # 3. Try to add this network to the VM (both belong to different zones)
+ # 2. Create a network in zone 2
+ # 3. Try to add this network to the VM (both belong to different zones)
# Validate the following:
# 1. API should throw exception vminstance is in zone, but network is in zone
@@ -1460,20 +1466,20 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
zones = list_zones(self.apiclient, available=True)
list_zones_validation_result = validateList(zones)
self.assertEqual(list_zones_validation_result[0], PASS, "list zones validation failed due to: %s" %
- list_zones_validation_result[2])
+ list_zones_validation_result[2])
if len(zones) >= 2:
for zone in zones:
if zone.id != self.zone.id:
- foreignZoneId = zone.id
- break
- else:
- self.skipTest("This test requires at least two zones to be present in the setup")
+ foreignZoneId = zone.id
+ break
+ else:
+ self.skipTest("This test requires at least two zones to be present in the setup")
- self.services["isolated_network"]["zoneid"] = foreignZoneId
+ self.services["isolated_network"]["zoneid"] = foreignZoneId
self.debug("Creating isolated network in zone %s which is foreign to VM" %
- foreignZoneId)
- isolated_network = Network.create(self.apiclient,self.services["isolated_network"],
+ foreignZoneId)
+ isolated_network = Network.create(self.apiclient, self.services["isolated_network"],
self.account.name, self.account.domainid,
networkofferingid=self.isolated_network_offering.id)
self.debug("Created isolated network %s in zone %s" %
@@ -1481,17 +1487,17 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
self.debug("Trying to add network to VM, both belonging to different zones")
cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
+ cmd.virtualmachineid = self.virtual_machine.id
cmd.networkid = isolated_network.id
with self.assertRaises(Exception) as e:
time.sleep(5)
self.apiclient.addNicToVirtualMachine(cmd)
- self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
+ self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
return
- @attr(tags = ["invalid"])
+ @attr(tags=["invalid"])
def test_18_add_nic_basic_zone(self):
"""Add network to vm in basic zone"""
@@ -1506,16 +1512,16 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
zones = list_zones(self.apiclient, available=True)
list_zones_validation_result = validateList(zones)
self.assertEqual(list_zones_validation_result[0], PASS, "list zones validation failed due to: %s" %
- list_zones_validation_result[2])
+ list_zones_validation_result[2])
for zone in zones:
- if zone.networktype.lower() == 'BASIC':
- basicZone = zone.id
- break
+ if zone.networktype.lower() == 'BASIC':
+ basicZone = zone.id
+ break
if basicZone is None:
- self.skipTest("This test requires at least one basic zone to be present in the setup")
+ self.skipTest("This test requires at least one basic zone to be present in the setup")
self.services["isolated_network"]["zoneid"] = basicZone.id
self.debug("Creating isolated network in basic zone: %s" % basicZone.id)
- isolated_network = Network.create(self.apiclient,self.services["isolated_network"],
+ isolated_network = Network.create(self.apiclient, self.services["isolated_network"],
networkofferingid=self.isolated_network_offering.id)
self.debug("Created isolated network %s:" % isolated_network.id)
@@ -1524,7 +1530,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
self.services["virtual_machine"]["zoneid"] = basicZone.id
self.debug("Deploying virtual machine in basic zone: %s" % basicZone.id)
- virtual_machine = VirtualMachine.create(self.apiclient,self.services["virtual_machine"],
+ virtual_machine = VirtualMachine.create(self.apiclient, self.services["virtual_machine"],
serviceofferingid=self.service_offering.id,
mode=basicZone.networktype)
time.sleep(self.services["sleep"])
@@ -1537,13 +1543,13 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
self.dedbug("Trying to add isolated network to VM (both in basic zone,\
this operation should fail")
with self.assertRaises(Exception) as e:
- time.sleep(5)
+ time.sleep(5)
self.apiclient.addNicToVirtualMachine(cmd)
- self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
+ self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_26_add_nic_insufficient_permission(self):
"""Try to add network to vm with insufficient permission"""
@@ -1553,12 +1559,12 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
# 1. API should throw exception saying insufficient permission
cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
+ cmd.virtualmachineid = self.virtual_machine.id
cmd.networkid = self.isolated_network.id
self.debug("Creating new account")
- account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id)
+ account = Account.create(self.apiclient, self.services["account"], domainid=self.domain.id)
self.cleanup.append(account)
self.debug("Created account %s" % account.name)
@@ -1570,12 +1576,13 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
insufficient permission")
with self.assertRaises(Exception) as e:
- time.sleep(5)
+ time.sleep(5)
api_client.addNicToVirtualMachine(cmd)
- self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
+ self.debug("addNicToVirtualMachine API failed with exception: %s" % e.exception)
return
+
class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
@classmethod
@@ -1586,191 +1593,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
cls.services = Services().services
hypervisor = get_hypervisor_type(cls.api_client)
- if hypervisor.lower() not in ["xenserver","kvm"]:
- raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
-
- # Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client)
- cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
-
- template = get_template(cls.api_client,cls.zone.id,cls.services["ostype"])
- # Set Zones and disk offerings
- cls.services["virtual_machine"]["zoneid"] = cls.zone.id
- cls.services["virtual_machine"]["template"] = template.id
-
- # Create Accounts & networks
- cls.services["isolated_network"]["zoneid"] = cls.zone.id
- cls.services["shared_network"]["zoneid"] = cls.zone.id
- cls._cleanup = []
-
- cls.account = Account.create(cls.api_client,cls.services["account"],domainid = cls.domain.id)
- cls._cleanup.append(cls.account)
-
- cls.service_offering = ServiceOffering.create(cls.api_client,cls.services["service_offering"])
- cls._cleanup.append(cls.service_offering)
-
- cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
- accountid=cls.account.name,domainid=cls.account.domainid,
- serviceofferingid=cls.service_offering.id,
- mode=cls.zone.networktype)
-
- # Create Shared Network Offering
- cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"],)
- cls._cleanup.append(cls.isolated_network_offering)
- # Enable Isolated Network offering
- cls.isolated_network_offering.update(cls.api_client, state='Enabled')
- cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],cls.account.name,
- cls.account.domainid,networkofferingid=cls.isolated_network_offering.id)
-
- # Add network to VM
- cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id)
- return
-
- def setUp(self):
- self.apiclient = self.testClient.getApiClient()
- self.dbclient = self.testClient.getDbConnection()
- self.cleanup = []
-
- def tearDown(self):
- try:
- #Clean up, terminate the created accounts, domains etc
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
-
- @classmethod
- def tearDownClass(cls):
- try:
- # Disable Network Offerings
- cls.isolated_network_offering.update(cls.api_client, state='Disabled')
- # Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
-
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
-
- @attr(tags = ["advanced", "dvs"])
- def test_19_remove_nic_wrong_vm_id(self):
- """Try to remove nic from a vm providing wrong vm id to API"""
-
- # (Frist two steps are perfromed in setupClass)
- # 1. Deploy Vm in account
- # 2. Add network to VM
- # 3. Remove the nic added by the newly added network providing wrong vm id to the API
-
- # Validate the following:
- # 1. API throws exception unable to find a virtual machine with id
-
- vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
- vm_list_validation_result = validateList(vm_list)
- self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
- vm = vm_list_validation_result[1]
-
- nics = [x for x in vm.nic if x.networkid == self.isolated_network.id]
-
- self.assertEqual(len(nics), 1 , "There should be exactly one nic corresponding to the isolate\
- network %s" % self.isolated_network.id)
-
- cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id + random_gen()
- cmd.nicid = nics[0].id
-
- with self.assertRaises(Exception) as e:
- self.apiclient.removeNicFromVirtualMachine(cmd)
- self.debug("removeNicFromVirtualMachine API failed with exception: %s" % e.exception)
-
- return
-
- @attr(tags = ["advanced", "dvs"])
- def test_20_remove_nic_wrong_nic_id(self):
- """Try to remove nic from a vm providing wrong nic id to API"""
-
- # (Frist two steps are perfromed in setupClass)
- # 1. Deploy Vm in account
- # 2. Add network to VM
- # 3. Remove the nic added by the newly added network providing wrong nic id to the API
-
- # Validate the following:
- # 1. API throws exception unable to find nic with id
-
- vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
- vm_list_validation_result = validateList(vm_list)
- self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
- vm = vm_list_validation_result[1]
-
- nics = [x for x in vm.nic if x.networkid == self.isolated_network.id]
-
- self.assertEqual(len(nics), 1 , "There should be exactly one nic corresponding to the isolate\
- network %s" % self.isolated_network.id)
-
- cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
- cmd.nicid = nics[0].id + random_gen()
-
- with self.assertRaises(Exception) as e:
- self.apiclient.removeNicFromVirtualMachine(cmd)
- self.debug("removeNicFromVirtualMachine API failed with exception: %s" % e.exception)
-
- return
-
- @attr(tags = ["advanced", "dvs"])
- def test_27_remove_nic_insufficient_permission(self):
- """Try to remove nic from vm with insufficient permission"""
-
- # 1. Call remove network from VM API with api client of other account
-
- # Validate the following:
- # 1. API should throw exception saying insufficient permission
-
- vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
- vm_list_validation_result = validateList(vm_list)
- self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
- vm = vm_list_validation_result[1]
-
- nics = [x for x in vm.nic if x.networkid == self.isolated_network.id]
-
- self.assertEqual(len(nics), 1 , "There should be exactly one nic corresponding to the isolate\
- network %s" % self.isolated_network.id)
-
- cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
- cmd.nicid = nics[0].id
-
- self.debug("Creating new account")
-
- account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id)
- self.cleanup.append(account)
-
- self.debug("Created account %s" % account.name)
-
- self.debug("creating user api client for account: %s" % account.name)
- api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
-
- self.debug("Trying to add network to vm with this api client, this should fail due to \
- insufficient permission")
-
- with self.assertRaises(Exception) as e:
- api_client.removeNicFromVirtualMachine(cmd)
- self.debug("removeNicFromVirtualMachine API failed with exception: %s" % e.exception)
-
- return
-
-class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
-
- @classmethod
- def setUpClass(cls):
- cls.testClient = super(TestFailureScenariosUpdateVirtualMachineNIC, cls).getClsTestClient()
- cls.api_client = cls.testClient.getApiClient()
-
- cls.services = Services().services
-
- hypervisor = get_hypervisor_type(cls.api_client)
- if hypervisor.lower() not in ["xenserver","kvm"]:
+ if hypervisor.lower() not in ["xenserver", "kvm"]:
raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
# Get Zone, Domain and templates
@@ -1787,27 +1610,26 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
cls.services["shared_network"]["zoneid"] = cls.zone.id
cls._cleanup = []
- cls.account = Account.create(cls.api_client, cls.services["account"], domainid = cls.domain.id)
+ cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
cls._cleanup.append(cls.account)
cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
cls._cleanup.append(cls.service_offering)
- cls.virtual_machine = VirtualMachine.create(cls.api_client,cls.services["virtual_machine"],
- accountid=cls.account.name,domainid=cls.account.domainid,
- serviceofferingid=cls.service_offering.id,mode=cls.zone.networktype)
-
- cls.defaultNetworkId = cls.virtual_machine.nic[0].networkid
+ cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],
+ accountid=cls.account.name, domainid=cls.account.domainid,
+ serviceofferingid=cls.service_offering.id,
+ mode=cls.zone.networktype)
# Create Shared Network Offering
- cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"],)
+ cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"], )
cls._cleanup.append(cls.isolated_network_offering)
# Enable Isolated Network offering
cls.isolated_network_offering.update(cls.api_client, state='Enabled')
+ cls.isolated_network = Network.create(cls.api_client, cls.services["isolated_network"], cls.account.name,
+ cls.account.domainid, networkofferingid=cls.isolated_network_offering.id)
- cls.isolated_network = Network.create(cls.api_client,cls.services["isolated_network"],
- cls.account.name,cls.account.domainid,
- networkofferingid=cls.isolated_network_offering.id)
+ # Add network to VM
cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id)
return
@@ -1818,7 +1640,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
def tearDown(self):
try:
- #Clean up, terminate the created accounts, domains etc
+ # Clean up, terminate the created accounts, domains etc
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -1836,7 +1658,193 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
+ def test_19_remove_nic_wrong_vm_id(self):
+ """Try to remove nic from a vm providing wrong vm id to API"""
+
+ # (Frist two steps are perfromed in setupClass)
+ # 1. Deploy Vm in account
+ # 2. Add network to VM
+ # 3. Remove the nic added by the newly added network providing wrong vm id to the API
+
+ # Validate the following:
+ # 1. API throws exception unable to find a virtual machine with id
+
+ vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
+ vm_list_validation_result = validateList(vm_list)
+ self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
+ vm_list_validation_result[2])
+ vm = vm_list_validation_result[1]
+
+ nics = [x for x in vm.nic if x.networkid == self.isolated_network.id]
+
+ self.assertEqual(len(nics), 1, "There should be exactly one nic corresponding to the isolate\
+ network %s" % self.isolated_network.id)
+
+ cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd()
+ cmd.virtualmachineid = self.virtual_machine.id + random_gen()
+ cmd.nicid = nics[0].id
+
+ with self.assertRaises(Exception) as e:
+ self.apiclient.removeNicFromVirtualMachine(cmd)
+ self.debug("removeNicFromVirtualMachine API failed with exception: %s" % e.exception)
+
+ return
+
+ @attr(tags=["advanced", "dvs"])
+ def test_20_remove_nic_wrong_nic_id(self):
+ """Try to remove nic from a vm providing wrong nic id to API"""
+
+ # (Frist two steps are perfromed in setupClass)
+ # 1. Deploy Vm in account
+ # 2. Add network to VM
+ # 3. Remove the nic added by the newly added network providing wrong nic id to the API
+
+ # Validate the following:
+ # 1. API throws exception unable to find nic with id
+
+ vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
+ vm_list_validation_result = validateList(vm_list)
+ self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
+ vm_list_validation_result[2])
+ vm = vm_list_validation_result[1]
+
+ nics = [x for x in vm.nic if x.networkid == self.isolated_network.id]
+
+ self.assertEqual(len(nics), 1, "There should be exactly one nic corresponding to the isolate\
+ network %s" % self.isolated_network.id)
+
+ cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd()
+ cmd.virtualmachineid = self.virtual_machine.id
+ cmd.nicid = nics[0].id + random_gen()
+
+ with self.assertRaises(Exception) as e:
+ self.apiclient.removeNicFromVirtualMachine(cmd)
+ self.debug("removeNicFromVirtualMachine API failed with exception: %s" % e.exception)
+
+ return
+
+ @attr(tags=["advanced", "dvs"])
+ def test_27_remove_nic_insufficient_permission(self):
+ """Try to remove nic from vm with insufficient permission"""
+
+ # 1. Call remove network from VM API with api client of other account
+
+ # Validate the following:
+ # 1. API should throw exception saying insufficient permission
+
+ vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
+ vm_list_validation_result = validateList(vm_list)
+ self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
+ vm_list_validation_result[2])
+ vm = vm_list_validation_result[1]
+
+ nics = [x for x in vm.nic if x.networkid == self.isolated_network.id]
+
+ self.assertEqual(len(nics), 1, "There should be exactly one nic corresponding to the isolate\
+ network %s" % self.isolated_network.id)
+
+ cmd = removeNicFromVirtualMachine.removeNicFromVirtualMachineCmd()
+ cmd.virtualmachineid = self.virtual_machine.id
+ cmd.nicid = nics[0].id
+
+ self.debug("Creating new account")
+
+ account = Account.create(self.apiclient, self.services["account"], domainid=self.domain.id)
+ self.cleanup.append(account)
+
+ self.debug("Created account %s" % account.name)
+
+ self.debug("creating user api client for account: %s" % account.name)
+ api_client = self.testClient.getUserApiClient(UserName=account.name, DomainName=self.account.domain)
+
+ self.debug("Trying to add network to vm with this api client, this should fail due to \
+ insufficient permission")
+
+ with self.assertRaises(Exception) as e:
+ api_client.removeNicFromVirtualMachine(cmd)
+ self.debug("removeNicFromVirtualMachine API failed with exception: %s" % e.exception)
+
+ return
+
+
+class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.testClient = super(TestFailureScenariosUpdateVirtualMachineNIC, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
+ cls.services = Services().services
+
+ hypervisor = get_hypervisor_type(cls.api_client)
+ if hypervisor.lower() not in ["xenserver", "kvm"]:
+ raise unittest.SkipTest("This feature is supported only on XenServer and KVM")
+
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+
+ template = get_template(cls.api_client, cls.zone.id, cls.services["ostype"])
+ # Set Zones and disk offerings
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+ cls.services["virtual_machine"]["template"] = template.id
+
+ # Create Accounts & networks
+ cls.services["isolated_network"]["zoneid"] = cls.zone.id
+ cls.services["shared_network"]["zoneid"] = cls.zone.id
+ cls._cleanup = []
+
+ cls.account = Account.create(cls.api_client, cls.services["account"], domainid=cls.domain.id)
+ cls._cleanup.append(cls.account)
+
+ cls.service_offering = ServiceOffering.create(cls.api_client, cls.services["service_offering"])
+ cls._cleanup.append(cls.service_offering)
+
+ cls.virtual_machine = VirtualMachine.create(cls.api_client, cls.services["virtual_machine"],
+ accountid=cls.account.name, domainid=cls.account.domainid,
+ serviceofferingid=cls.service_offering.id, mode=cls.zone.networktype)
+
+ cls.defaultNetworkId = cls.virtual_machine.nic[0].networkid
+
+ # Create Shared Network Offering
+ cls.isolated_network_offering = NetworkOffering.create(cls.api_client, cls.services["isolated_network_offering"], )
+ cls._cleanup.append(cls.isolated_network_offering)
+ # Enable Isolated Network offering
+ cls.isolated_network_offering.update(cls.api_client, state='Enabled')
+
+ cls.isolated_network = Network.create(cls.api_client, cls.services["isolated_network"],
+ cls.account.name, cls.account.domainid,
+ networkofferingid=cls.isolated_network_offering.id)
+ cls.virtual_machine.add_nic(cls.api_client, cls.isolated_network.id)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+
+ def tearDown(self):
+ try:
+ # Clean up, terminate the created accounts, domains etc
+ cleanup_resources(self.apiclient, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ # Disable Network Offerings
+ cls.isolated_network_offering.update(cls.api_client, state='Disabled')
+ # Cleanup resources used
+ cleanup_resources(cls.api_client, cls._cleanup)
+
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ @attr(tags=["advanced", "dvs"])
def test_21_update_nic_wrong_vm_id(self):
"""update default nic of vm providing wrong vm id to the API"""
@@ -1853,7 +1861,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
if len(vm_list[0].nic) != 2:
self.fail("VM should have exactly two NICs")
@@ -1867,21 +1875,21 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
nonDefaultNicIdBeforeUpdate = nic.id
self.debug("Default nic of VM is %s and non default nic of VM is %s"
- % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
+ % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
self.debug("Making non default nic as default nic")
cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id + random_gen()
+ cmd.virtualmachineid = self.virtual_machine.id + random_gen()
cmd.nicid = nonDefaultNicIdBeforeUpdate
with self.assertRaises(Exception) as e:
self.apiclient.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
- e.exception)
+ e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_22_update_nic_wrong_nic_id(self):
"""update default nic of vm providing wrong nic id to the API"""
@@ -1898,7 +1906,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
if len(vm_list[0].nic) != 2:
self.fail("VM should have exactly two NICs")
@@ -1913,21 +1921,21 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
nonDefaultNicIdBeforeUpdate = nic.id
self.debug("Default nic of VM is %s and non default nic of VM is %s"
- % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
+ % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
self.debug("Making non default nic as default nic")
cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
+ cmd.virtualmachineid = self.virtual_machine.id
cmd.nicid = nonDefaultNicIdBeforeUpdate + random_gen()
with self.assertRaises(Exception) as e:
self.apiclient.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
- e.exception)
+ e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_23_update_nic_incorrect_vm_state(self):
"""update default nic of vm when vm is state is not Running or Stopped"""
@@ -1941,20 +1949,20 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
# 1. API throws exception instance is not Running or Stopped
self.debug("Creating new account")
- account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id)
+ account = Account.create(self.apiclient, self.services["account"], domainid=self.domain.id)
self.cleanup.append(account)
self.debug("Creating virtual machine in the account %s" % account.name)
virtual_machine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
- accountid=account.name,domainid=account.domainid,
+ accountid=account.name, domainid=account.domainid,
serviceofferingid=self.service_offering.id,
mode=self.zone.networktype)
time.sleep(self.services["sleep"])
self.debug("Created virtual machine %s" % virtual_machine.id)
self.debug("Creating isolated network in account %s" % account.name)
- isolated_network = Network.create(self.apiclient,self.services["isolated_network"],account.name,
- account.domainid,networkofferingid=self.isolated_network_offering.id)
+ isolated_network = Network.create(self.apiclient, self.services["isolated_network"], account.name,
+ account.domainid, networkofferingid=self.isolated_network_offering.id)
self.debug("Created isolated network %s" % isolated_network.id)
@@ -1965,7 +1973,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=virtual_machine.id, listall=True)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
if len(vm_list[0].nic) != 2:
self.fail("VM should have exactly two NICs")
@@ -1980,23 +1988,23 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
nonDefaultNicIdBeforeUpdate = nic.id
self.debug("Default nic of VM is %s and non default nic of VM is %s"
- % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
+ % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
self.debug("Destroying VM %s" % virtual_machine.id)
virtual_machine.delete(self.apiclient, expunge=False)
self.debug("Making non default nic as default nic")
cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd()
- cmd.virtualmachineid = virtual_machine.id
+ cmd.virtualmachineid = virtual_machine.id
cmd.nicid = nonDefaultNicIdBeforeUpdate
with self.assertRaises(Exception) as e:
self.apiclient.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
- e.exception)
+ e.exception)
return
- @attr(tags = ["advanced", "dvs"])
+ @attr(tags=["advanced", "dvs"])
def test_28_update_nic_insufficient_permission(self):
"""Try to update default nic of vm with insufficient permission"""
@@ -2005,7 +2013,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
# Validate the following:
# 1. API should throw exception saying insufficient permission
- account = Account.create(self.apiclient,self.services["account"],domainid = self.domain.id)
+ account = Account.create(self.apiclient, self.services["account"], domainid=self.domain.id)
self.cleanup.append(account)
self.debug("Created account %s" % account.name)
@@ -2017,7 +2025,7 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)
vm_list_validation_result = validateList(vm_list)
self.assertEqual(vm_list_validation_result[0], PASS, "vm list validation failed due to %s" %
- vm_list_validation_result[2])
+ vm_list_validation_result[2])
if len(vm_list[0].nic) != 2:
self.fail("VM should have exactly two NICs")
@@ -2032,16 +2040,16 @@ class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
nonDefaultNicIdBeforeUpdate = nic.id
self.debug("Default nic of VM is %s and non default nic of VM is %s"
- % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
+ % (defaultNicIdBeforeUpdate, nonDefaultNicIdBeforeUpdate))
self.debug("Making non default nic as default nic")
cmd = updateDefaultNicForVirtualMachine.updateDefaultNicForVirtualMachineCmd()
- cmd.virtualmachineid = self.virtual_machine.id
+ cmd.virtualmachineid = self.virtual_machine.id
cmd.nicid = nonDefaultNicIdBeforeUpdate
with self.assertRaises(Exception) as e:
api_client.updateDefaultNicForVirtualMachine(cmd)
self.debug("updateDefaultNicForVirtualMachine API failed with exception: %s" %
- e.exception)
+ e.exception)
return
diff --git a/test/integration/component/test_advancedsg_networks.py b/test/integration/component/test_advancedsg_networks.py
index 2273e15006e..6a885121212 100644
--- a/test/integration/component/test_advancedsg_networks.py
+++ b/test/integration/component/test_advancedsg_networks.py
@@ -17,7 +17,8 @@
""" P1 tests for networks in advanced zone with security groups
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from ddt import ddt, data
from marvin.lib.base import (Zone,
ServiceOffering,
@@ -2162,7 +2163,7 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase):
name=self.services["test_34_DeployVM_in_SecondSGNetwork"]["zone"]
)
status = validateList(zone_list)
- self.assertEquals(status[0], PASS, "Failed to list the zones")
+ self.assertEqual(status[0], PASS, "Failed to list the zones")
count = 0
"""
In simulator environment default guest os template should be in ready state immediately after the ssvm is up.
@@ -2260,7 +2261,7 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase):
)
#construct ip list using start and end ips in the network
for i in range(0,nwIPs):
- ips_in_new_network.append(str(ip_gen.next()))
+ ips_in_new_network.append(str(next(ip_gen)))
if vm_ip not in ips_in_new_network:
self.fail("vm did not get the ip from new SG enabled shared network")
self.cleanup_vms.append(vm_2)
diff --git a/test/integration/component/test_affinity_groups.py b/test/integration/component/test_affinity_groups.py
index be0a6e5cff1..445364877a7 100644
--- a/test/integration/component/test_affinity_groups.py
+++ b/test/integration/component/test_affinity_groups.py
@@ -15,7 +15,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources,
random_gen)
@@ -187,8 +188,8 @@ class TestCreateAffinityGroup(cloudstackTestCase):
acc=self.account.name, domainid=self.account.domainid)
self.debug("Created Affinity Group: %s" % aff_grp.name)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -455,7 +456,7 @@ class TestListAffinityGroups(cloudstackTestCase):
"""
self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
- print self.aff_grp[0].__dict__
+ print(self.aff_grp[0].__dict__)
list_aff_grps = AffinityGroup.list(self.api_client)
list_aff_grps = AffinityGroup.list(self.api_client, id=list_aff_grps[0].id)
self.assertEqual(list_aff_grps[0].name, self.aff_grp[0].name,
@@ -646,7 +647,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
def delete_aff_group(self, apiclient, **kwargs):
cmd = deleteAffinityGroup.deleteAffinityGroupCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.deleteAffinityGroup(cmd)
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
@@ -658,7 +659,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
aff_0 = self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
AffinityGroup.list(self.api_client, name=aff_0.name)
self.delete_aff_group(self.api_client, name=aff_0.name)
- self.assert_(AffinityGroup.list(self.api_client, name=aff_0.name) is None)
+ self.assertTrue(AffinityGroup.list(self.api_client, name=aff_0.name) is None)
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
def test_02_delete_aff_grp_for_acc(self):
@@ -688,7 +689,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
vm, hostid = self.create_vm_in_aff_grps([aff_0.name, aff_1.name], account_name=self.account.name, domain_id=self.domain.id)
aff_0.delete(self.api_client)
vm_list = list_virtual_machines(self.apiclient, id=vm.id)
- self.assert_(vm_list is not None)
+ self.assertTrue(vm_list is not None)
vm.delete(self.api_client)
#Wait for expunge interval to cleanup VM
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
diff --git a/test/integration/component/test_affinity_groups_projects.py b/test/integration/component/test_affinity_groups_projects.py
index 4be673a6a7b..16135e24e96 100644
--- a/test/integration/component/test_affinity_groups_projects.py
+++ b/test/integration/component/test_affinity_groups_projects.py
@@ -15,7 +15,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources,
random_gen)
@@ -218,9 +219,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
aff_grp = self.create_aff_grp()
self.debug("Created Affinity Group: %s" % aff_grp.name)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
- self.assert_(list_aff_grps[0].projectid == self.project.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -231,9 +232,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
"""
aff_grp = self.create_aff_grp(api_client=self.domain_api_client)
list_aff_grps = AffinityGroup.list(self.domain_api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
- self.assert_(list_aff_grps[0].projectid == self.project.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
@attr(tags=["vogxn", "simulator", "basic", "advanced"], required_hardware="false")
@@ -244,9 +245,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
"""
aff_grp = self.create_aff_grp(api_client=self.account_api_client)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
- self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
- self.assert_(list_aff_grps[0].id == aff_grp.id)
- self.assert_(list_aff_grps[0].projectid == self.project.id)
+ self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
+ self.assertTrue(list_aff_grps[0].id == aff_grp.id)
+ self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@@ -670,7 +671,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
def delete_aff_group(self, apiclient, **kwargs):
cmd = deleteAffinityGroup.deleteAffinityGroupCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.deleteAffinityGroup(cmd)
diff --git a/test/integration/component/test_base_image_updation.py b/test/integration/component/test_base_image_updation.py
index e38aa336eee..133db821267 100644
--- a/test/integration/component/test_base_image_updation.py
+++ b/test/integration/component/test_base_image_updation.py
@@ -28,7 +28,8 @@
from marvin.codes import (PASS,
RECURRING)
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (ServiceOffering,
Account,
@@ -419,7 +420,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
hypervisor = host_list_validation_result[1].hypervisor
- for k, v in self.services["templates"].items():
+ for k, v in list(self.services["templates"].items()):
if k.lower() == hypervisor.lower():
# Register new template
template = Template.register(
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index dce6781d064..cffb488e3ba 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -36,7 +36,8 @@ from marvin.lib.common import (get_zone,
get_builtin_template_info)
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import restartNetwork
from marvin.codes import PASS
import time
diff --git a/test/integration/component/test_brocade_vcs.py b/test/integration/component/test_brocade_vcs.py
index adaf21bda5e..1b2dcebe66e 100644
--- a/test/integration/component/test_brocade_vcs.py
+++ b/test/integration/component/test_brocade_vcs.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (listPhysicalNetworks,
listNetworkServiceProviders,
addNetworkServiceProvider,
diff --git a/test/integration/component/test_browse_templates.py b/test/integration/component/test_browse_templates.py
index 4340092b9a0..3bceb44fc73 100644
--- a/test/integration/component/test_browse_templates.py
+++ b/test/integration/component/test_browse_templates.py
@@ -20,7 +20,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
@@ -160,7 +161,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -284,7 +285,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -377,7 +378,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -427,7 +428,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -477,7 +478,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -545,7 +546,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmlist.attach_volume(
self.apiclient,
list_volume_response[0]
@@ -612,7 +613,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmdetails.detach_volume(self.apiclient,list_volume_response[0])
# Sleep to ensure the current state will reflected in other calls
diff --git a/test/integration/component/test_browse_templates2.py b/test/integration/component/test_browse_templates2.py
index 927dd345610..0aa7bee18a6 100644
--- a/test/integration/component/test_browse_templates2.py
+++ b/test/integration/component/test_browse_templates2.py
@@ -19,7 +19,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
@@ -32,7 +33,7 @@ import random
import string
import telnetlib
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import time
import tempfile
_multiprocess_shared_ = True
diff --git a/test/integration/component/test_browse_volumes.py b/test/integration/component/test_browse_volumes.py
index 08a41b4588a..09ed681ed40 100644
--- a/test/integration/component/test_browse_volumes.py
+++ b/test/integration/component/test_browse_volumes.py
@@ -20,7 +20,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import *
from marvin.lib.utils import *
from marvin.lib.base import *
@@ -39,7 +40,7 @@ import string
import telnetlib
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import time
import tempfile
_multiprocess_shared_ = True
@@ -136,7 +137,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -213,7 +214,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -299,7 +300,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -425,7 +426,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code == 200:
self.fail("Upload URL is allowed to reuse")
@@ -547,7 +548,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -593,7 +594,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -647,7 +648,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmlist.attach_volume(
self.apiclient,
list_volume_response[0]
@@ -715,7 +716,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient,
id=volid
)
- print list_volume_response[0]
+ print(list_volume_response[0])
vmdetails.detach_volume(self.apiclient,list_volume_response[0])
# Sleep to ensure the current state will reflected in other calls
@@ -821,9 +822,9 @@ class TestBrowseUploadVolume(cloudstackTestCase):
extract_vol = self.apiclient.extractVolume(cmd)
try:
- formatted_url = urllib.unquote_plus(extract_vol.url)
+ formatted_url = urllib.parse.unquote_plus(extract_vol.url)
self.debug("Attempting to download volume at url %s" % formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug("Saving volume %s to path %s" %(volumeid, path))
@@ -1185,7 +1186,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient,
templatefilter='self')
- self.assertEquals(
+ self.assertEqual(
templates_before_size + 1,
len(list_templates_after),
"Template creation failed from snapshot"
@@ -1763,7 +1764,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -1808,7 +1809,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -1916,7 +1917,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code !=200:
self.fail("Upload is not fine")
@@ -1955,7 +1956,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False)
- print results.status_code
+ print(results.status_code)
if results.status_code ==200:
return("FAIL")
return("PASS")
diff --git a/test/integration/component/test_concurrent_snapshots_limit.py b/test/integration/component/test_concurrent_snapshots_limit.py
index fce1dd4439a..65a7496e410 100644
--- a/test/integration/component/test_concurrent_snapshots_limit.py
+++ b/test/integration/component/test_concurrent_snapshots_limit.py
@@ -58,8 +58,8 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
cls.supportedHypervisor = True
if cls.hypervisor.lower() in [
- "hyperv",
- "lxc"]:
+ "hyperv",
+ "lxc"]:
cls.supportedHypervisor = False
return
@@ -168,14 +168,14 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
name="concurrent.snapshots.threshold.perhost"
)
if config[0].value:
- self.assertEqual(
- isinstance(
- config,
- list),
- True,
- "concurrent.snapshots.threshold.perhost should be present\
- in global config")
- concurrentSnapshots = int(config[0].value)
+ self.assertEqual(
+ isinstance(
+ config,
+ list),
+ True,
+ "concurrent.snapshots.threshold.perhost should be present\
+ in global config")
+ concurrentSnapshots = int(config[0].value)
self.debug("concurrent Snapshots: %s" % concurrentSnapshots)
threads = []
@@ -228,14 +228,14 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
name="concurrent.snapshots.threshold.perhost"
)
if config[0].value:
- self.assertEqual(
- isinstance(
- config,
- list),
- True,
- "concurrent.snapshots.threshold.perhost should be present\
- in global config")
- concurrentSnapshots = int(config[0].value)
+ self.assertEqual(
+ isinstance(
+ config,
+ list),
+ True,
+ "concurrent.snapshots.threshold.perhost should be present\
+ in global config")
+ concurrentSnapshots = int(config[0].value)
else:
self.skipTest("Skipping tests as the config value \
concurrent.snapshots.threshold.perhost is Null")
@@ -304,9 +304,9 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
concurrent.snapshots.threshold.perhost parameter.
"""
with self.assertRaises(Exception):
- Configurations.update(
- self.apiclient,
- "concurrent.snapshots.threshold.perhost",
- "String"
- )
- return
\ No newline at end of file
+ Configurations.update(
+ self.apiclient,
+ "concurrent.snapshots.threshold.perhost",
+ "String"
+ )
+ return
diff --git a/test/integration/component/test_configdrive.py b/test/integration/component/test_configdrive.py
index 38a9a7d2ca8..316fbe98c98 100644
--- a/test/integration/component/test_configdrive.py
+++ b/test/integration/component/test_configdrive.py
@@ -19,44 +19,46 @@
and password reset functionality with
ConfigDrive
"""
+
+# Import Local Modules
+from marvin.cloudstackAPI import (restartVPC)
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (
+ Account,
+ createVlanIpRange,
+ Configurations,
+ FireWallRule,
+ Host,
+ listVlanIpRanges,
+ Network,
+ NetworkACL,
+ NetworkACLList,
+ NetworkOffering,
+ NetworkServiceProvider,
+ PublicIPAddress,
+ Router,
+ ServiceOffering,
+ createSSHKeyPair,
+ deleteSSHKeyPair,
+ StaticNATRule,
+ VirtualMachine,
+ VPC,
+ VpcOffering,
+ Hypervisor, Template)
+from marvin.lib.common import (
+ get_domain,
+ get_zone, get_test_template,
+ is_config_suitable)
+from marvin.lib.utils import random_gen
+
+# Import System Modules
import base64
import os
import socket
-# Import Local Modules
import subprocess
import tempfile
-from contextlib import contextmanager
-
import time
-from marvin.cloudstackAPI import (restartVPC)
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.lib.base import (Account,
- createVlanIpRange,
- Configurations,
- FireWallRule,
- Host,
- listVlanIpRanges,
- Network,
- NetworkACL,
- NetworkACLList,
- NetworkOffering,
- NetworkServiceProvider,
- PublicIPAddress,
- Router,
- ServiceOffering,
- createSSHKeyPair,
- deleteSSHKeyPair,
- StaticNATRule,
- VirtualMachine,
- VPC,
- VpcOffering,
- Hypervisor, Template)
-from marvin.lib.common import (get_domain,
- get_template,
- get_zone, get_test_template,
- is_config_suitable)
-from marvin.lib.utils import random_gen
-# Import System Modules
+from contextlib import contextmanager
from nose.plugins.attrib import attr
from retry import retry
@@ -1000,7 +1002,7 @@ class ConfigDriveUtils:
:rtype: str
"""
self.debug("Updating userdata for VM - %s" % vm.name)
- updated_user_data = base64.b64encode(new_user_data)
+ updated_user_data = base64.encodestring(new_user_data.encode()).decode()
with self.stopped_vm(vm):
vm.update(self.api_client, userdata=updated_user_data)
@@ -2371,7 +2373,6 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils):
vm1, public_ip_1,
metadata=True)
-
# =====================================================================
# Network restart tests
# =====================================================================
diff --git a/test/integration/component/test_cpu_domain_limits.py b/test/integration/component/test_cpu_domain_limits.py
index 4d7c165bfcc..82192c103a8 100644
--- a/test/integration/component/test_cpu_domain_limits.py
+++ b/test/integration/component/test_cpu_domain_limits.py
@@ -191,7 +191,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -267,7 +267,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -328,7 +328,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -392,7 +392,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin,
self.child_domain: self.child_do_admin
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_cpu_limits.py b/test/integration/component/test_cpu_limits.py
index b9df64907b4..15a31f8a2c7 100644
--- a/test/integration/component/test_cpu_limits.py
+++ b/test/integration/component/test_cpu_limits.py
@@ -435,7 +435,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -510,7 +510,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -570,7 +570,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -633,7 +633,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_cpu_project_limits.py b/test/integration/component/test_cpu_project_limits.py
index 8a43b7680bd..5781e6af077 100644
--- a/test/integration/component/test_cpu_project_limits.py
+++ b/test/integration/component/test_cpu_project_limits.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_custom_hostname.py b/test/integration/component/test_custom_hostname.py
index ac85b8c37f9..7d71c581e95 100644
--- a/test/integration/component/test_custom_hostname.py
+++ b/test/integration/component/test_custom_hostname.py
@@ -19,7 +19,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
random_gen,
get_hypervisor_type)
diff --git a/test/integration/component/test_deploy_vgpu_vm.py b/test/integration/component/test_deploy_vgpu_vm.py
index de47c42256c..2c1f124e8ef 100644
--- a/test/integration/component/test_deploy_vgpu_vm.py
+++ b/test/integration/component/test_deploy_vgpu_vm.py
@@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import changeServiceForVirtualMachine, startVirtualMachine
# Import Integration Libraries
diff --git a/test/integration/component/test_deploy_vm_userdata_multi_nic.py b/test/integration/component/test_deploy_vm_userdata_multi_nic.py
index 86c0f1317bf..2f1f256399d 100644
--- a/test/integration/component/test_deploy_vm_userdata_multi_nic.py
+++ b/test/integration/component/test_deploy_vm_userdata_multi_nic.py
@@ -126,7 +126,7 @@ class TestDeployVmWithUserDataMultiNic(cloudstackTestCase):
"""Test userdata update when non default nic is without userdata for deploy and update
"""
- self.userdata = base64.b64encode(self.userdata)
+ self.userdata = base64.encodestring(self.userdata.encode()).decode()
network1 = Network.create(
self.apiclient,
@@ -166,10 +166,10 @@ class TestDeployVmWithUserDataMultiNic(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
try:
updateresponse = deployVmResponse.update(self.apiclient, userdata=self.userdata)
diff --git a/test/integration/component/test_deploy_vm_userdata_reg.py b/test/integration/component/test_deploy_vm_userdata_reg.py
index ee1f81a5771..cd048d022da 100644
--- a/test/integration/component/test_deploy_vm_userdata_reg.py
+++ b/test/integration/component/test_deploy_vm_userdata_reg.py
@@ -110,8 +110,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
"""Test userdata as POST, size > 2k
"""
-
- self.userdata=base64.b64encode(self.userdata)
+ self.userdata = base64.encodestring(self.userdata.encode()).decode()
self.services["virtual_machine"]["userdata"] = self.userdata
deployVmResponse = VirtualMachine.create(
@@ -132,10 +131,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
ip_addr=deployVmResponse.ipaddress
if self.zone.networktype == "Basic":
list_router_response = list_routers(
diff --git a/test/integration/component/test_dhcp_dns_offload.py b/test/integration/component/test_dhcp_dns_offload.py
index eea5c26ff16..d012bcb1763 100644
--- a/test/integration/component/test_dhcp_dns_offload.py
+++ b/test/integration/component/test_dhcp_dns_offload.py
@@ -16,7 +16,8 @@
# under the License.
""" Tests for DHCP DNS offload feature
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (random_gen, validateList, cleanup_resources, get_hypervisor_type)
from marvin.lib.base import (Account,
NIC,
@@ -321,7 +322,7 @@ class TestDeployVMs(cloudstackTestCase):
self.assertEqual(validateList(qresultset)[0], PASS, "sql query returned invalid response")
self.assertEqual(
metadata["vm-id.txt"][0],
- unicode(qresultset[0][0]),
+ str(qresultset[0][0]),
"vm id in metadata does not match with the vm id from cloud db"
)
return
diff --git a/test/integration/component/test_dynamic_compute_offering.py b/test/integration/component/test_dynamic_compute_offering.py
index 1889fbfbea5..1f8740c9c42 100644
--- a/test/integration/component/test_dynamic_compute_offering.py
+++ b/test/integration/component/test_dynamic_compute_offering.py
@@ -25,7 +25,8 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/
CLOUDSTACK/Dynamic+Compute+Offering+FS
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList,
random_gen,
diff --git a/test/integration/component/test_egress_fw_rules.py b/test/integration/component/test_egress_fw_rules.py
index f3bce20afd4..fc64cc6a3df 100644
--- a/test/integration/component/test_egress_fw_rules.py
+++ b/test/integration/component/test_egress_fw_rules.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
Domain,
Router,
diff --git a/test/integration/component/test_eip_elb.py b/test/integration/component/test_eip_elb.py
index 76987b94254..e0b54317b76 100644
--- a/test/integration/component/test_eip_elb.py
+++ b/test/integration/component/test_eip_elb.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (authorizeSecurityGroupIngress,
disassociateIpAddress,
deleteLoadBalancerRule)
@@ -167,7 +168,7 @@ class TestEIP(cloudstackTestCase):
)
if isinstance(ip_addrs, list):
cls.source_nat = ip_addrs[0]
- print "source_nat ipaddress : ", cls.source_nat.ipaddress
+ print("source_nat ipaddress : ", cls.source_nat.ipaddress)
else:
raise Exception(
"No Source NAT IP found for guest network: %s" %
diff --git a/test/integration/component/test_escalation_listTemplateDomainAdmin.py b/test/integration/component/test_escalation_listTemplateDomainAdmin.py
index f0c492989be..2148a607357 100644
--- a/test/integration/component/test_escalation_listTemplateDomainAdmin.py
+++ b/test/integration/component/test_escalation_listTemplateDomainAdmin.py
@@ -164,4 +164,4 @@ class TestlistTemplatesDomainAdmin(cloudstackTestCase):
else:
retries = retries - 1
- raise Exception("Template download failed exception.")
\ No newline at end of file
+ raise Exception("Template download failed exception.")
diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py
index 9e0d27eb590..20f398c77bb 100644
--- a/test/integration/component/test_escalations_instances.py
+++ b/test/integration/component/test_escalations_instances.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (Account,
ServiceOffering,
@@ -152,7 +153,7 @@ class TestListInstances(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -222,7 +223,7 @@ class TestListInstances(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
status = validateList(list_instances_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances after creation failed"
@@ -243,7 +244,7 @@ class TestListInstances(cloudstackTestCase):
domainid=self.account.domainid
)
status = validateList(list_instances_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page1 failed"
@@ -264,7 +265,7 @@ class TestListInstances(cloudstackTestCase):
domainid=self.account.domainid
)
status = validateList(list_instances_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page2 failed"
@@ -281,7 +282,7 @@ class TestListInstances(cloudstackTestCase):
# Verifying that the VM on page 2 is not present in page1
for i in range(0, len(list_instances_page1)):
instance_page1 = list_instances_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
instance_page2.id,
instance_page1.id,
"VM listed in page 2 is also listed in page 1"
@@ -354,13 +355,13 @@ class TestListInstances(cloudstackTestCase):
state="Running"
)
status = validateList(list_running_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Newly created VM is not in Running state"
)
# Verifying list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_running_vms_after),
"Running VM list count is not matching"
@@ -448,13 +449,13 @@ class TestListInstances(cloudstackTestCase):
state="Stopped"
)
status = validateList(list_stopped_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Stopped VM is not in Stopped state"
)
# Verifying list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_stopped_vms_after),
"Stopped VM list count is not matching"
@@ -557,13 +558,13 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_destroyed_vms_admin)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Destroyed VM is not in Destroyed state"
)
# Verifying that the length of the destroyed VMs list should be 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_destroyed_vms_admin),
"Destroyed VM list count is not matching"
@@ -648,12 +649,12 @@ class TestListInstances(cloudstackTestCase):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM after creation failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -665,7 +666,7 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vm_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM by Id failed"
@@ -756,12 +757,12 @@ class TestListInstances(cloudstackTestCase):
domainid=self.account.domainid,
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM's creation failed"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(list_vms_after),
"VM's list count is not matching"
@@ -776,13 +777,13 @@ class TestListInstances(cloudstackTestCase):
name=vms[0].name
)
status = validateList(list_vm_byfullname)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VM by Name"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_byfullname),
"VM list by full name count is not matching"
@@ -825,13 +826,13 @@ class TestListInstances(cloudstackTestCase):
name=vms[0].name[:1]
)
status = validateList(list_vm_bypartialname)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VM by Name"
)
# Verifying that the size of the list is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_vm_bypartialname),
"VM list by full name count is not matching"
@@ -893,12 +894,12 @@ class TestListInstances(cloudstackTestCase):
domainid=self.account.domainid,
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM's creation failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM's list count is not matching"
@@ -914,13 +915,13 @@ class TestListInstances(cloudstackTestCase):
state="Running"
)
status = validateList(list_running_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List VM by name and state failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_running_vm),
"Count of VM list by name and state is not matching"
@@ -1008,7 +1009,7 @@ class TestListInstances(cloudstackTestCase):
# Listing all the zones available
zones_list = Zone.list(self.apiClient)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"zones not available in the given setup"
@@ -1066,13 +1067,13 @@ class TestListInstances(cloudstackTestCase):
zoneid=zones_list[0].id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1155,7 +1156,7 @@ class TestListInstances(cloudstackTestCase):
# Listing all the zones available
zones_list = Zone.list(self.apiClient)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"zones not available in the given setup"
@@ -1215,13 +1216,13 @@ class TestListInstances(cloudstackTestCase):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1238,13 +1239,13 @@ class TestListInstances(cloudstackTestCase):
name=vm_created.name
)
status = validateList(list_vms)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing VM's by name and zone failed"
)
# Verifying Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms),
"Count of listed VM's by name and zone is not as expected"
@@ -1374,13 +1375,13 @@ class TestListInstances(cloudstackTestCase):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1398,13 +1399,13 @@ class TestListInstances(cloudstackTestCase):
state="Running"
)
status = validateList(list_vms)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing VM's by name and zone failed"
)
# Verifying Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms),
"Count of listed VM's by name, zone and state is not as expected"
@@ -1468,13 +1469,13 @@ class TestListInstances(cloudstackTestCase):
account=self.account.name
)
status = validateList(list_vms)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing VM's by name, account and zone failed"
)
# Verifying Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms),
"Count of listed VM's by name, zone and account is not as expected"
@@ -1553,13 +1554,13 @@ class TestListInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1586,7 +1587,7 @@ class TestListInstances(cloudstackTestCase):
new_keypair,
"New Key pair generation failed"
)
- self.assertEquals(
+ self.assertEqual(
"keypair1",
new_keypair.name,
"Key Pair not created with given name"
@@ -1596,13 +1597,13 @@ class TestListInstances(cloudstackTestCase):
self.userapiclient
)
status = validateList(list_keypairs_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Key pairs failed"
)
# Verifying that list size is increased by 1
- self.assertEquals(
+ self.assertEqual(
list_keypairs_before_size + 1,
len(list_keypairs_after),
"List count is not matching"
@@ -1618,18 +1619,18 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"VMs list is not as expected"
)
# Verifying that VM's SSH keypair is set to newly created keypair
- self.assertEquals(
+ self.assertEqual(
new_keypair.name,
list_vm[0].keypair,
"VM is not set to newly created SSH Key pair"
@@ -1677,7 +1678,7 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.serviceofferingid
)
status = validateList(vm_so_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Service offering failed"
@@ -1689,13 +1690,13 @@ class TestListInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1737,18 +1738,18 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VMs list is not as expected"
)
# Verifying that VM's service offerings is not changed
- self.assertEquals(
+ self.assertEqual(
current_so.id,
list_vms_after[0].serviceofferingid,
"VM is not containing old Service Offering"
@@ -1818,13 +1819,13 @@ class TestListInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -1839,13 +1840,13 @@ class TestListInstances(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_network_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Network not created when deploying a VM"
)
# Verifying that only 1 network is created while deploying a VM
- self.assertEquals(
+ self.assertEqual(
1,
len(list_network_before),
"More than 1 default network exists"
@@ -1886,13 +1887,13 @@ class TestListInstances(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_network_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List of Networks failed"
)
# Verifying that list size is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_network_after),
"More than 1 default network exists"
@@ -1903,13 +1904,13 @@ class TestListInstances(cloudstackTestCase):
vm_nics_before,
"Nic not found for the VM deployed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_nics_before),
"VM Nic count is not matching"
)
# Verifying that the nic is same as the default network listed above
- self.assertEquals(
+ self.assertEqual(
network1.id,
vm_nics_before[0].networkid,
"Default NIC for VM is not as expected"
@@ -1926,7 +1927,7 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
@@ -1938,7 +1939,7 @@ class TestListInstances(cloudstackTestCase):
vm_nics_after,
"Nic not found for the deployed VM"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_nics_after),
"VM NIC's count is not matching"
@@ -1951,14 +1952,14 @@ class TestListInstances(cloudstackTestCase):
default_nic = vm_nics_after[i]
else:
non_default_nic = vm_nics_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
default_count,
"Default NIC count is not matching"
)
# Verifying that default NIC is same the network created when VM is
# deployed
- self.assertEquals(
+ self.assertEqual(
network1.id,
default_nic.networkid,
"Default NIC is not matching for VM"
@@ -1974,7 +1975,7 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
@@ -1986,7 +1987,7 @@ class TestListInstances(cloudstackTestCase):
vm_nics_after,
"Nic not found for the deployed VM"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_nics_after),
"VM NIC's count is not matching"
@@ -2000,14 +2001,14 @@ class TestListInstances(cloudstackTestCase):
else:
non_default_nic = vm_nics_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
default_count,
"Default NIC count is not matching"
)
# Verifying that default NIC is same the newly updated network (network
# 2)
- self.assertEquals(
+ self.assertEqual(
network2.id,
default_nic.networkid,
"Default NIC is not matching for VM"
@@ -2044,7 +2045,7 @@ class TestListInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
@@ -2056,13 +2057,13 @@ class TestListInstances(cloudstackTestCase):
vm_nics_after,
"Nic not found for the deployed VM"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_nics_after),
"VM NIC's count is not matching"
)
# Verifying the nic network is same as the default nic network
- self.assertEquals(
+ self.assertEqual(
network2.id,
vm_nics_after[0].networkid,
"VM NIC is not same as expected"
@@ -2092,7 +2093,7 @@ class TestListInstances(cloudstackTestCase):
new_keypair1,
"New Key pair generation failed"
)
- self.assertEquals(
+ self.assertEqual(
"keypair1",
new_keypair1.name,
"Key Pair not created with given name"
@@ -2102,13 +2103,13 @@ class TestListInstances(cloudstackTestCase):
self.userapiclient
)
status = validateList(list_keypairs_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Key pairs failed"
)
# Verifying that list size is increased by 1
- self.assertEquals(
+ self.assertEqual(
list_keypairs_before_size + 1,
len(list_keypairs_after),
"List count is not matching"
@@ -2133,7 +2134,7 @@ class TestListInstances(cloudstackTestCase):
listall=True,
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
@@ -2153,7 +2154,7 @@ class TestListInstances(cloudstackTestCase):
name="keypair2",
publickey="ssh-rsa: e6:9a:1e:b5:98:75:88:5d:56:bc:92:7b:43:48:05:b2")
self.fail("SSH Key creation passed using same public key ")
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e)
return
@@ -2269,7 +2270,7 @@ class TestInstances(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -2332,7 +2333,7 @@ class TestInstances(cloudstackTestCase):
timeout -= 1
# Verify template response to check whether template added successfully
status = validateList(list_template_response)
- self.assertEquals(PASS, status[0], "Template download failed")
+ self.assertEqual(PASS, status[0], "Template download failed")
self.assertNotEqual(
len(list_template_response),
@@ -2682,13 +2683,13 @@ class TestInstances(cloudstackTestCase):
account=self.account.name
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -2728,18 +2729,18 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM listing by Id failed"
)
# Verifying that attached ISO details are present in VM
- self.assertEquals(
+ self.assertEqual(
iso_toattach.name,
list_vm[0].isoname,
"Attached ISO name is not matching"
)
- self.assertEquals(
+ self.assertEqual(
iso_toattach.displaytext,
list_vm[0].isodisplaytext,
"Attached ISO display is not matching"
@@ -2754,7 +2755,7 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM listing by Id failed"
@@ -2816,13 +2817,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -2856,12 +2857,12 @@ class TestInstances(cloudstackTestCase):
virtualmachineid=vm_created.id
)
status = validateList(list_snapshots_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Snapshots creation failed"
)
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_snapshots_after),
"Count of VM Snapshots is not matching"
@@ -2875,13 +2876,13 @@ class TestInstances(cloudstackTestCase):
pagesize=self.services["pagesize"],
)
status = validateList(list_snapshots_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Snapshots failed in page 1"
)
# Verifying the list size is equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_snapshots_page1),
"List VM Snapshot count is not matching in page 1"
@@ -2895,13 +2896,13 @@ class TestInstances(cloudstackTestCase):
pagesize=self.services["pagesize"],
)
status = validateList(list_snapshots_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Snapshots failed in page 2"
)
# Verifying the list size is equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_snapshots_page2),
"List VM Snapshot count is not matching in page 2"
@@ -2978,13 +2979,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3026,12 +3027,12 @@ class TestInstances(cloudstackTestCase):
virtualmachineid=vm_created.id
)
status = validateList(list_snapshots_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Snapshots creation failed"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(list_snapshots_after),
"Count of VM Snapshots is not matching"
@@ -3044,12 +3045,12 @@ class TestInstances(cloudstackTestCase):
current_count = current_count + 1
current_snapshot = list_snapshots_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
current_count,
"count of VM Snapshot with current flag as true is not matching"
)
- self.assertEquals(
+ self.assertEqual(
snapshot2.id,
current_snapshot.id,
"Latest snapshot taken is not marked as current"
@@ -3067,12 +3068,12 @@ class TestInstances(cloudstackTestCase):
virtualmachineid=vm_created.id
)
status = validateList(list_snapshots_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Snapshots creation failed"
)
- self.assertEquals(
+ self.assertEqual(
2,
len(list_snapshots_after),
"Count of VM Snapshots is not matching"
@@ -3084,12 +3085,12 @@ class TestInstances(cloudstackTestCase):
if (list_snapshots_after[i].current is True):
current_count = current_count + 1
current_snapshot = list_snapshots_after[i]
- self.assertEquals(
+ self.assertEqual(
1,
current_count,
"count of VM Snapshot with current flag as true is not matching"
)
- self.assertEquals(
+ self.assertEqual(
snapshot1.id,
current_snapshot.id,
"Current flag was set properly after reverting the VM to snapshot"
@@ -3148,13 +3149,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3166,13 +3167,13 @@ class TestInstances(cloudstackTestCase):
virtualmachineid=vm_created.id
)
status = validateList(list_volumes_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Root volume is not created for VM deployed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_volumes_before),
"Volumes count is not matching"
@@ -3202,13 +3203,13 @@ class TestInstances(cloudstackTestCase):
virtualmachineid=vm_created.id
)
status = validateList(list_volumes_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes are not listed"
)
# Verifying that size of the list is equal to page size + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_volumes_after),
"VM's volume count is not matching"
@@ -3222,13 +3223,13 @@ class TestInstances(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_volumes_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes not listed in page1"
)
# Verifying that list size is equal to page size
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_volumes_page1),
"VM's volume count is not matching in page 1"
@@ -3242,13 +3243,13 @@ class TestInstances(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_volumes_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes not listed in page2"
)
# Verifying that list size is equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_volumes_page2),
"VM's volume count is not matching in page 1"
@@ -3280,13 +3281,13 @@ class TestInstances(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_volumes_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volumes not listed in page1"
)
# Verifying that list size is equal to page size
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_volumes_page1),
"VM's volume count is not matching in page 1"
@@ -3350,7 +3351,7 @@ class TestInstances(cloudstackTestCase):
name="enable.dynamic.scale.vm"
)
status = validateList(list_config)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of configuration failed"
@@ -3390,7 +3391,7 @@ class TestInstances(cloudstackTestCase):
id=vm_created.serviceofferingid
)
status = validateList(vm_so_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Service offering failed"
@@ -3402,13 +3403,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3460,18 +3461,18 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VMs list is not as expected"
)
# Verifying that VM's service offerings is changed
- self.assertEquals(
+ self.assertEqual(
new_so.id,
list_vms_after[0].serviceofferingid,
"VM is not containing New Service Offering"
@@ -3520,7 +3521,7 @@ class TestInstances(cloudstackTestCase):
id=vm_created.serviceofferingid
)
status = validateList(vm_so_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM Service offering failed"
@@ -3532,13 +3533,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3584,18 +3585,18 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"VMs list is not as expected"
)
# Verifying that VM's service offerings is changed
- self.assertEquals(
+ self.assertEqual(
new_so.id,
list_vm[0].serviceofferingid,
"VM is not containing New Service Offering"
@@ -3643,13 +3644,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3678,7 +3679,7 @@ class TestInstances(cloudstackTestCase):
new_keypair,
"New Key pair generation failed"
)
- self.assertEquals(
+ self.assertEqual(
"keypair1",
new_keypair.name,
"Key Pair not created with given name"
@@ -3688,13 +3689,13 @@ class TestInstances(cloudstackTestCase):
self.userapiclient
)
status = validateList(list_keypairs_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Key pairs failed"
)
# Verifying that list size is increased by 1
- self.assertEquals(
+ self.assertEqual(
list_keypairs_before_size + 1,
len(list_keypairs_after),
"List count is not matching"
@@ -3710,18 +3711,18 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"VMs list is not as expected"
)
# Verifying that VM's SSH keypair is set to newly created keypair
- self.assertEquals(
+ self.assertEqual(
new_keypair.name,
list_vm[0].keypair,
"VM is not set to newly created SSH Key pair"
@@ -3765,12 +3766,12 @@ class TestInstances(cloudstackTestCase):
"VM creation failed"
)
# Verifying the displayname and group details for deployed VM
- self.assertEquals(
+ self.assertEqual(
self.services["virtual_machine"]["displayname"],
vm_created.displayname,
"Display name of VM is not as expected"
)
- self.assertEquals(
+ self.assertEqual(
"groupName",
vm_created.group,
"Group of VM is not as expected"
@@ -3781,13 +3782,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3805,23 +3806,23 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id,
)
status = validateList(list_vm)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VM by Id failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm),
"Count of List VM by Id is not matching"
)
# Verifying that displayname and group details are updated
- self.assertEquals(
+ self.assertEqual(
"DisplayName",
list_vm[0].displayname,
"Displayname of VM is not updated"
)
- self.assertEquals(
+ self.assertEqual(
"Group",
list_vm[0].group,
"Group of VM is not updated"
@@ -3868,13 +3869,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -3950,7 +3951,7 @@ class TestInstances(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -3978,7 +3979,7 @@ class TestInstances(cloudstackTestCase):
type="Isolated"
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing networks failed"
@@ -4014,13 +4015,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -4028,7 +4029,7 @@ class TestInstances(cloudstackTestCase):
# Verifying that the NIC's in VM created are same as provided
vm_nics = vm_created.nic
# Verifying that the size of nics is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_nics),
"NIC's count in VM created is not matching"
@@ -4036,13 +4037,13 @@ class TestInstances(cloudstackTestCase):
# Verifying that NIC network ID's are as expected
for i in range(0, len(vm_nics)):
if vm_nics[i].isdefault is True:
- self.assertEquals(
+ self.assertEqual(
networks_list_after[0].id,
vm_nics[i].networkid,
"Default NIC is not as expected"
)
else:
- self.assertEquals(
+ self.assertEqual(
networks_list_after[1].id,
vm_nics[i].networkid,
"Non Default NIC is not as expected"
@@ -4095,7 +4096,7 @@ class TestInstances(cloudstackTestCase):
domainid=self.domain.id
)
status = validateList(security_groups_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing Security Groups failed"
@@ -4132,13 +4133,13 @@ class TestInstances(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vms_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM creation failed"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vms_after),
"VM list count is not matching"
@@ -4147,7 +4148,7 @@ class TestInstances(cloudstackTestCase):
# provided
vm_securitygroups = vm_created.securitygroup
# Verifying that the size of security groups is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(vm_securitygroups),
"Security Groups count in VM created is not matching"
@@ -4160,7 +4161,7 @@ class TestInstances(cloudstackTestCase):
vm_securitygroups_flag = False
break
- self.assertEquals(
+ self.assertEqual(
True,
vm_securitygroups_flag,
"Security Groups in VM are not same as created"
@@ -4187,7 +4188,7 @@ class TestInstances(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -4235,13 +4236,13 @@ class TestInstances(cloudstackTestCase):
id=vm_created.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list returned invalid response"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching"
@@ -4249,13 +4250,13 @@ class TestInstances(cloudstackTestCase):
# Verifying that the NIC's in VM created are same as provided
vm_nics = vm_created.nic
status = validateList(vm_nics)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list returned invalid response for vm nics"
)
# Verifying that the size of nics is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_nics),
"VM is created with more than one nic which is not expected"
@@ -4263,7 +4264,7 @@ class TestInstances(cloudstackTestCase):
"""
Verifying that NIC IP address is as expected
"""
- self.assertEquals(
+ self.assertEqual(
str(vm_nics[0].ipaddress),
vm_ip,
"VM is not created with static ip address used in vm deployment"
@@ -4305,7 +4306,7 @@ class TestInstances(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -4357,13 +4358,13 @@ class TestInstances(cloudstackTestCase):
id=vm1.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm1"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching"
@@ -4391,13 +4392,13 @@ class TestInstances(cloudstackTestCase):
id=vm2.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm2"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching after vm2 deployment"
@@ -4434,13 +4435,13 @@ class TestInstances(cloudstackTestCase):
id=vm3.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm3"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching after vm2 deployment"
@@ -4472,13 +4473,13 @@ class TestInstances(cloudstackTestCase):
id=vm4.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response for vm4"
)
# Verifying that the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(vm_response),
"VM list count is not matching after vm2 deployment"
diff --git a/test/integration/component/test_escalations_ipaddresses.py b/test/integration/component/test_escalations_ipaddresses.py
index 4a971f03a1b..059843ad504 100644
--- a/test/integration/component/test_escalations_ipaddresses.py
+++ b/test/integration/component/test_escalations_ipaddresses.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (PublicIPAddress,
NetworkOffering,
Autoscale,
@@ -139,7 +140,7 @@ class TestIpAddresses(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -195,7 +196,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -223,12 +224,12 @@ class TestIpAddresses(cloudstackTestCase):
type="Isolated"
)
status = validateList(networks_list_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(networks_list_after),
"Network creation failed"
@@ -260,7 +261,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -279,13 +280,13 @@ class TestIpAddresses(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_ipaddress_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses in page1"
)
# Verifying that list size is equals to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_ipaddress_page1),
"Failed to list pagesize number of IP Addresses in page1"
@@ -298,13 +299,13 @@ class TestIpAddresses(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_ipaddress_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses in page2"
)
# Verifying that List size is equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddress_page2),
"Failed to list IP Addresses in page2"
@@ -363,7 +364,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat enabled are not found"
@@ -391,12 +392,12 @@ class TestIpAddresses(cloudstackTestCase):
type="Isolated"
)
status = validateList(networks_list_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(networks_list_after),
"Network creation failed"
@@ -408,12 +409,12 @@ class TestIpAddresses(cloudstackTestCase):
id=network.id
)
status = validateList(network_list_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Network by Id"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(network_list_byid),
"Failed to list Network by Id"
@@ -443,7 +444,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -460,13 +461,13 @@ class TestIpAddresses(cloudstackTestCase):
id=associated_ipaddress.ipaddress.id
)
status = validateList(list_ipaddress_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses by ID"
)
# Verifying that list size is equals to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddress_byid),
"Failed to list IP Addresses by ID"
@@ -545,13 +546,13 @@ class TestIpAddresses(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -562,12 +563,12 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List VPC IP Address"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"Failed to List VPC IP Address"
@@ -588,7 +589,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -608,13 +609,13 @@ class TestIpAddresses(cloudstackTestCase):
id=associated_ipaddress.ipaddress.id
)
status = validateList(list_ipaddress_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list IP Addresses by ID"
)
# Verifying that list size is equals to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddress_byid),
"Failed to list IP Addresses by ID"
@@ -698,7 +699,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat, Lb enabled are\
@@ -744,7 +745,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -807,7 +808,7 @@ class TestIpAddresses(cloudstackTestCase):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -879,13 +880,13 @@ class TestIpAddresses(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -899,7 +900,7 @@ class TestIpAddresses(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true with Lb")
@@ -925,13 +926,13 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
@@ -952,7 +953,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1016,7 +1017,7 @@ class TestIpAddresses(cloudstackTestCase):
publicipid=associated_ipaddress.ipaddress.id,
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1082,7 +1083,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1109,13 +1110,13 @@ class TestIpAddresses(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
# Verifying network list count is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_after),
"Network Creation Failed"
@@ -1146,7 +1147,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1186,7 +1187,7 @@ class TestIpAddresses(cloudstackTestCase):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1291,7 +1292,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1336,7 +1337,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1372,7 +1373,7 @@ class TestIpAddresses(cloudstackTestCase):
networkid=network.id
)
status = validateList(list_vms_running)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Created is not in Running state"
@@ -1383,7 +1384,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_vms_running),
"VM Created is not in Running state"
)
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_vms_running[0].id,
"VM Created is not in Running state"
@@ -1432,7 +1433,7 @@ class TestIpAddresses(cloudstackTestCase):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1463,7 +1464,7 @@ class TestIpAddresses(cloudstackTestCase):
applied="false"
)
status = validateList(list_lbruleinstance_applied_false)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No Instances are available to assign to Load Balancer Rule"
@@ -1475,7 +1476,7 @@ class TestIpAddresses(cloudstackTestCase):
"No Instances are available to assign to Load Balancer Rule"
)
# Verifying that Instance created above is listed
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_lbruleinstance_applied_false[0].id,
"Failed to list Instance available to asign a Load Balancer Rule"
@@ -1494,7 +1495,7 @@ class TestIpAddresses(cloudstackTestCase):
applied="true"
)
status = validateList(list_lbruleinstance_applied_false)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No Instances are available to assign to Load Balancer Rule"
@@ -1506,7 +1507,7 @@ class TestIpAddresses(cloudstackTestCase):
"No Instances are available to assign to Load Balancer Rule"
)
# Verifying Instances is assigned to the Load Balancer Rule
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_lbruleinstance_applied_true[0].id,
"Failed to assign Load Balancer Rule to given Instance"
@@ -1550,7 +1551,7 @@ class TestIpAddresses(cloudstackTestCase):
applied="false"
)
status = validateList(list_lbruleinstance_applied_false)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No Instances are available to assign to Load Balancer Rule"
@@ -1562,7 +1563,7 @@ class TestIpAddresses(cloudstackTestCase):
"No Instances are available to assign to Load Balancer Rule"
)
# Verifying that Instance created above is listed
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_lbruleinstance_applied_false[0].id,
"Failed to list Instance available to asign a Load Balancer Rule"
@@ -1615,7 +1616,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1642,13 +1643,13 @@ class TestIpAddresses(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
# Verifying network list count is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_after),
"Network Creation Failed"
@@ -1679,7 +1680,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1719,7 +1720,7 @@ class TestIpAddresses(cloudstackTestCase):
publicipid=associated_ipaddress.ipaddress.id
)
status = validateList(list_lbrules_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Rule creation Failed"
@@ -1737,7 +1738,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
# Verifying no Sticky Policies are listed
- self.assertEquals(
+ self.assertEqual(
0,
len(list_lbstickypolicy_before[0].stickinesspolicy),
"Sticky Policy listed for newly created Load Balancer Rule"
@@ -1785,7 +1786,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_lbstickypolicy_after[0].stickinesspolicy)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Load Balancer Sticky Policy creation Failed"
@@ -1809,7 +1810,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
# Verifying no Sticky Policies are listed
- self.assertEquals(
+ self.assertEqual(
0,
len(list_lbstickypolicy_after[0].stickinesspolicy),
"Sticky Policy listed for newly created Load Balancer Rule"
@@ -1860,7 +1861,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -1905,7 +1906,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -1938,7 +1939,7 @@ class TestIpAddresses(cloudstackTestCase):
networkid=network.id
)
status = validateList(list_vms_running)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Created is not in Running state"
@@ -1949,7 +1950,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddresses_after),
"VM Created is not in Running state"
)
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_vms_running[0].id,
"VM Created is not in Running state"
@@ -2018,7 +2019,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_prtfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Port Forwarding Rule"
@@ -2093,13 +2094,13 @@ class TestIpAddresses(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2113,7 +2114,7 @@ class TestIpAddresses(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for\
@@ -2138,13 +2139,13 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
@@ -2165,7 +2166,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2244,7 +2245,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_prtfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Port Forwarding Rule"
@@ -2311,7 +2312,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2357,7 +2358,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2424,7 +2425,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_firewalls_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Firewall Rule"
@@ -2492,7 +2493,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2538,7 +2539,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2602,7 +2603,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_vpns_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Remote Access VPN"
@@ -2668,7 +2669,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2714,7 +2715,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2768,7 +2769,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_vpns_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Remote Access VPN"
@@ -2811,7 +2812,7 @@ class TestIpAddresses(cloudstackTestCase):
domainid=self.domain.id
)
status = validateList(list_vpnusers_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN user after creation"
@@ -2877,7 +2878,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -2933,7 +2934,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -2970,7 +2971,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -2981,7 +2982,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_ipaddress[0].isstaticnat,
"Failed to Enable Static Nat"
@@ -2998,7 +2999,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3009,7 +3010,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
False,
list_ipaddress[0].isstaticnat,
"Failed to Disable Static Nat"
@@ -3057,13 +3058,13 @@ class TestIpAddresses(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -3077,7 +3078,7 @@ class TestIpAddresses(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present\
@@ -3102,13 +3103,13 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list IP Addresses not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_ipaddresses_before),
"list IP Addresses not equal as expected"
@@ -3129,7 +3130,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3169,7 +3170,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3180,7 +3181,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_ipaddress[0].isstaticnat,
"Failed to Enable Static Nat"
@@ -3197,7 +3198,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3208,7 +3209,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
False,
list_ipaddress[0].isstaticnat,
"Failed to Disable Static Nat"
@@ -3259,7 +3260,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -3315,7 +3316,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3352,7 +3353,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Address"
@@ -3363,7 +3364,7 @@ class TestIpAddresses(cloudstackTestCase):
len(list_ipaddress),
"Failed to List IP Address"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_ipaddress[0].isstaticnat,
"Failed to Enable Static Nat"
@@ -3399,7 +3400,7 @@ class TestIpAddresses(cloudstackTestCase):
ipaddressid=associated_ipaddress2.ipaddress.id
)
status = validateList(list_ipfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to List IP Forwarding Rule after Creation"
@@ -3507,7 +3508,7 @@ class TestIpAddresses(cloudstackTestCase):
supportedservices="SourceNat,Lb",
zoneid=self.zone.id
)
- self.assertEquals(
+ self.assertEqual(
len(list_nwoff_before) + 1,
len(list_nwoff_after),
"Failed to create Network Offering"
@@ -3546,7 +3547,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed while launching a VM"
@@ -3573,7 +3574,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3589,7 +3590,7 @@ class TestIpAddresses(cloudstackTestCase):
self.userapiclient,
)
status = validateList(list_counters)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list counters"
@@ -3635,7 +3636,7 @@ class TestIpAddresses(cloudstackTestCase):
domainid=self.domain.id
)
status = validateList(list_conditions_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Conditions after creation"
@@ -3663,7 +3664,7 @@ class TestIpAddresses(cloudstackTestCase):
"Failed to create Autoscale VM Policy"
)
# Verifying autoscalepolicy is created using condition1
- self.assertEquals(
+ self.assertEqual(
condition_created1.id,
autoscalepolicy_created.conditions[0].id,
"Autoscale Policy not created by given condition"
@@ -3674,12 +3675,12 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_autoscalepolicies_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale Policy after creation"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(list_autoscalepolicies_after),
"Autoscale Policies count is not matching"
@@ -3697,7 +3698,7 @@ class TestIpAddresses(cloudstackTestCase):
"Failed to update Autoscale Policy"
)
# Verifying the Autoscale Policy is updated
- self.assertEquals(
+ self.assertEqual(
condition_created2.id,
autoscalepolicy_updated.conditions[0].id,
"Autoscale Policy not updated to given condition"
@@ -3787,7 +3788,7 @@ class TestIpAddresses(cloudstackTestCase):
supportedservices="SourceNat,Lb",
zoneid=self.zone.id
)
- self.assertEquals(
+ self.assertEqual(
len(list_nwoff_before) + 1,
len(list_nwoff_after),
"Failed to create Network Offering"
@@ -3826,7 +3827,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed while launching a VM"
@@ -3853,7 +3854,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -3871,7 +3872,7 @@ class TestIpAddresses(cloudstackTestCase):
issystem='false'
)
status = validateList(list_service_offerings)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Service Offerings"
@@ -3884,7 +3885,7 @@ class TestIpAddresses(cloudstackTestCase):
domainid=self.domain.id
)
status = validateList(list_users)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Users"
@@ -3897,7 +3898,7 @@ class TestIpAddresses(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(list_templates_featured)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Featured Templates"
@@ -3955,13 +3956,13 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_autoscalevm_profiles_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale VM Profile after creation"
)
# Verifying only 1 autoscale vm profile is created
- self.assertEquals(
+ self.assertEqual(
1,
len(list_autoscalevm_profiles_after),
"Count of Autoscale VM profiles listed is not matching"
@@ -3973,7 +3974,7 @@ class TestIpAddresses(cloudstackTestCase):
id=autoscalevm_profile.id
)
status = validateList(list_autoscalvmprofile)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale VM Profile by Id after creation"
@@ -4025,7 +4026,7 @@ class TestIpAddresses(cloudstackTestCase):
)
# Verifyign that Destroy VM Graceperiod is updated in autoscale VM
# Profile
- self.assertEquals(
+ self.assertEqual(
200,
autoscalevm_profile_updated.destroyvmgraceperiod,
"Failed to update destroy vm grace period"
@@ -4114,7 +4115,7 @@ class TestIpAddresses(cloudstackTestCase):
supportedservices="SourceNat,Lb",
zoneid=self.zone.id
)
- self.assertEquals(
+ self.assertEqual(
len(list_nwoff_before) + 1,
len(list_nwoff_after),
"Failed to create Network Offering"
@@ -4153,7 +4154,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed while launching a VM"
@@ -4180,7 +4181,7 @@ class TestIpAddresses(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -4199,7 +4200,7 @@ class TestIpAddresses(cloudstackTestCase):
domainid=self.domain.id
)
status = validateList(list_users)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Users"
@@ -4207,7 +4208,7 @@ class TestIpAddresses(cloudstackTestCase):
# Listing counters
list_counters = Autoscale.listCounters(self.userapiclient)
status = validateList(list_counters)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Counters"
@@ -4320,13 +4321,13 @@ class TestIpAddresses(cloudstackTestCase):
lbruleid=lbrule.id
)
status = validateList(list_vmgroup_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Autoscale VM group after creation"
)
# Verifying only 1 Autoscale VM group is listed
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vmgroup_after),
"Autoscale VM group list count is not matching"
@@ -4341,7 +4342,7 @@ class TestIpAddresses(cloudstackTestCase):
"Failed to disable Autoscale VM group"
)
# Verifyign the state of the VM Group afte renabling
- self.assertEquals(
+ self.assertEqual(
"disabled",
vmgroup_disabled.state,
"Disabled VM Group state is not matching"
@@ -4360,7 +4361,7 @@ class TestIpAddresses(cloudstackTestCase):
vmgroup_updated,
"Failed to update Autoscale VM group"
)
- self.assertEquals(
+ self.assertEqual(
40,
vmgroup_updated.interval,
"Updated Autoscale VM group interval value is not matching"
@@ -4375,7 +4376,7 @@ class TestIpAddresses(cloudstackTestCase):
"Failed to enable Autoscale VM group"
)
# Verifyign the state of the VM Group afte renabling
- self.assertEquals(
+ self.assertEqual(
"enabled",
vmgroup_enabled.state,
"Enabled VM Group state is not matching"
diff --git a/test/integration/component/test_escalations_isos.py b/test/integration/component/test_escalations_isos.py
index 4e818a5c3b8..d1de07d98f8 100644
--- a/test/integration/component/test_escalations_isos.py
+++ b/test/integration/component/test_escalations_isos.py
@@ -121,7 +121,7 @@ class TestIsos(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -189,13 +189,13 @@ class TestIsos(cloudstackTestCase):
isofilter=self.services["templatefilter"]
)
status = validateList(list_iso_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO's creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_iso_after),
"Failed to create pagesize + 1 number of ISO's"
@@ -209,13 +209,13 @@ class TestIsos(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_iso_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO's in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_iso_page1),
"Size of ISO's in page 1 is not matching"
@@ -229,13 +229,13 @@ class TestIsos(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_iso_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISo's in page 2"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_iso_page2),
"Size of ISO's in page 2 is not matching"
@@ -251,7 +251,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -335,13 +335,13 @@ class TestIsos(cloudstackTestCase):
isofilter=self.services["templatefilter"]
)
status = validateList(list_iso_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO's creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_iso_after),
"Failed to create an ISO's"
@@ -357,7 +357,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -386,7 +386,7 @@ class TestIsos(cloudstackTestCase):
"Download ISO failed"
)
# Verifying the details of downloaded ISO
- self.assertEquals(
+ self.assertEqual(
"DOWNLOAD_URL_CREATED",
download_iso.state,
"Download URL not created for ISO"
@@ -395,7 +395,7 @@ class TestIsos(cloudstackTestCase):
download_iso.url,
"Download URL not created for ISO"
)
- self.assertEquals(
+ self.assertEqual(
iso_created.id,
download_iso.id,
"Download ISO details are not same as ISO created"
@@ -451,13 +451,13 @@ class TestIsos(cloudstackTestCase):
isofilter=self.services["templatefilter"]
)
status = validateList(list_iso_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO's creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_iso_after),
"Failed to create an ISO's"
@@ -473,7 +473,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -534,7 +534,7 @@ class TestIsos(cloudstackTestCase):
# Editing the ISO name, displaytext, ostypeid
ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list OS Types"
@@ -618,7 +618,7 @@ class TestIsos(cloudstackTestCase):
available=True
)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Zones"
@@ -669,13 +669,13 @@ class TestIsos(cloudstackTestCase):
zoneid=zones_list[0].id
)
status = validateList(list_isos_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_isos_zone1),
"Failed to create a Template"
@@ -703,7 +703,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id
)
status = validateList(list_iso)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list ISO by Id"
@@ -739,13 +739,13 @@ class TestIsos(cloudstackTestCase):
zoneid=zones_list[0].id
)
status = validateList(list_isos_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_isos_zone1),
"Failed to create a Template"
@@ -758,23 +758,23 @@ class TestIsos(cloudstackTestCase):
zoneid=zones_list[1].id
)
status = validateList(list_isos_zone2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO failed to copy into Zone2"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_isos_zone2),
"ISO failed to copy into Zone2"
)
- self.assertNotEquals(
+ self.assertNotEqual(
"Connection refused",
list_isos_zone2[0].status,
"Failed to copy ISO"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_isos_zone2[0].isready,
"Failed to copy ISO"
diff --git a/test/integration/component/test_escalations_networks.py b/test/integration/component/test_escalations_networks.py
index 8be177ba8a5..e3095a1299b 100644
--- a/test/integration/component/test_escalations_networks.py
+++ b/test/integration/component/test_escalations_networks.py
@@ -132,7 +132,7 @@ class TestNetworks_1(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -168,7 +168,7 @@ class TestNetworks_1(cloudstackTestCase):
id=self.zone.id
)
status = validateList(list_zones)
- self.assertEquals(PASS, status[0], "No Zones found for a given id")
+ self.assertEqual(PASS, status[0], "No Zones found for a given id")
self.test_data["network_without_acl"]["zoneid"] = list_zones[0].id
# Listing the networks for a user
list_networks_before = Network.list(
@@ -226,7 +226,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
len(list_networks_after),
@@ -242,7 +242,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_page1)
- self.assertEquals(PASS, status[0], "No networks found at page 1")
+ self.assertEqual(PASS, status[0], "No networks found at page 1")
self.assertEqual(
len(list_networks_page1),
self.test_data["pagesize"],
@@ -257,7 +257,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_page2)
- self.assertEquals(PASS, status[0], "No networks found at page 2")
+ self.assertEqual(PASS, status[0], "No networks found at page 2")
self.assertEqual(
len(list_networks_page2),
1,
@@ -267,7 +267,7 @@ class TestNetworks_1(cloudstackTestCase):
network_page2 = list_networks_page2[0]
for i in range(0, len(list_networks_page1)):
network_page1 = list_networks_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
network_page2.id,
network_page1.id,
"Network listed in page 2 is also listed in page 1"
@@ -341,7 +341,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# verify no vpc is present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
for i in range(0, (self.test_data["pagesize"] + 1)):
vpc_1 = VPC.create(
self.userapiclient,
@@ -354,13 +354,13 @@ class TestNetworks_1(cloudstackTestCase):
# verify vpc is created and not none
self.assertIsNotNone(vpc_1, "VPC is not created")
# Verify VPC name with test data
- self.assertNotEquals(
+ self.assertNotEqual(
-1,
vpc_1.name.find(self.test_data["vpc"]["name"]),
"VPC name not matched"
)
# verify zone with test data
- self.assertEquals(
+ self.assertEqual(
self.zone.id,
vpc_1.zoneid,
"Zone is not matching in the vpc created"
@@ -370,7 +370,7 @@ class TestNetworks_1(cloudstackTestCase):
self.userapiclient,
listall=self.test_data["listall"])
status = validateList(vpc_count_after)
- self.assertEquals(PASS, status[0], "VPC list count is null")
+ self.assertEqual(PASS, status[0], "VPC list count is null")
self.assertEqual(
len(vpc_count_after),
(self.test_data["pagesize"] + 1),
@@ -384,7 +384,7 @@ class TestNetworks_1(cloudstackTestCase):
pagesize=self.test_data["pagesize"]
)
status = validateList(list_vpcs_page1)
- self.assertEquals(PASS, status[0], "No vpcs found in Page 1")
+ self.assertEqual(PASS, status[0], "No vpcs found in Page 1")
self.assertEqual(
len(list_vpcs_page1),
self.test_data["pagesize"],
@@ -398,7 +398,7 @@ class TestNetworks_1(cloudstackTestCase):
pagesize=self.test_data["pagesize"]
)
status = validateList(list_vpcs_page2)
- self.assertEquals(PASS, status[0], "No vpc found in Page 2")
+ self.assertEqual(PASS, status[0], "No vpc found in Page 2")
self.assertEqual(
1,
len(list_vpcs_page2),
@@ -410,7 +410,7 @@ class TestNetworks_1(cloudstackTestCase):
# is not present in page1
for i in range(0, len(list_vpcs_page1)):
vpc_page1 = list_vpcs_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
vpc_page2.id,
vpc_page1.id,
"VPC listed in page 2 is also listed in page 1"
@@ -456,7 +456,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -472,8 +472,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -500,7 +500,7 @@ class TestNetworks_1(cloudstackTestCase):
network_offering_before_count = NetworkOffering.list(
self.userapiclient)
status = validateList(network_offering_before_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present")
@@ -515,7 +515,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_before_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -530,7 +530,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_false_before_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = false")
@@ -548,12 +548,12 @@ class TestNetworks_1(cloudstackTestCase):
# List network offering
network_offering_after_count = NetworkOffering.list(self.userapiclient)
status = validateList(network_offering_after_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Offering list results in null")
# Verify that count is incremented by 1
- self.assertEquals(
+ self.assertEqual(
len(network_offering_before_count) + 1,
len(network_offering_after_count),
"Network offering is not created"
@@ -569,12 +569,12 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_after_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Offering list results in null")
# Verify that its count is same as step 1
- self.assertEquals(
+ self.assertEqual(
len(network_offering_vpc_true_before_count),
len(network_offering_vpc_true_after_count),
"Default Network offering is created with vpc as true"
@@ -590,12 +590,12 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_false_after_count)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Offering list results in null")
# Verify that its count is same as step 3
- self.assertEquals(
+ self.assertEqual(
len(network_offering_vpc_false_before_count) + 1,
len(network_offering_vpc_false_after_count),
"Default Network offering is not created with vpc as false"
@@ -632,7 +632,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -647,8 +647,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -673,7 +673,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -733,7 +733,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -746,7 +746,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_in_vpc)
- self.assertEquals(PASS, status[0], "No networks found in vpc")
+ self.assertEqual(PASS, status[0], "No networks found in vpc")
# Asserting for the length of the networks
self.assertEqual(
1,
@@ -760,7 +760,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# verify no vpc is present for newly created user
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPCs not found.")
+ self.assertEqual(PASS, status[0], "VPCs not found.")
# verify vpc name matches for newly created vpc name and vpc list name
self.assertEqual(
vpc_1.name,
@@ -799,7 +799,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_false_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = false")
@@ -845,7 +845,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -861,14 +861,14 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_after_delete)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
self.assertEqual(
1,
len(list_networks_after_delete),
"Number of networks created is not matching expected"
)
# Verify deleted network is not present
- self.assertNotEquals(
+ self.assertNotEqual(
network_created.id,
list_networks_after_delete[0].id,
"Deleted network present"
@@ -894,7 +894,7 @@ class TestNetworks_1(cloudstackTestCase):
self.assertIsNotNone(
list_networks_before,
"Network create failed at class level")
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_before),
"More than 1 network created at class level"
@@ -910,7 +910,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_false_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = false")
@@ -949,7 +949,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -969,7 +969,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after_update)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
self.assertEqual(
2,
len(list_networks_after_update),
@@ -1056,7 +1056,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=list_networks_before[0].id
)
status = validateList(list_instances_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances after creation failed"
@@ -1076,7 +1076,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=list_networks_before[0].id
)
status = validateList(list_instances_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page1 failed"
@@ -1096,7 +1096,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=list_networks_before[0].id
)
status = validateList(list_instances_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of instances in page2 failed"
@@ -1155,7 +1155,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -1170,8 +1170,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -1196,7 +1196,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -1246,7 +1246,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -1261,7 +1261,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_in_vpc)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Verify network name matches for newly created network name and name
# from network list
self.assertEqual(
@@ -1298,7 +1298,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# verify no vpc is present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_1 = VPC.create(
self.userapiclient,
self.test_data["vpc"],
@@ -1309,13 +1309,13 @@ class TestNetworks_1(cloudstackTestCase):
self.cleanup.append(vpc_1)
# verify vpc is created and not none
# Verify VPC name with test data
- self.assertNotEquals(
+ self.assertNotEqual(
-1,
vpc_1.name.find(self.test_data["vpc"]["name"]),
"VPC name not matched"
)
# verify zone with test data
- self.assertEquals(
+ self.assertEqual(
self.zone.id,
vpc_1.zoneid,
"Zone is not matching in the vpc created"
@@ -1325,7 +1325,7 @@ class TestNetworks_1(cloudstackTestCase):
self.userapiclient,
listall=self.test_data["listall"])
status = validateList(vpc_count_after)
- self.assertEquals(PASS, status[0], "VPC list count is null")
+ self.assertEqual(PASS, status[0], "VPC list count is null")
self.assertEqual(
1,
len(vpc_count_after),
@@ -1344,7 +1344,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(list_vpcs_after_update)
- self.assertEquals(PASS, status[0], "No vpcs found using list call")
+ self.assertEqual(PASS, status[0], "No vpcs found using list call")
self.assertEqual(
1,
len(list_vpcs_after_update),
@@ -1403,7 +1403,7 @@ class TestNetworks_1(cloudstackTestCase):
)
# No VPCs should be present for newly created user
status = validateList(vpc_list)
- self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
+ self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
vpc_count_before = 0
vpc_1 = VPC.create(
self.userapiclient,
@@ -1418,8 +1418,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(vpc_list)
- self.assertEquals(PASS, status[0], "VPC is not created")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "VPC is not created")
+ self.assertEqual(
vpc_count_before + 1,
len(vpc_list),
"VPC is not created"
@@ -1445,7 +1445,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled"
)
status = validateList(network_offering_vpc_true_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default network offering not present for vpc = true")
@@ -1505,7 +1505,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"],
type="Isolated")
status = validateList(list_networks_after)
- self.assertEquals(PASS, status[0], "No networks found using list call")
+ self.assertEqual(PASS, status[0], "No networks found using list call")
# Asserting for the length of the networks
self.assertEqual(
2,
@@ -1518,7 +1518,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_in_vpc)
- self.assertEquals(PASS, status[0], "No networks found in vpc")
+ self.assertEqual(PASS, status[0], "No networks found in vpc")
# Asserting for the length of the networks
self.assertEqual(
1,
@@ -1554,7 +1554,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=network_created.id
)
status = validateList(list_network_acl)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"No networks acls found after creating")
@@ -1654,7 +1654,7 @@ class TestNetworks_2(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -1703,13 +1703,13 @@ class TestNetworks_2(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -1721,13 +1721,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(list_vpc_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_byid),
"list VPC not equal as expected"
@@ -1829,13 +1829,13 @@ class TestNetworks_2(cloudstackTestCase):
# ipaddress for network
list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient)
status = validateList(list_public_ipaddress_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list Public IPAddress not as expected"
)
# Verifying the list public ipaddress size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_public_ipaddress_after),
"list Public IPAddress not equal as expected"
@@ -1847,13 +1847,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(list_public_ipaddress_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list public ipaddress not as expected"
)
# Verifying the list public ipaddress size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_public_ipaddress_byid),
"list public ipaddress not equal as expected"
@@ -1966,8 +1966,8 @@ class TestNetworks_2(cloudstackTestCase):
)
# Verifying PrivateGateways are listed
status = validateList(list_private_gateways_after)
- self.assertEquals(PASS, status[0], "Private Gateway Creation Failed")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "Private Gateway Creation Failed")
+ self.assertEqual(
1,
len(list_private_gateways_after),
"list Private Gateway not equal as expected"
@@ -1979,13 +1979,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id
)
status = validateList(list_privategateway_byvpcid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list private gateway not as expected"
)
# Verifying the list private gateway size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_privategateway_byvpcid),
"list private gateway not equal as expected"
@@ -2089,13 +2089,13 @@ class TestNetworks_2(cloudstackTestCase):
type="Isolated"
)
status = validateList(list_networks_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Network Creation Failed"
)
# Verifying network list count is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_networks_after),
"Network Creation Failed"
@@ -2131,13 +2131,13 @@ class TestNetworks_2(cloudstackTestCase):
networkid=network.id
)
status = validateList(list_egressfirewallrule_bynetworkid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list EgressFirewall Rule not as expected"
)
# Verifying the list EgressFirewall Rule size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_egressfirewallrule_bynetworkid),
"list EgressFirewall Rule not equal as expected"
@@ -2215,13 +2215,13 @@ class TestNetworks_2(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2238,13 +2238,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"]
)
status = validateList(list_vpc_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_byid),
"list VPC not equal as expected"
@@ -2291,13 +2291,13 @@ class TestNetworks_2(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2329,13 +2329,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id
)
status = validateList(list_vpngateway_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List VPN Gateway not equal as expected"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpngateway_after
),
@@ -2410,13 +2410,13 @@ class TestNetworks_2(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPC not as expected"
)
# Verifying the list vpc size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpc_after),
"list VPC not equal as expected"
@@ -2448,13 +2448,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id
)
status = validateList(list_vpngateway_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"List VPN Gateway not equal as expected"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpngateway_after
),
@@ -2491,13 +2491,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"],
)
status = validateList(list_vpncustomergateways_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VPN Customer Gateway list failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateways_after),
"Failed to list VPN Customer Gateways"
@@ -2530,13 +2530,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id
)
status = validateList(list_vpn_connection_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPN Connection not as expected"
)
# Verifying the list vpn connection size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpn_connection_after),
"list VPC Connection equal as expected"
@@ -2553,13 +2553,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id
)
status = validateList(list_vpn_connection_after_reset)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"list VPN Connection not as expected"
)
# Verifying the list vpn connection size is increased by 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpn_connection_after_reset),
"list VPN Connection not equal as expected"
@@ -2664,7 +2664,7 @@ class TestNetworks_2(cloudstackTestCase):
"Failed to list network acl list")
# Verfying list is not none
status = validateList(list_networkacl)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list network acl list"
@@ -2711,8 +2711,8 @@ class TestNetworks_2(cloudstackTestCase):
)
# Verifying PrivateGateways are listed
status = validateList(list_private_gateways_after)
- self.assertEquals(PASS, status[0], "Failed to list Private Gateway")
- self.assertEquals(
+ self.assertEqual(PASS, status[0], "Failed to list Private Gateway")
+ self.assertEqual(
1,
len(list_private_gateways_after),
"list Private Gateway not equal as expected"
diff --git a/test/integration/component/test_escalations_securitygroups.py b/test/integration/component/test_escalations_securitygroups.py
index ffaf6571b95..7fa645e99e3 100644
--- a/test/integration/component/test_escalations_securitygroups.py
+++ b/test/integration/component/test_escalations_securitygroups.py
@@ -95,7 +95,7 @@ class TestSecurityGroups(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -134,13 +134,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that default security group is created
status = validateList(list_securitygroups_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Security Groups creation failed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_before),
"Count of Security Groups list is not matching"
@@ -167,13 +167,13 @@ class TestSecurityGroups(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_securitygroups_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_securitygroups_after),
"Failed to create pagesize + 1 number of Security Groups"
@@ -186,13 +186,13 @@ class TestSecurityGroups(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_securitygroups_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list security groups in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_securitygroups_page1),
"Size of security groups in page 1 is not matching"
@@ -205,13 +205,13 @@ class TestSecurityGroups(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_securitygroups_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list security groups in page 2"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_page2),
"Size of security groups in page 2 is not matching"
@@ -262,13 +262,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that default security group is created
status = validateList(list_securitygroups_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Security Groups creation failed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_before),
"Count of Security Groups list is not matching"
@@ -293,13 +293,13 @@ class TestSecurityGroups(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_securitygroups_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups creation failed"
)
# Verifying that list size is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_securitygroups_after),
"Failed to create Security Group"
@@ -320,13 +320,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -334,12 +334,12 @@ class TestSecurityGroups(cloudstackTestCase):
securitygroup_ingress = list_securitygroups_byid[0].ingressrule
# Validating the Ingress rule
status = validateList(securitygroup_ingress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups Ingress rule authorization failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(securitygroup_ingress),
"Security Group Ingress rules count is not matching"
@@ -378,13 +378,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -392,7 +392,7 @@ class TestSecurityGroups(cloudstackTestCase):
securitygroup_ingress = list_securitygroups_byid[0].ingressrule
# Verifying that Ingress rule is empty(revoked)
status = validateList(securitygroup_ingress)
- self.assertEquals(
+ self.assertEqual(
EMPTY_LIST,
status[2],
"Security Groups Ingress rule is not revoked"
@@ -426,13 +426,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that default security group is created
status = validateList(list_securitygroups_before)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Default Security Groups creation failed"
)
# Verifying the size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_before),
"Count of Security Groups list is not matching"
@@ -457,13 +457,13 @@ class TestSecurityGroups(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_securitygroups_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups creation failed"
)
# Verifying that list size is 2
- self.assertEquals(
+ self.assertEqual(
2,
len(list_securitygroups_after),
"Failed to create Security Group"
@@ -484,13 +484,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -498,12 +498,12 @@ class TestSecurityGroups(cloudstackTestCase):
securitygroup_egress = list_securitygroups_byid[0].egressrule
# Validating the Ingress rule
status = validateList(securitygroup_egress)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Security Groups Egress rule authorization failed"
)
- self.assertEquals(
+ self.assertEqual(
1,
len(securitygroup_egress),
"Security Group Egress rules count is not matching"
@@ -542,13 +542,13 @@ class TestSecurityGroups(cloudstackTestCase):
)
# Verifying that security group is listed
status = validateList(list_securitygroups_byid)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of Security Groups by id failed"
)
# Verifying size of the list is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_securitygroups_byid),
"Count of the listing security group by id is not matching"
@@ -556,7 +556,7 @@ class TestSecurityGroups(cloudstackTestCase):
securitygroup_egress = list_securitygroups_byid[0].egressrule
# Verifying that Ingress rule is empty(revoked)
status = validateList(securitygroup_egress)
- self.assertEquals(
+ self.assertEqual(
EMPTY_LIST,
status[2],
"Security Groups Egress rule is not revoked"
diff --git a/test/integration/component/test_escalations_snapshots.py b/test/integration/component/test_escalations_snapshots.py
index 1e2b445d1e1..33ff79dadab 100644
--- a/test/integration/component/test_escalations_snapshots.py
+++ b/test/integration/component/test_escalations_snapshots.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VmSnapshot,
Snapshot,
DiskOffering,
@@ -138,7 +139,7 @@ class TestSnapshots(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -188,13 +189,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(volumes_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Root volume did not get created while deploying a VM"
)
# Verifying list size to be 1
- self.assertEquals(
+ self.assertEqual(
1,
len(volumes_list),
"More than 1 root volume created for deployed VM"
@@ -218,13 +219,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_vol_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volume snapshot creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_vol_snaps_after),
"Failed to create pagesize + 1 number of Volume snapshots"
@@ -237,13 +238,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_vol_snaps_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list volume snapshots in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vol_snaps_page1),
"Size of volume snapshots in page 1 is not matching"
@@ -256,13 +257,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_vol_snaps_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list volume snapshots in page 2"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vol_snaps_page2),
"Size of volume snapshots in page 2 is not matching"
@@ -319,13 +320,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(volumes_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Root volume did not get created while deploying a VM"
)
# Verifying list size to be 1
- self.assertEquals(
+ self.assertEqual(
1,
len(volumes_list),
"More than 1 root volume created for deployed VM"
@@ -347,13 +348,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_vol_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Volume snapshot creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vol_snaps_after),
"Failed to create Volume snapshot"
@@ -365,13 +366,13 @@ class TestSnapshots(cloudstackTestCase):
id=snapshot_created.id
)
status = validateList(list_vol_snapshot)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Volume snapshot by Id"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vol_snapshot),
"Size of the list volume snapshot by Id is not matching"
@@ -454,13 +455,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_vm_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM snapshot creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_vm_snaps_after),
"Failed to create pagesize + 1 number of VM snapshots"
@@ -473,13 +474,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_vm_snaps_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list vm snapshots in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vm_snaps_page1),
"Size of vm snapshots in page 1 is not matching"
@@ -492,13 +493,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_vm_snaps_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list vm snapshots in page 2"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_snaps_page2),
"Size of vm snapshots in page 2 is not matching"
@@ -526,13 +527,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"],
)
status = validateList(list_vm_snaps)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"All VM snapshots deleted"
)
# Verifying that list size is equal to page size
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vm_snaps),
"VM Snapshots count is not matching"
@@ -586,13 +587,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_vm_snaps_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM snapshot creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_snaps_after),
"Failed to create VM snapshot"
@@ -604,13 +605,13 @@ class TestSnapshots(cloudstackTestCase):
vmsnapshotid=snapshot_created.id
)
status = validateList(list_vm_snapshot)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VM snapshot by Id"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vm_snapshot),
"Size of the list vm snapshot by Id is not matching"
diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py
index 12f98ac2cb1..bd7c4180345 100644
--- a/test/integration/component/test_escalations_templates.py
+++ b/test/integration/component/test_escalations_templates.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList)
from marvin.lib.base import (Account,
@@ -118,7 +119,7 @@ class TestTemplates(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -231,13 +232,13 @@ class TestTemplates(cloudstackTestCase):
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_templates_after),
"Failed to create pagesize + 1 number of Templates"
@@ -251,13 +252,13 @@ class TestTemplates(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_templates_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Templates in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_templates_page1),
"Size of Templates in page 1 is not matching"
@@ -271,13 +272,13 @@ class TestTemplates(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_templates_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Templates in page 2"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_page2),
"Size of Templates in page 2 is not matching"
@@ -354,13 +355,13 @@ class TestTemplates(cloudstackTestCase):
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_after),
"Failed to create a Template"
@@ -381,7 +382,7 @@ class TestTemplates(cloudstackTestCase):
"Download Template failed"
)
# Verifying the details of downloaded template
- self.assertEquals(
+ self.assertEqual(
"DOWNLOAD_URL_CREATED",
download_template.state,
"Download URL not created for Template"
@@ -390,7 +391,7 @@ class TestTemplates(cloudstackTestCase):
download_template.url,
"Download URL not created for Template"
)
- self.assertEquals(
+ self.assertEqual(
template_created.id,
download_template.id,
"Download Template details are not same as Template created"
@@ -453,13 +454,13 @@ class TestTemplates(cloudstackTestCase):
templatefilter=self.services["templatefilter"]
)
status = validateList(list_templates_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_after),
"Failed to create a Template"
@@ -551,7 +552,7 @@ class TestTemplates(cloudstackTestCase):
# Editing the Template ostypeid
ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list OS Types"
@@ -716,7 +717,7 @@ class TestTemplates(cloudstackTestCase):
available=True
)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Zones"
@@ -756,7 +757,7 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[0].id
)
status = validateList(zones_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list Hypervisors in Zone 1"
@@ -780,13 +781,13 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[0].id
)
status = validateList(list_templates_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_zone1),
"Failed to create a Template"
@@ -825,13 +826,13 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[0].id
)
status = validateList(list_templates_zone1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Templates creation failed in Zone1"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_zone1),
"Failed to create a Template"
@@ -844,23 +845,23 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[1].id
)
status = validateList(list_templates_zone2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Template failed to copy into Zone2"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_templates_zone2),
"Template failed to copy into Zone2"
)
- self.assertNotEquals(
+ self.assertNotEqual(
"Connection refused",
list_templates_zone2[0].status,
"Failed to copy Template"
)
- self.assertEquals(
+ self.assertEqual(
True,
list_templates_zone2[0].isready,
"Failed to copy Template"
diff --git a/test/integration/component/test_escalations_vmware.py b/test/integration/component/test_escalations_vmware.py
index 098ece07af4..e5e44b73ae1 100644
--- a/test/integration/component/test_escalations_vmware.py
+++ b/test/integration/component/test_escalations_vmware.py
@@ -252,7 +252,7 @@ class TestVMware(cloudstackTestCase):
isready="true"
)
status = validateList(list_default_iso_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO list is empty")
@@ -260,7 +260,7 @@ class TestVMware(cloudstackTestCase):
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response)
@@ -316,7 +316,7 @@ class TestVMware(cloudstackTestCase):
isready="true"
)
status = validateList(list_default_iso_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"ISO list is empty")
@@ -324,7 +324,7 @@ class TestVMware(cloudstackTestCase):
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
- except CloudstackAPIException as e:
+ except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response)
diff --git a/test/integration/component/test_escalations_volumes.py b/test/integration/component/test_escalations_volumes.py
index b2e21f6be04..6d62d31a689 100644
--- a/test/integration/component/test_escalations_volumes.py
+++ b/test/integration/component/test_escalations_volumes.py
@@ -16,7 +16,8 @@
# under the License.
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import createVolume, createTemplate
from marvin.lib.utils import (cleanup_resources,
random_gen, validateList)
@@ -149,7 +150,7 @@ class TestVolumes(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -266,7 +267,7 @@ class TestVolumes(cloudstackTestCase):
# Verifying that the volume on page 2 is not present in page1
for i in range(0, len(list_volumes_page1)):
volume_page1 = list_volumes_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
volume_page2.id,
volume_page1.id,
"Volume listed in page 2 is also listed in page 1"
@@ -482,7 +483,7 @@ class TestVolumes(cloudstackTestCase):
list_volumes_after = Volume.list(
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Data volume creation failed"
@@ -505,7 +506,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -563,7 +564,7 @@ class TestVolumes(cloudstackTestCase):
)
self.assertIsNotNone(resized_volume, "Resize Volume failed")
# Verifying data volume size is increased
- self.assertEquals(
+ self.assertEqual(
new_size,
(resized_volume.size / (1024 * 1024 * 1024)),
"volume not resized to expected value"
@@ -637,7 +638,7 @@ class TestVolumes(cloudstackTestCase):
# Verifyign that volume list is increased by 1 after creation of
# custion volume
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Custom volume did not get created"
@@ -659,7 +660,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -691,7 +692,7 @@ class TestVolumes(cloudstackTestCase):
size=new_size)
self.assertIsNotNone(resized_volume, "Resize Volume failed")
# Verifying that custom disk size is increased
- self.assertEquals(
+ self.assertEqual(
new_size,
(resized_volume.size / (1024 * 1024 * 1024)),
"volume not resized to expected value"
@@ -731,7 +732,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -753,7 +754,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -911,7 +912,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
templatefilter='self')
- self.assertEquals(
+ self.assertEqual(
templates_before_size + 1,
len(list_templates_after),
"Template creation failed from snapshot"
@@ -955,7 +956,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -978,7 +979,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1049,7 +1050,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after,
"Hourly Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Hourly Snapshot policy creation failed"
@@ -1093,7 +1094,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1115,7 +1116,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1186,7 +1187,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after,
"Daily Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Daily Snapshot policy creation failed"
@@ -1230,7 +1231,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1252,7 +1253,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1323,7 +1324,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after,
"Weekly Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Weekly Snapshot policy creation failed"
@@ -1369,7 +1370,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1390,7 +1391,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1459,7 +1460,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after,
"Monthly Snapshot policy creation failed"
)
- self.assertEquals(
+ self.assertEqual(
snapshot_policy_before_size + 1,
len(list_snapshot_policy_after),
"Monthly Snapshot policy creation failed"
@@ -1518,7 +1519,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient,
listall=self.services["listall"])
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1539,7 +1540,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1579,7 +1580,7 @@ class TestVolumes(cloudstackTestCase):
)
self.assertIsNotNone(snapshot_created, "Snapshot not created")
- self.assertEquals(
+ self.assertEqual(
volume_created.id,
snapshot_created.volumeid,
"Snapshot not created for given volume"
@@ -1630,7 +1631,7 @@ class TestVolumes(cloudstackTestCase):
# Verifying that the snapshot on page 2 is not present in page1
for i in range(0, len(list_snapshots_page1)):
snapshot_page1 = list_snapshots_page1[i]
- self.assertNotEquals(
+ self.assertNotEqual(
snapshot_page2.id,
snapshot_page1.id,
"Snapshot listed in page 2 is also listed in page 1"
@@ -1705,7 +1706,7 @@ class TestVolumes(cloudstackTestCase):
list_volumes_after,
"volume creation failed"
)
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"Volume not created"
@@ -1726,7 +1727,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname,
"VM is not attached to Volume"
)
- self.assertEquals(
+ self.assertEqual(
self.virtual_machine.name,
attached_volume.vmname,
"VM Name is not matching with attached vm"
@@ -1758,7 +1759,7 @@ class TestVolumes(cloudstackTestCase):
extract_volume_response,
"Extract/Download volume failed")
- self.assertEquals(
+ self.assertEqual(
"DOWNLOAD_URL_CREATED",
extract_volume_response.state,
"Failed to create Download URL"
@@ -1771,7 +1772,7 @@ class TestVolumes(cloudstackTestCase):
(extract_volume_response.url.find("http") != -1),
"Extract/Download volume URL doesnot contain http"
)
- self.assertEquals(
+ self.assertEqual(
volume_created.id,
extract_volume_response.id,
"Extracted/Downloaded volume is not matching with original volume"
@@ -1815,7 +1816,7 @@ class TestVolumes(cloudstackTestCase):
"volume not created for the vm launched at class level"
)
# Asserting that the list volume length after upload is increased by 1
- self.assertEquals(
+ self.assertEqual(
len(list_volumes_before) + 1,
len(list_volumes_after),
"upload volume failed"
diff --git a/test/integration/component/test_escalations_vpncustomergateways.py b/test/integration/component/test_escalations_vpncustomergateways.py
index b09930ab099..8c7cdd1c600 100644
--- a/test/integration/component/test_escalations_vpncustomergateways.py
+++ b/test/integration/component/test_escalations_vpncustomergateways.py
@@ -120,7 +120,7 @@ class TestVpnCustomerGateways(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -186,13 +186,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_vpncustomergateways_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VPN Customer Gateway creation failed"
)
# Verifying that list size is pagesize + 1
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"] + 1,
len(list_vpncustomergateways_after),
"Failed to create pagesize + 1 number of VPN Customer Gateways"
@@ -205,13 +205,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_vpncustomergateways_page1)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN Customer Gateways in page 1"
)
# Verifying the list size to be equal to pagesize
- self.assertEquals(
+ self.assertEqual(
self.services["pagesize"],
len(list_vpncustomergateways_page1),
"Size of VPN Customer Gateways in page 1 is not matching"
@@ -224,13 +224,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
pagesize=self.services["pagesize"]
)
status = validateList(list_vpncustomergateways_page2)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN Customer Gateways in page 2"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateways_page2),
"Size of VPN Customer Gateways in page 2 is not matching"
@@ -301,13 +301,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_vpncustomergateways_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VPN Customer Gateway creation failed"
)
# Verifying that list size is 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateways_after),
"Failed to create VPN Customer Gateways"
@@ -332,13 +332,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
id=vpncustomergateway_created.id
)
status = validateList(list_vpncustomergateway)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to list VPN Customer Gateways by Id"
)
# Verifying the list size to be equal to 1
- self.assertEquals(
+ self.assertEqual(
1,
len(list_vpncustomergateway),
"Size of VPN Customer Gateways by id is not matching"
diff --git a/test/integration/component/test_haproxy.py b/test/integration/component/test_haproxy.py
index 25b169f6572..5728ef07591 100644
--- a/test/integration/component/test_haproxy.py
+++ b/test/integration/component/test_haproxy.py
@@ -412,7 +412,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
self.virtual_machine_2],
services=services)
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Creating stickiness policy for the LB rule: %s" %
lb_rule.id)
policies = self.configure_Stickiness_Policy(lb_rule,
@@ -496,7 +496,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
#TODO: Add code to check the AppCookie and LbCookie Stickiness policies
configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods:
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method))
@@ -566,7 +566,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
#TODO: Add code to check the AppCookie and LbCookie Stickiness policies
configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods:
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method))
@@ -632,7 +632,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods:
- for method, params in configs.items():
+ for method, params in list(configs.items()):
self.debug("Setting up environment - acquire public IP")
public_ip = self.acquire_Public_Ip()
diff --git a/test/integration/component/test_host.py b/test/integration/component/test_host.py
index c2a590a6117..56913f02e8b 100644
--- a/test/integration/component/test_host.py
+++ b/test/integration/component/test_host.py
@@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __builtin__ import False
""" BVT tests for Hosts Test
"""
diff --git a/test/integration/component/test_host_ha.py b/test/integration/component/test_host_ha.py
index cb2a86998bf..d32e708b081 100644
--- a/test/integration/component/test_host_ha.py
+++ b/test/integration/component/test_host_ha.py
@@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __builtin__ import False
""" BVT tests for Hosts Maintenance
"""
@@ -198,7 +197,7 @@ class TestHostHA(cloudstackTestCase):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return True
return False
@@ -218,7 +217,7 @@ class TestHostHA(cloudstackTestCase):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return False
return True
@@ -238,7 +237,7 @@ class TestHostHA(cloudstackTestCase):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return True
return False
diff --git a/test/integration/component/test_interop_xd_ccp.py b/test/integration/component/test_interop_xd_ccp.py
index 4b6b15d2010..6987b528f0e 100644
--- a/test/integration/component/test_interop_xd_ccp.py
+++ b/test/integration/component/test_interop_xd_ccp.py
@@ -1156,10 +1156,10 @@ class TestXDCCPInterop(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
return
@attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
@@ -1181,10 +1181,10 @@ class TestXDCCPInterop(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
return
diff --git a/test/integration/component/test_ip_reservation.py b/test/integration/component/test_ip_reservation.py
index 14b6f5c8cd6..c5341516f3a 100644
--- a/test/integration/component/test_ip_reservation.py
+++ b/test/integration/component/test_ip_reservation.py
@@ -22,7 +22,8 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network
"""
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import validateList, cleanup_resources, verifyRouterState
from marvin.lib.base import (Account,
Network,
@@ -762,7 +763,7 @@ class TestUpdateIPReservation(cloudstackTestCase):
try:
virtual_machine_1 = createVirtualMachine(self, network_id=isolated_network.id,
- ip_address=u"10.1."+random_subnet+".3")
+ ip_address="10.1."+random_subnet+".3")
except Exception as e:
self.fail("VM creation failed: %s" % e)
diff --git a/test/integration/component/test_lb_secondary_ip.py b/test/integration/component/test_lb_secondary_ip.py
index e1d885d62ef..991466decd1 100644
--- a/test/integration/component/test_lb_secondary_ip.py
+++ b/test/integration/component/test_lb_secondary_ip.py
@@ -30,7 +30,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_ldap.py b/test/integration/component/test_ldap.py
index 1ebd98aaa13..5591d21ecc9 100644
--- a/test/integration/component/test_ldap.py
+++ b/test/integration/component/test_ldap.py
@@ -89,7 +89,7 @@ class TestLdap(cloudstackTestCase):
else:
self.delflag = 1
self.acctRes = self.apiClient.createAccount(self.acct)
- self.assertEquals(self.delflag, 1, "LDAP account details are not provided,please check the configuration")
+ self.assertEqual(self.delflag, 1, "LDAP account details are not provided,please check the configuration")
return
def tearDown(self):
@@ -134,13 +134,13 @@ class TestLdap(cloudstackTestCase):
self.services["configurableData"]["ldap_configuration"]["ldapUsername"],
self.services["configurableData"]["ldap_configuration"]["ldapPassword"])
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
else:
self.debug("LDAP Configuration failed with exception")
- self.assertEquals(
+ self.assertEqual(
self.ldapconfRes,
1,
self.reason)
@@ -250,7 +250,7 @@ class TestLdap(cloudstackTestCase):
tn = telnetlib.Telnet(ldapConfiguration['hostname'], ldapConfiguration['port'], timeout=15)
if tn is not None:
tn.set_debuglevel(1)
- print tn.msg("Connected to the server")
+ print(tn.msg("Connected to the server"))
self.debug("Ldap Server is Up and listening on the port %s" % tn.msg("Connected to the server"))
flag = True
tn.close()
diff --git a/test/integration/component/test_ldap_auto_import.py b/test/integration/component/test_ldap_auto_import.py
index b7b9e2a87b6..028e53db2c8 100644
--- a/test/integration/component/test_ldap_auto_import.py
+++ b/test/integration/component/test_ldap_auto_import.py
@@ -143,7 +143,7 @@ def checkLdapConfiguration(cls, ldapConfiguration):
timeout=15)
if tn is not None:
tn.set_debuglevel(1)
- print tn.msg("Connected to the server")
+ print(tn.msg("Connected to the server"))
cls.debug(
"Ldap Server is Up and listening on the port %s" %
tn.msg("Connected to the server"))
@@ -251,7 +251,7 @@ class TestLdap(cloudstackTestCase):
else:
self.delflag1 = 1
self.ldaplinkRes = self.apiClient.linkDomainToLdap(self.ldaplink)
- self.assertEquals(
+ self.assertEqual(
self.delflag1,
1,
"Linking LDAP failed,please check the configuration")
@@ -260,7 +260,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
lsap_user = Account.list(self.api_client,
domainid=self.parent_domain.id,
@@ -328,7 +328,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_03_ldap(self):
@@ -340,7 +340,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_04_ldap(self):
@@ -353,7 +353,7 @@ class TestLdap(cloudstackTestCase):
"",
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_05_ldap(self):
@@ -362,7 +362,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_06_ldap(self):
@@ -395,7 +395,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_07_ldap(self):
@@ -414,7 +414,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_08_ldap(self):
@@ -428,7 +428,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
self.domain2 = Domain.create(
self.apiclient,
@@ -465,7 +465,7 @@ class TestLdap(cloudstackTestCase):
self.delflag2 = 1
self.ldaplinkRes2 = self.apiClient.linkDomainToLdap(
self.ldaplink2)
- self.assertEquals(
+ self.assertEqual(
self.delflag2,
1,
"Linking LDAP failed,please check the configuration")
@@ -477,7 +477,7 @@ class TestLdap(cloudstackTestCase):
self.domain2.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
self.domain3 = Domain.create(
self.apiclient,
@@ -511,7 +511,7 @@ class TestLdap(cloudstackTestCase):
self.delflag3 = 1
self.ldaplinkRes3 = self.apiClient.linkDomainToLdap(
self.ldaplink3)
- self.assertEquals(
+ self.assertEqual(
self.delflag3,
1,
"Linking LDAP failed,please check the configuration")
@@ -522,7 +522,7 @@ class TestLdap(cloudstackTestCase):
self.domain2.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
finally:
try:
@@ -556,7 +556,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name,
method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, 1, self.reason)
+ self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_10_ldap(self):
@@ -584,7 +584,7 @@ class TestLdap(cloudstackTestCase):
dbChecking[0][2]) == \
self.services["configurableData"]["link_ldap_details"]["accounttype"]:
db_check = 0
- self.assertEquals(db_check, 0, "DB check failed")
+ self.assertEqual(db_check, 0, "DB check failed")
@attr(tags=["advanced", "basic"], required_hardware="true")
def test_11_ldap(self):
@@ -593,6 +593,6 @@ class TestLdap(cloudstackTestCase):
self,
"", "", self.parent_domain.name, method="POST")
self.debug(loginRes)
- self.assertEquals(loginRes, None, self.reason)
+ self.assertEqual(loginRes, None, self.reason)
diff --git a/test/integration/component/test_list_nics.py b/test/integration/component/test_list_nics.py
index 12bae1fa2ea..a93c07bfc4b 100644
--- a/test/integration/component/test_list_nics.py
+++ b/test/integration/component/test_list_nics.py
@@ -147,4 +147,4 @@ class TestDeployVM(cloudstackTestCase):
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
self.debug("Warning! Exception in tearDown: %s" % e)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_list_pod.py b/test/integration/component/test_list_pod.py
index 07ab2c589af..ac8a8895c6b 100644
--- a/test/integration/component/test_list_pod.py
+++ b/test/integration/component/test_list_pod.py
@@ -19,7 +19,8 @@
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Pod, Cluster, Capacities)
from marvin.cloudstackAPI import (updateConfiguration)
diff --git a/test/integration/component/test_memory_limits.py b/test/integration/component/test_memory_limits.py
index 4e7e5cc4323..2044607ee45 100644
--- a/test/integration/component/test_memory_limits.py
+++ b/test/integration/component/test_memory_limits.py
@@ -16,25 +16,26 @@
# under the License.
""" P1 tests for memory resource limits
"""
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
+from marvin.lib.base import (
+ Account,
+ ServiceOffering,
+ VirtualMachine,
+ Resources,
+ Domain
+)
+from marvin.lib.common import (get_domain,
+ get_zone,
+ get_template,
+ wait_for_cleanup,
+ findSuitableHostForMigration,
+ get_resource_type
+ )
+from marvin.lib.utils import cleanup_resources
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
-from marvin.lib.base import (
- Account,
- ServiceOffering,
- VirtualMachine,
- Resources,
- Domain
- )
-from marvin.lib.common import (get_domain,
- get_zone,
- get_template,
- wait_for_cleanup,
- findSuitableHostForMigration,
- get_resource_type
- )
-from marvin.lib.utils import cleanup_resources
-from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
+
class Services:
"""Test memory resource limit services
@@ -42,50 +43,51 @@ class Services:
def __init__(self):
self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "resource",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 2048, # In MBs
- },
- "virtual_machine": {
- "displayname": "TestVM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'KVM',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "network": {
- "name": "Test Network",
- "displaytext": "Test Network",
- "netmask": '255.255.255.0'
- },
- "project": {
- "name": "Project",
- "displaytext": "Test project",
- },
- "domain": {
- "name": "Domain",
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "sleep": 60,
- "timeout": 10,
- "mode": 'advanced',
- # Networking mode: Advanced, Basic
- }
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "resource",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100, # in MHz
+ "memory": 2048, # In MBs
+ },
+ "virtual_machine": {
+ "displayname": "TestVM",
+ "username": "root",
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'KVM',
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
+ "network": {
+ "name": "Test Network",
+ "displaytext": "Test Network",
+ "netmask": '255.255.255.0'
+ },
+ "project": {
+ "name": "Project",
+ "displaytext": "Test project",
+ },
+ "domain": {
+ "name": "Domain",
+ },
+ "ostype": 'CentOS 5.3 (64-bit)',
+ "sleep": 60,
+ "timeout": 10,
+ "mode": 'advanced',
+ # Networking mode: Advanced, Basic
+ }
+
class TestMemoryLimits(cloudstackTestCase):
@@ -102,17 +104,17 @@ class TestMemoryLimits(cloudstackTestCase):
cls.services["mode"] = cls.zone.networktype
cls.template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
- )
+ cls.api_client,
+ cls.services["service_offering"]
+ )
cls._cleanup = [cls.service_offering, ]
return
@@ -130,13 +132,13 @@ class TestMemoryLimits(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True
- )
+ self.apiclient,
+ self.services["account"],
+ admin=True
+ )
self.debug("Creating an instance with service offering: %s" %
- self.service_offering.name)
+ self.service_offering.name)
self.vm = self.createInstance(service_off=self.service_offering)
self.cleanup = [self.account, ]
@@ -153,20 +155,20 @@ class TestMemoryLimits(cloudstackTestCase):
def createInstance(self, service_off, networks=None, api_client=None):
"""Creates an instance in account"""
self.debug("Deploying an instance in account: %s" %
- self.account.name)
+ self.account.name)
if api_client is None:
- api_client = self.apiclient
+ api_client = self.apiclient
try:
vm = VirtualMachine.create(
- api_client,
- self.services["virtual_machine"],
- templateid=self.template.id,
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkids=networks,
- serviceofferingid=service_off.id)
+ api_client,
+ self.services["virtual_machine"],
+ templateid=self.template.id,
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkids=networks,
+ serviceofferingid=service_off.id)
vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
self.assertIsInstance(vms,
list,
@@ -177,7 +179,7 @@ class TestMemoryLimits(cloudstackTestCase):
except Exception as e:
self.fail("Failed to deploy an instance: %s" % e)
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_01_stop_start_instance(self):
"""Test Deploy VM with specified RAM & verify the usage"""
@@ -229,7 +231,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should be same after stopping the instance")
return
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="true")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="true")
def test_02_migrate_instance(self):
"""Test Deploy VM with specified RAM & verify the usage"""
@@ -273,7 +275,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should be same after stopping the instance")
return
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_03_delete_instance(self):
"""Test Deploy VM with specified GB RAM & verify the usage"""
@@ -300,8 +302,8 @@ class TestMemoryLimits(cloudstackTestCase):
except Exception as e:
self.fail("Failed to delete instance: %s" % e)
- # Wait for expunge interval to cleanup Memory
- wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
+ # Wait for expunge interval to cleanup Memory
+ wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
account_list = Account.list(self.apiclient, id=self.account.id)
self.assertIsInstance(account_list,
@@ -309,10 +311,10 @@ class TestMemoryLimits(cloudstackTestCase):
"List Accounts should return a valid response"
)
resource_count_after_delete = account_list[0].memorytotal
- self.assertEqual(resource_count_after_delete, 0 , "Resource count for %s should be 0" % get_resource_type(resource_id=9))#RAM
+ self.assertEqual(resource_count_after_delete, 0, "Resource count for %s should be 0" % get_resource_type(resource_id=9)) # RAM
return
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_04_deploy_multiple_vm(self):
"""Test Deploy multiple VM with specified RAM & verify the usage"""
@@ -335,7 +337,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should match with the expected resource count")
self.debug("Creating two instances with service offering: %s" %
- self.service_offering.name)
+ self.service_offering.name)
vm_1 = self.createInstance(service_off=self.service_offering)
self.createInstance(service_off=self.service_offering)
@@ -346,7 +348,7 @@ class TestMemoryLimits(cloudstackTestCase):
)
resource_count_new = account_list[0].memorytotal
- expected_resource_count = int(self.services["service_offering"]["memory"]) * 3 #Total 3 VMs
+ expected_resource_count = int(self.services["service_offering"]["memory"]) * 3 # Total 3 VMs
self.assertEqual(resource_count_new, expected_resource_count,
"Resource count should match with the expected resource count")
@@ -370,6 +372,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should match with the expected resource count")
return
+
class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
@classmethod
@@ -384,17 +387,17 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
cls.services["mode"] = cls.zone.networktype
cls.template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
- )
+ cls.api_client,
+ cls.services["service_offering"]
+ )
cls._cleanup = [cls.service_offering, ]
return
@@ -426,20 +429,20 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
def createInstance(self, service_off, networks=None, api_client=None):
"""Creates an instance in account"""
self.debug("Deploying an instance in account: %s" %
- self.account.name)
+ self.account.name)
if api_client is None:
- api_client = self.apiclient
+ api_client = self.apiclient
try:
vm = VirtualMachine.create(
- api_client,
- self.services["virtual_machine"],
- templateid=self.template.id,
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkids=networks,
- serviceofferingid=service_off.id)
+ api_client,
+ self.services["virtual_machine"],
+ templateid=self.template.id,
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkids=networks,
+ serviceofferingid=service_off.id)
vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
self.assertIsInstance(vms,
list,
@@ -458,11 +461,11 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
parentdomainid=self.domain.id)
self.child_do_admin_1 = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True,
- domainid=self.child_domain_1.id
- )
+ self.apiclient,
+ self.services["account"],
+ admin=True,
+ domainid=self.child_domain_1.id
+ )
# Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin_1)
self.cleanup.append(self.child_domain_1)
@@ -470,21 +473,21 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.debug("Creating a domain under: %s" % self.domain.name)
self.child_domain_2 = Domain.create(self.apiclient,
- services=self.services["domain"],
- parentdomainid=self.domain.id)
+ services=self.services["domain"],
+ parentdomainid=self.domain.id)
self.child_do_admin_2 = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True,
- domainid=self.child_domain_2.id)
+ self.apiclient,
+ self.services["account"],
+ admin=True,
+ domainid=self.child_domain_2.id)
# Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin_2)
self.cleanup.append(self.child_domain_2)
return
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_01_stop_start_instance(self):
"""Test Deploy VM with 5 GB memory & verify the usage"""
@@ -499,16 +502,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
api_client = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain)
+ UserName=self.account.name,
+ DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" %
- self.service_offering.name)
+ self.service_offering.name)
vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
account_list = Account.list(self.apiclient, id=self.account.id)
@@ -521,7 +524,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count = int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count, expected_resource_count,
- "Initial resource count should match with the expected resource count")
+ "Initial resource count should match with the expected resource count")
self.debug("Stopping instance: %s" % vm.name)
try:
@@ -537,7 +540,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
resource_count_after_stop = account_list[0].memorytotal
self.assertEqual(resource_count, resource_count_after_stop,
- "Resource count should be same after stopping the instance")
+ "Resource count should be same after stopping the instance")
self.debug("Starting instance: %s" % vm.name)
try:
@@ -553,10 +556,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
resource_count_after_start = account_list[0].memorytotal
self.assertEqual(resource_count_after_stop, resource_count_after_start,
- "Resource count should be same after starting the instance")
+ "Resource count should be same after starting the instance")
return
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="true")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="true")
def test_02_migrate_instance(self):
"""Test Deploy VM with specified memory & verify the usage"""
@@ -574,16 +577,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
api_client = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain)
+ UserName=self.account.name,
+ DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" %
- self.service_offering.name)
+ self.service_offering.name)
vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
account_list = Account.list(self.apiclient, id=self.account.id)
@@ -596,13 +599,13 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count = int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count, expected_resource_count,
- "Initial resource count should with the expected resource count")
+ "Initial resource count should with the expected resource count")
host = findSuitableHostForMigration(self.apiclient, vm.id)
if host is None:
self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
self.debug("Migrating instance: %s to host: %s" %
- (vm.name, host.name))
+ (vm.name, host.name))
try:
vm.migrate(self.apiclient, host.id)
except Exception as e:
@@ -616,10 +619,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
resource_count_after_migrate = account_list[0].memorytotal
self.assertEqual(resource_count, resource_count_after_migrate,
- "Resource count should be same after starting the instance")
+ "Resource count should be same after starting the instance")
return
- @attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
+ @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_03_delete_instance(self):
"""Test Deploy VM with specified RAM & verify the usage"""
@@ -634,16 +637,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
api_client = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain)
+ UserName=self.account.name,
+ DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" %
- self.service_offering.name)
+ self.service_offering.name)
vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
account_list = Account.list(self.apiclient, id=self.account.id)
@@ -656,7 +659,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count = int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count, expected_resource_count,
- "Initial resource count should match with the expected resource count")
+ "Initial resource count should match with the expected resource count")
self.debug("Destroying instance: %s" % vm.name)
try:
@@ -670,14 +673,14 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
"List Accounts should return a valid response"
)
resource_count = account_list[0].memorytotal
- self.assertEqual(resource_count, 0 , "Resource count for %s should be 0" % get_resource_type(resource_id=9))#RAM
+ self.assertEqual(resource_count, 0, "Resource count for %s should be 0" % get_resource_type(resource_id=9)) # RAM
return
- @attr(tags=["advanced", "advancedns","simulator"])
+ @attr(tags=["advanced", "advancedns", "simulator"])
@attr(configuration='max.account.memory')
def test_04_deploy_multiple_vm(self):
"""Test Deploy multiple VM with 2 GB memory & verify the usage"""
- #keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)
+ # keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)
# Validate the following
# 1. Create compute offering with 2 GB RAM
@@ -687,9 +690,9 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.debug("Creating service offering with 2 GB RAM")
self.service_offering = ServiceOffering.create(
- self.apiclient,
- self.services["service_offering"]
- )
+ self.apiclient,
+ self.services["service_offering"]
+ )
# Adding to cleanup list after execution
self.cleanup.append(self.service_offering)
@@ -698,25 +701,25 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
memory_account_gc = Resources.list(self.apiclient,
- resourcetype = 9, #Memory
- account = self.account.name,
- domainid = self.domain.id
- )
+ resourcetype=9, # Memory
+ account=self.account.name,
+ domainid=self.domain.id
+ )
if memory_account_gc[0].max != 8192:
self.skipTest("This test case requires configuration value max.account.memory to be 8192")
- api_client = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain)
+ api_client = self.testClient.getUserApiClient(
+ UserName=self.account.name,
+ DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" %
- self.service_offering.name)
+ self.service_offering.name)
vm_1 = self.createInstance(service_off=self.service_offering, api_client=api_client)
vm_2 = self.createInstance(service_off=self.service_offering, api_client=api_client)
self.createInstance(service_off=self.service_offering, api_client=api_client)
@@ -733,10 +736,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
)
resource_count = account_list[0].memorytotal
- expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 #Total 4 vms
+ expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 # Total 4 vms
self.assertEqual(resource_count, expected_resource_count,
- "Initial resource count should with the expected resource count")
+ "Initial resource count should with the expected resource count")
self.debug("Destroying instance: %s" % vm_1.name)
try:
@@ -754,7 +757,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count -= int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count_after_delete, expected_resource_count,
- "Resource count should match with the expected resource count")
+ "Resource count should match with the expected resource count")
host = findSuitableHostForMigration(self.apiclient, vm_2.id)
if host is None:
@@ -775,5 +778,5 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.debug(resource_count_after_migrate)
self.assertEqual(resource_count_after_delete, resource_count_after_migrate,
- "Resource count should be same after migrating the instance")
+ "Resource count should be same after migrating the instance")
return
diff --git a/test/integration/component/test_mm_domain_limits.py b/test/integration/component/test_mm_domain_limits.py
index 795055eca6f..73ef3ecfed1 100644
--- a/test/integration/component/test_mm_domain_limits.py
+++ b/test/integration/component/test_mm_domain_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
@@ -225,7 +226,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -369,7 +370,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
self.debug("Creating an instance with service offering: %s" %
@@ -430,7 +431,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
self.debug("Creating an instance with service offering: %s" %
@@ -490,7 +491,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2
}
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
self.debug("Creating an instance with service offering: %s" %
diff --git a/test/integration/component/test_mm_max_limits.py b/test/integration/component/test_mm_max_limits.py
index e08052b2f8e..b831e0b0ab3 100644
--- a/test/integration/component/test_mm_max_limits.py
+++ b/test/integration/component/test_mm_max_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_mm_project_limits.py b/test/integration/component/test_mm_project_limits.py
index 0d5b282f5b4..09acf058669 100644
--- a/test/integration/component/test_mm_project_limits.py
+++ b/test/integration/component/test_mm_project_limits.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/component/test_multiple_nic_support.py b/test/integration/component/test_multiple_nic_support.py
index d38693c9cb1..6c99999e2d8 100644
--- a/test/integration/component/test_multiple_nic_support.py
+++ b/test/integration/component/test_multiple_nic_support.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList,
cleanup_resources,
diff --git a/test/integration/component/test_multiple_public_interfaces.py b/test/integration/component/test_multiple_public_interfaces.py
index 31164653654..91db55f6a6e 100644
--- a/test/integration/component/test_multiple_public_interfaces.py
+++ b/test/integration/component/test_multiple_public_interfaces.py
@@ -1011,7 +1011,7 @@ class TestVPCPortForwarding(cloudstackTestCase):
)
logger.debug("Created network with ID: %s" % obj_network.id)
return obj_network
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
def deployvm_in_network(self, network, host_id=None):
@@ -1231,7 +1231,7 @@ class TestVPCStaticNat(cloudstackTestCase):
)
logger.debug("Created network with ID: %s" % obj_network.id)
return obj_network
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
def deployvm_in_network(self, network, host_id=None):
diff --git a/test/integration/component/test_multiple_subnets_in_isolated_network.py b/test/integration/component/test_multiple_subnets_in_isolated_network.py
index 9a35bc519a0..80334955a81 100644
--- a/test/integration/component/test_multiple_subnets_in_isolated_network.py
+++ b/test/integration/component/test_multiple_subnets_in_isolated_network.py
@@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py b/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
index 2114df58602..0565b98d8e4 100644
--- a/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
+++ b/test/integration/component/test_multiple_subnets_in_isolated_network_rvr.py
@@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_multiple_subnets_in_vpc.py b/test/integration/component/test_multiple_subnets_in_vpc.py
index f3f9864ccdb..f20f7c4a8bc 100644
--- a/test/integration/component/test_multiple_subnets_in_vpc.py
+++ b/test/integration/component/test_multiple_subnets_in_vpc.py
@@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_multiple_subnets_in_vpc_rvr.py b/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
index 1e2e9151cf4..ca7731472b6 100644
--- a/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
+++ b/test/integration/component/test_multiple_subnets_in_vpc_rvr.py
@@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
from nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (validateList,
get_host_credentials,
get_process_status,
diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py
index 9d35721f16c..1fb24ca68bd 100644
--- a/test/integration/component/test_network_offering.py
+++ b/test/integration/component/test_network_offering.py
@@ -785,7 +785,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
issystem = "true"
)
status = validateList(vr_sys_off_res)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of VR system offering failed"
@@ -815,17 +815,17 @@ class TestNOVirtualRouter(cloudstackTestCase):
id=self.network_offering.id
)
status = validateList(network_off_res)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of network offerings failed"
)
- self.assertEquals(
+ self.assertEqual(
len(network_off_res),
1,
"More than one network offerings are created"
)
- self.assertEquals(
+ self.assertEqual(
network_off_res[0].serviceofferingid,
vr_sys_off.id,
"FAIL: Network offering has been created with default system offering"
diff --git a/test/integration/component/test_non_contiguous_vlan.py b/test/integration/component/test_non_contiguous_vlan.py
index 0f3dcb78fb4..3224a3a5946 100644
--- a/test/integration/component/test_non_contiguous_vlan.py
+++ b/test/integration/component/test_non_contiguous_vlan.py
@@ -176,7 +176,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlans = xsplit(vlan,[','])
for virtualLan in vlans:
- self.assert_(physicalnetworks[0].vlan.find(virtualLan) != -1, "vlan range %s \
+ self.assertTrue(physicalnetworks[0].vlan.find(virtualLan) != -1, "vlan range %s \
is not present in physical network: %s" % (virtualLan, physicalNetworkId))
return
@@ -193,7 +193,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlan1 = self.existingvlan + "," + self.vlan["partial_range"][0]
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan1)
- self.assert_(updatePhysicalNetworkResponse is not None,
+ self.assertTrue(updatePhysicalNetworkResponse is not None,
msg="couldn't add non contiguous range in the physical network with vlan %s"%vlan1)
self.debug("Verifying the VLAN of the updated physical network: %s, It should match with \
@@ -204,7 +204,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlan2 = vlan1 + "," + self.vlan["partial_range"][1]
updatePhysicalNetworkResponse2 = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2)
- self.assert_(updatePhysicalNetworkResponse2 is not None,
+ self.assertTrue(updatePhysicalNetworkResponse2 is not None,
msg="couldn't add non contiguous range in the physical network with vlan %s"%vlan2)
self.debug("Verifying the VLAN of the updated physical network: %s, It should match with \
@@ -252,7 +252,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlan2 = vlan1 + "," + self.vlan["full_range"]
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2)
- self.assert_(updatePhysicalNetworkResponse is not None,
+ self.assertTrue(updatePhysicalNetworkResponse is not None,
msg="couldn't extend the physical network with vlan %s"%vlan2)
extendedvlan = self.existingvlan + "," + self.vlan["full_range"]
@@ -289,7 +289,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlanranges= physicalnetworks[0].vlan
- self.assert_(vlanranges.find(self.vlan["partial_range"][0]) == -1, "vlan range is not removed")
+ self.assertTrue(vlanranges.find(self.vlan["partial_range"][0]) == -1, "vlan range is not removed")
return
diff --git a/test/integration/component/test_organization_states.py b/test/integration/component/test_organization_states.py
index 03b938cfab6..2969ccb8280 100644
--- a/test/integration/component/test_organization_states.py
+++ b/test/integration/component/test_organization_states.py
@@ -19,621 +19,608 @@
Test cases relating to enabling/diabling of zone/pod/cluster/host
"""
-#Import Local Modules
-import marvin
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
-from marvin.cloudstackException import CloudstackAclException
-from nose.plugins.attrib import attr
-#Import System modules
-import time
+# Import System modules
+# Import System modules
import traceback
+from marvin.cloudstackAPI import *
+from marvin.cloudstackAPI import *
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+# Import Local Modules
+from marvin.cloudstackTestCase import *
+from marvin.lib.base import *
+from marvin.lib.base import *
+from marvin.lib.common import *
+from marvin.lib.common import *
+from marvin.lib.utils import *
+from marvin.lib.utils import *
+from nose.plugins.attrib import attr
_multiprocess_shared_ = True
+
class TestOrganizationStates(cloudstackTestCase):
@classmethod
def setUpClass(cls):
-
- try:
-
+ try:
cls.testclient = super(TestOrganizationStates, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
cls.testdata = cls.testClient.getParsedTestDataConfig()
cls.cleanup = []
- zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
- cls.zone = Zone(zone.__dict__)
- cls.template = get_template(cls.apiclient, cls.zone.id, cls.testdata["ostype"])
+ zone = get_zone(cls.apiclient, cls.testclient.getZoneForTests())
+ cls.zone = Zone(zone.__dict__)
+ cls.template = get_template(cls.apiclient, cls.zone.id, cls.testdata["ostype"])
- hostList = Host.list(cls.apiclient,zoneid=cls.zone.id,type="routing")
- cls.host = Host(hostList[0].__dict__)
+ hostList = Host.list(cls.apiclient, zoneid=cls.zone.id, type="routing")
+ cls.host = Host(hostList[0].__dict__)
- clusterList = Cluster.list(cls.apiclient,id= hostList[0].clusterid)
- cls.cluster = Cluster(clusterList[0].__dict__)
-
- podList = Pod.list(cls.apiclient,id= hostList[0].podid)
- cls.pod = Pod(podList[0].__dict__)
-
- cls.serviceOffering = ServiceOffering.create(
- cls.apiclient,
- cls.testdata["service_offering"],
- hosttags="test"
- )
+ clusterList = Cluster.list(cls.apiclient, id=hostList[0].clusterid)
+ cls.cluster = Cluster(clusterList[0].__dict__)
+
+ podList = Pod.list(cls.apiclient, id=hostList[0].podid)
+ cls.pod = Pod(podList[0].__dict__)
+
+ cls.serviceOffering = ServiceOffering.create(
+ cls.apiclient,
+ cls.testdata["service_offering"],
+ hosttags="test"
+ )
hostupdResp = Host.update(cls.apiclient,
- id=cls.host.id,
- hosttags="test")
-
- userAccountName = "-".join(("TestOrgUser", random_gen()))
- adminAccountName = "-".join(("TestOrgAdmin", random_gen()))
-
+ id=cls.host.id,
+ hosttags="test")
- cls.user_apiclient = cls.testclient.getUserApiClient(
+ userAccountName = "-".join(("TestOrgUser", random_gen()))
+ adminAccountName = "-".join(("TestOrgAdmin", random_gen()))
+
+ cls.user_apiclient = cls.testclient.getUserApiClient(
UserName=userAccountName,
DomainName="ROOT"
- )
+ )
- cls.admin_apiclient = cls.testclient.getUserApiClient(
+ cls.admin_apiclient = cls.testclient.getUserApiClient(
UserName=adminAccountName,
DomainName="ROOT",
- type=1
- )
+ type=1
+ )
accountList = Account.list(
cls.apiclient,
name=userAccountName,
- listAll="true"
+ listAll="true"
)
- cls.account = Account(accountList[0].__dict__)
+ cls.account = Account(accountList[0].__dict__)
accountList = Account.list(
cls.apiclient,
name=adminAccountName,
- listAll="true"
+ listAll="true"
)
- cls.adminAccount = Account(accountList[0].__dict__)
+ cls.adminAccount = Account(accountList[0].__dict__)
cls.cleanup = [
- cls.account,
- cls.adminAccount,
- cls.serviceOffering
- ]
+ cls.account,
+ cls.adminAccount,
+ cls.serviceOffering
+ ]
cls.vm_admin = VirtualMachine.create(
- cls.admin_apiclient,
- {},
- zoneid=cls.zone.id,
- serviceofferingid=cls.serviceOffering.id,
- templateid=cls.template.id
- )
+ cls.admin_apiclient,
+ {},
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.serviceOffering.id,
+ templateid=cls.template.id
+ )
cls.vm_user = VirtualMachine.create(
- cls.user_apiclient,
- {},
- zoneid=cls.zone.id,
- serviceofferingid=cls.serviceOffering.id,
- templateid=cls.template.id
- )
+ cls.user_apiclient,
+ {},
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.serviceOffering.id,
+ templateid=cls.template.id
+ )
except Exception as e:
- printex = traceback.format_exc()
- cls.debug("Exception Occurred : {0}".format(printex))
- cleanup_resources(cls.apiclient, cls.cleanup)
- raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
+ printex = traceback.format_exc()
+ cls.debug("Exception Occurred : {0}".format(printex))
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod
def tearDownClass(cls):
cls.apiclient = super(TestOrganizationStates, cls).getClsTestClient().getApiClient()
hostupdResp = Host.update(cls.apiclient,
- id=cls.host.id,
- hosttags="")
+ id=cls.host.id,
+ hosttags="")
cleanup_resources(cls.apiclient, cls.cleanup)
return
def setUp(cls):
- return
+ return
def tearDown(cls):
- return
+ return
-## Test cases relating to disabling and enabling zone
+ ## Test cases relating to disabling and enabling zone
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_11_disableZone(self):
- """
- Disable Zone
- Validate that listZones() returns the allocationstate as "Disabled"
- """
- self.debug("Zone to be disabled: " + self.zone.id)
-
- zoneupdResp = self.zone.update(self.apiclient,allocationstate="Disabled")
+ """
+ Disable Zone
+ Validate that listZones() returns the allocationstate as "Disabled"
+ """
+ self.debug("Zone to be disabled: " + self.zone.id)
- self.assertEqual(zoneupdResp.allocationstate,
- "Disabled",
- "Disabling Zone did not set the alloctionstate to Disabled")
+ zoneupdResp = self.zone.update(self.apiclient, allocationstate="Disabled")
- zonelistResp = Zone.list(self.apiclient,id=self.zone.id)
+ self.assertEqual(zoneupdResp.allocationstate,
+ "Disabled",
+ "Disabling Zone did not set the alloctionstate to Disabled")
- self.assertEqual(zonelistResp[0].allocationstate,
- "Disabled",
- "Disabling Zone did not set the alloctionstate to Disabled")
+ zonelistResp = Zone.list(self.apiclient, id=self.zone.id)
+ self.assertEqual(zonelistResp[0].allocationstate,
+ "Disabled",
+ "Disabling Zone did not set the alloctionstate to Disabled")
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_12_disableZone_admin_deployVM(self):
- """
- Validate that admin is allowed to deploy VM in a disabled zone
- """
+ """
+ Validate that admin is allowed to deploy VM in a disabled zone
+ """
vm = VirtualMachine.create(
- self.admin_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
+ self.admin_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
- self.assertEqual(vm.state,
- "Running",
- "Admin is not able to deploy Vm in a disabled Zone! ")
+ self.assertEqual(vm.state,
+ "Running",
+ "Admin is not able to deploy Vm in a disabled Zone! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_13_disableZone_admin_stop_startVM(self):
- """
- Validate that admin is allowed to stop and start existing VMs that are running on a disabled zone
- """
+ """
+ Validate that admin is allowed to stop and start existing VMs that are running on a disabled zone
+ """
self.vm_admin.stop(self.apiclient)
-
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Admin is not able to Stop Vm in a disabled Zone! ")
+
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Admin is not able to Stop Vm in a disabled Zone! ")
self.vm_admin.start(self.apiclient)
- listResp = VirtualMachine.list(self.admin_apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Admin is not able to Stop Vm in a disabled Zone! ")
+ listResp = VirtualMachine.list(self.admin_apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Admin is not able to Stop Vm in a disabled Zone! ")
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_14_disableZone_user_deployVM(self):
- """
- Validate that regular user is not allowed to deploy VM in a disabled zone
- """
- try:
- vm = VirtualMachine.create(
- self.user_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
- self.fail("Regular user is allowed to deploy VM in a zone that is disabled")
- except Exception as e:
- self.debug ("Exception thrown when deploying Virtual Machine on a disabled zone - %s" %e)
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_15_disableZone_user_stop_startVM(self):
- """
- Validate that regular user is allowed to stop and start existing VMs in a disabled zone
- """
- self.vm_user.stop(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
-
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Regular user is not able to Stop Vm in a disabled Zone! ")
-
- self.vm_user.start(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
-
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Regular is not able to Stop Vm in a disabled Zone! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_16_enableZone(self):
- """
- Enable Zone that is diabled
- Validate that listZones() returns the allocationstate as "Enabled"
- """
- self.debug("Zone to be enabled: " + self.zone.id)
-
- zoneupdResp = self.zone.update(self.apiclient,allocationstate="Enabled")
-
- self.assertEqual(zoneupdResp.allocationstate,
- "Enabled",
- "Enabling Zone did not set the alloctionstate to Enabled")
-
- zonelistResp = Zone.list(self.apiclient,id=self.zone.id)
-
- self.assertEqual(zonelistResp[0].allocationstate,
- "Enabled",
- "Enabling Zone did not set the alloctionstate to Enabled")
-
-## Test cases relating to disabling and enabling pod
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_21_disablePod(self):
- """
- Disable Pod
- Validate that listPods() returns the allocationstate as "Disabled"
- """
- self.debug("Pod to be disabled: " + self.zone.id)
-
- podupdResp = self.pod.update(self.apiclient,allocationstate="Disabled",id=self.pod.id)
-
- self.assertEqual(podupdResp.allocationstate,
- "Disabled",
- "Disabling Pod did not set the alloctionstate to Disabled")
-
- podlistResp = Pod.list(self.apiclient,id=self.pod.id)
-
- self.assertEqual(podlistResp[0].allocationstate,
- "Disabled",
- "Disabling Pod did not set the alloctionstate to Disabled")
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_22_disablePod_admin_deployVM(self):
- """
- Validate that admin is allowed to deploy VM in a disabled pod
- """
- vm = VirtualMachine.create(
- self.admin_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
-
- self.assertEqual(vm.state,
- "Running",
- "Admin is not able to deploy Vm in a disabled Pod! ")
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_23_disablePod_admin_stop_startVM(self):
- """
- Validate that admin is allowed to stop and start existing VMs running in a disabled pod
- """
- self.vm_admin.stop(self.admin_apiclient)
-
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Admin is not able to Stop Vm in a disabled Pod! ")
-
- self.vm_admin.start(self.admin_apiclient)
-
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Admin is not able to Stop Vm in a disabled Pod! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_24_disablePod_user_deployVM(self):
- """
- Validate that regular user is not allowed to deploy VM in a disabled pod
- """
- try:
- vm = VirtualMachine.create(
- self.user_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
- self.fail("Regular user is allowed to deploy VM in a zone that is disabled")
- except Exception as e:
- self.debug ("Exception thrown when deploying Virtual Machine on a disabled zone - %s" %e)
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_25_disablePod_user_stop_startVM(self):
- """
- Validate that regular user is allowed to stop and start existing VMs runing in a disabled pod
- """
- self.vm_user.stop(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
-
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Regular user is not able to Stop Vm in a disabled Pod! ")
-
- self.vm_user.start(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
-
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Regular is not able to Stop Vm in a disabled Pod! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_26_enablePod(self):
- """
- Enable Pod that is diabled
- Validate that listPods() returns the allocationstate as "Enabled"
- """
- self.debug("Pod to be enabled: " + self.zone.id)
-
- podupdResp = self.pod.update(self.apiclient,allocationstate="Enabled",id=self.pod.id)
-
- self.assertEqual(podupdResp.allocationstate,
- "Enabled",
- "Enabling Pod did not set the alloctionstate to Enabled")
-
- podlistResp = Pod.list(self.apiclient,id=self.pod.id)
-
- self.assertEqual(podlistResp[0].allocationstate,
- "Enabled",
- "Enabling Pod did not set the alloctionstate to Enabled")
-
-
-## Test cases relating to disabling and enabling cluster
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_31_disableCluster(self):
- """
- Disable Cluster
- Validate that listClusters() returns the allocationstate as "Disabled"
- """
- self.debug("Cluster to be disabled: " + self.cluster.id)
-
- clusterupdResp = self.cluster.update(self.apiclient,allocationstate="Disabled",id=self.cluster.id)
-
- self.assertEqual(clusterupdResp.allocationstate,
- "Disabled",
- "Disabling Cluster did not set the alloctionstate to Disabled")
-
- clusterlistResp = Cluster.list(self.apiclient,id=self.cluster.id)
-
- self.assertEqual(clusterlistResp[0].allocationstate,
- "Disabled",
- "Disabling Cluster did not set the alloctionstate to Disabled")
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_32_disableCluster_admin_deployVM(self):
- """
- Validate that admin is allowed to deploy VM in a disabled cluster
- """
- vm = VirtualMachine.create(
- self.admin_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
-
- self.assertEqual(vm.state,
- "Running",
- "Admin is not able to deploy Vm in a disabled Cluster! ")
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_33_disableCluster_admin_stop_startVM(self):
- """
- Validate that admin is allowed to stop and start existing VMs that are running in a disabled cluster
- """
- self.vm_admin.stop(self.admin_apiclient)
-
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Admin is not able to Stop Vm in a disabled Cluster! ")
-
- self.vm_admin.start(self.admin_apiclient)
-
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Admin is not able to Stop Vm in a disabled Cluster! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_34_disableCluster_user_deployVM(self):
- """
- Validate that regular user is not allowed to deploy VM in a disabled cluster
- """
- try:
- vm = VirtualMachine.create(
- self.user_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
- self.fail("Regular user is allowed to deploy VM in a cluster that is disabled")
- except Exception as e:
- self.debug ("Exception thrown when deploying Virtual Machine on a disabled cluster - %s" %e)
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_35_disableCluster_user_stop_startVM(self):
- """
- Validate that regular user is allowed to stop and start existing VMs that are running in a disabled cluster
- """
- self.vm_user.stop(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
-
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Regular user is not able to Stop Vm in a disabled Cluster! ")
-
- self.vm_user.start(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
-
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Regular is not able to Stop Vm in a disabled Cluster! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_36_enableCluster(self):
- """
- Enable Cluster that is diabled
- Validate that listClusters() returns the allocationstate as "Enabled"
- """
- self.debug("Cluster to be enabled: " + self.cluster.id)
-
- clusterupdResp = self.cluster.update(self.apiclient,allocationstate="Enabled",id=self.cluster.id)
-
- self.assertEqual(clusterupdResp.allocationstate,
- "Enabled",
- "Enabling Cluster did not set the alloctionstate to Enabled")
-
- clusterlistResp = Cluster.list(self.apiclient,id=self.cluster.id)
-
- self.assertEqual(clusterlistResp[0].allocationstate,
- "Enabled",
- "Enabling Cluster did not set the alloctionstate to Enabled")
-
-## Test cases relating to disabling and enabling host
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_41_disableHost(self):
- """
- Disable Host
- Validate that listHosts() returns the allocationstate as "Disabled"
- """
- self.debug("Host to be disabled: " + self.host.id)
-
- hostupdResp = Host.update(self.apiclient,id=self.host.id,allocationstate="Disable")
-
- self.assertEqual(hostupdResp.resourcestate,
- "Disabled",
- "Disabling Host did not set the alloctionstate to Disabled")
-
- hostlistResp = Host.list(self.apiclient,id=self.host.id)
-
- self.assertEqual(hostlistResp[0].resourcestate,
- "Disabled",
- "Disabling Host did not set the alloctionstate to Disabled")
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_42_disableHost_admin_deployVM(self):
- """
- Validate that admin is allowed to deploy VM in a disabled host by passing hostId parameter
- """
- vm = VirtualMachine.create(
- self.admin_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id,
- hostid=self.host.id
- )
-
- self.assertEqual(vm.state,
- "Running",
- "Admin is not able to deploy Vm in a disabled Host! ")
-
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
- def test_43_disableHost_admin_deployVM(self):
- """
- Validate that admin is allowed to deploy VM in a disabled host without passing hostId parameter
- """
+ """
+ Validate that regular user is not allowed to deploy VM in a disabled zone
+ """
try:
vm = VirtualMachine.create(
- self.admin_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
+ self.user_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
+ self.fail("Regular user is allowed to deploy VM in a zone that is disabled")
+ except Exception as e:
+ self.debug("Exception thrown when deploying Virtual Machine on a disabled zone - %s" % e)
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_15_disableZone_user_stop_startVM(self):
+ """
+ Validate that regular user is allowed to stop and start existing VMs in a disabled zone
+ """
+ self.vm_user.stop(self.user_apiclient)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
+
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Regular user is not able to Stop Vm in a disabled Zone! ")
+
+ self.vm_user.start(self.user_apiclient)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
+
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Regular is not able to Stop Vm in a disabled Zone! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_16_enableZone(self):
+ """
+ Enable Zone that is diabled
+ Validate that listZones() returns the allocationstate as "Enabled"
+ """
+ self.debug("Zone to be enabled: " + self.zone.id)
+
+ zoneupdResp = self.zone.update(self.apiclient, allocationstate="Enabled")
+
+ self.assertEqual(zoneupdResp.allocationstate,
+ "Enabled",
+ "Enabling Zone did not set the alloctionstate to Enabled")
+
+ zonelistResp = Zone.list(self.apiclient, id=self.zone.id)
+
+ self.assertEqual(zonelistResp[0].allocationstate,
+ "Enabled",
+ "Enabling Zone did not set the alloctionstate to Enabled")
+
+ ## Test cases relating to disabling and enabling pod
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_21_disablePod(self):
+ """
+ Disable Pod
+ Validate that listPods() returns the allocationstate as "Disabled"
+ """
+ self.debug("Pod to be disabled: " + self.zone.id)
+
+ podupdResp = self.pod.update(self.apiclient, allocationstate="Disabled", id=self.pod.id)
+
+ self.assertEqual(podupdResp.allocationstate,
+ "Disabled",
+ "Disabling Pod did not set the alloctionstate to Disabled")
+
+ podlistResp = Pod.list(self.apiclient, id=self.pod.id)
+
+ self.assertEqual(podlistResp[0].allocationstate,
+ "Disabled",
+ "Disabling Pod did not set the alloctionstate to Disabled")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_22_disablePod_admin_deployVM(self):
+ """
+ Validate that admin is allowed to deploy VM in a disabled pod
+ """
+ vm = VirtualMachine.create(
+ self.admin_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
+
+ self.assertEqual(vm.state,
+ "Running",
+ "Admin is not able to deploy Vm in a disabled Pod! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_23_disablePod_admin_stop_startVM(self):
+ """
+ Validate that admin is allowed to stop and start existing VMs running in a disabled pod
+ """
+ self.vm_admin.stop(self.admin_apiclient)
+
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Admin is not able to Stop Vm in a disabled Pod! ")
+
+ self.vm_admin.start(self.admin_apiclient)
+
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Admin is not able to Stop Vm in a disabled Pod! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_24_disablePod_user_deployVM(self):
+ """
+ Validate that regular user is not allowed to deploy VM in a disabled pod
+ """
+ try:
+ vm = VirtualMachine.create(
+ self.user_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
+ self.fail("Regular user is allowed to deploy VM in a zone that is disabled")
+ except Exception as e:
+ self.debug("Exception thrown when deploying Virtual Machine on a disabled zone - %s" % e)
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_25_disablePod_user_stop_startVM(self):
+ """
+ Validate that regular user is allowed to stop and start existing VMs runing in a disabled pod
+ """
+ self.vm_user.stop(self.user_apiclient)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
+
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Regular user is not able to Stop Vm in a disabled Pod! ")
+
+ self.vm_user.start(self.user_apiclient)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
+
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Regular is not able to Stop Vm in a disabled Pod! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_26_enablePod(self):
+ """
+ Enable Pod that is diabled
+ Validate that listPods() returns the allocationstate as "Enabled"
+ """
+ self.debug("Pod to be enabled: " + self.zone.id)
+
+ podupdResp = self.pod.update(self.apiclient, allocationstate="Enabled", id=self.pod.id)
+
+ self.assertEqual(podupdResp.allocationstate,
+ "Enabled",
+ "Enabling Pod did not set the alloctionstate to Enabled")
+
+ podlistResp = Pod.list(self.apiclient, id=self.pod.id)
+
+ self.assertEqual(podlistResp[0].allocationstate,
+ "Enabled",
+ "Enabling Pod did not set the alloctionstate to Enabled")
+
+ ## Test cases relating to disabling and enabling cluster
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_31_disableCluster(self):
+ """
+ Disable Cluster
+ Validate that listClusters() returns the allocationstate as "Disabled"
+ """
+ self.debug("Cluster to be disabled: " + self.cluster.id)
+
+ clusterupdResp = self.cluster.update(self.apiclient, allocationstate="Disabled", id=self.cluster.id)
+
+ self.assertEqual(clusterupdResp.allocationstate,
+ "Disabled",
+ "Disabling Cluster did not set the alloctionstate to Disabled")
+
+ clusterlistResp = Cluster.list(self.apiclient, id=self.cluster.id)
+
+ self.assertEqual(clusterlistResp[0].allocationstate,
+ "Disabled",
+ "Disabling Cluster did not set the alloctionstate to Disabled")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_32_disableCluster_admin_deployVM(self):
+ """
+ Validate that admin is allowed to deploy VM in a disabled cluster
+ """
+ vm = VirtualMachine.create(
+ self.admin_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
+
+ self.assertEqual(vm.state,
+ "Running",
+ "Admin is not able to deploy Vm in a disabled Cluster! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_33_disableCluster_admin_stop_startVM(self):
+ """
+ Validate that admin is allowed to stop and start existing VMs that are running in a disabled cluster
+ """
+ self.vm_admin.stop(self.admin_apiclient)
+
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Admin is not able to Stop Vm in a disabled Cluster! ")
+
+ self.vm_admin.start(self.admin_apiclient)
+
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Admin is not able to Stop Vm in a disabled Cluster! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_34_disableCluster_user_deployVM(self):
+ """
+ Validate that regular user is not allowed to deploy VM in a disabled cluster
+ """
+ try:
+ vm = VirtualMachine.create(
+ self.user_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
+ self.fail("Regular user is allowed to deploy VM in a cluster that is disabled")
+ except Exception as e:
+ self.debug("Exception thrown when deploying Virtual Machine on a disabled cluster - %s" % e)
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_35_disableCluster_user_stop_startVM(self):
+ """
+ Validate that regular user is allowed to stop and start existing VMs that are running in a disabled cluster
+ """
+ self.vm_user.stop(self.user_apiclient)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
+
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Regular user is not able to Stop Vm in a disabled Cluster! ")
+
+ self.vm_user.start(self.user_apiclient)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
+
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Regular is not able to Stop Vm in a disabled Cluster! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_36_enableCluster(self):
+ """
+ Enable Cluster that is diabled
+ Validate that listClusters() returns the allocationstate as "Enabled"
+ """
+ self.debug("Cluster to be enabled: " + self.cluster.id)
+
+ clusterupdResp = self.cluster.update(self.apiclient, allocationstate="Enabled", id=self.cluster.id)
+
+ self.assertEqual(clusterupdResp.allocationstate,
+ "Enabled",
+ "Enabling Cluster did not set the alloctionstate to Enabled")
+
+ clusterlistResp = Cluster.list(self.apiclient, id=self.cluster.id)
+
+ self.assertEqual(clusterlistResp[0].allocationstate,
+ "Enabled",
+ "Enabling Cluster did not set the alloctionstate to Enabled")
+
+ ## Test cases relating to disabling and enabling host
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_41_disableHost(self):
+ """
+ Disable Host
+ Validate that listHosts() returns the allocationstate as "Disabled"
+ """
+ self.debug("Host to be disabled: " + self.host.id)
+
+ hostupdResp = Host.update(self.apiclient, id=self.host.id, allocationstate="Disable")
+
+ self.assertEqual(hostupdResp.resourcestate,
+ "Disabled",
+ "Disabling Host did not set the alloctionstate to Disabled")
+
+ hostlistResp = Host.list(self.apiclient, id=self.host.id)
+
+ self.assertEqual(hostlistResp[0].resourcestate,
+ "Disabled",
+ "Disabling Host did not set the alloctionstate to Disabled")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_42_disableHost_admin_deployVM(self):
+ """
+ Validate that admin is allowed to deploy VM in a disabled host by passing hostId parameter
+ """
+ vm = VirtualMachine.create(
+ self.admin_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id,
+ hostid=self.host.id
+ )
+
+ self.assertEqual(vm.state,
+ "Running",
+ "Admin is not able to deploy Vm in a disabled Host! ")
+
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
+ def test_43_disableHost_admin_deployVM(self):
+ """
+ Validate that admin is allowed to deploy VM in a disabled host without passing hostId parameter
+ """
+ try:
+ vm = VirtualMachine.create(
+ self.admin_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
except Exception:
raise self.fail("Failed to deploy VM, this issue was hit: https://issues.apache.org/jira/browse/CLOUDSTACK-7735")
- self.assertEqual(vm.state,
- "Running",
- "Admin is not able to deploy Vm in a disabled Host! ")
+ self.assertEqual(vm.state,
+ "Running",
+ "Admin is not able to deploy Vm in a disabled Host! ")
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_44_disableHost_admin_stop_startVM(self):
- """
- Validate that admin is allowed to stop and start existing VMs running in a disabled host
- """
+ """
+ Validate that admin is allowed to stop and start existing VMs running in a disabled host
+ """
self.vm_admin.stop(self.admin_apiclient)
-
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Admin is not able to Stop Vm in a disabled Host! ")
+
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Admin is not able to Stop Vm in a disabled Host! ")
try:
self.vm_admin.start(self.admin_apiclient)
except Exception:
raise self.fail("Failed to deploy VM, this issue was hit: https://issues.apache.org/jira/browse/CLOUDSTACK-7735")
- listResp = VirtualMachine.list(self.apiclient,id=self.vm_admin.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Admin is not able to Stop Vm in a disabled Host! ")
+ listResp = VirtualMachine.list(self.apiclient, id=self.vm_admin.id)
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Admin is not able to Stop Vm in a disabled Host! ")
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_45_disableHost_user_deployVM(self):
- """
- Validate that regular user is not allowed to deploy VM in a disabled host
- """
- try:
+ """
+ Validate that regular user is not allowed to deploy VM in a disabled host
+ """
+ try:
vm = VirtualMachine.create(
- self.user_apiclient,
- {},
- zoneid=self.zone.id,
- serviceofferingid=self.serviceOffering.id,
- templateid=self.template.id
- )
+ self.user_apiclient,
+ {},
+ zoneid=self.zone.id,
+ serviceofferingid=self.serviceOffering.id,
+ templateid=self.template.id
+ )
self.fail("Regular user is allowed to deploy VM in a host that is disabled")
except Exception as e:
- self.debug ("Exception thrown when deploying Virtual Machine on a disabled host - %s" %e)
+ self.debug("Exception thrown when deploying Virtual Machine on a disabled host - %s" % e)
-
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_46_disableHost_user_stop_startVM(self):
- """
- Validate that regular user is allowed to stop and start existing VMs running in a disabled host
- """
+ """
+ Validate that regular user is allowed to stop and start existing VMs running in a disabled host
+ """
self.vm_user.stop(self.user_apiclient)
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.STOPPED,
- "Regular user is not able to Stop Vm in a disabled Host! ")
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.STOPPED,
+ "Regular user is not able to Stop Vm in a disabled Host! ")
try:
self.vm_user.start(self.user_apiclient)
except Exception:
raise self.fail("Failed to deploy VM, this issue was hit: https://issues.apache.org/jira/browse/CLOUDSTACK-7735")
- listResp = VirtualMachine.list(self.user_apiclient,id=self.vm_user.id)
+ listResp = VirtualMachine.list(self.user_apiclient, id=self.vm_user.id)
- self.assertEqual(listResp[0].state,
- VirtualMachine.RUNNING,
- "Regular is not able to Stop Vm in a disabled Host! ")
+ self.assertEqual(listResp[0].state,
+ VirtualMachine.RUNNING,
+ "Regular is not able to Stop Vm in a disabled Host! ")
- @attr("disruptive","simulator_only",tags=["advanced"],required_hardware="false")
+ @attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_47_enableHost(self):
- """
- Enable Host that is diabled
- Validate that listHosts() returns the allocationstate as "Enabled"
- """
- self.debug("Host to be enabled: " + self.host.id)
-
- hostupdResp = Host.update(self.apiclient,id=self.host.id,allocationstate="Enable")
+ """
+ Enable Host that is diabled
+ Validate that listHosts() returns the allocationstate as "Enabled"
+ """
+ self.debug("Host to be enabled: " + self.host.id)
- self.assertEqual(hostupdResp.resourcestate,
- "Enabled",
- "Enabling Host did not set the alloctionstate to Enabled")
+ hostupdResp = Host.update(self.apiclient, id=self.host.id, allocationstate="Enable")
- hostlistResp = Host.list(self.apiclient,id=self.host.id)
+ self.assertEqual(hostupdResp.resourcestate,
+ "Enabled",
+ "Enabling Host did not set the alloctionstate to Enabled")
- self.assertEqual(hostlistResp[0].resourcestate,
- "Enabled",
- "Enabling Host did not set the alloctionstate to Enabled")
+ hostlistResp = Host.list(self.apiclient, id=self.host.id)
+ self.assertEqual(hostlistResp[0].resourcestate,
+ "Enabled",
+ "Enabling Host did not set the alloctionstate to Enabled")
diff --git a/test/integration/component/test_overcommit.py b/test/integration/component/test_overcommit.py
index 14b76f5092b..fc9b26c86eb 100644
--- a/test/integration/component/test_overcommit.py
+++ b/test/integration/component/test_overcommit.py
@@ -394,7 +394,7 @@ class Overcommit (cloudstackTestCase):
"check list cluster response for zone id %s" %
self.zone.id)
k = len(list_cluster)
- for id in xrange(k):
+ for id in range(k):
Configurations.update(self.apiclient,
clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor",
@@ -414,7 +414,7 @@ class Overcommit (cloudstackTestCase):
"check list capacity response for zone id %s" %
self.zone.id)
cpu, mem = capacity_parser(capacity)
- for id in xrange(k):
+ for id in range(k):
Configurations.update(self.apiclient,
clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor",
@@ -452,7 +452,7 @@ class Overcommit (cloudstackTestCase):
self.assertEqual(mem[2],
mem1[2],
"check mem capacity % used")
- for id in xrange(k):
+ for id in range(k):
Configurations.update(self.apiclient,
clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor",
diff --git a/test/integration/component/test_persistent_networks.py b/test/integration/component/test_persistent_networks.py
index 40703789693..97b868802d6 100644
--- a/test/integration/component/test_persistent_networks.py
+++ b/test/integration/component/test_persistent_networks.py
@@ -44,7 +44,8 @@ from marvin.lib.common import (get_domain,
from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from ddt import ddt, data
import time
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index ad4e75de025..955c4dd0861 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -18,7 +18,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
#from marvin.cloudstackAPI import *
from marvin.lib.utils import (cleanup_resources,
validateList)
diff --git a/test/integration/component/test_project_resources.py b/test/integration/component/test_project_resources.py
index 607c684f8ce..0b7d9a7fdbe 100644
--- a/test/integration/component/test_project_resources.py
+++ b/test/integration/component/test_project_resources.py
@@ -18,7 +18,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VirtualMachine,
Account,
Project,
diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py
index 829cbc7e09a..10028ed92a3 100644
--- a/test/integration/component/test_project_usage.py
+++ b/test/integration/component/test_project_usage.py
@@ -18,7 +18,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteVolume
from marvin.lib.utils import (cleanup_resources, validateList)
from marvin.lib.base import (Project,
@@ -2026,4 +2027,4 @@ class TestVMSnapshotUsage(cloudstackTestCase):
1,
"Check VM.SNAPSHOT.DELETE in events table"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_protocol_number_security_group.py b/test/integration/component/test_protocol_number_security_group.py
index 60296753845..69c07c2263c 100644
--- a/test/integration/component/test_protocol_number_security_group.py
+++ b/test/integration/component/test_protocol_number_security_group.py
@@ -21,7 +21,8 @@ Tests protocol number support for security groups
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import authorizeSecurityGroupIngress, revokeSecurityGroupIngress, authorizeSecurityGroupEgress, revokeSecurityGroupEgress
from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList,
diff --git a/test/integration/component/test_ps_domain_limits.py b/test/integration/component/test_ps_domain_limits.py
index 3c4c4d32daf..9740ab9557d 100644
--- a/test/integration/component/test_ps_domain_limits.py
+++ b/test/integration/component/test_ps_domain_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
@@ -366,7 +367,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
templatesize = (self.template.size / (1024 ** 3))
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -454,7 +455,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
templatesize = (self.template.size / (1024 ** 3))
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -562,7 +563,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -724,7 +725,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
self.assertEqual(result[0], PASS, result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
try:
diff --git a/test/integration/component/test_ps_limits.py b/test/integration/component/test_ps_limits.py
index 983f72aa7aa..d87e605393c 100644
--- a/test/integration/component/test_ps_limits.py
+++ b/test/integration/component/test_ps_limits.py
@@ -23,31 +23,36 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
"""
-# Import Local Modules
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+import unittest
+
+from ddt import ddt, data
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.codes import (
+ PASS,
+ FAIL,
+ RESOURCE_PRIMARY_STORAGE,
+ CHILD_DOMAIN_ADMIN,
+ ROOT_DOMAIN_ADMIN)
from marvin.lib.base import (
- Account,
- ServiceOffering,
- VirtualMachine,
- Domain,
- Volume,
- DiskOffering)
-from marvin.lib.common import (get_domain,
- get_zone,
- get_template,
- matchResourceCount,
- createSnapshotFromVirtualMachineVolume,
- isVmExpunged,
- find_storage_pool_type)
+ Account,
+ ServiceOffering,
+ VirtualMachine,
+ Domain,
+ Volume,
+ DiskOffering)
+from marvin.lib.common import (
+ get_domain,
+ get_zone,
+ get_template,
+ matchResourceCount,
+ createSnapshotFromVirtualMachineVolume,
+ isVmExpunged,
+ find_storage_pool_type)
from marvin.lib.utils import (cleanup_resources,
validateList)
-from marvin.codes import (PASS,
- FAIL,
- RESOURCE_PRIMARY_STORAGE,
- CHILD_DOMAIN_ADMIN,
- ROOT_DOMAIN_ADMIN)
-from ddt import ddt, data
+# Import Local Modules
+from nose.plugins.attrib import attr
+
@ddt
class TestVolumeLimits(cloudstackTestCase):
@@ -55,7 +60,7 @@ class TestVolumeLimits(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cloudstackTestClient = super(TestVolumeLimits,
- cls).getClsTestClient()
+ cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient()
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
# Fill services from the external config file
@@ -72,10 +77,10 @@ class TestVolumeLimits(cloudstackTestCase):
return
cls.template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
@@ -108,8 +113,8 @@ class TestVolumeLimits(cloudstackTestCase):
try:
self.services["disk_offering"]["disksize"] = 2
self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"])
- self.assertNotEqual(self.disk_offering, None,\
- "Disk offering is None")
+ self.assertNotEqual(self.disk_offering, None, \
+ "Disk offering is None")
self.cleanup.append(self.disk_offering)
except Exception as e:
self.tearDown()
@@ -131,19 +136,19 @@ class TestVolumeLimits(cloudstackTestCase):
try:
if accountType == CHILD_DOMAIN_ADMIN:
self.domain = Domain.create(self.apiclient,
- services=self.services["domain"],
- parentdomainid=self.domain.id)
+ services=self.services["domain"],
+ parentdomainid=self.domain.id)
self.account = Account.create(self.apiclient, self.services["account"],
- domainid=self.domain.id, admin=True)
+ domainid=self.domain.id, admin=True)
self.cleanup.append(self.account)
if accountType == CHILD_DOMAIN_ADMIN:
self.cleanup.append(self.domain)
self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
- accountid=self.account.name, domainid=self.account.domainid,
- diskofferingid=self.disk_offering.id,
- serviceofferingid=self.service_offering.id)
+ accountid=self.account.name, domainid=self.account.domainid,
+ diskofferingid=self.disk_offering.id,
+ serviceofferingid=self.service_offering.id)
accounts = Account.list(self.apiclient, id=self.account.id)
@@ -156,7 +161,7 @@ class TestVolumeLimits(cloudstackTestCase):
return [PASS, None]
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic"], required_hardware="false")
+ @attr(tags=["advanced", "basic"], required_hardware="false")
def test_stop_start_vm(self, value):
"""Test Deploy VM with 5 GB volume & verify the usage
@@ -175,9 +180,9 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e:
self.fail("Failed to stop instance: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
# Starting instance
@@ -187,15 +192,15 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failed to start instance: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
return
@unittest.skip("skip")
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic"], required_hardware="false")
+ @attr(tags=["advanced", "basic"], required_hardware="false")
def test_destroy_recover_vm(self, value):
"""Test delete and recover instance
@@ -214,9 +219,9 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e:
self.fail("Failed to destroy instance: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
# Recovering instance
@@ -226,14 +231,14 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failed to start instance: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic"], required_hardware="false")
+ @attr(tags=["advanced", "basic"], required_hardware="false")
def test_attach_detach_volume(self, value):
"""Stop attach and detach volume from VM
@@ -251,9 +256,9 @@ class TestVolumeLimits(cloudstackTestCase):
apiclient = self.apiclient
if value == CHILD_DOMAIN_ADMIN:
apiclient = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain
- )
+ UserName=self.account.name,
+ DomainName=self.account.domain
+ )
self.assertNotEqual(apiclient, FAIL, "Failure while getting\
api client of account: %s" % self.account.name)
@@ -261,32 +266,32 @@ class TestVolumeLimits(cloudstackTestCase):
self.services["disk_offering"]["disksize"] = 4
expectedCount = self.initialResourceCount + int(self.services["disk_offering"]["disksize"])
disk_offering = DiskOffering.create(self.apiclient,
- services=self.services["disk_offering"])
+ services=self.services["disk_offering"])
self.cleanup.append(disk_offering)
volume = Volume.create(
- apiclient,self.services["volume"],zoneid=self.zone.id,
- account=self.account.name,domainid=self.account.domainid,
- diskofferingid=disk_offering.id)
+ apiclient, self.services["volume"], zoneid=self.zone.id,
+ account=self.account.name, domainid=self.account.domainid,
+ diskofferingid=disk_offering.id)
except Exception as e:
self.fail("Failure: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
- self.virtualMachine.attach_volume(apiclient, volume=volume)
+ self.virtualMachine.attach_volume(apiclient, volume=volume)
except Exception as e:
self.fail("Failed while attaching volume to VM: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
@@ -295,14 +300,14 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failure while detaching volume: %s" % e)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic"], required_hardware="false")
+ @attr(tags=["advanced", "basic"], required_hardware="false")
def test_create_multiple_volumes(self, value):
"""Test create multiple volumes
@@ -323,33 +328,33 @@ class TestVolumeLimits(cloudstackTestCase):
apiclient = self.apiclient
if value == CHILD_DOMAIN_ADMIN:
apiclient = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain
- )
+ UserName=self.account.name,
+ DomainName=self.account.domain
+ )
self.assertNotEqual(apiclient, FAIL, "Failure while getting\
api client of account %s" % self.account.name)
try:
self.services["disk_offering"]["disksize"] = 5
disk_offering_5_GB = DiskOffering.create(self.apiclient,
- services=self.services["disk_offering"])
+ services=self.services["disk_offering"])
self.cleanup.append(disk_offering_5_GB)
self.services["disk_offering"]["disksize"] = 10
disk_offering_10_GB = DiskOffering.create(self.apiclient,
- services=self.services["disk_offering"])
+ services=self.services["disk_offering"])
self.cleanup.append(disk_offering_10_GB)
volume_1 = Volume.create(
- apiclient,self.services["volume"],zoneid=self.zone.id,
- account=self.account.name,domainid=self.account.domainid,
- diskofferingid=disk_offering_5_GB.id)
+ apiclient, self.services["volume"], zoneid=self.zone.id,
+ account=self.account.name, domainid=self.account.domainid,
+ diskofferingid=disk_offering_5_GB.id)
volume_2 = Volume.create(
- apiclient,self.services["volume"],zoneid=self.zone.id,
- account=self.account.name,domainid=self.account.domainid,
- diskofferingid=disk_offering_10_GB.id)
+ apiclient, self.services["volume"], zoneid=self.zone.id,
+ account=self.account.name, domainid=self.account.domainid,
+ diskofferingid=disk_offering_10_GB.id)
self.debug("Attaching volume %s to vm %s" % (volume_1.name, self.virtualMachine.name))
self.virtualMachine.attach_volume(apiclient, volume=volume_1)
@@ -359,11 +364,11 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e:
self.fail("Failure: %s" % e)
- expectedCount = self.initialResourceCount + 15 # (5 + 10)
+ expectedCount = self.initialResourceCount + 15 # (5 + 10)
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
@@ -373,11 +378,11 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e:
self.fail("Failure while volume operation: %s" % e)
- expectedCount -= 5 #After deleting first volume
+ expectedCount -= 5 # After deleting first volume
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
@@ -389,14 +394,14 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount -= 10
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic"], required_hardware="false")
+ @attr(tags=["advanced", "basic"], required_hardware="false")
def test_deploy_multiple_vm(self, value):
"""Test Deploy multiple VMs with & verify the usage
# Validate the following
@@ -411,32 +416,32 @@ class TestVolumeLimits(cloudstackTestCase):
self.assertEqual(response[0], PASS, response[1])
self.virtualMachine_2 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
- accountid=self.account.name, domainid=self.account.domainid,
- diskofferingid=self.disk_offering.id,
- serviceofferingid=self.service_offering.id)
+ accountid=self.account.name, domainid=self.account.domainid,
+ diskofferingid=self.disk_offering.id,
+ serviceofferingid=self.service_offering.id)
- expectedCount = (self.initialResourceCount * 2) #Total 2 vms
+ expectedCount = (self.initialResourceCount * 2) # Total 2 vms
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
self.virtualMachine_3 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
- accountid=self.account.name, domainid=self.account.domainid,
- diskofferingid=self.disk_offering.id,
- serviceofferingid=self.service_offering.id)
+ accountid=self.account.name, domainid=self.account.domainid,
+ diskofferingid=self.disk_offering.id,
+ serviceofferingid=self.service_offering.id)
- expectedCount = (self.initialResourceCount * 3) #Total 3 vms
+ expectedCount = (self.initialResourceCount * 3) # Total 3 vms
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
self.debug("Destroying instance: %s" % self.virtualMachine_2.name)
try:
- self.virtualMachine_2.delete(self.apiclient)
+ self.virtualMachine_2.delete(self.apiclient)
except Exception as e:
self.fail("Failed to delete instance: %s" % e)
@@ -445,14 +450,14 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount -= (self.template.size / (1024 ** 3))
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
- return
+ return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic","selfservice"])
+ @attr(tags=["advanced", "basic", "selfservice"])
def test_assign_vm_different_account(self, value):
"""Test assign Vm to different account
# Validate the following
@@ -468,44 +473,44 @@ class TestVolumeLimits(cloudstackTestCase):
try:
account_2 = Account.create(self.apiclient, self.services["account"],
- domainid=self.domain.id, admin=True)
+ domainid=self.domain.id, admin=True)
self.cleanup.insert(0, account_2)
except Exception as e:
self.fail("Failed to create account: %s" % e)
expectedCount = self.initialResourceCount
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
self.virtualMachine.stop(self.apiclient)
- self.virtualMachine.assign_virtual_machine(self.apiclient,
- account_2.name ,account_2.domainid)
+ self.virtualMachine.assign_virtual_machine(self.apiclient,
+ account_2.name, account_2.domainid)
except Exception as e:
self.fail("Failed to assign virtual machine to account %s: %s" %
- (account_2.name,e))
+ (account_2.name, e))
# Checking resource count for account 2
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=account_2.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=account_2.id)
self.assertEqual(response[0], PASS, response[1])
expectedCount = 0
# Checking resource count for original account
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
- return
+ return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
- @attr(tags=["advanced","basic"], required_hardware="true")
+ @attr(tags=["advanced", "basic"], required_hardware="true")
def test_create_template_snapshot(self, value):
"""Test create snapshot and templates from volume
@@ -526,9 +531,9 @@ class TestVolumeLimits(cloudstackTestCase):
apiclient = self.apiclient
if value == CHILD_DOMAIN_ADMIN:
apiclient = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain
- )
+ UserName=self.account.name,
+ DomainName=self.account.domain
+ )
self.assertNotEqual(apiclient, FAIL, "Failure while getting api\
client of account: %s" % self.account.name)
@@ -538,9 +543,9 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failed to stop instance: %s" % e)
expectedCount = self.initialResourceCount
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
self.debug("Creating snapshot from ROOT volume: %s" % self.virtualMachine.name)
@@ -549,18 +554,18 @@ class TestVolumeLimits(cloudstackTestCase):
self.assertEqual(response[0], PASS, response[1])
snapshot = response[1]
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
volume = Volume.create_from_snapshot(apiclient,
- snapshot_id=snapshot.id,
- services=self.services["volume"],
- account=self.account.name,
- domainid=self.account.domainid)
+ snapshot_id=snapshot.id,
+ services=self.services["volume"],
+ account=self.account.name,
+ domainid=self.account.domainid)
self.debug("Attaching the volume to vm: %s" % self.virtualMachine.name)
self.virtualMachine.attach_volume(apiclient, volume)
@@ -569,9 +574,9 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount += int(self.services["volume"]["size"])
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
try:
@@ -587,8 +592,8 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount -= int(self.services["volume"]["size"])
response = matchResourceCount(
- self.apiclient, expectedCount,
- RESOURCE_PRIMARY_STORAGE,
- accountid=self.account.id)
+ self.apiclient, expectedCount,
+ RESOURCE_PRIMARY_STORAGE,
+ accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1])
return
diff --git a/test/integration/component/test_ps_max_limits.py b/test/integration/component/test_ps_max_limits.py
index 5fb84228a89..d8d8992f70a 100644
--- a/test/integration/component/test_ps_max_limits.py
+++ b/test/integration/component/test_ps_max_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_ps_project_limits.py b/test/integration/component/test_ps_project_limits.py
index c79e3b881fe..d549467d55c 100644
--- a/test/integration/component/test_ps_project_limits.py
+++ b/test/integration/component/test_ps_project_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_ps_resize_volume.py b/test/integration/component/test_ps_resize_volume.py
index c396016ad0a..f691dd9fd67 100644
--- a/test/integration/component/test_ps_resize_volume.py
+++ b/test/integration/component/test_ps_resize_volume.py
@@ -28,7 +28,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_reset_ssh_keypair.py b/test/integration/component/test_reset_ssh_keypair.py
index db7e9b82d98..23f19743fc6 100644
--- a/test/integration/component/test_reset_ssh_keypair.py
+++ b/test/integration/component/test_reset_ssh_keypair.py
@@ -32,7 +32,8 @@ from marvin.lib.common import (get_domain,
from marvin.lib.utils import (cleanup_resources,
random_gen,
validateList)
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.codes import PASS, RUNNING
#Import System modules
diff --git a/test/integration/component/test_rootvolume_resize.py b/test/integration/component/test_rootvolume_resize.py
index 94fc53bf1bb..f5bd47d1146 100644
--- a/test/integration/component/test_rootvolume_resize.py
+++ b/test/integration/component/test_rootvolume_resize.py
@@ -24,7 +24,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
@@ -641,7 +642,7 @@ class TestResizeVolume(cloudstackTestCase):
list(self.apiclient,
vmsnapshotid=virtualmachine_snapshot.id)
status = validateList(virtulmachine_snapshot_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Listing of configuration failed")
@@ -1030,7 +1031,7 @@ class TestResizeVolume(cloudstackTestCase):
self.assertNotEqual(res[2], INVALID_INPUT, "Check DB Query result set")
qresult = int(qresultsize[0][0])
self.debug("Query result: %s" % qresult)
- self.assertEquals(
+ self.assertEqual(
qresult,
(newsize * 1024 * 1024 * 1024),
"Usage event not logged properly with right volume"
@@ -1140,4 +1141,4 @@ class TestResizeVolume(cloudstackTestCase):
" storage capacity after root "
"volume resize : %s" % e)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_secsr_mount.py b/test/integration/component/test_secsr_mount.py
index 71b45ccc274..3a69ec291fd 100644
--- a/test/integration/component/test_secsr_mount.py
+++ b/test/integration/component/test_secsr_mount.py
@@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from __builtin__ import False
""" Tests for Secondary Storage with Local Storage
"""
@@ -93,7 +92,7 @@ class TestSecSRMount(cloudstackTestCase):
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
- if storage_pool.type == u'NetworkFilesystem':
+ if storage_pool.type == 'NetworkFilesystem':
return False
return True
diff --git a/test/integration/component/test_shared_networks.py b/test/integration/component/test_shared_networks.py
index 93d266a52a0..725ee9162aa 100644
--- a/test/integration/component/test_shared_networks.py
+++ b/test/integration/component/test_shared_networks.py
@@ -18,7 +18,8 @@
""" P1 tests for shared networks
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import rebootRouter, stopRouter, startRouter
from marvin.lib.base import (Account,
Network,
@@ -796,10 +797,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned to\
network created.")
@@ -834,10 +835,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned to\
network created.")
@@ -1107,10 +1108,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned\
to network created.")
@@ -1449,10 +1450,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range\
assigned to network created.")
@@ -1484,10 +1485,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigne\
to network created.")
@@ -1777,10 +1778,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list(
netaddr.iter_iprange(
- unicode(
- self.testdata["shared_network"]["startip"]), unicode(
+ str(
+ self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"])))
- if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
+ if netaddr.IPAddress(str(vms[0].nic[0].ipaddress)) not in ip_range:
self.fail(
"Virtual machine ip should be from the ip range assigned\
to network created.")
@@ -3144,7 +3145,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.shared_network_offering.id
)
status = validateList(list_network_offerings_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworkOfferings returned invalid object in response."
@@ -3170,7 +3171,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.shared_network_offering.id
)
status = validateList(list_network_offerings_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworkOfferings returned invalid object in\
@@ -3200,7 +3201,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.network.id
)
status = validateList(list_accounts_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworks returned invalid object in response."
@@ -3246,7 +3247,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.network2.id
)
status = validateList(list_networks_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"listNetworks returned invalid object in response after\
diff --git a/test/integration/component/test_simultaneous_volume_attach.py b/test/integration/component/test_simultaneous_volume_attach.py
index 7ccde9cc785..aee5cf60026 100644
--- a/test/integration/component/test_simultaneous_volume_attach.py
+++ b/test/integration/component/test_simultaneous_volume_attach.py
@@ -17,7 +17,8 @@
#Import Local Modules
from marvin.cloudstackAPI import *
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
validateList)
from marvin.lib.base import (ServiceOffering,
@@ -252,4 +253,4 @@ class TestMultipleVolumeAttach(cloudstackTestCase):
"All 4 data disks are not attached to VM Successfully"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_snapshot_gc.py b/test/integration/component/test_snapshot_gc.py
index 21a23e5ca1e..1e08c046e07 100644
--- a/test/integration/component/test_snapshot_gc.py
+++ b/test/integration/component/test_snapshot_gc.py
@@ -16,7 +16,8 @@
# under the License.
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
#from marvin.cloudstackAPI import *
from marvin.lib.utils import (
is_snapshot_on_nfs,
@@ -190,7 +191,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
# Create a snapshot from the ROOTDISK
cls.snapshot = Snapshot.create(cls.api_client, volume.id)
- except Exception, e:
+ except Exception as e:
cls.tearDownClass()
unittest.SkipTest("setupClass fails for %s" % cls.__name__)
raise e
diff --git a/test/integration/component/test_snapshot_limits.py b/test/integration/component/test_snapshot_limits.py
index 21e15da236a..eb036605e91 100644
--- a/test/integration/component/test_snapshot_limits.py
+++ b/test/integration/component/test_snapshot_limits.py
@@ -16,7 +16,8 @@
# under the License.
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Account,
VirtualMachine,
@@ -179,7 +180,7 @@ class TestSnapshotLimit(cloudstackTestCase):
serviceofferingid=cls.service_offering.id
)
cls._cleanup.append(cls.virtual_machine)
- except Exception, e:
+ except Exception as e:
cls.tearDownClass()
unittest.SkipTest("setupClass fails for %s" % cls.__name__)
raise e
diff --git a/test/integration/component/test_ss_domain_limits.py b/test/integration/component/test_ss_domain_limits.py
index 0d9138ad659..ea89f9d3f06 100644
--- a/test/integration/component/test_ss_domain_limits.py
+++ b/test/integration/component/test_ss_domain_limits.py
@@ -280,7 +280,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
self.assertEqual(result[0], PASS, result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
@@ -351,7 +351,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
self.assertEqual(result[0], PASS, result[1])
users = result[2]
- for domain, admin in users.items():
+ for domain, admin in list(users.items()):
self.account = admin
self.domain = domain
diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py
index bd61398aac2..3d35d4337aa 100644
--- a/test/integration/component/test_ss_limits.py
+++ b/test/integration/component/test_ss_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_ss_project_limits.py b/test/integration/component/test_ss_project_limits.py
index ca58dbd7dcb..289c4c1778a 100644
--- a/test/integration/component/test_ss_project_limits.py
+++ b/test/integration/component/test_ss_project_limits.py
@@ -25,7 +25,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
ServiceOffering,
VirtualMachine,
diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py
index 589c71b4cbb..c1b5da366b3 100644
--- a/test/integration/component/test_stopped_vm.py
+++ b/test/integration/component/test_stopped_vm.py
@@ -343,8 +343,8 @@ class TestDeployVM(cloudstackTestCase):
listedvm = VirtualMachine.list(
self.apiclient,
id=self.virtual_machine.id)
- self.assert_(isinstance(listedvm, list))
- self.assert_(len(listedvm) > 0)
+ self.assertTrue(isinstance(listedvm, list))
+ self.assertTrue(len(listedvm) > 0)
self.assertEqual(
listedvm[0].serviceofferingid,
medium_service_off.id,
diff --git a/test/integration/component/test_storage_motion.py b/test/integration/component/test_storage_motion.py
index 6450d060649..7987dee3a17 100644
--- a/test/integration/component/test_storage_motion.py
+++ b/test/integration/component/test_storage_motion.py
@@ -268,8 +268,8 @@ class TestStorageMotion(cloudstackTestCase):
if not pools:
self.skipTest("No suitable storage pools found for volume migration. Skipping")
- self.assert_(isinstance(pools, list), "invalid pool response from listStoragePoolsForMigration: %s" %pools)
- self.assert_(len(pools) > 0, "no valid storage pools found for migration")
+ self.assertTrue(isinstance(pools, list), "invalid pool response from listStoragePoolsForMigration: %s" %pools)
+ self.assertTrue(len(pools) > 0, "no valid storage pools found for migration")
pool = pools[0]
self.debug("Migrating Volume-ID: %s to Pool: %s" % (
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index dcf82c191c5..9e3c8a42516 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -787,7 +787,7 @@ class TestResourceTags(cloudstackTestCase):
)
except Exception as e:
- print e
+ print(e)
vpns = Vpn.list(
self.apiclient,
@@ -3024,7 +3024,13 @@ class TestResourceTags(cloudstackTestCase):
)
except Exception as e:
# verify e.message
- assert "tag scope33 already on UserVm with id" in e.message, \
+ print(f"=== exception caught === {type(e)}")
+ strerror = ""
+ if hasattr(e,'message'):
+ strerror = e.__getattribute__('message')
+ else:
+ strerror = e.args
+ assert "tag scope33 already on UserVm with id" in str(strerror), \
"neat error message missing from error result"
pass
diff --git a/test/integration/component/test_template_from_snapshot_with_template_details.py b/test/integration/component/test_template_from_snapshot_with_template_details.py
index 4e20261ea9b..6b03860319a 100644
--- a/test/integration/component/test_template_from_snapshot_with_template_details.py
+++ b/test/integration/component/test_template_from_snapshot_with_template_details.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py
index 496c1d605af..f5e2d4625ce 100644
--- a/test/integration/component/test_templates.py
+++ b/test/integration/component/test_templates.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
diff --git a/test/integration/component/test_updateResourceCount.py b/test/integration/component/test_updateResourceCount.py
index c9bd6e6f183..cc024681843 100644
--- a/test/integration/component/test_updateResourceCount.py
+++ b/test/integration/component/test_updateResourceCount.py
@@ -232,4 +232,4 @@ class TestUpdateResourceCount(cloudstackTestCase):
1024,
"The memory amount does not seem to be right."
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/component/test_vm_passwdenabled.py b/test/integration/component/test_vm_passwdenabled.py
index d340031935c..20dcbd73d5f 100644
--- a/test/integration/component/test_vm_passwdenabled.py
+++ b/test/integration/component/test_vm_passwdenabled.py
@@ -14,7 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Account,
ServiceOffering,
diff --git a/test/integration/component/test_vmware_drs.py b/test/integration/component/test_vmware_drs.py
index 5d701e89340..9ec84ef4639 100644
--- a/test/integration/component/test_vmware_drs.py
+++ b/test/integration/component/test_vmware_drs.py
@@ -21,7 +21,8 @@
import marvin
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
AffinityGroup,
diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py
index 50341ac7c3c..9662f6aa695 100644
--- a/test/integration/component/test_volumes.py
+++ b/test/integration/component/test_volumes.py
@@ -1231,7 +1231,7 @@ class TestVolumes(cloudstackTestCase):
zoneid=self.zone.id,
account=domuser.name,
domainid=dom.id,
- diskofferingid=filter(lambda x: not x.iscustomized, diskoffering)[0].id
+ diskofferingid=[x for x in diskoffering if not x.iscustomized][0].id
)
self.assertTrue(
vol is not None, "volume creation fails in domain %s as user %s" %
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index 1dbccf8fc45..4f31738d0b4 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -19,7 +19,8 @@
"""
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import startVirtualMachine, stopVirtualMachine
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (VirtualMachine,
diff --git a/test/integration/component/test_vpc_network_internal_lbrules.py b/test/integration/component/test_vpc_network_internal_lbrules.py
index 9523083e13b..ea2a00f3076 100644
--- a/test/integration/component/test_vpc_network_internal_lbrules.py
+++ b/test/integration/component/test_vpc_network_internal_lbrules.py
@@ -83,7 +83,7 @@ class TestVPCNetworkInternalLBRules(cloudstackTestCase):
# Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
- print ("Warning: Exception during cleanup : %s" % e)
+ print(("Warning: Exception during cleanup : %s" % e))
return
def setUp(self):
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index 88da61d47d3..9d3ec51bd03 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (stopRouter,
startRouter,
Account,
@@ -209,7 +210,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
- print ("Warning: Exception during cleanup : %s" % e)
+ print(("Warning: Exception during cleanup : %s" % e))
#raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -330,15 +331,15 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
def check_wget_from_vm(self, vm, public_ip, testnegative=False):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
- urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
+ urllib.request.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
if not testnegative:
self.debug("Successful to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
else:
self.fail("Successful to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
- except Exception, e:
+ except Exception as e:
if not testnegative:
self.fail("Failed to wget from VM=%s http server on public_ip=%s because of %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
else:
@@ -540,7 +541,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
id=lb_rule1.id,
listall=True
)
- self.failIfEqual(lb_rules,
+ self.assertNotEqual(lb_rules,
None,
"Failed to list the LB Rule"
)
@@ -548,7 +549,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
networkid=network_1.id,
listall=True
)
- self.failIfEqual(vms,
+ self.assertNotEqual(vms,
None,
"Failed to list the VMs in network=%s" % network_1.name
)
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index e5fca1a1282..e1623e02771 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -17,29 +17,31 @@
""" Component tests for VPC network functionality - Port Forwarding Rules.
"""
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.lib.base import (stopRouter,
- startRouter,
- Account,
- VpcOffering,
- VPC,
- ServiceOffering,
- NATRule,
- NetworkACL,
- PublicIPAddress,
- NetworkOffering,
- Network,
- VirtualMachine,
- LoadBalancerRule)
-from marvin.lib.common import (get_domain,
- get_zone,
- get_template,
- list_routers)
-from marvin.lib.utils import cleanup_resources
import socket
import time
-import sys
+from nose.plugins.attrib import attr
+
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (
+ stopRouter,
+ startRouter,
+ Account,
+ VpcOffering,
+ VPC,
+ ServiceOffering,
+ NATRule,
+ NetworkACL,
+ PublicIPAddress,
+ NetworkOffering,
+ Network,
+ VirtualMachine,
+ LoadBalancerRule)
+from marvin.lib.common import (
+ get_domain,
+ get_zone,
+ get_template,
+ list_routers)
+from marvin.lib.utils import cleanup_resources
class Services:
@@ -191,44 +193,40 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
- )
- cls._cleanup = [cls.service_offering]
+ cls.api_client,
+ cls.services["service_offering"]
+ )
+ cls._cleanup = []
+ cls._cleanup.append(cls.service_offering)
return
@classmethod
def tearDownClass(cls):
- try:
- #Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
-
+ super(TestVPCNetworkPFRules,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.account = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True,
- domainid=self.domain.id
- )
- self.cleanup = [self.account]
+ self.apiclient,
+ self.services["account"],
+ admin=True,
+ domainid=self.domain.id
+ )
+ self.cleanup = []
+ self.cleanup.append(self.account)
self.debug("Creating a VPC offering..")
self.vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.debug("Enabling the VPC offering created")
self.vpc_off.update(self.apiclient, state='Enabled')
@@ -236,40 +234,35 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.debug("Creating a VPC network in the account: %s" % self.account.name)
self.services["vpc"]["cidr"] = '10.1.1.1/16'
self.vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=self.vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=self.vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(self.vpc)
return
def tearDown(self):
- try:
- #Clean up, terminate the created network offerings
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- self.debug("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPCNetworkPFRules,self).tearDown()
def get_vpcrouter(self):
routers = list_routers(self.apiclient,
- account=self.account.name,
- domainid=self.account.domainid,
- )
+ account=self.account.name,
+ domainid=self.account.domainid,
+ )
self.assertEqual(isinstance(routers, list),
- True,
- "Check for list routers response return valid data"
- )
+ True,
+ "Check for list routers response return valid data"
+ )
self.assertNotEqual(len(routers),
- 0,
- "Check list router response"
- )
+ 0,
+ "Check list router response"
+ )
router = routers[0]
return router
-
def stop_vpcrouter(self):
router = self.get_vpcrouter()
self.debug("Stopping router ID: %s" % router.id)
@@ -278,18 +271,18 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.apiclient.stopRouter(cmd)
routers = list_routers(self.apiclient,
- account=self.account.name,
- domainid=self.account.domainid,
- )
+ account=self.account.name,
+ domainid=self.account.domainid,
+ )
self.assertEqual(isinstance(routers, list),
- True,
- "Check for list routers response return valid data"
- )
+ True,
+ "Check for list routers response return valid data"
+ )
router = routers[0]
self.assertEqual(router.state,
- 'Stopped',
- "Check list router response for router state"
- )
+ 'Stopped',
+ "Check list router response for router state"
+ )
return router
def start_vpcrouter(self, router):
@@ -300,58 +293,58 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.apiclient.startRouter(cmd)
routers = list_routers(self.apiclient,
- account=self.account.name,
- domainid=self.account.domainid,
- zoneid=self.zone.id
- )
+ account=self.account.name,
+ domainid=self.account.domainid,
+ zoneid=self.zone.id
+ )
self.assertEqual(isinstance(routers, list),
- True,
- "Check for list routers response return valid data"
- )
+ True,
+ "Check for list routers response return valid data"
+ )
router = routers[0]
self.assertEqual(router.state,
- 'Running',
- "Check list router response for router state"
- )
+ 'Running',
+ "Check list router response for router state"
+ )
def check_ssh_into_vm(self, vm, public_ip, testnegative=False):
self.debug("Checking if we can SSH into VM=%s on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
- vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
- if not testnegative:
- self.debug("SSH into VM=%s on public_ip=%s is successfully" % (vm.name, public_ip.ipaddress.ipaddress))
- else:
- self.fail("SSH into VM=%s on public_ip=%s is successfully" % (vm.name, public_ip.ipaddress.ipaddress))
+ vm.get_ssh_client(ipaddress=public_ip.ipaddress.ipaddress)
+ if not testnegative:
+ self.debug("SSH into VM=%s on public_ip=%s is successfully" % (vm.name, public_ip.ipaddress.ipaddress))
+ else:
+ self.fail("SSH into VM=%s on public_ip=%s is successfully" % (vm.name, public_ip.ipaddress.ipaddress))
except:
- if not testnegative:
- self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
- else:
- self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
+ if not testnegative:
+ self.fail("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
+ else:
+ self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
def check_wget_from_vm(self, vm, public_ip, network=None, testnegative=False, isVmAccessible=True):
- import urllib
- self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+ import urllib.request, urllib.error
+ self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
- if not isVmAccessible:
- self.create_natrule(vm, public_ip, network)
- self.setup_webserver(vm)
+ if not isVmAccessible:
+ self.create_natrule(vm, public_ip, network)
+ self.setup_webserver(vm)
- urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
- if not testnegative:
- self.debug("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
- else:
- self.fail("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+ urllib.request.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
+ if not testnegative:
+ self.debug("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
+ else:
+ self.fail("Successesfull to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
except Exception as e:
- if not testnegative:
- self.fail("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
- else:
- self.debug("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
+ if not testnegative:
+ self.fail("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
+ else:
+ self.debug("Failed to wget from VM=%s http server on public_ip=%s: %s" % (vm.name, public_ip.ipaddress.ipaddress, e))
def setup_webserver(self, vm):
# Start httpd service on VM first
- sshClient = vm.get_ssh_client()
- # Test to see if we are on a tiny linux box (using busybox)
- res = str(sshClient.execute("busybox")).lower()
+ sshClient = vm.get_ssh_client()
+ # Test to see if we are on a tiny linux box (using busybox)
+ res = str(sshClient.execute("busybox")).lower()
if "hexdump" in res:
self.setup_busybox(sshClient)
else:
@@ -359,69 +352,69 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
def setup_busybox(self, sshClient):
""" Create a dummy test.html file and fire up the busybox web server """
- sshClient.execute('echo test > test.html')
- sshClient.execute("/usr/sbin/httpd")
- self.debug("Setup webserver using busybox")
+ sshClient.execute('echo test > test.html')
+ sshClient.execute("/usr/sbin/httpd")
+ self.debug("Setup webserver using busybox")
def setup_apache(self, sshClient):
- sshClient.execute("service httpd start")
- time.sleep(5)
- ssh_response = str(sshClient.execute("service httpd status")).lower()
- self.debug("httpd service status is: %s" % ssh_response)
- if "httpd: unrecognized service" in ssh_response or "inactive" in ssh_response:
- ssh_res = sshClient.execute("yum install httpd -y")
- if "Complete!" not in ssh_res:
- raise Exception("Failed to install http server")
- sshClient.execute("service httpd start")
- time.sleep(5)
- ssh_response = str(sshClient.execute("service httpd status")).lower()
- if not "running" in ssh_response:
- raise Exception("Failed to start httpd service")
- self.debug("Setup webserver using apache")
+ sshClient.execute("service httpd start")
+ time.sleep(5)
+ ssh_response = str(sshClient.execute("service httpd status")).lower()
+ self.debug("httpd service status is: %s" % ssh_response)
+ if "httpd: unrecognized service" in ssh_response or "inactive" in ssh_response:
+ ssh_res = sshClient.execute("yum install httpd -y")
+ if "Complete!" not in ssh_res:
+ raise Exception("Failed to install http server")
+ sshClient.execute("service httpd start")
+ time.sleep(5)
+ ssh_response = str(sshClient.execute("service httpd status")).lower()
+ if not "running" in ssh_response:
+ raise Exception("Failed to start httpd service")
+ self.debug("Setup webserver using apache")
def create_natrule(self, vm, public_ip, network, services=None):
self.debug("Creating NAT rule in network for vm with public IP")
if not services:
services = self.services["natrule"]
nat_rule = NATRule.create(self.apiclient,
- vm,
- services,
- ipaddressid=public_ip.ipaddress.id,
- openfirewall=False,
- networkid=network.id,
- vpcid=self.vpc.id
- )
+ vm,
+ services,
+ ipaddressid=public_ip.ipaddress.id,
+ openfirewall=False,
+ networkid=network.id,
+ vpcid=self.vpc.id
+ )
self.debug("Adding NetworkACL rules to make NAT rule accessible")
nwacl_nat = NetworkACL.create(self.apiclient,
- networkid=network.id,
- services=services,
- traffictype='Ingress'
- )
+ networkid=network.id,
+ services=services,
+ traffictype='Ingress'
+ )
self.debug('nwacl_nat=%s' % nwacl_nat.__dict__)
return nat_rule
def acquire_publicip(self, network):
self.debug("Associating public IP for network: %s" % network.name)
public_ip = PublicIPAddress.create(self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=self.vpc.id
- )
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=self.vpc.id
+ )
self.debug("Associated %s with network %s" % (public_ip.ipaddress.ipaddress,
- network.id
- ))
+ network.id
+ ))
return public_ip
def create_vpc(self, cidr='10.1.2.1/16'):
self.debug("Creating a VPC offering..")
self.services["vpc_offering"]["name"] = self.services["vpc_offering"]["name"] + str(cidr)
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self._cleanup.append(vpc_off)
self.debug("Enabling the VPC offering created")
@@ -430,96 +423,95 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.debug("Creating a VPC network in the account: %s" % self.account.name)
self.services["vpc"]["cidr"] = cidr
vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
return vpc
- def create_network(self, net_offerring, gateway='10.1.1.1',vpc=None):
+ def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None):
try:
- self.debug('Create NetworkOffering')
- net_offerring["name"] = "NET_OFF-" + str(gateway)
- nw_off = NetworkOffering.create(self.apiclient,
- net_offerring,
- conservemode=False
- )
- # Enable Network offering
- nw_off.update(self.apiclient, state='Enabled')
- self._cleanup.append(nw_off)
- self.debug('Created and Enabled NetworkOffering')
+ self.debug('Create NetworkOffering')
+ net_offerring["name"] = "NET_OFF-" + str(gateway)
+ nw_off = NetworkOffering.create(self.apiclient,
+ net_offerring,
+ conservemode=False
+ )
+ # Enable Network offering
+ nw_off.update(self.apiclient, state='Enabled')
+ self._cleanup.append(nw_off)
+ self.debug('Created and Enabled NetworkOffering')
- self.services["network"]["name"] = "NETWORK-" + str(gateway)
- self.debug('Adding Network=%s' % self.services["network"])
- obj_network = Network.create(self.apiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkofferingid=nw_off.id,
- zoneid=self.zone.id,
- gateway=gateway,
- vpcid=vpc.id if vpc else self.vpc.id
- )
- self.debug("Created network with ID: %s" % obj_network.id)
- return obj_network
- except Exception, e:
- self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
+ self.services["network"]["name"] = "NETWORK-" + str(gateway)
+ self.debug('Adding Network=%s' % self.services["network"])
+ obj_network = Network.create(self.apiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkofferingid=nw_off.id,
+ zoneid=self.zone.id,
+ gateway=gateway,
+ vpcid=vpc.id if vpc else self.vpc.id
+ )
+ self.debug("Created network with ID: %s" % obj_network.id)
+ return obj_network
+ except Exception as e:
+ self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
def deployvm_in_network(self, network, host_id=None):
try:
- self.debug('Creating VM in network=%s' % network.name)
- vm = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering.id,
- networkids=[str(network.id)],
- hostid=host_id
- )
- self.debug('Created VM=%s in network=%s' % (vm.id, network.name))
+ self.debug('Creating VM in network=%s' % network.name)
+ vm = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[str(network.id)],
+ hostid=host_id
+ )
+ self.debug('Created VM=%s in network=%s' % (vm.id, network.name))
- return vm
+ return vm
except:
- self.fail('Unable to create VM in a Network=%s' % network.name)
+ self.fail('Unable to create VM in a Network=%s' % network.name)
def create_lbrule(self, public_ip, network, vmarray, services=None):
self.debug("Creating LB rule for IP address: %s" %
- public_ip.ipaddress.ipaddress)
+ public_ip.ipaddress.ipaddress)
objservices = None
if services:
- objservices = services
+ objservices = services
else:
- objservices = self.services["lbrule"]
+ objservices = self.services["lbrule"]
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- objservices,
- ipaddressid=public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=network.id,
- vpcid=self.vpc.id,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ objservices,
+ ipaddressid=public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=network.id,
+ vpcid=self.vpc.id,
+ domainid=self.account.domainid
+ )
self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray))
lb_rule.assign(self.apiclient, vmarray)
return lb_rule
def open_egress_to_world(self, network):
- self.debug("Adding Egress rules to network %s and %s to allow access to internet" % (network.name,self.services["http_rule"]))
+ self.debug("Adding Egress rules to network %s and %s to allow access to internet" % (network.name, self.services["http_rule"]))
nwacl_internet_1 = NetworkACL.create(
- self.apiclient,
- networkid=network.id,
- services=self.services["http_rule"],
- traffictype='Ingress'
- )
+ self.apiclient,
+ networkid=network.id,
+ services=self.services["http_rule"],
+ traffictype='Ingress'
+ )
return nwacl_internet_1
-
@attr(tags=["advanced", "intervlan"], required_hardware="true")
def test_01_network_services_VPC_StopCreatePF(self):
""" Test : Create VPC PF rules on acquired public ip when VpcVirtualRouter is stopped
@@ -538,14 +530,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
network_1 = self.create_network(self.services["network_offering"])
vm_1 = self.deployvm_in_network(network_1)
public_ip_1 = self.acquire_publicip(network_1)
- #ensure vm is accessible over public ip
+ # ensure vm is accessible over public ip
nat_rule = self.create_natrule(vm_1, public_ip_1, network_1)
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
- #remove the nat rule
+ # remove the nat rule
nat_rule.delete(self.apiclient)
router = self.stop_vpcrouter()
- #recreate nat rule
+ # recreate nat rule
self.create_natrule(vm_1, public_ip_1, network_1)
self.start_vpcrouter(router)
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
@@ -567,7 +559,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
network_1 = self.create_network(self.services["network_offering"])
vm_1 = self.deployvm_in_network(network_1)
public_ip_1 = self.acquire_publicip(network_1)
- self.create_natrule( vm_1, public_ip_1, network_1)
+ self.create_natrule(vm_1, public_ip_1, network_1)
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
return
@@ -686,7 +678,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vm_1 = self.deployvm_in_network(network_1)
public_ip_1 = self.acquire_publicip(network_1)
self.create_natrule(vm_1, public_ip_1, network_1)
- http_rule=self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
+ http_rule = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
http_rule.delete(self.apiclient)
@@ -715,7 +707,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
network_1 = self.create_network(self.services["network_offering"])
vm_1 = self.deployvm_in_network(network_1)
public_ip_1 = self.acquire_publicip(network_1)
- nat_rule = self.create_natrule(vm_1, public_ip_1, network_1)
+ nat_rule = self.create_natrule(vm_1, public_ip_1, network_1)
http_rule = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
@@ -725,7 +717,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.start_vpcrouter(router)
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
- isVmAccessible=False, network=network_1)
+ isVmAccessible=False, network=network_1)
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -748,7 +740,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
network_1 = self.create_network(self.services["network_offering"])
vm_1 = self.deployvm_in_network(network_1)
public_ip_1 = self.acquire_publicip(network_1)
- nat_rule = self.create_natrule(vm_1, public_ip_1, network_1)
+ nat_rule = self.create_natrule(vm_1, public_ip_1, network_1)
http_rule = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=False)
@@ -756,7 +748,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
nat_rule.delete(self.apiclient)
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=True)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
- isVmAccessible=False, network=network_1)
+ isVmAccessible=False, network=network_1)
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -788,14 +780,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vm_4 = self.deployvm_in_network(network_2)
public_ip_1 = self.acquire_publicip(network_1)
public_ip_2 = self.acquire_publicip(network_1)
- nat_rule1 = self.create_natrule(vm_1, public_ip_1, network_1)
- nat_rule2 = self.create_natrule(vm_2, public_ip_2, network_1)
+ nat_rule1 = self.create_natrule(vm_1, public_ip_1, network_1)
+ nat_rule2 = self.create_natrule(vm_2, public_ip_2, network_1)
http_rule1 = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
http_rule2 = self.create_natrule(vm_2, public_ip_2, network_1, self.services["http_rule"])
public_ip_3 = self.acquire_publicip(network_2)
public_ip_4 = self.acquire_publicip(network_2)
- nat_rule3 = self.create_natrule(vm_3, public_ip_3, network_2)
- nat_rule4 = self.create_natrule(vm_4, public_ip_4, network_2)
+ nat_rule3 = self.create_natrule(vm_3, public_ip_3, network_2)
+ nat_rule4 = self.create_natrule(vm_4, public_ip_4, network_2)
http_rule3 = self.create_natrule(vm_3, public_ip_3, network_2, self.services["http_rule"])
http_rule4 = self.create_natrule(vm_4, public_ip_4, network_2, self.services["http_rule"])
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
@@ -821,13 +813,13 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
- isVmAccessible=False, network=network_1)
+ isVmAccessible=False, network=network_1)
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
- isVmAccessible=False, network=network_1)
+ isVmAccessible=False, network=network_1)
self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
- isVmAccessible=False, network=network_2)
+ isVmAccessible=False, network=network_2)
self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
- isVmAccessible=False, network=network_2)
+ isVmAccessible=False, network=network_2)
return
@attr(tags=["advanced", "intervlan"], required_hardware="true")
@@ -856,14 +848,14 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vm_4 = self.deployvm_in_network(network_2)
public_ip_1 = self.acquire_publicip(network_1)
public_ip_2 = self.acquire_publicip(network_1)
- nat_rule1 = self.create_natrule(vm_1, public_ip_1, network_1)
- nat_rule2 = self.create_natrule(vm_2, public_ip_2, network_1)
+ nat_rule1 = self.create_natrule(vm_1, public_ip_1, network_1)
+ nat_rule2 = self.create_natrule(vm_2, public_ip_2, network_1)
http_rule1 = self.create_natrule(vm_1, public_ip_1, network_1, self.services["http_rule"])
http_rule2 = self.create_natrule(vm_2, public_ip_2, network_1, self.services["http_rule"])
public_ip_3 = self.acquire_publicip(network_2)
public_ip_4 = self.acquire_publicip(network_2)
- nat_rule3 = self.create_natrule(vm_3, public_ip_3, network_2)
- nat_rule4 = self.create_natrule(vm_4, public_ip_4, network_2)
+ nat_rule3 = self.create_natrule(vm_3, public_ip_3, network_2)
+ nat_rule4 = self.create_natrule(vm_4, public_ip_4, network_2)
http_rule3 = self.create_natrule(vm_3, public_ip_3, network_2, self.services["http_rule"])
http_rule4 = self.create_natrule(vm_4, public_ip_4, network_2, self.services["http_rule"])
self.check_ssh_into_vm(vm_1, public_ip_1, testnegative=False)
@@ -887,11 +879,11 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.check_ssh_into_vm(vm_3, public_ip_3, testnegative=True)
self.check_ssh_into_vm(vm_4, public_ip_4, testnegative=True)
self.check_wget_from_vm(vm_1, public_ip_1, testnegative=True,
- isVmAccessible=False, network=network_1)
+ isVmAccessible=False, network=network_1)
self.check_wget_from_vm(vm_2, public_ip_2, testnegative=True,
- isVmAccessible=False, network=network_1)
+ isVmAccessible=False, network=network_1)
self.check_wget_from_vm(vm_3, public_ip_3, testnegative=True,
- isVmAccessible=False, network=network_2)
+ isVmAccessible=False, network=network_2)
self.check_wget_from_vm(vm_4, public_ip_4, testnegative=True,
- isVmAccessible=False, network=network_2)
+ isVmAccessible=False, network=network_2)
return
diff --git a/test/integration/component/test_vpc_network_staticnatrule.py b/test/integration/component/test_vpc_network_staticnatrule.py
index d75044bae28..c5f39b34499 100644
--- a/test/integration/component/test_vpc_network_staticnatrule.py
+++ b/test/integration/component/test_vpc_network_staticnatrule.py
@@ -18,7 +18,8 @@
""" Component tests for VPC network functionality - Port Forwarding Rules.
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (Account,
VpcOffering,
VPC,
@@ -210,7 +211,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
- print("Warning: Exception during cleanup : %s" % e)
+ print(("Warning: Exception during cleanup : %s" % e))
#raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -330,10 +331,10 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.debug("Failed to SSH into VM - %s" % (public_ip.ipaddress.ipaddress))
def check_wget_from_vm(self, vm, public_ip, testnegative=False):
- import urllib
+ import urllib.request, urllib.parse, urllib.error
self.debug("Checking if we can wget from a VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
try:
- urllib.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
+ urllib.request.urlretrieve("http://%s/test.html" % public_ip.ipaddress.ipaddress, filename="test.html")
if not testnegative:
self.debug("Successful to wget from VM=%s http server on public_ip=%s" % (vm.name, public_ip.ipaddress.ipaddress))
else:
diff --git a/test/integration/component/test_vpc_offerings.py b/test/integration/component/test_vpc_offerings.py
index 5424cbeaba5..e3af67ac18c 100644
--- a/test/integration/component/test_vpc_offerings.py
+++ b/test/integration/component/test_vpc_offerings.py
@@ -14,150 +14,148 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import unittest
""" Component tests for inter VLAN functionality
"""
-#Import Local Modules
-import marvin
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
+
+# Import Local Modules
from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
+from marvin.cloudstackTestCase import *
from marvin.lib.base import *
from marvin.lib.common import *
-from marvin.sshClient import SshClient
-import datetime
+from marvin.lib.utils import *
+from nose.plugins.attrib import attr
import logging
+
class Services:
"""Test inter VLAN services
"""
def __init__(self):
self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100,
- "memory": 128,
- },
- "network_offering": {
- "name": 'VPC Network offering',
- "displaytext": 'VPC Network off',
- "guestiptype": 'Isolated',
- "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
- "traffictype": 'GUEST',
- "availability": 'Optional',
- "useVpc": 'on',
- "serviceProviderList": {
- "Vpn": 'VpcVirtualRouter',
- "Dhcp": 'VpcVirtualRouter',
- "Dns": 'VpcVirtualRouter',
- "SourceNat": 'VpcVirtualRouter',
- "PortForwarding": 'VpcVirtualRouter',
- "Lb": 'VpcVirtualRouter',
- "UserData": 'VpcVirtualRouter',
- "StaticNat": 'VpcVirtualRouter',
- "NetworkACL": 'VpcVirtualRouter'
- },
- },
- "vpc_offering": {
- "name": 'VPC off',
- "displaytext": 'VPC off',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat',
- },
- "redundant_vpc_offering": {
- "name": 'Redundant VPC off',
- "displaytext": 'Redundant VPC off',
- "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat',
- "serviceProviderList": {
- "Vpn": 'VpcVirtualRouter',
- "Dhcp": 'VpcVirtualRouter',
- "Dns": 'VpcVirtualRouter',
- "SourceNat": 'VpcVirtualRouter',
- "PortForwarding": 'VpcVirtualRouter',
- "Lb": 'VpcVirtualRouter',
- "UserData": 'VpcVirtualRouter',
- "StaticNat": 'VpcVirtualRouter',
- "NetworkACL": 'VpcVirtualRouter'
- },
- "serviceCapabilityList": {
- "SourceNat": {
- "RedundantRouter": 'true'
- }
- },
- },
- "vpc": {
- "name": "TestVPC",
- "displaytext": "TestVPC",
- "cidr": '10.0.0.1/24'
- },
- "redundant_vpc": {
- "name": "TestRedundantVPC",
- "displaytext": "TestRedundantVPC",
- "cidr": '10.0.0.1/24'
- },
- "network": {
- "name": "Test Network",
- "displaytext": "Test Network",
- "netmask": '255.255.255.0'
- },
- "lbrule": {
- "name": "SSH",
- "alg": "leastconn",
- # Algorithm used for load balancing
- "privateport": 22,
- "publicport": 2222,
- "openfirewall": False,
- "startport": 2222,
- "endport": 2222,
- "cidrlist": '0.0.0.0/0',
- "protocol": 'TCP'
- },
- "natrule": {
- "privateport": 22,
- "publicport": 22,
- "startport": 22,
- "endport": 22,
- "protocol": "TCP",
- "cidrlist": '0.0.0.0/0',
- },
- "fw_rule": {
- "startport": 1,
- "endport": 6000,
- "cidr": '0.0.0.0/0',
- # Any network (For creating FW rule)
- "protocol": "TCP"
- },
- "virtual_machine": {
- "displayname": "Test VM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- # Hypervisor type should be same as
- # hypervisor type of cluster
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- # Cent OS 5.3 (64 bit)
- "sleep": 60,
- "timeout": 10,
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ "memory": 128,
+ },
+ "network_offering": {
+ "name": 'VPC Network offering',
+ "displaytext": 'VPC Network off',
+ "guestiptype": 'Isolated',
+ "supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
+ "traffictype": 'GUEST',
+ "availability": 'Optional',
+ "useVpc": 'on',
+ "serviceProviderList": {
+ "Vpn": 'VpcVirtualRouter',
+ "Dhcp": 'VpcVirtualRouter',
+ "Dns": 'VpcVirtualRouter',
+ "SourceNat": 'VpcVirtualRouter',
+ "PortForwarding": 'VpcVirtualRouter',
+ "Lb": 'VpcVirtualRouter',
+ "UserData": 'VpcVirtualRouter',
+ "StaticNat": 'VpcVirtualRouter',
+ "NetworkACL": 'VpcVirtualRouter'
+ },
+ },
+ "vpc_offering": {
+ "name": 'VPC off',
+ "displaytext": 'VPC off',
+ "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat',
+ },
+ "redundant_vpc_offering": {
+ "name": 'Redundant VPC off',
+ "displaytext": 'Redundant VPC off',
+ "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat',
+ "serviceProviderList": {
+ "Vpn": 'VpcVirtualRouter',
+ "Dhcp": 'VpcVirtualRouter',
+ "Dns": 'VpcVirtualRouter',
+ "SourceNat": 'VpcVirtualRouter',
+ "PortForwarding": 'VpcVirtualRouter',
+ "Lb": 'VpcVirtualRouter',
+ "UserData": 'VpcVirtualRouter',
+ "StaticNat": 'VpcVirtualRouter',
+ "NetworkACL": 'VpcVirtualRouter'
+ },
+ "serviceCapabilityList": {
+ "SourceNat": {
+ "RedundantRouter": 'true'
}
+ },
+ },
+ "vpc": {
+ "name": "TestVPC",
+ "displaytext": "TestVPC",
+ "cidr": '10.0.0.1/24'
+ },
+ "redundant_vpc": {
+ "name": "TestRedundantVPC",
+ "displaytext": "TestRedundantVPC",
+ "cidr": '10.0.0.1/24'
+ },
+ "network": {
+ "name": "Test Network",
+ "displaytext": "Test Network",
+ "netmask": '255.255.255.0'
+ },
+ "lbrule": {
+ "name": "SSH",
+ "alg": "leastconn",
+ # Algorithm used for load balancing
+ "privateport": 22,
+ "publicport": 2222,
+ "openfirewall": False,
+ "startport": 2222,
+ "endport": 2222,
+ "cidrlist": '0.0.0.0/0',
+ "protocol": 'TCP'
+ },
+ "natrule": {
+ "privateport": 22,
+ "publicport": 22,
+ "startport": 22,
+ "endport": 22,
+ "protocol": "TCP",
+ "cidrlist": '0.0.0.0/0',
+ },
+ "fw_rule": {
+ "startport": 1,
+ "endport": 6000,
+ "cidr": '0.0.0.0/0',
+ # Any network (For creating FW rule)
+ "protocol": "TCP"
+ },
+ "virtual_machine": {
+ "displayname": "Test VM",
+ "username": "root",
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'XenServer',
+ # Hypervisor type should be same as
+ # hypervisor type of cluster
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
+ "ostype": 'CentOS 5.3 (64-bit)',
+ # Cent OS 5.3 (64 bit)
+ "sleep": 60,
+ "timeout": 10,
+ }
class TestVPCOffering(cloudstackTestCase):
@@ -172,80 +170,70 @@ class TestVPCOffering(cloudstackTestCase):
cls.testClient = super(TestVPCOffering, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
+ cls._cleanup = []
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
- )
- cls._cleanup = [
- cls.service_offering,
- ]
+ cls.api_client,
+ cls.services["service_offering"]
+ )
+ cls._cleanup.append(cls.service_offering)
return
@classmethod
def tearDownClass(cls):
- try:
- #Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPCOffering,cls).tearDownClass()
def setUp(self):
self.logger.debug("test_vpc_offering#setUp")
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
- self.apiclient,
- self.services["account"],
- admin=True,
- domainid=self.domain.id
- )
+ self.apiclient,
+ self.services["account"],
+ admin=True,
+ domainid=self.domain.id
+ )
self.cleanup = []
- self.cleanup.insert(0, self.account)
+ self.cleanup.append(self.account)
return
def tearDown(self):
self.logger.debug("test_vpc_offering#tearDown")
- try:
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPCOffering,self).tearDown()
def validate_vpc_offering(self, vpc_offering):
"""Validates the VPC offering"""
self.logger.debug("Check if the VPC offering is created successfully?")
vpc_offs = VpcOffering.list(
- self.apiclient,
- id=vpc_offering.id
- )
+ self.apiclient,
+ id=vpc_offering.id
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings should return a valid list"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings should return a valid list"
+ )
self.assertEqual(
- vpc_offering.name,
- vpc_offs[0].name,
- "Name of the VPC offering should match with listVPCOff data"
- )
+ vpc_offering.name,
+ vpc_offs[0].name,
+ "Name of the VPC offering should match with listVPCOff data"
+ )
self.logger.debug(
- "VPC offering is created successfully - %s" %
- vpc_offering.name)
+ "VPC offering is created successfully - %s" %
+ vpc_offering.name)
return
def validate_vpc_network(self, network):
@@ -253,19 +241,19 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Check if the VPC network is created successfully?")
vpc_networks = VPC.list(
- self.apiclient,
- id=network.id
- )
+ self.apiclient,
+ id=network.id
+ )
self.assertEqual(
- isinstance(vpc_networks, list),
- True,
- "List VPC network should return a valid list"
- )
+ isinstance(vpc_networks, list),
+ True,
+ "List VPC network should return a valid list"
+ )
self.assertEqual(
- network.name,
- vpc_networks[0].name,
- "Name of the VPC network should match with listVPC data"
- )
+ network.name,
+ vpc_networks[0].name,
+ "Name of the VPC network should match with listVPC data"
+ )
self.logger.debug("VPC network created successfully - %s" % network.name)
return
@@ -280,9 +268,9 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Creating inter VPC offering")
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.logger.debug("Check if the VPC offering is created successfully?")
self.cleanup.append(vpc_off)
@@ -308,9 +296,10 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Creating a VPC offering..")
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
+ self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
@@ -318,22 +307,24 @@ class TestVPCOffering(cloudstackTestCase):
vpc_off.update(self.apiclient, state='Enabled')
self.logger.debug("creating a VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(vpc)
self.validate_vpc_network(vpc)
self.network_offering = NetworkOffering.create(
- self.apiclient,
- self.services["network_offering"],
- conservemode=False
- )
+ self.apiclient,
+ self.services["network_offering"],
+ conservemode=False
+ )
+ self.cleanup.append(self.network_offering)
# Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled')
@@ -344,150 +335,159 @@ class TestVPCOffering(cloudstackTestCase):
# Creating network using the network offering created
self.logger.debug("Creating network with network offering: %s" %
- self.network_offering.id)
+ self.network_offering.id)
network = Network.create(
- self.apiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkofferingid=self.network_offering.id,
- zoneid=self.zone.id,
- gateway=gateway,
- vpcid=vpc.id
- )
+ self.apiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkofferingid=self.network_offering.id,
+ zoneid=self.zone.id,
+ gateway=gateway,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(network)
self.logger.debug("Created network with ID: %s" % network.id)
# Spawn an instance in that network
virtual_machine = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering.id,
- networkids=[str(network.id)]
- )
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[str(network.id)]
+ )
+ self.cleanup.append(virtual_machine)
self.logger.debug("Deployed VM in network: %s" % network.id)
self.logger.debug("Associating public IP for network: %s" % network.name)
public_ip = PublicIPAddress.create(
- self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(public_ip)
self.logger.debug("Associated %s with network %s" % (
- public_ip.ipaddress.ipaddress,
- network.id
- ))
+ public_ip.ipaddress.ipaddress,
+ network.id
+ ))
self.logger.debug("Creating LB rule for IP address: %s" %
- public_ip.ipaddress.ipaddress)
+ public_ip.ipaddress.ipaddress)
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=network.id,
- vpcid=vpc.id,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=network.id,
+ vpcid=vpc.id,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(lb_rule)
self.logger.debug("Associating public IP for network: %s" % vpc.name)
public_ip_2 = PublicIPAddress.create(
- self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(public_ip_2)
self.logger.debug("Associated %s with network %s" % (
- public_ip_2.ipaddress.ipaddress,
- network.id
- ))
+ public_ip_2.ipaddress.ipaddress,
+ network.id
+ ))
nat_rule = NATRule.create(
- self.apiclient,
- virtual_machine,
- self.services["natrule"],
- ipaddressid=public_ip_2.ipaddress.id,
- openfirewall=False,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ virtual_machine,
+ self.services["natrule"],
+ ipaddressid=public_ip_2.ipaddress.id,
+ openfirewall=False,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(nat_rule)
self.logger.debug("Adding NetwrokACl rules to make PF and LB accessible")
networkacl_1 = NetworkACL.create(
- self.apiclient,
- networkid=network.id,
- services=self.services["natrule"],
- traffictype='Ingress'
- )
+ self.apiclient,
+ networkid=network.id,
+ services=self.services["natrule"],
+ traffictype='Ingress'
+ )
+ self.cleanup.append(networkacl_1)
networkacl_2 = NetworkACL.create(
- self.apiclient,
- networkid=network.id,
- services=self.services["lbrule"],
- traffictype='Ingress'
- )
+ self.apiclient,
+ networkid=network.id,
+ services=self.services["lbrule"],
+ traffictype='Ingress'
+ )
+ self.cleanup.append(networkacl_2)
self.logger.debug("Checking if we can SSH into VM?")
try:
virtual_machine.get_ssh_client(
ipaddress=public_ip_2.ipaddress.ipaddress,
- )
+ )
self.logger.debug("SSH into VM is successfully")
except Exception as e:
self.fail("Failed to SSH into VM - %s, %s" %
- (public_ip_2.ipaddress.ipaddress, e))
+ (public_ip_2.ipaddress.ipaddress, e))
self.logger.debug("Associating public IP for network: %s" % network.name)
public_ip_3 = PublicIPAddress.create(
- self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(public_ip_3)
self.logger.debug("Associated %s with network %s" % (
- public_ip_3.ipaddress.ipaddress,
- network.id
- ))
+ public_ip_3.ipaddress.ipaddress,
+ network.id
+ ))
self.logger.debug("Enabling static NAT for IP: %s" %
- public_ip_3.ipaddress.ipaddress)
+ public_ip_3.ipaddress.ipaddress)
try:
StaticNATRule.enable(
- self.apiclient,
- ipaddressid=public_ip_3.ipaddress.id,
- virtualmachineid=virtual_machine.id,
- networkid=network.id
- )
+ self.apiclient,
+ ipaddressid=public_ip_3.ipaddress.id,
+ virtualmachineid=virtual_machine.id,
+ networkid=network.id
+ )
self.logger.debug("Static NAT enabled for IP: %s" %
- public_ip_3.ipaddress.ipaddress)
+ public_ip_3.ipaddress.ipaddress)
except Exception as e:
self.fail("Failed to enable static NAT on IP: %s - %s" % (
- public_ip_3.ipaddress.ipaddress, e))
+ public_ip_3.ipaddress.ipaddress, e))
public_ips = PublicIPAddress.list(
- self.apiclient,
- networkid=network.id,
- listall=True,
- isstaticnat=True,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ networkid=network.id,
+ listall=True,
+ isstaticnat=True,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
self.assertEqual(
- isinstance(public_ips, list),
- True,
- "List public Ip for network should list the Ip addr"
- )
+ isinstance(public_ips, list),
+ True,
+ "List public Ip for network should list the Ip addr"
+ )
self.assertEqual(
- public_ips[0].ipaddress,
- public_ip_3.ipaddress.ipaddress,
- "List public Ip for network should list the Ip addr"
- )
+ public_ips[0].ipaddress,
+ public_ip_3.ipaddress.ipaddress,
+ "List public Ip for network should list the Ip addr"
+ )
# TODO: Remote Access VPN is not yet supported in VPC
return
@@ -504,56 +504,55 @@ class TestVPCOffering(cloudstackTestCase):
# 5. Try to create a LB rule for this VM. LB creation should fail
self.logger.debug(
- "Creating a VPC offering with Vpn,dhcpdns,UserData," +
- " SourceNat,Static NAT and PF services"
- )
+ "Creating a VPC offering with Vpn,dhcpdns,UserData," +
+ " SourceNat,Static NAT and PF services"
+ )
self.services["vpc_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL'
self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL'
self.services["network_offering"]["serviceProviderList"] = {
- "Vpn": 'VpcVirtualRouter',
- "Dhcp": 'VpcVirtualRouter',
- "Dns": 'VpcVirtualRouter',
- "SourceNat": 'VpcVirtualRouter',
- "PortForwarding": 'VpcVirtualRouter',
- "UserData": 'VpcVirtualRouter',
- "StaticNat": 'VpcVirtualRouter',
- "NetworkACL": 'VpcVirtualRouter'
- }
+ "Vpn": 'VpcVirtualRouter',
+ "Dhcp": 'VpcVirtualRouter',
+ "Dns": 'VpcVirtualRouter',
+ "SourceNat": 'VpcVirtualRouter',
+ "PortForwarding": 'VpcVirtualRouter',
+ "UserData": 'VpcVirtualRouter',
+ "StaticNat": 'VpcVirtualRouter',
+ "NetworkACL": 'VpcVirtualRouter'
+ }
self.network_offering = NetworkOffering.create(
- self.apiclient,
- self.services["network_offering"],
- conservemode=False
- )
+ self.apiclient,
+ self.services["network_offering"],
+ conservemode=False
+ )
+ self.cleanup.append(self.network_offering)
# Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, self.network_offering)
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
+ self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
self.logger.debug("Enabling the VPC offering created")
vpc_off.update(self.apiclient, state='Enabled')
-
- self.cleanup.insert(0, vpc_off)
self.logger.debug("creating a VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(vpc)
self.validate_vpc_network(vpc)
- self.cleanup.insert(0, vpc)
gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway
@@ -562,58 +561,59 @@ class TestVPCOffering(cloudstackTestCase):
# Creating network using the network offering created
self.logger.debug("Creating network with network offering: %s" %
- self.network_offering.id)
+ self.network_offering.id)
network = Network.create(
- self.apiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkofferingid=self.network_offering.id,
- zoneid=self.zone.id,
- gateway=gateway,
- vpcid=vpc.id
- )
+ self.apiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkofferingid=self.network_offering.id,
+ zoneid=self.zone.id,
+ gateway=gateway,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(network)
self.logger.debug("Created network with ID: %s" % network.id)
- self.cleanup.insert(0, network)
self.logger.debug("Deploying virtual machines in network: %s" % vpc.name)
# Spawn an instance in that network
virtual_machine = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering.id,
- networkids=[str(network.id)]
- )
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[str(network.id)]
+ )
+ self.cleanup.append(virtual_machine)
self.logger.debug("Deployed VM in network: %s" % network.id)
- self.cleanup.insert(0, virtual_machine)
self.logger.debug("Associating public IP for network: %s" % network.name)
public_ip = PublicIPAddress.create(
- self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(public_ip)
self.logger.debug("Associated %s with network %s" % (
- public_ip.ipaddress.ipaddress,
- vpc.id
- ))
+ public_ip.ipaddress.ipaddress,
+ vpc.id
+ ))
self.logger.debug("Trying to LB rule for IP address: %s" %
- public_ip.ipaddress.ipaddress)
+ public_ip.ipaddress.ipaddress)
with self.assertRaises(Exception):
LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
return
@attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -629,53 +629,53 @@ class TestVPCOffering(cloudstackTestCase):
# 5. Try to create NAT rule for this VMStatic NAT creation should fail
self.logger.debug("Creating a VPC offering with Vpn,dhcpdns,UserData," +
- "SourceNat,lb and PF services")
+ "SourceNat,lb and PF services")
self.services["vpc_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,Lb,UserData,PortForwarding,NetworkACL'
self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,Lb,UserData,PortForwarding,NetworkACL'
self.services["network_offering"]["serviceProviderList"] = {
- "Vpn": 'VpcVirtualRouter',
- "Dhcp": 'VpcVirtualRouter',
- "Dns": 'VpcVirtualRouter',
- "SourceNat": 'VpcVirtualRouter',
- "Lb": 'VpcVirtualRouter',
- "UserData": 'VpcVirtualRouter',
- "PortForwarding": 'VpcVirtualRouter',
- "NetworkACL": 'VpcVirtualRouter'
- }
+ "Vpn": 'VpcVirtualRouter',
+ "Dhcp": 'VpcVirtualRouter',
+ "Dns": 'VpcVirtualRouter',
+ "SourceNat": 'VpcVirtualRouter',
+ "Lb": 'VpcVirtualRouter',
+ "UserData": 'VpcVirtualRouter',
+ "PortForwarding": 'VpcVirtualRouter',
+ "NetworkACL": 'VpcVirtualRouter'
+ }
self.network_offering = NetworkOffering.create(
- self.apiclient,
- self.services["network_offering"],
- conservemode=False
- )
+ self.apiclient,
+ self.services["network_offering"],
+ conservemode=False
+ )
+ self.cleanup.append(self.network_offering)
# Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, self.network_offering)
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
+ self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
self.logger.debug("Enabling the VPC offering created")
vpc_off.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, vpc_off)
self.logger.debug("creating a VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(vpc)
self.validate_vpc_network(vpc)
- self.cleanup.insert(0, vpc)
gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway
@@ -684,58 +684,59 @@ class TestVPCOffering(cloudstackTestCase):
# Creating network using the network offering created
self.logger.debug("Creating network with network offering: %s" %
- self.network_offering.id)
+ self.network_offering.id)
network = Network.create(
- self.apiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkofferingid=self.network_offering.id,
- zoneid=self.zone.id,
- gateway=gateway,
- vpcid=vpc.id
- )
+ self.apiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkofferingid=self.network_offering.id,
+ zoneid=self.zone.id,
+ gateway=gateway,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(network)
self.logger.debug("Created network with ID: %s" % network.id)
- self.cleanup.insert(0, network)
self.logger.debug("Deploying virtual machines in network: %s" % vpc.name)
# Spawn an instance in that network
virtual_machine = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering.id,
- networkids=[str(network.id)]
- )
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[str(network.id)]
+ )
+ self.cleanup.append(virtual_machine)
self.logger.debug("Deployed VM in network: %s" % network.id)
- self.cleanup.insert(0, virtual_machine)
self.logger.debug("Associating public IP for network: %s" % network.name)
public_ip = PublicIPAddress.create(
- self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(public_ip)
self.logger.debug("Associated %s with network %s" % (
- public_ip.ipaddress.ipaddress,
- network.id
- ))
+ public_ip.ipaddress.ipaddress,
+ network.id
+ ))
with self.assertRaises(Exception):
static_nat = StaticNATRule.create(
- self.apiclient,
- self.services["fw_rule"],
- ipaddressid=public_ip.ipaddress.id
- )
+ self.apiclient,
+ self.services["fw_rule"],
+ ipaddressid=public_ip.ipaddress.id
+ )
static_nat.enable(
- self.apiclient,
- ipaddressid=public_ip.ipaddress.id,
- virtualmachineid=virtual_machine.id
- )
+ self.apiclient,
+ ipaddressid=public_ip.ipaddress.id,
+ virtualmachineid=virtual_machine.id
+ )
return
@attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -751,55 +752,55 @@ class TestVPCOffering(cloudstackTestCase):
# 5. Try to create a PF rule for this VM. PF creation should fail
self.logger.debug(
- "Creating a VPC offering with Vpn,dhcpdns,UserData," +
- "SourceNat,Static NAT and lb services"
- )
+ "Creating a VPC offering with Vpn,dhcpdns,UserData," +
+ "SourceNat,Static NAT and lb services"
+ )
self.services["vpc_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,Lb,UserData,StaticNat,NetworkACL'
self.services["network_offering"]["supportedservices"] = 'Vpn,Dhcp,Dns,SourceNat,Lb,UserData,StaticNat,NetworkACL'
self.services["network_offering"]["serviceProviderList"] = {
- "Vpn": 'VpcVirtualRouter',
- "Dhcp": 'VpcVirtualRouter',
- "Dns": 'VpcVirtualRouter',
- "SourceNat": 'VpcVirtualRouter',
- "Lb": 'VpcVirtualRouter',
- "UserData": 'VpcVirtualRouter',
- "StaticNat": 'VpcVirtualRouter',
- "NetworkACL": 'VpcVirtualRouter'
- }
+ "Vpn": 'VpcVirtualRouter',
+ "Dhcp": 'VpcVirtualRouter',
+ "Dns": 'VpcVirtualRouter',
+ "SourceNat": 'VpcVirtualRouter',
+ "Lb": 'VpcVirtualRouter',
+ "UserData": 'VpcVirtualRouter',
+ "StaticNat": 'VpcVirtualRouter',
+ "NetworkACL": 'VpcVirtualRouter'
+ }
self.network_offering = NetworkOffering.create(
- self.apiclient,
- self.services["network_offering"],
- conservemode=False
- )
+ self.apiclient,
+ self.services["network_offering"],
+ conservemode=False
+ )
+ self.cleanup.append(self.network_offering)
# Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, self.network_offering)
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
+ self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
self.logger.debug("Enabling the VPC offering created")
vpc_off.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, vpc_off)
self.logger.debug("creating a VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(vpc)
self.validate_vpc_network(vpc)
- self.cleanup.insert(0, vpc)
gateway = vpc.cidr.split('/')[0]
# Split the cidr to retrieve gateway
@@ -808,56 +809,56 @@ class TestVPCOffering(cloudstackTestCase):
# Creating network using the network offering created
self.logger.debug("Creating network with network offering: %s" %
- self.network_offering.id)
+ self.network_offering.id)
network = Network.create(
- self.apiclient,
- self.services["network"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- networkofferingid=self.network_offering.id,
- zoneid=self.zone.id,
- gateway=gateway,
- vpcid=vpc.id
- )
+ self.apiclient,
+ self.services["network"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ networkofferingid=self.network_offering.id,
+ zoneid=self.zone.id,
+ gateway=gateway,
+ vpcid=vpc.id
+ )
+ self.cleanup.append(network)
self.logger.debug("Deploying virtual machines in network: %s" % vpc.name)
- self.cleanup.insert(0, network)
# Spawn an instance in that network
virtual_machine = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering.id,
- networkids=[str(network.id)]
- )
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[str(network.id)]
+ )
+ self.cleanup.append(virtual_machine)
self.logger.debug("Deployed VM in network: %s" % network.id)
- self.cleanup.insert(0, virtual_machine)
self.logger.debug("Associating public IP for network: %s" % network.name)
public_ip = PublicIPAddress.create(
- self.apiclient,
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- networkid=network.id,
- vpcid=vpc.id
- )
+ self.apiclient,
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ networkid=network.id,
+ vpcid=vpc.id
+ )
self.logger.debug("Associated %s with network %s" % (
- public_ip.ipaddress.ipaddress,
- network.id
- ))
+ public_ip.ipaddress.ipaddress,
+ network.id
+ ))
self.logger.debug("Trying to create NAT rule for the IP: %s" %
- public_ip.ipaddress.ipaddress)
+ public_ip.ipaddress.ipaddress)
with self.assertRaises(Exception):
NATRule.create(
- self.apiclient,
- virtual_machine,
- self.services["natrule"],
- ipaddressid=public_ip.ipaddress.id,
- openfirewall=True
- )
+ self.apiclient,
+ virtual_machine,
+ self.services["natrule"],
+ ipaddressid=public_ip.ipaddress.id,
+ openfirewall=True
+ )
return
@attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -873,21 +874,21 @@ class TestVPCOffering(cloudstackTestCase):
with self.assertRaises(Exception):
VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.logger.debug("Creating a VPC offering with only sourceNAT service")
self.services["vpc_offering"]["supportedservices"] = 'SourceNat'
try:
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
+ self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
# Appending to cleanup to delete after test
- self.cleanup.append(vpc_off)
except Exception as e:
self.fail("Failed to create the VPC offering - %s" % e)
return
@@ -907,9 +908,9 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Creating a VPC offering..")
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.cleanup.append(vpc_off)
self.validate_vpc_offering(vpc_off)
@@ -918,30 +919,31 @@ class TestVPCOffering(cloudstackTestCase):
vpc_off.update(self.apiclient, state='Disabled')
self.logger.debug("creating a VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
with self.assertRaises(Exception):
VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
self.logger.debug("VPC network creation failed! (Test succeeded)")
self.logger.debug("Enabling the VPC offering created")
vpc_off.update(self.apiclient, state='Enabled')
self.logger.debug("creating a VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
vpc = VPC.create(
- self.apiclient,
- self.services["vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(vpc)
self.validate_vpc_network(vpc)
self.logger.debug("Updating name & display text of the vpc offering created")
@@ -950,35 +952,35 @@ class TestVPCOffering(cloudstackTestCase):
try:
vpc_off.update(
- self.apiclient,
- name=new_name,
- displaytext=new_displaytext
- )
+ self.apiclient,
+ name=new_name,
+ displaytext=new_displaytext
+ )
except Exception as e:
self.fail("Failed to update VPC offering- %s" % e)
self.logger.debug("Cheking if the changes are reflected to listVPC call?")
vpc_offs = vpc_off.list(
- self.apiclient,
- id=vpc_off.id,
- listall=True
- )
+ self.apiclient,
+ id=vpc_off.id,
+ listall=True
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings shall return a valid list"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings shall return a valid list"
+ )
list_reposnse_vpc = vpc_offs[0]
self.assertEqual(
- list_reposnse_vpc.name,
- new_name,
- "VPC off Name should be updated with new one"
- )
+ list_reposnse_vpc.name,
+ new_name,
+ "VPC off Name should be updated with new one"
+ )
self.assertEqual(
- list_reposnse_vpc.displaytext,
- new_displaytext,
- "VPC off display text should be updated with new one"
- )
+ list_reposnse_vpc.displaytext,
+ new_displaytext,
+ "VPC off display text should be updated with new one"
+ )
return
@attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -1004,18 +1006,18 @@ class TestVPCOffering(cloudstackTestCase):
self.services["vpc_offering"]["supportedservices"] = 'SourceNat'
vpc_off_1 = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.cleanup.append(vpc_off_1)
self.validate_vpc_offering(vpc_off_1)
self.logger.debug("Disabling the VPC offering created")
vpc_off_1.update(self.apiclient, state='Disabled')
vpc_off_2 = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.cleanup.append(vpc_off_2)
self.validate_vpc_offering(vpc_off_2)
@@ -1023,9 +1025,9 @@ class TestVPCOffering(cloudstackTestCase):
vpc_off_2.update(self.apiclient, state='Enabled')
vpc_off_3 = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.cleanup.append(vpc_off_3)
self.validate_vpc_offering(vpc_off_3)
@@ -1033,9 +1035,9 @@ class TestVPCOffering(cloudstackTestCase):
vpc_off_3.update(self.apiclient, state='Enabled')
vpc_off_4 = VpcOffering.create(
- self.apiclient,
- self.services["vpc_offering"]
- )
+ self.apiclient,
+ self.services["vpc_offering"]
+ )
self.logger.debug("Enabling the VPC offering created")
vpc_off_4.update(self.apiclient, state='Enabled')
@@ -1044,110 +1046,110 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Cheking if listVPCOff return the deleted VPC off")
vpc_offs = VpcOffering.list(
- self.apiclient,
- id=vpc_off_4.id,
- listall=True
- )
+ self.apiclient,
+ id=vpc_off_4.id,
+ listall=True
+ )
self.assertEqual(
- vpc_offs,
- None,
- "List VPC offerings should nt return any response for deleted offering"
- )
+ vpc_offs,
+ None,
+ "List VPC offerings should nt return any response for deleted offering"
+ )
self.logger.debug("Validating the listVPCOfferings repsonse by ids")
self.validate_vpc_offering(vpc_off_3)
self.logger.debug("ListVPCOfferings by displaytext & verifying the response")
vpc_offs = VpcOffering.list(
- self.apiclient,
- displaytext=vpc_off_3.displaytext,
- listall=True
- )
+ self.apiclient,
+ displaytext=vpc_off_3.displaytext,
+ listall=True
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings shall return a valid response"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings shall return a valid response"
+ )
list_vpc_off_response = vpc_offs[0]
self.assertIn(
- vpc_off_3.id,
- [vpc.id for vpc in vpc_offs],
- "ListVPC Off with displaytext should return same VPC off"
- )
+ vpc_off_3.id,
+ [vpc.id for vpc in vpc_offs],
+ "ListVPC Off with displaytext should return same VPC off"
+ )
self.logger.debug("ListVPCOfferings by name and verifying the response")
vpc_offs = VpcOffering.list(
- self.apiclient,
- name=vpc_off_2.name,
- listall=True
- )
+ self.apiclient,
+ name=vpc_off_2.name,
+ listall=True
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings shall return a valid response"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings shall return a valid response"
+ )
list_vpc_off_response = vpc_offs[0]
self.assertEqual(
- list_vpc_off_response.id,
- vpc_off_2.id,
- "ListVPC Off with name should return same VPC off"
- )
+ list_vpc_off_response.id,
+ vpc_off_2.id,
+ "ListVPC Off with name should return same VPC off"
+ )
self.logger.debug(
"ListVPCOfferings by supported services & verifying the response")
vpc_offs = VpcOffering.list(
- self.apiclient,
- supportedservices='SourceNat',
- listall=True
- )
+ self.apiclient,
+ supportedservices='SourceNat',
+ listall=True
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings shall return a valid response"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings shall return a valid response"
+ )
for vpc_off in vpc_offs:
self.logger.debug(vpc_off)
self.assertEqual(
- 'SourceNat' in str(vpc_off),
- True,
- "ListVPC Off with name should return same VPC off"
- )
+ 'SourceNat' in str(vpc_off),
+ True,
+ "ListVPC Off with name should return same VPC off"
+ )
self.logger.debug("ListVPCOfferings by state & verifying the response")
vpc_offs = VpcOffering.list(
- self.apiclient,
- state='Enabled',
- listall=True
- )
+ self.apiclient,
+ state='Enabled',
+ listall=True
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings shall return a valid response"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings shall return a valid response"
+ )
for vpc_off in vpc_offs:
self.assertEqual(
- vpc_off.state,
- 'Enabled',
- "List VPC offering should return only offerings that are enabled"
- )
+ vpc_off.state,
+ 'Enabled',
+ "List VPC offering should return only offerings that are enabled"
+ )
self.logger.debug("ListVPCOfferings by state & verifying the response")
vpc_offs = VpcOffering.list(
- self.apiclient,
- state='Disabled',
- listall=True
- )
+ self.apiclient,
+ state='Disabled',
+ listall=True
+ )
self.assertEqual(
- isinstance(vpc_offs, list),
- True,
- "List VPC offerings shall return a valid response"
- )
+ isinstance(vpc_offs, list),
+ True,
+ "List VPC offerings shall return a valid response"
+ )
for vpc_off in vpc_offs:
self.assertEqual(
- vpc_off.state,
- 'Disabled',
- "List VPC offering should return only offerings that are disabled"
- )
+ vpc_off.state,
+ 'Disabled',
+ "List VPC offering should return only offerings that are disabled"
+ )
return
@attr(tags=["advanced", "redundancy"], required_hardware="false")
@@ -1155,9 +1157,9 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Creating Redundant VPC offering")
vpc_off = VpcOffering.create(
- self.apiclient,
- self.services["redundant_vpc_offering"]
- )
+ self.apiclient,
+ self.services["redundant_vpc_offering"]
+ )
self.cleanup.append(vpc_off)
self.logger.debug("Check if the Redundant VPC offering is created successfully?")
@@ -1166,17 +1168,17 @@ class TestVPCOffering(cloudstackTestCase):
self.logger.debug("Enabling the created Redundant VPC offering")
vpc_off.update(self.apiclient, state='Enabled')
-
self.logger.debug("Creating a Redundant VPC network in the account: %s" %
- self.account.name)
+ self.account.name)
vpc = VPC.create(
- self.apiclient,
- self.services["redundant_vpc"],
- vpcofferingid=vpc_off.id,
- zoneid=self.zone.id,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ self.apiclient,
+ self.services["redundant_vpc"],
+ vpcofferingid=vpc_off.id,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+ self.cleanup.append(vpc)
self.logger.debug("Validating Redundant VPC Nw creation")
self.validate_vpc_network(vpc)
@@ -1195,9 +1197,9 @@ class TestVPCOffering(cloudstackTestCase):
break
self.assertEqual(
- redundant,
- True,
- "Didn't create any Redundant Vpc"
- )
+ redundant,
+ True,
+ "Didn't create any Redundant Vpc"
+ )
return
diff --git a/test/integration/component/test_vpc_routers.py b/test/integration/component/test_vpc_routers.py
index fe9dc5d5520..c7351a5cd8c 100644
--- a/test/integration/component/test_vpc_routers.py
+++ b/test/integration/component/test_vpc_routers.py
@@ -17,39 +17,42 @@
""" Component tests for VPC - Router Operations
"""
-# Import Local Modules
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.cloudstackAPI import (startRouter,
- stopRouter,
- rebootRouter,
- migrateSystemVm)
-from marvin.lib.utils import cleanup_resources
-from marvin.lib.base import (Account,
- Router,
- ServiceOffering,
- VirtualMachine,
- Host,
- PublicIPAddress,
- VPC,
- VpcOffering,
- StaticRoute,
- Network,
- NetworkOffering,
- PrivateGateway,
- NATRule,
- NetworkACL,
- StaticNATRule,
- LoadBalancerRule)
-from marvin.lib.common import (get_domain,
- get_zone,
- list_routers,
- get_template)
import time
+from nose.plugins.attrib import attr
+
+# Import Local Modules
+from marvin.cloudstackAPI import (
+ startRouter,
+ stopRouter,
+ rebootRouter,
+ migrateSystemVm)
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (
+ Account,
+ Router,
+ ServiceOffering,
+ VirtualMachine,
+ Host,
+ PublicIPAddress,
+ VPC,
+ VpcOffering,
+ StaticRoute,
+ Network,
+ NetworkOffering,
+ PrivateGateway,
+ NATRule,
+ NetworkACL,
+ StaticNATRule,
+ LoadBalancerRule)
+from marvin.lib.common import (
+ get_domain,
+ get_zone,
+ list_routers,
+ get_template)
+from marvin.lib.utils import cleanup_resources
class Services:
-
"""Test VPC Router services
"""
@@ -215,10 +218,12 @@ class TestVPCRoutersBasic(cloudstackTestCase):
cls.api_client,
cls.services["service_offering"]
)
+ cls._cleanup.append(cls.service_offering)
cls.vpc_off = VpcOffering.create(
cls.api_client,
cls.services["vpc_offering"]
)
+ cls._cleanup.append(cls.vpc_off)
cls.vpc_off.update(cls.api_client, state='Enabled')
cls.account = Account.create(
cls.api_client,
@@ -226,13 +231,9 @@ class TestVPCRoutersBasic(cloudstackTestCase):
admin=True,
domainid=cls.domain.id
)
- cls._cleanup = [cls.account]
- cls._cleanup.append(cls.vpc_off)
- #cls.debug("Enabling the VPC offering created")
+ cls._cleanup.append(cls.account)
cls.vpc_off.update(cls.api_client, state='Enabled')
- # cls.debug("creating a VPC network in the account: %s" %
- # cls.account.name)
cls.services["vpc"]["cidr"] = '10.1.1.1/16'
cls.vpc = VPC.create(
cls.api_client,
@@ -242,18 +243,12 @@ class TestVPCRoutersBasic(cloudstackTestCase):
account=cls.account.name,
domainid=cls.account.domainid
)
-
- cls._cleanup.append(cls.service_offering)
+ cls._cleanup.append(cls.vpc)
return
@classmethod
def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPCRoutersBasic, cls).tearDownClass()
def setUp(self):
self.api_client = self.testClient.getApiClient()
@@ -262,6 +257,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
return
def tearDown(self):
+ super(TestVPCRoutersBasic, self).tearDown()
return
def validate_vpc_offering(self, vpc_offering):
@@ -368,8 +364,8 @@ class TestVPCRoutersBasic(cloudstackTestCase):
router.hostid = router_response[0].hostid
self.assertEqual(
router.hostid, host.id, "Migration to host %s failed. The router host is"
- " still %s" %
- (host.id, router.hostid))
+ " still %s" %
+ (host.id, router.hostid))
return
@attr(tags=["advanced", "intervlan"], required_hardware="false")
@@ -630,7 +626,6 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls._cleanup = []
cls.testClient = super(TestVPCRouterOneNetwork, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
cls.hypervisor = cls.testClient.getHypervisorInfo()
@@ -638,7 +633,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls._cleanup = []
if cls.hypervisor.lower() == 'hyperv':
cls.vpcSupported = False
- return
+ return
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
@@ -669,7 +664,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
admin=True,
domainid=cls.domain.id
)
- cls._cleanup.insert(0, cls.account)
+ cls._cleanup.append(cls.account)
cls.services["vpc"]["cidr"] = '10.1.1.1/16'
cls.vpc = VPC.create(
@@ -680,6 +675,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
account=cls.account.name,
domainid=cls.account.domainid
)
+ cls._cleanup.append(cls.vpc)
private_gateway = PrivateGateway.create(
cls.api_client,
@@ -689,6 +685,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
vlan=678,
vpcid=cls.vpc.id
)
+ cls._cleanup.append(private_gateway)
cls.gateways = PrivateGateway.list(
cls.api_client,
id=private_gateway.id,
@@ -705,6 +702,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
id=static_route.id,
listall=True
)
+ cls._cleanup.append(static_route)
cls.nw_off = NetworkOffering.create(
cls.api_client,
@@ -726,6 +724,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
gateway='10.1.1.1',
vpcid=cls.vpc.id
)
+ cls._cleanup.append(cls.network_1)
# Spawn an instance in that network
vm_1 = VirtualMachine.create(
@@ -736,6 +735,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
+ cls._cleanup.append(vm_1)
vm_2 = VirtualMachine.create(
cls.api_client,
cls.services["virtual_machine"],
@@ -744,6 +744,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
+ cls._cleanup.append(vm_2)
# Spawn an instance in that network
vm_3 = VirtualMachine.create(
@@ -754,6 +755,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
+ cls._cleanup.append(vm_3)
VirtualMachine.list(
cls.api_client,
@@ -770,6 +772,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
+ cls._cleanup.append(public_ip_1)
NATRule.create(
cls.api_client,
@@ -796,6 +799,8 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
+ cls._cleanup.append(public_ip_2)
+
try:
StaticNATRule.enable(
cls.api_client,
@@ -823,6 +828,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
+ cls._cleanup.append(public_ip_3)
lb_rule = LoadBalancerRule.create(
cls.api_client,
@@ -852,12 +858,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPCRouterOneNetwork, cls).tearDownClass()
def setUp(self):
self.api_client = self.testClient.getApiClient()
@@ -867,12 +868,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
return
def tearDown(self):
- try:
- # Clean up, terminate the created network offerings
- cleanup_resources(self.api_client, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
-
+ super(TestVPCRouterOneNetwork, self).tearDown()
return
def validate_vpc_offering(self, vpc_offering):
@@ -1020,8 +1016,8 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
router.hostid = router_response[0].hostid
self.assertEqual(
router.hostid, host.id, "Migration to host %s failed. The router host is"
- "still %s" %
- (host.id, router.hostid))
+ "still %s" %
+ (host.id, router.hostid))
return
@attr(tags=["advanced", "intervlan", "provisioining"])
@@ -1188,7 +1184,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
return
- @attr(tags=["advanced", "intervlan"], required_hardware="true")
+ @attr(tags=["advanced", "intervlan", "bla"], required_hardware="true")
def test_03_migrate_router_after_addition_of_one_guest_network(self):
""" Test migrate of router after addition of one guest network
"""
@@ -1316,7 +1312,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
)
return
- @attr(tags=["advanced", "intervlan"], required_hardware="false")
+ @attr(tags=["advanced", "intervlan", "bla"], required_hardware="false")
def test_05_destroy_router_after_addition_of_one_guest_network(self):
""" Test destroy of router after addition of one guest network
"""
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index ae8ee2b5fbd..bdc1c9f8f7a 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import cleanup_resources, validateList
from marvin.lib.base import (VirtualMachine,
NATRule,
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index f8aa556fea2..66d3e0c5837 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -19,7 +19,8 @@
"""
#Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (VirtualMachine,
NetworkOffering,
VpcOffering,
@@ -343,7 +344,7 @@ class TestVMDeployVPC(cloudstackTestCase):
id=vm.id,
)
status = validateList(vm_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"vm list api returned invalid response after vm {} deployment".format(vm)
diff --git a/test/integration/component/test_vpn_users.py b/test/integration/component/test_vpn_users.py
index 97849045018..980e21bba27 100644
--- a/test/integration/component/test_vpn_users.py
+++ b/test/integration/component/test_vpn_users.py
@@ -17,27 +17,27 @@
""" P1 tests for VPN users
"""
-# Import Local Modules
from nose.plugins.attrib import attr
+
+# Import Local Modules
from marvin.cloudstackException import CloudstackAPIException
from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.lib.base import (
- Account,
- ServiceOffering,
- VirtualMachine,
- PublicIPAddress,
- Vpn,
- VpnUser,
- Configurations,
- NATRule,
- FireWallRule
- )
-from marvin.lib.common import (get_domain,
- get_zone,
- get_template
- )
-from marvin.lib.utils import cleanup_resources, validateList
from marvin.codes import PASS
+from marvin.lib.base import (
+ Account,
+ ServiceOffering,
+ VirtualMachine,
+ PublicIPAddress,
+ Vpn,
+ VpnUser,
+ Configurations,
+ NATRule
+)
+from marvin.lib.common import (get_domain,
+ get_zone,
+ get_template
+ )
+from marvin.lib.utils import validateList
class Services:
@@ -46,51 +46,51 @@ class Services:
def __init__(self):
self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- },
- "disk_offering": {
- "displaytext": "Small Disk Offering",
- "name": "Small Disk Offering",
- "disksize": 1
- },
- "virtual_machine": {
- "displayname": "TestVM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'KVM',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "vpn_user": {
- "username": "test",
- "password": "p@as=s.w_o-r+d",
- },
- "natrule": {
- "privateport": 1701,
- "publicport": 1701,
- "protocol": "UDP"
- },
- "ostype": 'CentOS 5.5 (64-bit)',
- "sleep": 60,
- "timeout": 10,
- # Networking mode: Advanced, Basic
- }
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100, # in MHz
+ "memory": 128, # In MBs
+ },
+ "disk_offering": {
+ "displaytext": "Small Disk Offering",
+ "name": "Small Disk Offering",
+ "disksize": 1
+ },
+ "virtual_machine": {
+ "displayname": "TestVM",
+ "username": "root",
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'KVM',
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
+ "vpn_user": {
+ "username": "test",
+ "password": "p@as=s.w_o-r+d",
+ },
+ "natrule": {
+ "privateport": 1701,
+ "publicport": 1701,
+ "protocol": "UDP"
+ },
+ "ostype": 'CentOS 5.5 (64-bit)',
+ "sleep": 60,
+ "timeout": 10,
+ # Networking mode: Advanced, Basic
+ }
class TestVPNUsers(cloudstackTestCase):
@@ -103,6 +103,7 @@ class TestVPNUsers(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+ cls._cleanup = []
cls.services["mode"] = cls.zone.networktype
@@ -117,58 +118,49 @@ class TestVPNUsers(cloudstackTestCase):
cls.api_client,
cls.services["service_offering"]
)
-
- cls._cleanup = [cls.service_offering, ]
+ cls._cleanup.append(cls.service_offering)
return
@classmethod
def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPNUsers, cls).tearDownClass()
def setUp(self):
+ self.cleanup = []
try:
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
- self.apiclient,
- self.services["account"],
- domainid=self.domain.id
- )
- self.cleanup = [
- self.account,
- ]
+ self.apiclient,
+ self.services["account"],
+ domainid=self.domain.id
+ )
+ self.cleanup.append(self.account)
+
self.virtual_machine = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- templateid=self.template.id,
- accountid=self.account.name,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering.id
- )
+ self.apiclient,
+ self.services["virtual_machine"],
+ templateid=self.template.id,
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id
+ )
+ self.cleanup.append(self.virtual_machine)
self.public_ip = PublicIPAddress.create(
- self.apiclient,
- accountid=self.virtual_machine.account,
- zoneid=self.virtual_machine.zoneid,
- domainid=self.virtual_machine.domainid,
- services=self.services["virtual_machine"]
- )
+ self.apiclient,
+ accountid=self.virtual_machine.account,
+ zoneid=self.virtual_machine.zoneid,
+ domainid=self.virtual_machine.domainid,
+ services=self.services["virtual_machine"]
+ )
+ self.cleanup.append(self.public_ip)
return
except CloudstackAPIException as e:
- self.tearDown()
- raise e
+ self.tearDown()
+ raise e
def tearDown(self):
- try:
- # Clean up, terminate the created instance, volumes and snapshots
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVPNUsers, self).tearDown()
def create_VPN(self, public_ip):
"""Creates VPN for the network"""
@@ -177,19 +169,20 @@ class TestVPNUsers(cloudstackTestCase):
try:
# Assign VPN to Public IP
vpn = Vpn.create(self.apiclient,
- self.public_ip.ipaddress.id,
- account=self.account.name,
- domainid=self.account.domainid)
+ self.public_ip.ipaddress.id,
+ account=self.account.name,
+ domainid=self.account.domainid)
+ self.cleanup.append(vpn)
self.debug("Verifying the remote VPN access")
vpns = Vpn.list(self.apiclient,
- publicipid=public_ip.ipaddress.id,
- listall=True)
+ publicipid=public_ip.ipaddress.id,
+ listall=True)
self.assertEqual(
- isinstance(vpns, list),
- True,
- "List VPNs shall return a valid response"
- )
+ isinstance(vpns, list),
+ True,
+ "List VPNs shall return a valid response"
+ )
return vpn
except Exception as e:
self.fail("Failed to create remote VPN access: %s" % e)
@@ -198,28 +191,29 @@ class TestVPNUsers(cloudstackTestCase):
"""Creates VPN users for the network"""
self.debug("Creating VPN users for account: %s" %
- self.account.name)
+ self.account.name)
if api_client is None:
api_client = self.apiclient
try:
vpnuser = VpnUser.create(
- api_client,
- self.services["vpn_user"]["username"],
- self.services["vpn_user"]["password"],
- account=self.account.name,
- domainid=self.account.domainid,
- rand_name=rand_name
- )
+ api_client,
+ self.services["vpn_user"]["username"],
+ self.services["vpn_user"]["password"],
+ account=self.account.name,
+ domainid=self.account.domainid,
+ rand_name=rand_name
+ )
+ self.cleanup.append(vpnuser)
self.debug("Verifying the remote VPN access")
vpn_users = VpnUser.list(self.apiclient,
id=vpnuser.id,
listall=True)
self.assertEqual(
- isinstance(vpn_users, list),
- True,
- "List VPNs shall return a valid response"
- )
+ isinstance(vpn_users, list),
+ True,
+ "List VPNs shall return a valid response"
+ )
return vpnuser
except Exception as e:
self.fail("Failed to create remote VPN users: %s" % e)
@@ -238,9 +232,9 @@ class TestVPNUsers(cloudstackTestCase):
self.debug("Fetching the limit for remote access VPN users")
configs = Configurations.list(
- self.apiclient,
- name='remote.access.vpn.user.limit',
- listall=True)
+ self.apiclient,
+ name='remote.access.vpn.user.limit',
+ listall=True)
self.assertEqual(isinstance(configs, list),
True,
"List configs should return a valid response")
@@ -248,7 +242,7 @@ class TestVPNUsers(cloudstackTestCase):
limit = int(configs[0].value)
self.debug("Enabling the VPN access for IP: %s" %
- self.public_ip.ipaddress)
+ self.public_ip.ipaddress)
self.create_VPN(self.public_ip)
self.debug("Creating %s VPN users" % limit)
@@ -273,11 +267,11 @@ class TestVPNUsers(cloudstackTestCase):
self.debug("Creating a port forwarding rule on port 1701")
# Create NAT rule
nat_rule = NATRule.create(
- self.apiclient,
- self.virtual_machine,
- self.services["natrule"],
- self.public_ip.ipaddress.id)
-
+ self.apiclient,
+ self.virtual_machine,
+ self.services["natrule"],
+ self.public_ip.ipaddress.id)
+ self.cleanup.append(nat_rule)
self.debug("Verifying the NAT rule created")
nat_rules = NATRule.list(self.apiclient, id=nat_rule.id, listall=True)
@@ -286,7 +280,7 @@ class TestVPNUsers(cloudstackTestCase):
"List NAT rules should return a valid response")
self.debug("Enabling the VPN connection for IP: %s" %
- self.public_ip.ipaddress)
+ self.public_ip.ipaddress)
with self.assertRaises(Exception):
self.create_VPN(self.public_ip)
self.debug("Create VPN connection failed! Test successful!")
@@ -303,17 +297,17 @@ class TestVPNUsers(cloudstackTestCase):
# saying that VPN is enabled over port 1701
self.debug("Enabling the VPN connection for IP: %s" %
- self.public_ip.ipaddress)
+ self.public_ip.ipaddress)
self.create_VPN(self.public_ip)
self.debug("Creating a port forwarding rule on port 1701")
# Create NAT rule
with self.assertRaises(Exception):
NATRule.create(
- self.apiclient,
- self.virtual_machine,
- self.services["natrule"],
- self.public_ip.ipaddress.id)
+ self.apiclient,
+ self.virtual_machine,
+ self.services["natrule"],
+ self.public_ip.ipaddress.id)
self.debug("Create NAT rule failed! Test successful!")
return
@@ -329,12 +323,12 @@ class TestVPNUsers(cloudstackTestCase):
# the newly added user credential.
self.debug("Enabling the VPN connection for IP: %s" %
- self.public_ip.ipaddress)
+ self.public_ip.ipaddress)
self.create_VPN(self.public_ip)
try:
self.debug("Adding new VPN user to account: %s" %
- self.account.name)
+ self.account.name)
self.create_VPN_Users()
# TODO: Verify the VPN connection
@@ -356,11 +350,11 @@ class TestVPNUsers(cloudstackTestCase):
# 3. Adding this VPN user should fail.
self.debug("Enabling the VPN connection for IP: %s" %
- self.public_ip.ipaddress)
+ self.public_ip.ipaddress)
self.create_VPN(self.public_ip)
self.debug("Adding new VPN user to account: %s" %
- self.account.name)
+ self.account.name)
self.create_VPN_Users(rand_name=False)
# TODO: Verify the VPN connection
@@ -386,10 +380,10 @@ class TestVPNUsers(cloudstackTestCase):
# establish VPN connection that will give access all VMs of this user
self.debug("Enabling VPN connection to account: %s" %
- self.account.name)
+ self.account.name)
self.create_VPN(self.public_ip)
self.debug("Creating VPN user for the account: %s" %
- self.account.name)
+ self.account.name)
self.create_VPN_Users()
self.debug("Creating a global admin account")
@@ -400,16 +394,16 @@ class TestVPNUsers(cloudstackTestCase):
self.cleanup.append(admin)
self.debug("Creating API client for newly created user")
api_client = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain)
+ UserName=self.account.name,
+ DomainName=self.account.domain)
self.debug("Adding new user to VPN as a global admin: %s" %
- admin.name)
+ admin.name)
try:
self.create_VPN_Users(api_client=api_client)
except Exception as e:
self.fail("Global admin should be allowed to create VPN user: %s" %
- e)
+ e)
return
@attr(tags=["advanced", "advancedns"], required_hardware="false")
@@ -429,10 +423,10 @@ class TestVPNUsers(cloudstackTestCase):
# establish VPN connection that will give access all VMs of this user
self.debug("Enabling VPN connection to account: %s" %
- self.account.name)
+ self.account.name)
self.create_VPN(self.public_ip)
self.debug("Creating VPN user for the account: %s" %
- self.account.name)
+ self.account.name)
self.create_VPN_Users()
self.debug("Creating a domain admin account")
@@ -442,16 +436,16 @@ class TestVPNUsers(cloudstackTestCase):
self.cleanup.append(admin)
self.debug("Creating API client for newly created user")
api_client = self.testClient.getUserApiClient(
- UserName=self.account.name,
- DomainName=self.account.domain)
+ UserName=self.account.name,
+ DomainName=self.account.domain)
self.debug("Adding new user to VPN as a domain admin: %s" %
- admin.name)
+ admin.name)
try:
self.create_VPN_Users(api_client=api_client)
except Exception as e:
self.fail("Domain admin should be allowed to create VPN user: %s" %
- e)
+ e)
return
@attr(tags=["advanced", "advancedns"], required_hardware="false")
@@ -500,11 +494,12 @@ class TestVPNUsers(cloudstackTestCase):
vpn,
"Failed to create remote access vpn"
)
+ self.cleanup.append(vpn)
except Exception as e:
self.fail("Failed to enable vpn on SourceNAT IP with error: %s" % e)
- #Create PF rule with TCP ports 500,4500 and 1701
- self.services['natrule']['protocol']="TCP"
+ # Create PF rule with TCP ports 500,4500 and 1701
+ self.services['natrule']['protocol'] = "TCP"
for port in [500, 4500, 1701]:
self.services['natrule']['privateport'] = port
self.services['natrule']['publicport'] = port
@@ -519,6 +514,7 @@ class TestVPNUsers(cloudstackTestCase):
nat,
"Failed to add PF rule with tcp parts matching vpn"
)
+ self.cleanup.append(nat)
except Exception as e:
self.fail("Creating PF rule for TCP port %s in VPN failed : %s" % (port, e))
return
diff --git a/test/integration/plugins/datera/TestVolumes.py b/test/integration/plugins/datera/TestVolumes.py
index 2dc9ebeb836..15c326ba4e6 100644
--- a/test/integration/plugins/datera/TestVolumes.py
+++ b/test/integration/plugins/datera/TestVolumes.py
@@ -278,7 +278,7 @@ class TestData():
def _update(self, d, u):
- for k, v in u.iteritems():
+ for k, v in u.items():
if isinstance(v, collections.Mapping):
r = self.update(d.get(k, {}), v)
d[k] = r
@@ -497,7 +497,7 @@ class TestVolumes(cloudstackTestCase):
@classmethod
def _purge_datera_volumes(cls):
logger.warn("Deleting all volumes")
- for ai in cls.dt_client.app_instances.get().values():
+ for ai in list(cls.dt_client.app_instances.get().values()):
logger.warn(ai)
if 'CS-T' in ai['name']:
ai.set(admin_state="offline")
@@ -989,7 +989,7 @@ class TestVolumes(cloudstackTestCase):
dt_volume = None
dt_volumes = self._get_dt_volumes()
- for volume in dt_volumes.values():
+ for volume in list(dt_volumes.values()):
if volume['name'] == dt_volume_name:
dt_volume = volume
break
diff --git a/test/integration/plugins/ldap/ldap_test_data.py b/test/integration/plugins/ldap/ldap_test_data.py
index bfb89d58ae1..15dec9e2419 100644
--- a/test/integration/plugins/ldap/ldap_test_data.py
+++ b/test/integration/plugins/ldap/ldap_test_data.py
@@ -186,4 +186,4 @@ class LdapTestData:
LdapTestData.group : LdapTestData.seniors
}
],
- }
\ No newline at end of file
+ }
diff --git a/test/integration/plugins/ldap/test_ldap.py b/test/integration/plugins/ldap/test_ldap.py
index b017957b936..a8402014e7e 100644
--- a/test/integration/plugins/ldap/test_ldap.py
+++ b/test/integration/plugins/ldap/test_ldap.py
@@ -466,7 +466,7 @@ class TestLDAP(cloudstackTestCase):
cmd.value = cls.testdata.testdata[LdapTestData.configuration][LdapTestData.principal]
response = cls.apiclient.updateConfiguration(cmd)
cls.logger.debug("set the id: %s" % response)
- if cls.testdata.testdata[LdapTestData.configuration].has_key(LdapTestData.groupPrinciple) :
+ if LdapTestData.groupPrinciple in cls.testdata.testdata[LdapTestData.configuration] :
cmd.name = LdapTestData.groupPrinciple
cmd.value = cls.testdata.testdata[LdapTestData.configuration][LdapTestData.groupPrinciple]
response = cls.apiclient.updateConfiguration(cmd)
diff --git a/test/integration/plugins/solidfire/TestAddRemoveHosts.py b/test/integration/plugins/solidfire/TestAddRemoveHosts.py
index 1dd29bbcf1c..858d8e128ea 100644
--- a/test/integration/plugins/solidfire/TestAddRemoveHosts.py
+++ b/test/integration/plugins/solidfire/TestAddRemoveHosts.py
@@ -583,7 +583,7 @@ class TestAddRemoveHosts(cloudstackTestCase):
self.assertTrue(host_iqn, "'host_iqn' should not be 'None'.")
self.assertTrue(vags, "'vags' should not be 'None'.")
- self.assertTrue(isinstance(host_iqn, basestring), "'host_iqn' should be a 'string'.")
+ self.assertTrue(isinstance(host_iqn, str), "'host_iqn' should be a 'string'.")
self.assertTrue(isinstance(vags, list), "'vags' should be a 'list'.")
for vag in vags:
@@ -848,7 +848,7 @@ class TestAddRemoveHosts(cloudstackTestCase):
if volume.type.upper() == "ROOT":
return volume
- self.assert_(False, "Unable to locate the ROOT volume of the VM with the following ID: " + str(vm.id))
+ self.assertTrue(False, "Unable to locate the ROOT volume of the VM with the following ID: " + str(vm.id))
def _get_iqn_2(self, primary_storage):
sql_query = "Select path From storage_pool Where uuid = '" + str(primary_storage.id) + "'"
diff --git a/test/integration/plugins/solidfire/TestManagedSystemVMs.py b/test/integration/plugins/solidfire/TestManagedSystemVMs.py
index 5e9884d406a..c3807e07a53 100644
--- a/test/integration/plugins/solidfire/TestManagedSystemVMs.py
+++ b/test/integration/plugins/solidfire/TestManagedSystemVMs.py
@@ -398,7 +398,7 @@ class TestManagedSystemVMs(cloudstackTestCase):
except:
return
- self.assert_(False, "The service offering was created, but should not have been.")
+ self.assertTrue(False, "The service offering was created, but should not have been.")
def _prepare_to_use_managed_storage_for_system_vms(self):
self._update_system_vm_unique_name(TestManagedSystemVMs._secondary_storage_unique_name, TestManagedSystemVMs._secondary_storage_temp_unique_name)
diff --git a/test/integration/plugins/solidfire/TestUploadDownload.py b/test/integration/plugins/solidfire/TestUploadDownload.py
index a15f27b98bf..1c650060e22 100644
--- a/test/integration/plugins/solidfire/TestUploadDownload.py
+++ b/test/integration/plugins/solidfire/TestUploadDownload.py
@@ -18,7 +18,7 @@
import logging
import random
import SignedAPICall
-import urllib2
+import urllib.request, urllib.error, urllib.parse
from solidfire.factory import ElementFactory
@@ -465,7 +465,7 @@ class TestUploadDownload(cloudstackTestCase):
self._verify_uploaded_volume_present(install_path, False)
- url_response = urllib2.urlopen(extract_result.url)
+ url_response = urllib.request.urlopen(extract_result.url)
if url_response.code != 200:
raise Exception(error_msg)
@@ -486,7 +486,7 @@ class TestUploadDownload(cloudstackTestCase):
if len(result) == 0:
try:
- urllib2.urlopen(extract_result_url)
+ urllib.request.urlopen(extract_result_url)
except Exception as e:
if "404" in str(e):
return True, ""
diff --git a/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py b/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py
index 7da6c9d542b..3933c184b06 100644
--- a/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py
+++ b/test/integration/plugins/solidfire/TestVMMigrationWithStorage.py
@@ -660,20 +660,20 @@ class TestVMMigrationWithStorage(cloudstackTestCase):
self.assertEqual(src_sf_volume.account_id, dest_sf_volume.account_id, "The source and destination volumes should be in the same SolidFire account.")
def _verifySfVolumeIds(self, src_sf_volume, dest_sf_volume):
- self.assert_(src_sf_volume.volume_id < dest_sf_volume.volume_id,
+ self.assertTrue(src_sf_volume.volume_id < dest_sf_volume.volume_id,
"The destination SolidFire root volume's ID should be greater than the id of the source one.")
# verify the name, folder, and iscsi_name
def _verifyFields(self, cs_volume, sf_volume):
- self.assert_(cs_volume.name == sf_volume.name, "The CloudStack volume name does not match the SolidFire volume name.")
+ self.assertTrue(cs_volume.name == sf_volume.name, "The CloudStack volume name does not match the SolidFire volume name.")
cs_volume_folder = self._get_cs_volume_folder(cs_volume.id)
- self.assert_(int(cs_volume_folder) == sf_volume.volume_id, "The CloudStack folder name does not match the SolidFire volume ID.")
+ self.assertTrue(int(cs_volume_folder) == sf_volume.volume_id, "The CloudStack folder name does not match the SolidFire volume ID.")
cs_volume_iscsi_name = self._get_cs_volume_iscsi_name(cs_volume.id)
- self.assert_(cs_volume_iscsi_name == sf_util.format_iqn(sf_volume.iqn), "The CloudStack volume iscsi_name does not match the SolidFire volume IQN.")
+ self.assertTrue(cs_volume_iscsi_name == sf_util.format_iqn(sf_volume.iqn), "The CloudStack volume iscsi_name does not match the SolidFire volume IQN.")
def _get_cs_volume_property(self, cs_volume_id, volume_property):
sql_query = "Select " + volume_property + " From volumes Where uuid = '" + cs_volume_id + "'"
diff --git a/test/integration/plugins/solidfire/TestVolumes.py b/test/integration/plugins/solidfire/TestVolumes.py
index 9685e509cb8..30b5c0f1ab6 100644
--- a/test/integration/plugins/solidfire/TestVolumes.py
+++ b/test/integration/plugins/solidfire/TestVolumes.py
@@ -2617,7 +2617,7 @@ class TestVolumes(cloudstackTestCase):
elif TestData.hypervisor_type == TestData.xenServer:
return TestData.templateCacheNameXenServer
- self.assert_(False, "Invalid hypervisor type")
+ self.assertTrue(False, "Invalid hypervisor type")
def _get_modified_iscsi_name(self, sf_iscsi_name):
sf_iscsi_name = sf_iscsi_name.replace("/", "")
diff --git a/test/integration/plugins/test_nicira_controller.py b/test/integration/plugins/test_nicira_controller.py
index 75f94afdb66..9524a516fc1 100644
--- a/test/integration/plugins/test_nicira_controller.py
+++ b/test/integration/plugins/test_nicira_controller.py
@@ -405,7 +405,7 @@ class TestNiciraContoller(cloudstackTestCase):
def get_master_router(self, routers):
- master = filter(lambda r: r.redundantstate == 'MASTER', routers)
+ master = [r for r in routers if r.redundantstate == 'MASTER']
self.logger.debug("Found %s master router(s): %s" % (master.size(), master))
return master[0]
diff --git a/test/integration/smoke/test_accounts.py b/test/integration/smoke/test_accounts.py
index 1c1cf02f775..277e649d563 100644
--- a/test/integration/smoke/test_accounts.py
+++ b/test/integration/smoke/test_accounts.py
@@ -1812,34 +1812,34 @@ class TestDomainForceRemove(cloudstackTestCase):
# not return any routers in the deleted accounts/domains
self.debug("Creating a domain for login with API domain test")
- domain = Domain.create(
+ self.child_domain = Domain.create(
self.apiclient,
self.services["domain"],
parentdomainid=self.domain.id
)
- self.cleanup.append(domain)
+ self.cleanup.append(self.child_domain)
self.debug("Domain is created succesfully.")
self.debug(
"Checking if the created domain is listed in list domains API")
- domains = Domain.list(self.apiclient, id=domain.id, listall=True)
+ domains = Domain.list(self.apiclient, id=self.child_domain.id, listall=True)
self.assertEqual(
isinstance(domains, list),
True,
"List domains shall return a valid response"
)
- self.debug("Creating 2 user accounts in domain: %s" % domain.name)
+ self.debug("Creating 2 user accounts in domain: %s" % self.child_domain.name)
self.account_1 = Account.create(
self.apiclient,
self.services["account"],
- domainid=domain.id
+ domainid=self.child_domain.id
)
self.cleanup.append(self.account_1)
self.account_2 = Account.create(
self.apiclient,
self.services["account"],
- domainid=domain.id
+ domainid=self.child_domain.id
)
self.cleanup.append(self.account_2)
@@ -1856,7 +1856,7 @@ class TestDomainForceRemove(cloudstackTestCase):
self.debug("Deploying virtual machine in account 1: %s" %
self.account_1.name)
- vm_1 = VirtualMachine.create(
+ self.vm_1 = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
@@ -1864,11 +1864,11 @@ class TestDomainForceRemove(cloudstackTestCase):
domainid=self.account_1.domainid,
serviceofferingid=self.service_offering.id
)
- self.cleanup.append(vm_1)
+ self.cleanup.append(self.vm_1)
self.debug("Deploying virtual machine in account 2: %s" %
self.account_2.name)
- vm_2 = VirtualMachine.create(
+ self.vm_2 = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
@@ -1876,7 +1876,7 @@ class TestDomainForceRemove(cloudstackTestCase):
domainid=self.account_2.domainid,
serviceofferingid=self.service_offering.id
)
- self.cleanup.append(vm_2)
+ self.cleanup.append(self.vm_2)
networks = Network.list(
self.apiclient,
@@ -1918,15 +1918,16 @@ class TestDomainForceRemove(cloudstackTestCase):
"Trying to create a port forwarding rule in source NAT: %s" %
src_nat.ipaddress)
# Create NAT rule
- nat_rule = NATRule.create(
+ self.nat_rule = NATRule.create(
self.apiclient,
- vm_1,
+ self.vm_1,
self.services["natrule"],
ipaddressid=src_nat.id
)
+ self.cleanup.append(self.nat_rule)
self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
- nat_rules = NATRule.list(self.apiclient, id=nat_rule.id)
+ nat_rules = NATRule.list(self.apiclient, id=self.nat_rule.id)
self.assertEqual(
isinstance(nat_rules, list),
@@ -1944,12 +1945,14 @@ class TestDomainForceRemove(cloudstackTestCase):
self.debug("Deleting domain with force option")
try:
- domain.delete(self.apiclient, cleanup=True)
- self.cleanup.remove(domain)
- if vm_1 != None:
- self.cleanup.remove(vm_1)
- if vm_2 != None:
- self.cleanup.remove(vm_2)
+ self.child_domain.delete(self.apiclient, cleanup=True)
+ self.cleanup.remove(self.child_domain)
+ self.cleanup.remove(self.account_1)
+ self.cleanup.remove(self.account_2)
+ self.cleanup.remove(self.vm_1)
+ self.cleanup.remove(self.vm_2)
+ self.cleanup.remove(self.nat_rule)
+
except Exception as e:
self.debug("Waiting for account.cleanup.interval" +
" to cleanup any remaining resouces")
@@ -1958,7 +1961,7 @@ class TestDomainForceRemove(cloudstackTestCase):
with self.assertRaises(CloudstackAPIException):
Domain.list(
self.apiclient,
- id=domain.id,
+ id=self.child_domain.id,
listall=True
)
@@ -1997,35 +2000,35 @@ class TestDomainForceRemove(cloudstackTestCase):
# 5. domain deletion should fail saying there are resources under use
self.debug("Creating a domain for login with API domain test")
- domain = Domain.create(
+ self.child_domain = Domain.create(
self.apiclient,
self.services["domain"],
parentdomainid=self.domain.id
)
# in this test delete domain *should* fail so we need to housekeep:
- self.cleanup.append(domain)
- self.debug("Domain: %s is created successfully." % domain.name)
+ self.cleanup.append(self.child_domain)
+ self.debug("Domain: %s is created successfully." % self.child_domain.name)
self.debug(
"Checking if the created domain is listed in list domains API")
- domains = Domain.list(self.apiclient, id=domain.id, listall=True)
+ domains = Domain.list(self.apiclient, id=self.child_domain.id, listall=True)
self.assertEqual(
isinstance(domains, list),
True,
"List domains shall return a valid response"
)
- self.debug("Creating 2 user accounts in domain: %s" % domain.name)
+ self.debug("Creating 2 user accounts in domain: %s" % self.child_domain.name)
self.account_1 = Account.create(
self.apiclient,
self.services["account"],
- domainid=domain.id
+ domainid=self.child_domain.id
)
self.cleanup.append(self.account_1)
self.account_2 = Account.create(
self.apiclient,
self.services["account"],
- domainid=domain.id
+ domainid=self.child_domain.id
)
self.cleanup.append(self.account_2)
@@ -2039,7 +2042,7 @@ class TestDomainForceRemove(cloudstackTestCase):
self.debug("Deploying virtual machine in account 1: %s" %
self.account_1.name)
- vm_1 = VirtualMachine.create(
+ self.vm_1 = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
@@ -2047,11 +2050,11 @@ class TestDomainForceRemove(cloudstackTestCase):
domainid=self.account_1.domainid,
serviceofferingid=self.service_offering.id
)
- self.cleanup.append(vm_1)
+ self.cleanup.append(self.vm_1)
self.debug("Deploying virtual machine in account 2: %s" %
self.account_2.name)
- vm_2 = VirtualMachine.create(
+ self.vm_2 = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
templateid=self.template.id,
@@ -2059,7 +2062,7 @@ class TestDomainForceRemove(cloudstackTestCase):
domainid=self.account_2.domainid,
serviceofferingid=self.service_offering.id
)
- self.cleanup.append(vm_2)
+ self.cleanup.append(self.vm_2)
networks = Network.list(
self.apiclient,
@@ -2101,15 +2104,16 @@ class TestDomainForceRemove(cloudstackTestCase):
"Trying to create a port forwarding rule in source NAT: %s" %
src_nat.ipaddress)
# Create NAT rule
- nat_rule = NATRule.create(
+ self.nat_rule = NATRule.create(
self.apiclient,
- vm_1,
+ self.vm_1,
self.services["natrule"],
ipaddressid=src_nat.id
)
+ self.cleanup.append(self.nat_rule)
self.debug("Created PF rule on source NAT: %s" % src_nat.ipaddress)
- nat_rules = NATRule.list(self.apiclient, id=nat_rule.id)
+ nat_rules = NATRule.list(self.apiclient, id=self.nat_rule.id)
self.assertEqual(
isinstance(nat_rules, list),
@@ -2124,9 +2128,17 @@ class TestDomainForceRemove(cloudstackTestCase):
)
self.debug("Deleting domain without force option")
- with self.assertRaises(Exception):
- domain.delete(self.apiclient, cleanup=False)
- # TODO should domain be removed from self.cleanup or can it remain in the list?
+ try:
+ self.child_domain.delete(self.apiclient, cleanup=False)
+ self.cleanup.remove(self.nat_rule)
+ self.cleanup.remove(self.vm_2)
+ self.cleanup.remove(self.vm_1)
+ self.cleanup.remove(self.account_2)
+ self.cleanup.remove(self.account_1)
+ self.cleanup.remove(self.child_domain)
+ self.fail("shouldn't be able to delete domain")
+ except:
+ pass
return
class TestMoveUser(cloudstackTestCase):
@@ -2180,6 +2192,7 @@ class TestMoveUser(cloudstackTestCase):
account=self.account1.name,
domainid=self.account1.domainid
)
+ self.cleanup.append(self.user)
return
diff --git a/test/integration/smoke/test_async_job.py b/test/integration/smoke/test_async_job.py
index b0e06ec4051..0db45de0390 100644
--- a/test/integration/smoke/test_async_job.py
+++ b/test/integration/smoke/test_async_job.py
@@ -67,7 +67,6 @@ class TestAsyncJob(cloudstackTestCase):
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- self.hypervisor = self.testClient.getHypervisorInfo()
self.testdata["virtual_machine"]["zoneid"] = self.zone.id
self.testdata["virtual_machine"]["template"] = self.template.id
self.testdata["iso"]["zoneid"] = self.zone.id
diff --git a/test/integration/smoke/test_certauthority_root.py b/test/integration/smoke/test_certauthority_root.py
index a7cf18884a4..f20314ad4c5 100644
--- a/test/integration/smoke/test_certauthority_root.py
+++ b/test/integration/smoke/test_certauthority_root.py
@@ -102,7 +102,7 @@ class TestCARootProvider(cloudstackTestCase):
certificate = self.getCaCertificate()
self.assertTrue(len(certificate) > 0)
- cert = x509.load_pem_x509_certificate(str(certificate), default_backend())
+ cert = x509.load_pem_x509_certificate(certificate.encode(), default_backend())
self.assertEqual(cert.signature_hash_algorithm.name, 'sha256')
self.assertEqual(cert.issuer.get_attributes_for_oid(x509.oid.NameOID.COMMON_NAME)[0].value, 'ca.cloudstack.apache.org')
@@ -122,7 +122,7 @@ class TestCARootProvider(cloudstackTestCase):
self.assertTrue(len(response.cacertificates) > 0)
self.assertTrue(len(response.certificate) > 0)
- cert = x509.load_pem_x509_certificate(str(response.certificate), default_backend())
+ cert = x509.load_pem_x509_certificate(response.certificate.encode(), default_backend())
# Validate basic certificate attributes
self.assertEqual(cert.signature_hash_algorithm.name, 'sha256')
@@ -133,15 +133,15 @@ class TestCARootProvider(cloudstackTestCase):
for domain in cmd.domain.split(','):
self.assertTrue(domain in altNames.value.get_values_for_type(x509.DNSName))
for address in cmd.ipaddress.split(','):
- self.assertTrue(address in map(lambda x: str(x), altNames.value.get_values_for_type(x509.IPAddress)))
+ self.assertTrue(address in [str(x) for x in altNames.value.get_values_for_type(x509.IPAddress)])
# Validate certificate against CA public key
global PUBKEY_VERIFY
if not PUBKEY_VERIFY:
return
- caCert = x509.load_pem_x509_certificate(str(self.getCaCertificate()), default_backend())
+ caCert = x509.load_pem_x509_certificate(self.getCaCertificate().encode(), default_backend())
x = X509()
- x.set_pubkey(load_publickey(FILETYPE_PEM, str(caCert.public_key().public_bytes(serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo))))
+ x.set_pubkey(load_publickey(FILETYPE_PEM, caCert.public_key().public_bytes(serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo)))
verify(x, cert.signature, cert.tbs_certificate_bytes, cert.signature_hash_algorithm.name)
@@ -158,8 +158,7 @@ class TestCARootProvider(cloudstackTestCase):
self.assertTrue(response.privatekey is None)
self.assertTrue(len(response.cacertificates) > 0)
self.assertTrue(len(response.certificate) > 0)
-
- cert = x509.load_pem_x509_certificate(str(response.certificate), default_backend())
+ cert = x509.load_pem_x509_certificate(response.certificate.encode(), default_backend())
# Validate basic certificate attributes
self.assertEqual(cert.signature_hash_algorithm.name, 'sha256')
@@ -169,9 +168,9 @@ class TestCARootProvider(cloudstackTestCase):
global PUBKEY_VERIFY
if not PUBKEY_VERIFY:
return
- caCert = x509.load_pem_x509_certificate(str(self.getCaCertificate()), default_backend())
+ caCert = x509.load_pem_x509_certificate(self.getCaCertificate().encode(), default_backend())
x = X509()
- x.set_pubkey(load_publickey(FILETYPE_PEM, str(caCert.public_key().public_bytes(serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo))))
+ x.set_pubkey(load_publickey(FILETYPE_PEM, caCert.public_key().public_bytes(serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo)))
verify(x, cert.signature, cert.tbs_certificate_bytes, cert.signature_hash_algorithm.name)
@@ -184,8 +183,9 @@ class TestCARootProvider(cloudstackTestCase):
cmd.serial = 'abc123' # hex value
cmd.cn = 'example.com'
cmd.provider = 'root'
-
- self.dbclient.execute("delete from crl where serial='%s'" % cmd.serial)
+ serials = self.dbclient.execute(f"select serial, cn from crl where serial='{cmd.serial}'")
+ if len(serials) > 0:
+ self.dbclient.execute(f"delete from crl where serial='{cmd.serial}'")
response = self.apiclient.revokeCertificate(cmd)
self.assertTrue(response.success)
diff --git a/test/integration/smoke/test_create_network.py b/test/integration/smoke/test_create_network.py
index 7fe7cbbc53a..497679fc0eb 100644
--- a/test/integration/smoke/test_create_network.py
+++ b/test/integration/smoke/test_create_network.py
@@ -17,7 +17,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.sshClient import SshClient
from marvin.lib.utils import (cleanup_resources,
random_gen)
diff --git a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
index 0bf210c6000..6df64081ebc 100644
--- a/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
+++ b/test/integration/smoke/test_deploy_vgpu_enabled_vm.py
@@ -324,12 +324,12 @@ class TestDeployvGPUenabledVM(cloudstackTestCase):
self.assertTrue('mks.enable3d' in detailKeys and 'mks.use3dRenderer' in detailKeys and 'svga.autodetect' in detailKeys and 'svga.vramSize' in detailKeys, "VM details do not contain 3D GPU details")
- self.assertEquals('true', qresultset[detailKeys.index('mks.enable3d')][1], "Expected detail 'mks.enable3d'='true'")
+ self.assertEqual('true', qresultset[detailKeys.index('mks.enable3d')][1], "Expected detail 'mks.enable3d'='true'")
- self.assertEquals('automatic', qresultset[detailKeys.index('mks.use3dRenderer')][1], "Expected detail 'mks.use3dRenderer'='automatic'")
+ self.assertEqual('automatic', qresultset[detailKeys.index('mks.use3dRenderer')][1], "Expected detail 'mks.use3dRenderer'='automatic'")
- self.assertEquals('false', qresultset[detailKeys.index('svga.autodetect')][1], "Expected detail 'svga.autodetect'='false'")
+ self.assertEqual('false', qresultset[detailKeys.index('svga.autodetect')][1], "Expected detail 'svga.autodetect'='false'")
- self.assertEquals('131072', qresultset[detailKeys.index('svga.vramSize')][1], "Expected detail 'svga.vramSize'='131072'")
+ self.assertEqual('131072', qresultset[detailKeys.index('svga.vramSize')][1], "Expected detail 'svga.vramSize'='131072'")
return
diff --git a/test/integration/smoke/test_deploy_virtio_scsi_vm.py b/test/integration/smoke/test_deploy_virtio_scsi_vm.py
index 0bcf999882d..4540d16fea5 100644
--- a/test/integration/smoke/test_deploy_virtio_scsi_vm.py
+++ b/test/integration/smoke/test_deploy_virtio_scsi_vm.py
@@ -197,7 +197,7 @@ class TestDeployVirtioSCSIVM(cloudstackTestCase):
for child in disk:
if child.tag.lower() == "target":
dev = child.get("dev")
- self.assert_(dev is not None and dev.startswith("sd"), "disk dev is invalid")
+ self.assertTrue(dev is not None and dev.startswith("sd"), "disk dev is invalid")
elif child.tag.lower() == "address":
con = child.get("controller")
self.assertEqual(con, scsiindex, "disk controller not equal to SCSI " \
@@ -244,14 +244,14 @@ class TestDeployVirtioSCSIVM(cloudstackTestCase):
b = chan.recv(10000)
if len(b) == 0:
break
- stdout += b
+ stdout += b.decode()
stderr = ""
while True:
b = chan.recv_stderr(10000)
if len(b) == 0:
break
- stderr += b
+ stderr += b.decode()
xstatus = chan.recv_exit_status()
chan.close()
diff --git a/test/integration/smoke/test_deploy_vm_extra_config_data.py b/test/integration/smoke/test_deploy_vm_extra_config_data.py
index 3078cce0362..80b046102ca 100644
--- a/test/integration/smoke/test_deploy_vm_extra_config_data.py
+++ b/test/integration/smoke/test_deploy_vm_extra_config_data.py
@@ -17,7 +17,7 @@
""" BVT tests for Virtual Machine additional configuration
"""
# Import System modules
-import urllib
+import urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
from lxml import etree
@@ -292,7 +292,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
xml_res = ssh_client.execute(virsh_cmd)
xml_as_str = ''.join(xml_res)
- extraconfig_decoded_xml = '' + urllib.unquote(extraconfig) + ''
+ extraconfig_decoded_xml = '' + urllib.parse.unquote(extraconfig) + ''
# Root XML Elements
parser = etree.XMLParser(remove_blank_text=True)
@@ -302,7 +302,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
find_element_in_domain_xml = domain_xml_root.find(child.tag)
# Fail if extra config is not found in domain xml
- self.assertNotEquals(
+ self.assertNotEqual(
0,
len(find_element_in_domain_xml),
'Element tag from extra config not added to VM'
@@ -310,7 +310,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
# Compare found XML node with extra config node
is_a_match = self.elements_equal(child, find_element_in_domain_xml)
- self.assertEquals(
+ self.assertEqual(
True,
is_a_match,
'The element from tags from extra config do not match with those found in domain xml'
@@ -371,7 +371,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
xml_res = ssh_client.execute(virsh_cmd)
xml_as_str = ''.join(xml_res)
- extraconfig_decoded_xml = '' + urllib.unquote(extraconfig) + ''
+ extraconfig_decoded_xml = '' + urllib.parse.unquote(extraconfig) + ''
# Root XML Elements
parser = etree.XMLParser(remove_blank_text=True)
@@ -381,7 +381,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
find_element_in_domain_xml = domain_xml_root.find(child.tag)
# Fail if extra config is not found in domain xml
- self.assertNotEquals(
+ self.assertNotEqual(
0,
len(find_element_in_domain_xml),
'Element tag from extra config not added to VM'
@@ -389,7 +389,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
# Compare found XML node with extra config node
is_a_match = self.elements_equal(child, find_element_in_domain_xml)
- self.assertEquals(
+ self.assertEqual(
True,
is_a_match,
'The element from tags from extra config do not match with those found in domain xml'
@@ -462,7 +462,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
user=self.hostConfig['username'],
passwd=self.hostConfig['password'])
- extraconfig_decoded = urllib.unquote(extraconfig)
+ extraconfig_decoded = urllib.parse.unquote(extraconfig)
config_arr = extraconfig_decoded.splitlines()
for config in config_arr:
@@ -472,7 +472,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
grep_config = "cat %s | grep -w '%s'" % (vmx_file_name, vmx_config)
result = ssh_client.execute(grep_config)
# Match exact configuration from vmx file, return empty result array if configuration is not found
- self.assertNotEquals(
+ self.assertNotEqual(
0,
len(result),
'Extra configuration not found in instance vmx file'
@@ -546,7 +546,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
user=self.hostConfig['username'],
passwd=self.hostConfig['password'])
- extraconfig_decoded = urllib.unquote(extraconfig)
+ extraconfig_decoded = urllib.parse.unquote(extraconfig)
config_arr = extraconfig_decoded.splitlines()
# Get vm instance uuid
@@ -558,7 +558,7 @@ class TestAddConfigtoDeployVM(cloudstackTestCase):
result = ssh_client.execute(vm_config_check)
param_value = config_tuple[1].strip()
# Check if each configuration command has set the configuration as sent with extraconfig
- self.assertEquals(
+ self.assertEqual(
param_value,
result[0],
'Extra configuration not found in VM param list'
diff --git a/test/integration/smoke/test_deploy_vm_root_resize.py b/test/integration/smoke/test_deploy_vm_root_resize.py
index 5f3cfe8b08a..f3b42a389b9 100644
--- a/test/integration/smoke/test_deploy_vm_root_resize.py
+++ b/test/integration/smoke/test_deploy_vm_root_resize.py
@@ -164,14 +164,7 @@ class TestDeployVmRootSize(cloudstackTestCase):
return
def tearDown(self):
- try:
- # Clean up, terminate the created instance, volumes and snapshots
-
- cleanup_resources(self.apiclient, self.cleanup)
- pass
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestDeployVmRootSize,self).tearDown()
@classmethod
def restartServer(cls):
@@ -402,10 +395,5 @@ class TestDeployVmRootSize(cloudstackTestCase):
else:
self.debug("test 02 does not support hypervisor type " + self.hypervisor)
- def tearDown(self):
- try:
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- self.debug("Warning! Exception in tearDown: %s" % e)
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 52b71f7ea1a..ced0d3cf255 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -91,10 +91,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
@attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
def test_deployvm_userdata(self):
@@ -115,10 +115,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
@classmethod
def tearDownClass(cls):
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index 181958d74e5..ebd7739d878 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -156,8 +156,8 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
"Running",
msg="VM is not in Running state"
)
- vm1clusterid = filter(lambda c: c.id == vm1.hostid, self.hosts)[0].clusterid
- vm2clusterid = filter(lambda c: c.id == vm2.hostid, self.hosts)[0].clusterid
+ vm1clusterid = [c for c in self.hosts if c.id == vm1.hostid][0].clusterid
+ vm2clusterid = [c for c in self.hosts if c.id == vm2.hostid][0].clusterid
if vm1clusterid == vm2clusterid:
self.debug("VMs (%s, %s) meant to be dispersed are deployed in the same cluster %s" % (
vm1.id, vm2.id, vm1clusterid))
@@ -215,11 +215,11 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
"Running",
msg="VM is not in Running state"
)
- vm1clusterid = filter(lambda c: c.id == vm1.hostid, self.hosts)[0].clusterid
- vm2clusterid = filter(lambda c: c.id == vm2.hostid, self.hosts)[0].clusterid
+ vm1clusterid = [c for c in self.hosts if c.id == vm1.hostid][0].clusterid
+ vm2clusterid = [c for c in self.hosts if c.id == vm2.hostid][0].clusterid
- vm1podid = filter(lambda p: p.id == vm1clusterid, self.clusters)[0].podid
- vm2podid = filter(lambda p: p.id == vm2clusterid, self.clusters)[0].podid
+ vm1podid = [p for p in self.clusters if p.id == vm1clusterid][0].podid
+ vm2podid = [p for p in self.clusters if p.id == vm2clusterid][0].podid
self.assertEqual(
vm1podid,
vm2podid,
diff --git a/test/integration/smoke/test_diagnostics.py b/test/integration/smoke/test_diagnostics.py
index b2de339bb5b..d6931b7fc11 100644
--- a/test/integration/smoke/test_diagnostics.py
+++ b/test/integration/smoke/test_diagnostics.py
@@ -16,7 +16,7 @@
# under the License.
""" BVT tests for remote diagnostics of system VMs
"""
-import urllib
+import urllib.request, urllib.parse, urllib.error
from marvin.cloudstackAPI import (runDiagnostics, getDiagnosticsData)
from marvin.cloudstackTestCase import cloudstackTestCase
@@ -566,14 +566,14 @@ class TestRemoteDiagnostics(cloudstackTestCase):
)
def check_url(self, url):
- import urllib2
+ import urllib.request, urllib.error, urllib.parse
try:
- r = urllib.urlopen(url)
+ r = urllib.request.urlopen(url)
if r.code == 200:
return True
- except urllib2.HTTPError:
+ except urllib.error.HTTPError:
return False
- except urllib2.URLError:
+ except urllib.error.URLError:
return False
return True
diff --git a/test/integration/smoke/test_domain_disk_offerings.py b/test/integration/smoke/test_domain_disk_offerings.py
index 953d68034b8..c37b73b8da8 100644
--- a/test/integration/smoke/test_domain_disk_offerings.py
+++ b/test/integration/smoke/test_domain_disk_offerings.py
@@ -150,7 +150,7 @@ class TestCreateDomainsDiskOffering(cloudstackTestCase):
self.services["disk_offering"]["name"],
"Check name in createDiskOffering"
)
- self.assertItemsEqual(
+ self.assertCountEqual(
disk_response.domainid.split(","),
offering_data_domainid.split(","),
"Check domainid in createDiskOffering"
@@ -259,7 +259,7 @@ class TestDomainsDiskOfferings(cloudstackTestCase):
)
try:
- self.assertItemsEqual(
+ self.assertCountEqual(
list_disk_response[0].domainid.split(","),
input_domainid.split(","),
"Check child domainid in updateDiskOffering, should fail"
@@ -268,7 +268,7 @@ class TestDomainsDiskOfferings(cloudstackTestCase):
except AssertionError:
self.debug("Child domain check successful")
- self.assertItemsEqual(
+ self.assertCountEqual(
list_disk_response[0].domainid.split(","),
result_domainid.split(","),
"Check domainid in updateDiskOffering"
diff --git a/test/integration/smoke/test_domain_network_offerings.py b/test/integration/smoke/test_domain_network_offerings.py
index a1014e2ae23..0bab9a12c1d 100644
--- a/test/integration/smoke/test_domain_network_offerings.py
+++ b/test/integration/smoke/test_domain_network_offerings.py
@@ -144,7 +144,7 @@ class TestCreateDomainsNetworkOffering(cloudstackTestCase):
network_offering.id,
"Check server id in createNetworkOffering"
)
- self.assertItemsEqual(
+ self.assertCountEqual(
network_response.domainid.split(","),
offering_data_domainid.split(","),
"Check domainid in createNetworkOffering"
@@ -254,7 +254,7 @@ class TestDomainsNetworkOfferings(cloudstackTestCase):
)
try:
- self.assertItemsEqual(
+ self.assertCountEqual(
list_network_response[0].domainid.split(","),
input_domainid.split(","),
"Check child domainid in updateServiceOffering, should fail"
@@ -264,7 +264,7 @@ class TestDomainsNetworkOfferings(cloudstackTestCase):
self.debug("Child domain check successful")
domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id)
- self.assertItemsEqual(
+ self.assertCountEqual(
list_network_response[0].domainid.split(","),
result_domainid.split(","),
"Check domainid in createNetworkOffering"
diff --git a/test/integration/smoke/test_domain_service_offerings.py b/test/integration/smoke/test_domain_service_offerings.py
index 0f71f8c4f64..7acadaca542 100644
--- a/test/integration/smoke/test_domain_service_offerings.py
+++ b/test/integration/smoke/test_domain_service_offerings.py
@@ -168,7 +168,7 @@ class TestCreateDomainsServiceOffering(cloudstackTestCase):
self.services["service_offerings"]["tiny"]["name"],
"Check name in createServiceOffering"
)
- self.assertItemsEqual(
+ self.assertCountEqual(
list_service_response[0].domainid.split(","),
offering_data_domainid.split(","),
"Check domainid in createServiceOffering"
@@ -304,7 +304,7 @@ class TestDomainsServiceOfferings(cloudstackTestCase):
)
try:
- self.assertItemsEqual(
+ self.assertCountEqual(
list_service_response[0].domainid.split(","),
input_domainid.split(","),
"Check child domainid in updateServiceOffering, should fail"
@@ -313,7 +313,7 @@ class TestDomainsServiceOfferings(cloudstackTestCase):
except AssertionError:
self.debug("Child domain check successful")
- self.assertItemsEqual(
+ self.assertCountEqual(
list_service_response[0].domainid.split(","),
result_domainid.split(","),
"Check domainid in updateServiceOffering"
diff --git a/test/integration/smoke/test_domain_vpc_offerings.py b/test/integration/smoke/test_domain_vpc_offerings.py
index d24e05bd7d7..928c24accb7 100644
--- a/test/integration/smoke/test_domain_vpc_offerings.py
+++ b/test/integration/smoke/test_domain_vpc_offerings.py
@@ -151,7 +151,7 @@ class TestCreateDomainsVpcOffering(cloudstackTestCase):
cmd.supportedServices = offering_data["supportedservices"]
cmd.domainid = offering_data_domainid
if "serviceProviderList" in offering_data:
- for service, provider in offering_data["serviceProviderList"].items():
+ for service, provider in list(offering_data["serviceProviderList"].items()):
providers = provider
if isinstance(provider, str):
providers = [provider]
@@ -192,7 +192,7 @@ class TestCreateDomainsVpcOffering(cloudstackTestCase):
self.localservices["vpc_offering"]["displaytext"],
"Check server displaytext in createVPCOffering"
)
- self.assertItemsEqual(
+ self.assertCountEqual(
vpc_response.domainid.split(","),
offering_data_domainid.split(","),
"Check domainid in createVPCOffering"
@@ -301,7 +301,7 @@ class TestDomainsVpcOfferings(cloudstackTestCase):
)
try:
- self.assertItemsEqual(
+ self.assertCountEqual(
list_vpc_response[0].domainid.split(","),
input_domainid.split(","),
"Check child domainid in updateServiceOffering, should fail"
@@ -310,7 +310,7 @@ class TestDomainsVpcOfferings(cloudstackTestCase):
except AssertionError:
self.debug("Child domain check successful")
- self.assertItemsEqual(
+ self.assertCountEqual(
list_vpc_response[0].domainid.split(","),
result_domainid.split(","),
"Check domainid in createVPCOffering"
diff --git a/test/integration/smoke/test_dynamicroles.py b/test/integration/smoke/test_dynamicroles.py
index 2ce70011c2c..b91ba9c2eba 100644
--- a/test/integration/smoke/test_dynamicroles.py
+++ b/test/integration/smoke/test_dynamicroles.py
@@ -456,19 +456,19 @@ class TestDynamicRoles(cloudstackTestCase):
# Move last item to the top
rule = permissions.pop(len(permissions)-1)
permissions = [rule] + permissions
- rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ rule.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.validate_permissions_list(permissions, self.role.id)
# Move to the bottom
rule = permissions.pop(0)
permissions = permissions + [rule]
- rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ rule.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.validate_permissions_list(permissions, self.role.id)
# Random shuffles
for _ in range(3):
shuffle(permissions)
- rule.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ rule.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.validate_permissions_list(permissions, self.role.id)
@attr(tags=['advanced', 'simulator', 'basic', 'sg'], required_hardware=False)
@@ -541,7 +541,7 @@ class TestDynamicRoles(cloudstackTestCase):
shuffle(permissions)
try:
- permission.update(self.apiclient, ruleorder=",".join(map(lambda x: x.id, permissions)))
+ permission.update(self.apiclient, ruleorder=",".join([x.id for x in permissions]))
self.fail("Reordering should fail in case of concurrent updates by other user")
except CloudstackAPIException: pass
@@ -566,9 +566,9 @@ class TestDynamicRoles(cloudstackTestCase):
Checks available APIs based on api map
"""
response = userApiClient.listApis(listApis.listApisCmd())
- allowedApis = map(lambda x: x.name, response)
+ allowedApis = [x.name for x in response]
for api in allowedApis:
- for rule, perm in apiConfig.items():
+ for rule, perm in list(apiConfig.items()):
if re.match(rule.replace('*', '.*'), api):
if perm.lower() == 'allow':
break
@@ -612,7 +612,7 @@ class TestDynamicRoles(cloudstackTestCase):
Test to check role, role permissions and account life cycles
"""
apiConfig = self.testdata['apiConfig']
- for api, perm in apiConfig.items():
+ for api, perm in list(apiConfig.items()):
testdata = self.testdata['rolepermission']
testdata['roleid'] = self.role.id
testdata['rule'] = api
@@ -641,7 +641,7 @@ class TestDynamicRoles(cloudstackTestCase):
apiConfig = self.testdata["apiConfig"]
roleId = self.dbclient.execute("select id from roles where uuid='%s'" % self.role.id)[0][0]
sortOrder = 1
- for rule, perm in apiConfig.items():
+ for rule, perm in list(apiConfig.items()):
self.dbclient.execute("insert into role_permissions (uuid, role_id, rule, permission, sort_order) values (UUID(), %d, '%s', '%s', %d)" % (roleId, rule, perm.upper(), sortOrder))
sortOrder += 1
diff --git a/test/integration/smoke/test_host_annotations.py b/test/integration/smoke/test_host_annotations.py
index 9ce2586c812..a463af9e7fe 100644
--- a/test/integration/smoke/test_host_annotations.py
+++ b/test/integration/smoke/test_host_annotations.py
@@ -107,7 +107,7 @@ class TestHostAnnotations(cloudstackTestCase):
#Check that the last one is visible in host details
self.assertEqual(self.getHostAnnotation(self.host.id), "annotation3")
- print
+ print()
@attr(tags=["devcloud", "advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
def test_03_user_role_dont_see_annotations(self):
diff --git a/test/integration/smoke/test_hostha_kvm.py b/test/integration/smoke/test_hostha_kvm.py
index cd4a2d412a4..a287ecf052f 100644
--- a/test/integration/smoke/test_hostha_kvm.py
+++ b/test/integration/smoke/test_hostha_kvm.py
@@ -30,7 +30,7 @@ from ipmisim.ipmisim import IpmiServerContext, IpmiServer, ThreadedIpmiServer
import random
import socket
import sys
-import thread
+import _thread
import time
@@ -511,7 +511,7 @@ class TestHAKVM(cloudstackTestCase):
IpmiServerContext('reset')
ThreadedIpmiServer.allow_reuse_address = False
server = ThreadedIpmiServer(('0.0.0.0', self.getIpmiServerPort()), IpmiServer)
- thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
+ _thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
self.server = server
def stopIpmiServer(self):
diff --git a/test/integration/smoke/test_hostha_simulator.py b/test/integration/smoke/test_hostha_simulator.py
index 630512fdbe7..1b3dd815a30 100644
--- a/test/integration/smoke/test_hostha_simulator.py
+++ b/test/integration/smoke/test_hostha_simulator.py
@@ -28,7 +28,7 @@ from ipmisim.ipmisim import IpmiServerContext, IpmiServer, ThreadedIpmiServer
import random
import socket
import sys
-import thread
+import _thread
import time
@@ -173,7 +173,7 @@ class TestHostHA(cloudstackTestCase):
def checkSyncToState(self, state, interval=5000):
def checkForStateSync(expectedState):
response = self.getHost(hostId=self.getHost().id).hostha
- print("checkForStateSync:: response=%s, expected=%s" % (response, expectedState))
+ print(("checkForStateSync:: response=%s, expected=%s" % (response, expectedState)))
return response.hastate == expectedState, None
sync_interval = 1 + int(interval) / 1000
@@ -417,7 +417,7 @@ class TestHostHA(cloudstackTestCase):
mshosts = self.dbclient.execute(
"select msid from mshost where version='%s' and removed is NULL and state='Up'" % (cloudstackVersion))
if len(mshosts) > 0:
- currentMsHosts = map(lambda row: row[0], mshosts)
+ currentMsHosts = [row[0] for row in mshosts]
# Inject fake ms host
self.dbclient.execute(
@@ -475,7 +475,7 @@ class TestHostHA(cloudstackTestCase):
def checkFSMTransition(self, transition, event, haState, prevHaState, hasActiviyCounter, hasRecoveryCounter):
- print("checkFSMTransition:: transition=%s, event=%s, state=%s" % (transition, event, haState))
+ print(("checkFSMTransition:: transition=%s, event=%s, state=%s" % (transition, event, haState)))
self.assertEqual(transition.event, event)
self.assertEqual(transition.hastate, haState)
self.assertEqual(transition.prevhastate, prevHaState)
@@ -513,7 +513,7 @@ class TestHostHA(cloudstackTestCase):
if not stateTransition:
previousTransition = transition
- print("findFSMTransition:: prev=%s, cur=%s, next=%s, find state=%s" % (previousTransition, stateTransition, nextTransition, state))
+ print(("findFSMTransition:: prev=%s, cur=%s, next=%s, find state=%s" % (previousTransition, stateTransition, nextTransition, state)))
if stateTransition:
return True, (previousTransition, stateTransition, nextTransition,)
return False, (previousTransition, stateTransition, nextTransition,)
diff --git a/test/integration/smoke/test_internal_lb.py b/test/integration/smoke/test_internal_lb.py
index 1f4751761db..5864f7321bb 100644
--- a/test/integration/smoke/test_internal_lb.py
+++ b/test/integration/smoke/test_internal_lb.py
@@ -16,49 +16,37 @@
# under the License.
""" Tests for configuring Internal Load Balancing Rules.
"""
-# Import Local Modules
-from marvin.codes import PASS, FAILED
-from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.lib.utils import (cleanup_resources,
- get_process_status,
- get_host_credentials)
-from marvin.lib.base import (Domain,
- Account,
- Configurations,
- VPC,
- VpcOffering,
- ServiceOffering,
- NetworkOffering,
- Network,
- PublicIPAddress,
- NATRule,
- NetworkACL,
- LoadBalancerRule,
- ApplicationLoadBalancer,
- VirtualMachine,
- Template,
- FireWallRule,
- StaticNATRule,
- NetworkACLList
- )
+import logging
+import math
+import time
+from nose.plugins.attrib import attr
+# Import Local Modules
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.codes import FAILED
+from marvin.lib.base import (
+ Account,
+ Configurations,
+ VPC,
+ VpcOffering,
+ ServiceOffering,
+ NetworkOffering,
+ Network,
+ PublicIPAddress,
+ NATRule,
+ ApplicationLoadBalancer,
+ VirtualMachine,
+ NetworkACLList
+)
+from marvin.lib.common import (
+ get_zone,
+ get_domain,
+ get_test_template,
+ list_network_offerings)
from marvin.sshClient import SshClient
-from marvin.lib.common import (get_zone,
- get_domain,
- get_test_template,
- list_network_offerings)
-
-from nose.plugins.attrib import attr
-
-import logging
-import time
-import math
-
-
class Services:
-
"""Test VPC network services - Port Forwarding Rules Test Data Class.
"""
@@ -137,7 +125,7 @@ class Services:
"Dhcp": 'VpcVirtualRouter',
"Dns": 'VpcVirtualRouter',
"SourceNat": 'VpcVirtualRouter',
- "Lb" : ["InternalLbVm", "VpcVirtualRouter"],
+ "Lb": ["InternalLbVm", "VpcVirtualRouter"],
"PortForwarding": 'VpcVirtualRouter',
"UserData": 'VpcVirtualRouter',
"StaticNat": 'VpcVirtualRouter',
@@ -158,7 +146,7 @@ class Services:
"Dhcp": 'VpcVirtualRouter',
"Dns": 'VpcVirtualRouter',
"SourceNat": 'VpcVirtualRouter',
- "Lb" : ["InternalLbVm", "VpcVirtualRouter"],
+ "Lb": ["InternalLbVm", "VpcVirtualRouter"],
"PortForwarding": 'VpcVirtualRouter',
"UserData": 'VpcVirtualRouter',
"StaticNat": 'VpcVirtualRouter',
@@ -224,7 +212,6 @@ class Services:
class TestInternalLb(cloudstackTestCase):
-
"""Test Internal LB
"""
@@ -242,14 +229,18 @@ class TestInternalLb(cloudstackTestCase):
cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
cls.domain = get_domain(cls.apiclient)
- cls.logger.debug("Creating compute offering: %s" %cls.services["compute_offering"]["name"])
+ cls._cleanup = []
+
+ cls.logger.debug("Creating compute offering: %s" % cls.services["compute_offering"]["name"])
cls.compute_offering = ServiceOffering.create(
cls.apiclient,
cls.services["compute_offering"]
)
+ cls._cleanup.append(cls.compute_offering)
cls.account = Account.create(
cls.apiclient, services=cls.services["account"])
+ cls._cleanup.append(cls.account)
cls.hypervisor = testClient.getHypervisorInfo()
@@ -266,7 +257,6 @@ class TestInternalLb(cloudstackTestCase):
%s" % (cls.account.name,
cls.account.id))
- cls._cleanup = [cls.account, cls.compute_offering]
return
def setUp(self):
@@ -320,7 +310,7 @@ class TestInternalLb(cloudstackTestCase):
self.assertIsNotNone(vpc, "VPC creation failed")
self.logger.debug("Created VPC %s" % vpc.id)
- self.cleanup.insert(0, vpc)
+ self.cleanup.append(vpc)
return vpc
except Exception as e:
@@ -350,7 +340,7 @@ class TestInternalLb(cloudstackTestCase):
self.logger.debug(
"Created network %s in VPC %s" % (network.id, vpcid))
- self.cleanup.insert(0, network)
+ self.cleanup.append(network)
return network
except Exception as e:
@@ -370,10 +360,10 @@ class TestInternalLb(cloudstackTestCase):
)
self.assertIsNotNone(
vm, "Failed to deploy vm in network: %s" % networkid)
- self.assert_(vm.state == 'Running', "VM is not running")
+ self.assertTrue(vm.state == 'Running', "VM is not running")
self.logger.debug("Deployed VM id: %s in VPC %s" % (vm.id, vpc.id))
- self.cleanup.insert(0, vm)
+ self.cleanup.append(vm)
return vm
except Exception as e:
@@ -391,8 +381,8 @@ class TestInternalLb(cloudstackTestCase):
sourcenetworkid=networkid,
networkid=networkid
)
-
self.assertIsNotNone(applb, "Failed to create loadbalancer")
+ self.cleanup.append(applb)
self.logger.debug("Created LB %s in VPC" % applb.id)
return applb
@@ -412,6 +402,7 @@ class TestInternalLb(cloudstackTestCase):
vpcid=vpc.id
)
self.assertIsNotNone(public_ip, "Failed to acquire public IP")
+ self.cleanup.append(public_ip)
self.logger.debug("Associated %s with network %s" % (
public_ip.ipaddress.ipaddress,
network.id
@@ -436,6 +427,7 @@ class TestInternalLb(cloudstackTestCase):
)
self.assertIsNotNone(
nat_rule, "Failed to create NAT Rule for %s" % public_ip.ipaddress.ipaddress)
+ self.cleanup.append(nat_rule)
self.logger.debug(
"Adding NetworkACL rules to make NAT rule accessible")
@@ -494,7 +486,7 @@ class TestInternalLb(cloudstackTestCase):
try:
for x in range(0, max_requests):
cmd_test_http = "/usr/bin/wget -T2 -qO- http://" + \
- lb_address + "/ 2>/dev/null"
+ lb_address + "/ 2>/dev/null"
# self.debug( "SSH into VM public address: %s and port: %s"
# %(.public_ip, vm.public_port))
results.append(ssh_client.execute(cmd_test_http)[0])
@@ -510,7 +502,7 @@ class TestInternalLb(cloudstackTestCase):
""" Calculates and outputs a mean, variance and standard deviation from an input list of values """
num_val = len(data)
mean = sum(data) / num_val
- sqrt = map(lambda x: math.pow(abs(x - mean), 2), data)
+ sqrt = [math.pow(abs(x - mean), 2) for x in data]
variance = (sum(sqrt) / num_val - 1)
stddev = math.sqrt(variance)
return (mean, variance, stddev)
@@ -555,11 +547,11 @@ class TestInternalLb(cloudstackTestCase):
vpc_offering = VpcOffering.create(
self.apiclient,
self.services["vpc_offering"])
+ self.cleanup.append(vpc_offering)
self.logger.debug("Enabling the VPC offering created")
vpc_offering.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, vpc_offering)
self.execute_internallb_roundrobin_tests(vpc_offering)
@attr(tags=["smoke", "advanced"], required_hardware="true")
@@ -573,11 +565,11 @@ class TestInternalLb(cloudstackTestCase):
redundant_vpc_offering = VpcOffering.create(
self.apiclient,
self.services["redundant_vpc_offering"])
+ self.cleanup.append(redundant_vpc_offering)
self.logger.debug("Enabling the Redundant VPC offering created")
redundant_vpc_offering.update(self.apiclient, state='Enabled')
- self.cleanup.insert(0, redundant_vpc_offering)
self.execute_internallb_roundrobin_tests(redundant_vpc_offering)
def execute_internallb_roundrobin_tests(self, vpc_offering):
@@ -600,9 +592,9 @@ class TestInternalLb(cloudstackTestCase):
# Create network tiers
network_guestnet = self.create_network_tier(
- "guestnet_test01", vpc.id, "10.1.1.1", network_offering_guestnet)
+ "guestnet_test01", vpc.id, "10.1.1.1", network_offering_guestnet)
network_internal_lb = self.create_network_tier(
- "intlb_test01", vpc.id, "10.1.2.1", network_offering_intlb)
+ "intlb_test01", vpc.id, "10.1.2.1", network_offering_intlb)
# Create 1 lb client vm in guestnet network tier
client_vm = self.deployvm_in_network(vpc, network_guestnet.id)
@@ -632,7 +624,7 @@ class TestInternalLb(cloudstackTestCase):
self.setup_http_daemon(vm)
# Create a internal loadbalancer in the internal lb network tier
- applb = self.create_internal_loadbalancer( private_http_port, public_lb_port, algorithm, network_internal_lb.id)
+ applb = self.create_internal_loadbalancer(private_http_port, public_lb_port, algorithm, network_internal_lb.id)
# wait for the loadbalancer to boot and be configured
time.sleep(10)
# Assign the 2 VMs to the Internal Load Balancer
@@ -657,10 +649,6 @@ class TestInternalLb(cloudstackTestCase):
self.logger.debug("Remove virtual machines from LB: %s" % applb.id)
applb.remove(self.apiclient, vms=app_vms)
- # Remove the Load Balancer
- self.logger.debug("Deleting LB: %s" % applb.id)
- applb.delete(self.apiclient)
-
def get_lb_stats_settings(self):
self.logger.debug("Retrieving haproxy stats settings")
settings = {}
@@ -688,10 +676,10 @@ class TestInternalLb(cloudstackTestCase):
word_to_verify = "uptime"
url = "http://" + stats_ip + ":" + \
- settings["stats_port"] + settings["stats_uri"]
+ settings["stats_port"] + settings["stats_uri"]
get_contents = "/usr/bin/wget -T3 -qO- --user=" + \
- settings["username"] + " --password=" + \
- settings["password"] + " " + url
+ settings["username"] + " --password=" + \
+ settings["password"] + " " + url
try:
self.logger.debug(
"Trying to connect to the haproxy stats url %s" % url)
@@ -724,6 +712,7 @@ class TestInternalLb(cloudstackTestCase):
vpc_offering = VpcOffering.create(
self.apiclient,
self.services["vpc_offering"])
+ self.cleanup.append(vpc_offering)
self.logger.debug("Enabling the VPC offering created")
vpc_offering.update(self.apiclient, state='Enabled')
@@ -745,6 +734,7 @@ class TestInternalLb(cloudstackTestCase):
redundant_vpc_offering = VpcOffering.create(
self.apiclient,
self.services["redundant_vpc_offering"])
+ self.cleanup.append(redundant_vpc_offering)
self.logger.debug("Enabling the Redundant VPC offering created")
redundant_vpc_offering.update(self.apiclient, state='Enabled')
@@ -776,7 +766,7 @@ class TestInternalLb(cloudstackTestCase):
# Create network tier with internal lb service enabled
network_internal_lb = self.create_network_tier(
- "intlb_test02", vpc.id, network_gw, network_offering_intlb)
+ "intlb_test02", vpc.id, network_gw, network_offering_intlb)
# Create 1 lb vm in internal lb network tier
vm = self.deployvm_in_network(vpc, network_internal_lb.id)
@@ -808,15 +798,7 @@ class TestInternalLb(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- try:
- cls.logger.debug("Cleaning up class resources")
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Cleanup failed with %s" % e)
+ super(TestInternalLb, cls).tearDownClass()
def tearDown(self):
- try:
- self.logger.debug("Cleaning up test resources")
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Cleanup failed with %s" % e)
+ super(TestInternalLb, self).tearDown()
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index 53e42cb1cb3..c592b6bc606 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -18,7 +18,8 @@
"""
# Import Local Modules
from marvin.cloudstackException import GetDetailExceptionInfo
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones, updateIso, extractIso, updateIsoPermissions, copyIso, deleteIso,\
registerIso,listOsTypes
from marvin.lib.utils import cleanup_resources, random_gen, get_hypervisor_type,validateList
@@ -29,7 +30,7 @@ from marvin.lib.common import (get_domain,
list_os_types)
from nose.plugins.attrib import attr
from marvin.codes import PASS
-import urllib
+import urllib.request, urllib.parse, urllib.error
# Import System modules
import time
@@ -260,7 +261,7 @@ class TestISO(cloudstackTestCase):
isready="true"
)
status = validateList(list_default_iso_response)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Check if ISO exists in ListIsos")
@@ -404,8 +405,8 @@ class TestISO(cloudstackTestCase):
try:
# Format URL to ASCII to retrieve response code
- formatted_url = urllib.unquote_plus(list_extract_response.url)
- url_response = urllib.urlopen(formatted_url)
+ formatted_url = urllib.parse.unquote_plus(list_extract_response.url)
+ url_response = urllib.request.urlopen(formatted_url)
response_code = url_response.getcode()
except Exception:
self.fail(
@@ -515,9 +516,7 @@ class TestISO(cloudstackTestCase):
self.skipTest(
"Not enough zones available to perform copy template")
- self.services["destzoneid"] = filter(
- lambda z: z.id != self.zone.id,
- self.zones)[0].id
+ self.services["destzoneid"] = [z for z in self.zones if z.id != self.zone.id][0].id
self.debug("Copy ISO from %s to %s" % (
self.zone.id,
@@ -688,8 +687,8 @@ class TestCreateISOWithChecksum(cloudstackTestCase):
try:
self.download(self.apiclient, iso.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under iso download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under iso download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under iso download ")
@@ -701,8 +700,8 @@ class TestCreateISOWithChecksum(cloudstackTestCase):
try:
self.download(self.apiclient, iso.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under iso download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under iso download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under iso download ")
@@ -714,8 +713,8 @@ class TestCreateISOWithChecksum(cloudstackTestCase):
try:
self.download(self.apiclient, iso.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under iso download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under iso download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under iso download ")
@@ -777,4 +776,4 @@ class TestCreateISOWithChecksum(cloudstackTestCase):
else:
retries = retries - 1
- raise Exception("Template download failed exception.")
\ No newline at end of file
+ raise Exception("Template download failed exception.")
diff --git a/test/integration/smoke/test_kubernetes_clusters.py b/test/integration/smoke/test_kubernetes_clusters.py
index 55394c6f323..5ec2d49b039 100644
--- a/test/integration/smoke/test_kubernetes_clusters.py
+++ b/test/integration/smoke/test_kubernetes_clusters.py
@@ -17,7 +17,8 @@
""" Tests for Kubernetes supported version """
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (listInfrastructure,
listTemplates,
listKubernetesSupportedVersions,
@@ -245,7 +246,7 @@ class TestKubernetesCluster(cloudstackTestCase):
hypervisor = cls.hypervisor.lower()
- if hypervisor not in cks_templates.keys():
+ if hypervisor not in list(cks_templates.keys()):
cls.debug("Provided hypervisor has no CKS template")
return FAILED, False
diff --git a/test/integration/smoke/test_kubernetes_supported_versions.py b/test/integration/smoke/test_kubernetes_supported_versions.py
index ffeb00599d4..a6e47866673 100644
--- a/test/integration/smoke/test_kubernetes_supported_versions.py
+++ b/test/integration/smoke/test_kubernetes_supported_versions.py
@@ -17,7 +17,8 @@
""" Tests for Kubernetes supported version """
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import (listInfrastructure,
listKubernetesSupportedVersions,
addKubernetesSupportedVersion,
diff --git a/test/integration/smoke/test_login.py b/test/integration/smoke/test_login.py
index 5855feabd9f..40d8349a13d 100644
--- a/test/integration/smoke/test_login.py
+++ b/test/integration/smoke/test_login.py
@@ -69,7 +69,7 @@ class TestLogin(cloudstackTestCase):
try:
resp = session.post(self.server_url, params=args, verify=False)
- except requests.exceptions.ConnectionError, e:
+ except requests.exceptions.ConnectionError as e:
self.fail("Failed to attempt login request to mgmt server")
return None, None
diff --git a/test/integration/smoke/test_migration.py b/test/integration/smoke/test_migration.py
index ab5532a16cd..3b21a0b3936 100644
--- a/test/integration/smoke/test_migration.py
+++ b/test/integration/smoke/test_migration.py
@@ -18,7 +18,8 @@
""" Network migration test
"""
# Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
@@ -228,12 +229,12 @@ class TestNetworkMigration(cloudstackTestCase):
domainid=self.account.domainid,
id=deployVmResponse.id
)
- self.assert_(len(vms) > 0, "There are no Vms deployed in the account"
+ self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account"
" %s" % self.account.name)
vm = vms[0]
- self.assert_(vm.id == str(deployVmResponse.id),
+ self.assertTrue(vm.id == str(deployVmResponse.id),
"Vm deployed is different from the test")
- self.assert_(vm.state == "Running", "VM is not in Running state")
+ self.assertTrue(vm.state == "Running", "VM is not in Running state")
self.migrate_network(
self.network_offering_nouserdata,
diff --git a/test/integration/smoke/test_nested_virtualization.py b/test/integration/smoke/test_nested_virtualization.py
index 10dcf895ed9..547c05d9a8a 100644
--- a/test/integration/smoke/test_nested_virtualization.py
+++ b/test/integration/smoke/test_nested_virtualization.py
@@ -108,8 +108,8 @@ class TestNestedVirtualization(cloudstackTestCase):
serviceofferingid=self.service_offering.id,
mode=self.services['mode']
)
- self.assert_(virtual_machine is not None, "VM failed to deploy")
- self.assert_(virtual_machine.state == 'Running', "VM is not running")
+ self.assertTrue(virtual_machine is not None, "VM failed to deploy")
+ self.assertTrue(virtual_machine.state == 'Running', "VM is not running")
self.logger.debug("Deployed vm: %s" % virtual_machine.id)
isolated_network = Network.create(
@@ -137,7 +137,7 @@ class TestNestedVirtualization(cloudstackTestCase):
self.rollback_nested_configurations(rollback_nv, rollback_nv_per_vm)
#5) Check for CPU flags: vmx for Intel and svm for AMD indicates nested virtualization is enabled
- self.assert_(result is not None, "Empty result for CPU flags")
+ self.assertTrue(result is not None, "Empty result for CPU flags")
res = str(result)
self.assertTrue('vmx' in res or 'svm' in res)
except Exception as e:
@@ -157,5 +157,5 @@ class TestNestedVirtualization(cloudstackTestCase):
def tearDownClass(cls):
try:
cleanup_resources(cls.apiclient, cls.cleanup)
- except Exception, e:
+ except Exception as e:
raise Exception("Cleanup failed with %s" % e)
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 3799ff7648b..9bd053b4f76 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -1741,7 +1741,7 @@ class TestPrivateVlansL2Networks(cloudstackTestCase):
return len(response) == 3
def enable_l2_nic(self, vm):
- vm_ip = list(filter(lambda x: x['networkid'] == self.isolated_network.id, vm.nic))[0]['ipaddress']
+ vm_ip = list([x for x in vm.nic if x['networkid'] == self.isolated_network.id])[0]['ipaddress']
ssh_client = vm.get_ssh_client()
eth_device = "eth0"
if len(ssh_client.execute("/sbin/ifconfig %s | grep %s" % (eth_device, vm_ip))) > 0:
diff --git a/test/integration/smoke/test_network_acl.py b/test/integration/smoke/test_network_acl.py
index 7b8aa369125..0914f4dc2d4 100644
--- a/test/integration/smoke/test_network_acl.py
+++ b/test/integration/smoke/test_network_acl.py
@@ -62,11 +62,11 @@ class TestNetworkACL(cloudstackTestCase):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering")
+ self.assertTrue(networkOffering is not None and len(networkOffering) > 0, "No VPC based network offering")
# 1) Create VPC
vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
- self.assert_(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found")
+ self.assertTrue(vpcOffering is not None and len(vpcOffering)>0, "No VPC offerings found")
self.services["vpc"] = {}
self.services["vpc"]["name"] = "vpc-networkacl"
self.services["vpc"]["displaytext"] = "vpc-networkacl"
@@ -80,7 +80,7 @@ class TestNetworkACL(cloudstackTestCase):
account=self.account.name,
domainid=self.domain.id
)
- self.assert_(vpc is not None, "VPC creation failed")
+ self.assertTrue(vpc is not None, "VPC creation failed")
# 2) Create ACL
aclgroup = NetworkACLList.create(apiclient=self.apiclient, services={}, name="acl", description="acl", vpcid=vpc.id)
@@ -121,13 +121,13 @@ class TestNetworkACL(cloudstackTestCase):
domainid= self.domain.id,
serviceofferingid=self.service_offering.id,
)
- self.assert_(vm is not None, "VM failed to deploy")
- self.assert_(vm.state == 'Running', "VM is not running")
+ self.assertTrue(vm is not None, "VM failed to deploy")
+ self.assertTrue(vm.state == 'Running', "VM is not running")
self.debug("VM %s deployed in VPC %s" %(vm.id, vpc.id))
@classmethod
def tearDownClass(cls):
try:
cleanup_resources(cls.apiclient, cls.cleanup)
- except Exception, e:
+ except Exception as e:
raise Exception("Cleanup failed with %s" % e)
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index b24c3fa3425..ec7af5498d6 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -34,7 +34,7 @@ import sys
import logging
import time
import threading
-import Queue
+from queue import Queue
class TestNic(cloudstackTestCase):
@@ -374,7 +374,7 @@ class TestNic(cloudstackTestCase):
# Start multiple networks
tsize = 8
- queue = Queue.Queue()
+ queue = Queue()
for _ in range(tsize):
worker = NetworkMaker(queue, createNetwork)
worker.setDaemon(True)
diff --git a/test/integration/smoke/test_nic_adapter_type.py b/test/integration/smoke/test_nic_adapter_type.py
index 933b8d97894..0101cfecbcc 100644
--- a/test/integration/smoke/test_nic_adapter_type.py
+++ b/test/integration/smoke/test_nic_adapter_type.py
@@ -22,7 +22,8 @@
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.base import (
Account,
ServiceOffering,
diff --git a/test/integration/smoke/test_non_contigiousvlan.py b/test/integration/smoke/test_non_contigiousvlan.py
index c7a5467b110..3838e431655 100644
--- a/test/integration/smoke/test_non_contigiousvlan.py
+++ b/test/integration/smoke/test_non_contigiousvlan.py
@@ -53,25 +53,25 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
phy_network = network
break
- self.assert_(phy_network is not None, msg="No network with vlan found")
+ self.assertTrue(phy_network is not None, msg="No network with vlan found")
self.network = phy_network
self.networkid = phy_network.id
self.existing_vlan = phy_network.vlan
vlan1 = self.existing_vlan+","+self.vlan["partial_range"][0]
updatePhysicalNetworkResponse = self.network.update(self.apiClient, id = self.networkid, vlan = vlan1)
- self.assert_(updatePhysicalNetworkResponse is not None,
+ self.assertTrue(updatePhysicalNetworkResponse is not None,
msg="couldn't extend the physical network with vlan %s"%vlan1)
- self.assert_(isinstance(self.network, PhysicalNetwork))
+ self.assertTrue(isinstance(self.network, PhysicalNetwork))
vlan2 = vlan1+","+self.vlan["partial_range"][1]
updatePhysicalNetworkResponse2 = self.network.update(self.apiClient, id = self.networkid, vlan = vlan2)
- self.assert_(updatePhysicalNetworkResponse2 is not None,
+ self.assertTrue(updatePhysicalNetworkResponse2 is not None,
msg="couldn't extend the physical network with vlan %s"%vlan2)
- self.assert_(isinstance(self.network, PhysicalNetwork))
+ self.assertTrue(isinstance(self.network, PhysicalNetwork))
vlanranges= updatePhysicalNetworkResponse2.vlan
- self.assert_(vlanranges is not None,
+ self.assertTrue(vlanranges is not None,
"No VLAN ranges found on the deployment")
@@ -86,6 +86,6 @@ class TestUpdatePhysicalNetwork(cloudstackTestCase):
self.network = phy_networks[0]
self.networkid = phy_networks[0].id
updateResponse = self.network.update(self.apiClient, id = self.networkid, vlan=self.existing_vlan)
- self.assert_(updateResponse.vlan.find(self.vlan["full_range"]) < 0,
+ self.assertTrue(updateResponse.vlan.find(self.vlan["full_range"]) < 0,
"VLAN was not removed successfully")
diff --git a/test/integration/smoke/test_outofbandmanagement.py b/test/integration/smoke/test_outofbandmanagement.py
index a52e3b1f643..ef5bb52ebad 100644
--- a/test/integration/smoke/test_outofbandmanagement.py
+++ b/test/integration/smoke/test_outofbandmanagement.py
@@ -30,7 +30,7 @@ from ipmisim.ipmisim import IpmiServerContext, IpmiServer, ThreadedIpmiServer
import random
import socket
import sys
-import thread
+import _thread
import time
@@ -60,7 +60,7 @@ class TestOutOfBandManagement(cloudstackTestCase):
IpmiServerContext('reset')
ThreadedIpmiServer.allow_reuse_address = True
server = ThreadedIpmiServer(('0.0.0.0', cls.serverPort), IpmiServer)
- thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
+ _thread.start_new_thread(startIpmiServer, ("ipmi-server", server,))
cls.server = server
@@ -497,7 +497,7 @@ class TestOutOfBandManagement(cloudstackTestCase):
currentMsHosts = []
mshosts = self.dbclient.execute("select msid from mshost where version='%s' and removed is NULL and state='Up'" % (cloudstackVersion))
if len(mshosts) > 0:
- currentMsHosts = map(lambda row: row[0], mshosts)
+ currentMsHosts = [row[0] for row in mshosts]
# Inject fake ms host
self.dbclient.execute("insert into mshost (msid,runid,name,state,version,service_ip,service_port,last_update) values (%s,%s,'oobm-marvin-fakebox', 'Down', '%s', '127.0.0.1', '22', NOW())" % (self.getFakeMsId(), self.getFakeMsRunId(), cloudstackVersion))
diff --git a/test/integration/smoke/test_outofbandmanagement_nestedplugin.py b/test/integration/smoke/test_outofbandmanagement_nestedplugin.py
index 13fb9dd0b85..3df090a950c 100644
--- a/test/integration/smoke/test_outofbandmanagement_nestedplugin.py
+++ b/test/integration/smoke/test_outofbandmanagement_nestedplugin.py
@@ -23,11 +23,11 @@ from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
-from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
+from http.server import BaseHTTPRequestHandler,HTTPServer
import socket
import sys
-import thread
+import _thread
import time
@@ -56,7 +56,7 @@ class MockedCloudStackServer(BaseHTTPRequestHandler):
self.end_headers()
json = "{\"listvirtualmachinesresponse\":{\"count\":1,\"virtualmachine\":[{\"id\":\"some-uuid\",\"name\":\"test-vm\",\"state\":\"%s\"}]}}" % state
- self.wfile.write(json)
+ self.wfile.write(json.encode())
def log_message(self, format, *args):
return
@@ -169,7 +169,7 @@ class TestOutOfBandManagement(cloudstackTestCase):
server.serve_forever()
except Exception: pass
server = HTTPServer(('0.0.0.0', self.getServerPort()), MockedCloudStackServer)
- thread.start_new_thread(startMgmtServer, ("mocked-mgmt-server", server,))
+ _thread.start_new_thread(startMgmtServer, ("mocked-mgmt-server", server,))
self.server = server
diff --git a/test/integration/smoke/test_over_provisioning.py b/test/integration/smoke/test_over_provisioning.py
index 43d558e6715..94e4096b1ef 100644
--- a/test/integration/smoke/test_over_provisioning.py
+++ b/test/integration/smoke/test_over_provisioning.py
@@ -111,8 +111,8 @@ class TestUpdateOverProvision(cloudstackTestCase):
factorOld = 0
if pool.overprovisionfactor is not None:
factorOld = float(str(pool.overprovisionfactor))
- factorNew = str(factorOld - 1.0)
+ factorNew = (factorOld - 1.0)
if factorNew > 0:
- updateConfigurationCmd.value = factorNew
+ updateConfigurationCmd.value = str(factorNew)
updateConfigurationCmd.storageid = pool.id
updateConfigurationResponse = self.apiClient.updateConfiguration(updateConfigurationCmd)
diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py
index be37773484f..d45d38dd9b5 100644
--- a/test/integration/smoke/test_portable_publicip.py
+++ b/test/integration/smoke/test_portable_publicip.py
@@ -41,25 +41,20 @@ class TestPortablePublicIPRange(cloudstackTestCase):
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+ cls._cleanup = []
# Create Account
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
- cls._cleanup = [
- cls.account,
- ]
+ cls._cleanup.append(cls.account)
+
return
@classmethod
def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestPortablePublicIPRange,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -68,12 +63,7 @@ class TestPortablePublicIPRange(cloudstackTestCase):
return
def tearDown(self):
- try:
- # Clean up
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestPortablePublicIPRange,self).tearDown()
@attr(tags = ["basic", "advanced", "portablepublicip"], required_hardware="false")
def test_createPortablePublicIPRange(self):
@@ -84,11 +74,13 @@ class TestPortablePublicIPRange(cloudstackTestCase):
self.apiclient,
self.services
)
+ # cleanup by this test
self.debug("attempting to verify portable Public IP range is created")
list_portbale_ip_range_response = PortablePublicIpRange.list(
self.apiclient,
id=self.portable_ip_range.id
)
+ # no verification? what can we do?
self.portable_ip_range.delete(self.apiclient)
return
@@ -108,18 +100,21 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
# Get Zone, Domain
cls.domain = get_domain(cls.apiclient)
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
+ cls._cleanup = []
# Create Account
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
+ cls._cleanup.append(cls.account)
cls.services["network"]["zoneid"] = cls.zone.id
cls.network_offering = NetworkOffering.create(
cls.apiclient,
cls.services["network_offering"],
)
+ cls._cleanup.append(cls.network_offering)
# Enable Network offering
cls.network_offering.update(cls.apiclient, state='Enabled')
@@ -130,22 +125,13 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
cls.account.name,
cls.account.domainid
)
- cls._cleanup = [
- cls.account_network,
- cls.network_offering,
- cls.account
- ]
+ cls._cleanup.append(cls.account_network)
return
@classmethod
def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestPortablePublicIPAcquire,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -154,12 +140,7 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
return
def tearDown(self):
- try:
- # Clean up
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestPortablePublicIPAcquire,self).tearDown()
@attr(tags = ["advanced", "portablepublicip"], required_hardware="false")
def test_createPortablePublicIPAcquire(self):
@@ -170,10 +151,11 @@ class TestPortablePublicIPAcquire(cloudstackTestCase):
self.apiclient,
self.services
)
-
+ # cleaned up in this method
ip_address = PublicIPAddress.create(self.apiclient, self.account.name,
self.zone.id, self.account.domainid, isportable=True)
-
+ # cleaned up in this method
+ # no verifications done!
ip_address.delete(self.apiclient)
self.portable_ip_range.delete(self.apiclient)
return
diff --git a/test/integration/smoke/test_portforwardingrules.py b/test/integration/smoke/test_portforwardingrules.py
index 8aaa088a3d3..c162dbf568a 100644
--- a/test/integration/smoke/test_portforwardingrules.py
+++ b/test/integration/smoke/test_portforwardingrules.py
@@ -130,7 +130,7 @@ class TestPortForwardingRules(cloudstackTestCase):
if len(expected_vals) != len(actual_vals):
return False
- keys = expected_vals.keys()
+ keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]]
@@ -187,7 +187,7 @@ class TestPortForwardingRules(cloudstackTestCase):
zoneid=self.zone.id
)
status = validateList(network_offerings_list)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Isolated Network Offerings with sourceNat,\
@@ -252,7 +252,7 @@ class TestPortForwardingRules(cloudstackTestCase):
listall=self.services["listall"]
)
status = validateList(list_ipaddresses_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"IP Addresses Association Failed"
@@ -285,7 +285,7 @@ class TestPortForwardingRules(cloudstackTestCase):
networkid=network.id
)
status = validateList(list_vms_running)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"VM Created is not in Running state"
@@ -296,7 +296,7 @@ class TestPortForwardingRules(cloudstackTestCase):
len(list_ipaddresses_after),
"VM Created is not in Running state"
)
- self.assertEquals(
+ self.assertEqual(
vm_created.id,
list_vms_running[0].id,
"VM Created is not in Running state"
@@ -365,7 +365,7 @@ class TestPortForwardingRules(cloudstackTestCase):
ipaddressid=associated_ipaddress.ipaddress.id
)
status = validateList(list_prtfwdrule_after)
- self.assertEquals(
+ self.assertEqual(
PASS,
status[0],
"Failed to create Port Forwarding Rule"
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 79778e55583..7c0a9487af6 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -527,7 +527,7 @@ class TestStorageTags(cloudstackTestCase):
self.debug("Expected exception %s: " % e)
self.debug("Asssert that vm2 was not deployed, so it couldn't be appended to cleanup")
- self.assertEquals(cleanup_size, len(self.cleanup))
+ self.assertEqual(cleanup_size, len(self.cleanup))
# Create V-1 using DO-1
self.volume_1 = Volume.create(
@@ -567,7 +567,7 @@ class TestStorageTags(cloudstackTestCase):
listall=True
)
self.debug("VM-1 Volumes: %s" % vm_1_volumes)
- self.assertEquals(None, vm_1_volumes, "Check that volume V-2 has not been attached to VM-1")
+ self.assertEqual(None, vm_1_volumes, "Check that volume V-2 has not been attached to VM-1")
# Attach V_1 to VM_1
self.virtual_machine_1.attach_volume(self.apiclient, self.volume_1)
@@ -578,7 +578,7 @@ class TestStorageTags(cloudstackTestCase):
listall=True
)
self.debug("VM-1 Volumes: %s" % vm_1_volumes)
- self.assertEquals(vm_1_volumes[0].id, self.volume_1.id, "Check that volume V-1 has been attached to VM-1")
+ self.assertEqual(vm_1_volumes[0].id, self.volume_1.id, "Check that volume V-1 has been attached to VM-1")
self.virtual_machine_1.detach_volume(self.apiclient, self.volume_1)
return
@@ -586,9 +586,9 @@ class TestStorageTags(cloudstackTestCase):
def check_storage_pool_tag(self, poolid, tag):
cmd = listStorageTags.listStorageTagsCmd()
storage_tags_response = self.apiclient.listStorageTags(cmd)
- pool_tags = filter(lambda x: x.poolid == poolid, storage_tags_response)
- self.assertEquals(1, len(pool_tags), "Check storage tags size")
- self.assertEquals(tag, pool_tags[0].name, "Check storage tag on storage pool")
+ pool_tags = [x for x in storage_tags_response if x.poolid == poolid]
+ self.assertEqual(1, len(pool_tags), "Check storage tags size")
+ self.assertEqual(tag, pool_tags[0].name, "Check storage tag on storage pool")
@attr(tags=["advanced", "advancedns", "smoke", "basic", "sg"], required_hardware="false")
@skipTestIf("hypervisorNotSupported")
@@ -600,7 +600,7 @@ class TestStorageTags(cloudstackTestCase):
"select id from storage_pool where uuid = '%s';"
% str(self.storage_pool_1.id)
)
- self.assertEquals(1, len(qresultset), "Check DB Query result set")
+ self.assertEqual(1, len(qresultset), "Check DB Query result set")
qresult = qresultset[0]
storage_pool_db_id = qresult[0]
@@ -673,11 +673,11 @@ class TestStorageTags(cloudstackTestCase):
self.apiclient,
id=vol.id
)
- pools_suitable = filter(lambda p: p.suitableformigration, pools_response)
+ pools_suitable = [p for p in pools_response if p.suitableformigration]
self.debug("Suitable storage pools found: %s" % len(pools_suitable))
- self.assertEquals(1, len(pools_suitable), "Check that there is only one item on the list")
- self.assertEquals(pools_suitable[0].id, storage_pool_2.id, "Check that PS-2 is the migration option for volume")
+ self.assertEqual(1, len(pools_suitable), "Check that there is only one item on the list")
+ self.assertEqual(pools_suitable[0].id, storage_pool_2.id, "Check that PS-2 is the migration option for volume")
# Update PS-2 Storage Tags
StoragePool.update(
@@ -691,9 +691,9 @@ class TestStorageTags(cloudstackTestCase):
self.apiclient,
id=vol.id
)
- pools_suitable = filter(lambda p: p.suitableformigration, pools_response)
+ pools_suitable = [p for p in pools_response if p.suitableformigration]
self.debug("Suitable storage pools found: %s" % len(pools_suitable))
- self.assertEquals(0, len(pools_suitable), "Check that there is no migration option for volume")
+ self.assertEqual(0, len(pools_suitable), "Check that there is no migration option for volume")
return
diff --git a/test/integration/smoke/test_privategw_acl.py b/test/integration/smoke/test_privategw_acl.py
index b6860c8b437..1111a488c90 100644
--- a/test/integration/smoke/test_privategw_acl.py
+++ b/test/integration/smoke/test_privategw_acl.py
@@ -253,7 +253,7 @@ class TestPrivateGwACL(cloudstackTestCase):
)
# Find all the vlans that are for dynamic vlan allocation
- dc_vlans = sorted(map(lambda x: x[0], qresultset))
+ dc_vlans = sorted([x[0] for x in qresultset])
# Use VLAN id that is not in physical network vlan range for dynamic vlan allocation
vlan_1 = int(physical_network.vlan.split('-')[-1]) + 1
@@ -343,7 +343,7 @@ class TestPrivateGwACL(cloudstackTestCase):
)
# Find all the vlans that are for dynamic vlan allocation
- dc_vlans = sorted(map(lambda x: x[0], qresultset))
+ dc_vlans = sorted([x[0] for x in qresultset])
# Use VLAN id that is not in physical network vlan range for dynamic vlan allocation
vlan_1 = int(physical_network.vlan.split('-')[-1]) + 1
@@ -401,7 +401,7 @@ class TestPrivateGwACL(cloudstackTestCase):
)
# Find all the vlans that are for dynamic vlan allocation
- dc_vlans = sorted(map(lambda x: x[0], qresultset))
+ dc_vlans = sorted([x[0] for x in qresultset])
# Use VLAN id that is not in physical network vlan range for dynamic vlan allocation
vlan_1 = int(physical_network.vlan.split('-')[-1]) + 1
@@ -522,7 +522,7 @@ class TestPrivateGwACL(cloudstackTestCase):
domainid=self.account.domainid)
self.logger.debug("Created VPC with ID: %s" % vpc.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create VPC due to %s ' % e)
return vpc
@@ -539,7 +539,7 @@ class TestPrivateGwACL(cloudstackTestCase):
networkids=[str(network.id)]
)
self.logger.debug("Created VM with ID: %s" % vm.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create virtual machine due to %s ' % e)
return vm
@@ -554,7 +554,7 @@ class TestPrivateGwACL(cloudstackTestCase):
self.assertIsNotNone(staticRoute.id, "Failed to create static route.")
self.logger.debug("Created staticRoute with ID: %s" % staticRoute.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create static route due to %s ' % e)
return staticRoute
@@ -569,7 +569,7 @@ class TestPrivateGwACL(cloudstackTestCase):
self.assertIsNotNone(acl.id, "Failed to create ACL.")
self.logger.debug("Created ACL with ID: %s" % acl.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create ACL due to %s ' % e)
return acl
@@ -586,7 +586,7 @@ class TestPrivateGwACL(cloudstackTestCase):
self.assertIsNotNone(aclItem.id, "Failed to create ACL item.")
self.logger.debug("Created ACL Item ID: %s" % aclItem.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create ACL Item due to %s ' % e)
def createNetwork(self, vpc, net_offering = "network_offering", gateway = '10.1.1.1'):
@@ -618,7 +618,7 @@ class TestPrivateGwACL(cloudstackTestCase):
)
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
self.cleanup.insert(0, nw_off)
diff --git a/test/integration/smoke/test_projects.py b/test/integration/smoke/test_projects.py
index f4c340da756..05004a44118 100644
--- a/test/integration/smoke/test_projects.py
+++ b/test/integration/smoke/test_projects.py
@@ -259,8 +259,8 @@ class TestMultipleProjectCreation(cloudstackTestCase):
"Check list project response returns a valid project"
)
- self.assert_(isinstance(self.user.user, list))
- self.assert_(len(self.user.user) > 0,
+ self.assertTrue(isinstance(self.user.user, list))
+ self.assertTrue(len(self.user.user) > 0,
msg="Account %s has no users" % self.user.name)
self.debug(
"Adding account %s to project with email %s" %
diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py
index c8fce47d09a..f0ed939f0fc 100644
--- a/test/integration/smoke/test_public_ip_range.py
+++ b/test/integration/smoke/test_public_ip_range.py
@@ -40,25 +40,19 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
cls.services["zoneid"] = cls.zone.id
cls.pod = get_pod(cls.apiclient, cls.zone.id)
+ cls._cleanup = []
# Create Account
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=cls.domain.id
)
- cls._cleanup = [
- cls.account,
- ]
+ cls._cleanup.append(cls.account)
return
@classmethod
def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestDedicatePublicIPRange,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -67,12 +61,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
return
def tearDown(self):
- try:
- # Clean up
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestDedicatePublicIPRange,self).tearDown()
@attr(tags = ["advanced", "publiciprange", "dedicate", "release"], required_hardware="false")
def test_dedicatePublicIpRange(self):
@@ -93,6 +82,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
self.apiclient,
self.services
)
+ self._cleanup.append(self.public_ip_range)
list_public_ip_range_response = PublicIpRange.list(
self.apiclient,
id=self.public_ip_range.vlan.id
@@ -143,10 +133,6 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
"system",
"Check account name is system account in listVlanIpRanges"
)
-
- self.debug("Deleting Public IP range");
- self.public_ip_range.delete(self.apiclient)
-
return
@attr(tags = ["advanced", "publiciprange", "dedicate", "release"], required_hardware="false")
@@ -173,6 +159,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
services,
forsystemvms = True
)
+ self.cleanup.append(self.public_ip_range)
created_ip_range_response = PublicIpRange.list(
self.apiclient,
id = self.public_ip_range.vlan.id
@@ -186,10 +173,7 @@ class TestDedicatePublicIPRange(cloudstackTestCase):
created_ip_range_response[0].forsystemvms,
"Check forsystemvms parameter in created vlan ip range"
)
-
- # Delete range
- self.public_ip_range.delete(self.apiclient)
-
+
def get_ip_as_number(self, ip_string):
""" Return numeric value for ip (passed as a string)
"""
diff --git a/test/integration/smoke/test_pvlan.py b/test/integration/smoke/test_pvlan.py
index 0ed4b441c4c..d7d5d3efb03 100644
--- a/test/integration/smoke/test_pvlan.py
+++ b/test/integration/smoke/test_pvlan.py
@@ -17,18 +17,14 @@
""" test for private vlan isolation
"""
#Import Local Modules
-import marvin
from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import CloudstackAPIException
from marvin.cloudstackAPI import *
-from marvin.sshClient import SshClient
from marvin.lib.utils import *
from marvin.lib.base import *
from marvin.lib.common import *
from nose.plugins.attrib import attr
-import telnetlib
-#Import System modules
-import time
_multiprocess_shared_ = True
class TestPVLAN(cloudstackTestCase):
@@ -78,5 +74,5 @@ class TestPVLAN(cloudstackTestCase):
createNetworkCmd.startipv6="fc00:1234::10"
createNetworkCmd.endipv6="fc00:1234::20"
err = 0
- with self.assertRaises(Exception):
+ with self.assertRaises(CloudstackAPIException):
self.apiClient.createNetwork(createNetworkCmd)
diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py
index a6823c6ea35..36f92e7f68c 100644
--- a/test/integration/smoke/test_regions.py
+++ b/test/integration/smoke/test_regions.py
@@ -43,7 +43,7 @@ class TestRegions(cloudstackTestCase):
self.domain = get_domain(self.apiclient)
self.cleanup = []
- pseudo_random_int = choice(xrange(2, 200))
+ pseudo_random_int = choice(range(2, 200))
self.services["region"]["regionid"] = pseudo_random_int
self.services["region"]["regionname"] = "region" + str(pseudo_random_int)
self.services["region"]["regionendpoint"] = "http://region" + str(pseudo_random_int) + ":8080/client"
@@ -107,7 +107,7 @@ class TestRegions(cloudstackTestCase):
def test_createRegionWithExistingRegionName(self):
"""Test for duplicate checks on region name
"""
- random_int = choice(xrange(2, 200))
+ random_int = choice(range(2, 200))
self.services["region"]["regionid"] = random_int # alter id but not name
self.services["region"]["regionendpoint"] = "http://region" + str(random_int) + ":8080/client"
self.assertRaises(Exception, Region.create, self.apiclient, self.services["region"])
diff --git a/test/integration/smoke/test_routers_iptables_default_policy.py b/test/integration/smoke/test_routers_iptables_default_policy.py
index c077b56e582..a4eda3546bb 100644
--- a/test/integration/smoke/test_routers_iptables_default_policy.py
+++ b/test/integration/smoke/test_routers_iptables_default_policy.py
@@ -576,7 +576,7 @@ class EntityManager(object):
vpcid=vpc_id)
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
raise Exception('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index 2b2ced5ee34..64ab380b541 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -264,4 +264,4 @@ class TestScaleVm(cloudstackTestCase):
'Running',
"Check the state of VM"
)
- return
\ No newline at end of file
+ return
diff --git a/test/integration/smoke/test_secondary_storage.py b/test/integration/smoke/test_secondary_storage.py
index baa0f98935e..5b339ae67b9 100644
--- a/test/integration/smoke/test_secondary_storage.py
+++ b/test/integration/smoke/test_secondary_storage.py
@@ -184,7 +184,7 @@ class TestSecStorageServices(cloudstackTestCase):
hypervisors[cluster.hypervisor] = "self"
for zid in self.zones:
- for k, v in hypervisors.items():
+ for k, v in list(hypervisors.items()):
self.debug("Checking BUILTIN templates in zone: %s" %zid)
list_template_response = list_templates(
self.apiclient,
diff --git a/test/integration/smoke/test_ssvm.py b/test/integration/smoke/test_ssvm.py
index 0392d9eb9f1..d98c09062eb 100644
--- a/test/integration/smoke/test_ssvm.py
+++ b/test/integration/smoke/test_ssvm.py
@@ -470,27 +470,46 @@ class TestSSVMs(cloudstackTestCase):
if self.hypervisor.lower() in ('vmware', 'hyperv'):
# SSH into SSVMs is done via management server for Vmware and
# Hyper-V
- result = get_process_status(
- self.apiclient.connection.mgtSvr,
- 22,
- self.apiclient.connection.user,
- self.apiclient.connection.passwd,
- ssvm.privateip,
- "systemctl is-active cloud",
- hypervisor=self.hypervisor
- )
+ retries = 3
+ while retries > -1:
+ result = get_process_status(
+ self.apiclient.connection.mgtSvr,
+ 22,
+ self.apiclient.connection.user,
+ self.apiclient.connection.passwd,
+ ssvm.privateip,
+ "systemctl is-active cloud",
+ hypervisor=self.hypervisor
+ )
+ if ("deactivating" in result) or ("activating" in result):
+ if retries >= 0:
+ retries = retries - 1
+ time.sleep(10)
+ continue
+ else:
+ return result
else:
try:
host.user, host.passwd = get_host_credentials(
self.config, host.ipaddress)
- result = get_process_status(
- host.ipaddress,
- 22,
- host.user,
- host.passwd,
- ssvm.linklocalip,
- "systemctl is-active cloud"
- )
+ retries = 3
+ while retries > -1:
+ result = get_process_status(
+ host.ipaddress,
+ 22,
+ host.user,
+ host.passwd,
+ ssvm.linklocalip,
+ "systemctl is-active cloud"
+ )
+ print("result is %s" % result)
+ if ("deactivating" in result) or ("activating" in result):
+ if retries >= 0:
+ retries = retries - 1
+ time.sleep(10)
+ continue
+ else:
+ return result
except KeyError:
self.skipTest(
"Marvin configuration has no host\
diff --git a/test/integration/smoke/test_staticroles.py b/test/integration/smoke/test_staticroles.py
index 2300da5cd6e..5184b6a6814 100644
--- a/test/integration/smoke/test_staticroles.py
+++ b/test/integration/smoke/test_staticroles.py
@@ -86,7 +86,7 @@ class TestStaticRoles(cloudstackTestCase):
self.roleApiMap = {} # role to list of apis allowed
octetKey = {'Admin':1, 'DomainAdmin':4, 'User':8}
- for role in octetKey.keys():
+ for role in list(octetKey.keys()):
for api in sorted(apiMap.keys()):
if (octetKey[role] & int(apiMap[api])) > 0:
if role not in self.roleApiMap:
@@ -125,8 +125,8 @@ class TestStaticRoles(cloudstackTestCase):
)
self.cleanup.append(account)
userApiClient = self.testClient.getUserApiClient(UserName=account.name, DomainName=account.domain, type=accountType)
- allowedApis = map(lambda x: x.name, userApiClient.listApis(listApis.listApisCmd()))
- allApis = map(lambda x: x.name, self.apiclient.listApis(listApis.listApisCmd()))
+ allowedApis = [x.name for x in userApiClient.listApis(listApis.listApisCmd())]
+ allApis = [x.name for x in self.apiclient.listApis(listApis.listApisCmd())]
for api in self.roleApiMap[role]:
if api not in allApis:
continue
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index 2ea8ed24693..b967ebdc809 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -20,7 +20,8 @@
from marvin.cloudstackException import *
from marvin.cloudstackAPI import *
from marvin.codes import FAILED
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import listZones
from marvin.lib.utils import random_gen, cleanup_resources
from marvin.lib.base import (Account,
@@ -34,7 +35,7 @@ from marvin.lib.common import (get_domain,
get_zone,
get_template)
from nose.plugins.attrib import attr
-import urllib
+import urllib.request, urllib.parse, urllib.error
#Import System modules
import time
from marvin.cloudstackAPI import (createTemplate, listOsTypes)
@@ -144,8 +145,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
try:
self.download(self.apiclient, template.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under template download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under template download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under template download ")
@@ -157,8 +158,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
try:
self.download(self.apiclient, template.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under template download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under template download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under template download ")
@@ -170,8 +171,8 @@ class TestCreateTemplateWithChecksum(cloudstackTestCase):
try:
self.download(self.apiclient, template.id)
except Exception as e:
- print "Negative Test Passed - Exception Occurred Under template download " \
- "%s" % GetDetailExceptionInfo(e)
+ print("Negative Test Passed - Exception Occurred Under template download " \
+ "%s" % GetDetailExceptionInfo(e))
else:
self.fail("Negative Test Failed - Exception DID NOT Occurred Under template download ")
@@ -728,8 +729,8 @@ class TestTemplates(cloudstackTestCase):
try:
# Format URL to ASCII to retrieve response code
- formatted_url = urllib.unquote_plus(list_extract_response.url)
- url_response = urllib.urlopen(formatted_url)
+ formatted_url = urllib.parse.unquote_plus(list_extract_response.url)
+ url_response = urllib.request.urlopen(formatted_url)
response_code = url_response.getcode()
except Exception:
@@ -820,7 +821,7 @@ class TestTemplates(cloudstackTestCase):
if len(self.zones) <= 1:
self.skipTest("Not enough zones available to perform copy template")
- self.services["destzoneid"] = filter(lambda z: z.id != self.services["sourcezoneid"], self.zones)[0].id
+ self.services["destzoneid"] = [z for z in self.zones if z.id != self.services["sourcezoneid"]][0].id
self.debug("Copy template from Zone: %s to %s" % (
self.services["sourcezoneid"],
diff --git a/test/integration/smoke/test_update_security_group.py b/test/integration/smoke/test_update_security_group.py
index 41e4d596907..95bf7b2d924 100644
--- a/test/integration/smoke/test_update_security_group.py
+++ b/test/integration/smoke/test_update_security_group.py
@@ -21,7 +21,8 @@ Tests for updating security group name
# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import updateSecurityGroup, createSecurityGroup
from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList,
diff --git a/test/integration/smoke/test_usage.py b/test/integration/smoke/test_usage.py
index 54139e4737f..2100859ba52 100644
--- a/test/integration/smoke/test_usage.py
+++ b/test/integration/smoke/test_usage.py
@@ -19,7 +19,8 @@
# Import Local Modules
from marvin.codes import FAILED
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.cloudstackAPI import deleteVolume
from marvin.lib.utils import (cleanup_resources,get_hypervisor_type)
from marvin.lib.base import (Account,
diff --git a/test/integration/smoke/test_usage_events.py b/test/integration/smoke/test_usage_events.py
index 0c08fecdc69..94bf75ac3e3 100644
--- a/test/integration/smoke/test_usage_events.py
+++ b/test/integration/smoke/test_usage_events.py
@@ -63,10 +63,7 @@ class TestUsageEvents(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- try:
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestUsageEvents,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -81,13 +78,9 @@ class TestUsageEvents(cloudstackTestCase):
self.cleanup.append(self.account)
def tearDown(self):
- try:
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestUsageEvents,self).tearDown()
- @attr(tags=["advanced, basic"], required_hardware="true")
+ @attr(tags=["advanced", "basic"], required_hardware="true")
def test_01_positive_tests_usage(self):
""" Check events in usage_events table when VM creation fails
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 1b658500f92..d6a78907ad5 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -357,12 +357,7 @@ class TestVMLifeCycle(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.apiclient = super(TestVMLifeCycle, cls).getClsTestClient().getApiClient()
- try:
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
+ super(TestVMLifeCycle, cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -778,7 +773,7 @@ class TestVMLifeCycle(cloudstackTestCase):
(self.virtual_machine.ipaddress, e))
mount_dir = "/mnt/tmp"
cmds = "mkdir -p %s" % mount_dir
- self.assert_(ssh_client.execute(cmds) == [], "mkdir failed within guest")
+ self.assertTrue(ssh_client.execute(cmds) == [], "mkdir failed within guest")
iso_unsupported = False
for diskdevice in self.services["diskdevice"]:
@@ -788,8 +783,9 @@ class TestVMLifeCycle(cloudstackTestCase):
break
if str(res).find("mount: unknown filesystem type 'iso9660'") != -1:
iso_unsupported = True
- self.debug("Test template does not supports iso9660 filesystem. Proceeding with test without mounting.")
- print "Test template does not supports iso9660 filesystem. Proceeding with test without mounting."
+ log_msg = "Test template does not supports iso9660 filesystem. Proceeding with test without mounting."
+ self.debug(log_msg)
+ print(log_msg)
break
else:
self.fail("No mount points matched. Mount was unsuccessful")
@@ -933,11 +929,7 @@ class TestSecuredVmMigration(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.apiclient = super(TestSecuredVmMigration, cls).getClsTestClient().getApiClient()
- try:
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestSecuredVmMigration, cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -951,7 +943,8 @@ class TestSecuredVmMigration(cloudstackTestCase):
self.apiclient,
zoneid=self.zone.id,
type='Routing',
- hypervisor='KVM')
+ hypervisor='KVM',
+ state='Up')
if len(self.hosts) < 2:
self.skipTest("Requires at least two hosts for performing migration related tests")
@@ -962,10 +955,7 @@ class TestSecuredVmMigration(cloudstackTestCase):
def tearDown(self):
self.secure_all_hosts()
self.updateConfiguration("ca.plugin.root.auth.strictness", "true")
- try:
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestSecuredVmMigration, self).tearDown()
def get_target_host(self, secured, virtualmachineid):
target_hosts = Host.listForMigration(self.apiclient,
@@ -983,8 +973,7 @@ class TestSecuredVmMigration(cloudstackTestCase):
if protocol not in resp[0]:
cloudstackTestCase.fail(self, "Libvirt listen protocol expected: '" + protocol + "\n"
- "does not match actual: " +
- resp[0])
+ "does not match actual: " + resp[0])
def migrate_and_check(self, vm, src_host, dest_host, proto='tls'):
"""
@@ -997,7 +986,6 @@ class TestSecuredVmMigration(cloudstackTestCase):
def waitUntilHostInState(self, hostId, state="Up", interval=5, retries=20):
while retries > -1:
- print("Waiting for host: %s to be %s. %s retries left." % (hostId, state, retries))
time.sleep(interval)
host = Host.list(
self.apiclient,
@@ -1015,12 +1003,17 @@ class TestSecuredVmMigration(cloudstackTestCase):
def unsecure_host(self, host):
SshClient(host.ipaddress, port=22, user=self.hostConfig["username"], passwd=self.hostConfig["password"]) \
.execute("rm -f /etc/cloudstack/agent/cloud* && \
+ service cloudstack-agent stop ; \
+ service libvirtd stop ; \
+ service libvirt-bin stop ; \
sed -i 's/listen_tls.*/listen_tls=0/g' /etc/libvirt/libvirtd.conf && \
sed -i 's/listen_tcp.*/listen_tcp=1/g' /etc/libvirt/libvirtd.conf && \
sed -i '/.*_file=.*/d' /etc/libvirt/libvirtd.conf && \
- service libvirtd restart && \
- sleep 30 && \
- service cloudstack-agent restart")
+ service libvirtd start ; \
+ service libvirt-bin start ; \
+ sleep 30 ; \
+ service cloudstack-agent start")
+ time.sleep(30)
print("Unsecuring Host: %s" % (host.name))
self.waitUntilHostInState(hostId=host.id, state="Up")
self.check_connection(host=host, secured='false')
@@ -1206,11 +1199,7 @@ class TestMigrateVMwithVolume(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.apiclient = super(TestMigrateVMwithVolume, cls).getClsTestClient().getApiClient()
- try:
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestMigrateVMwithVolume,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -1220,20 +1209,17 @@ class TestMigrateVMwithVolume(cloudstackTestCase):
if self.hypervisor.lower() not in ["vmware"]:
self.skipTest("VM Migration with Volumes is not supported on other than VMware")
- self.hosts = Host.list(
- self.apiclient,
- zoneid=self.zone.id,
- type='Routing',
- hypervisor='KVM')
+ self.hosts = Host.list(
+ self.apiclient,
+ zoneid=self.zone.id,
+ type='Routing',
+ hypervisor='VMware')
- if len(self.hosts) < 2:
- self.skipTest("Requires at least two hosts for performing migration related tests")
+ if len(self.hosts) < 2:
+ self.skipTest("Requires at least two hosts for performing migration related tests")
def tearDown(self):
- try:
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestMigrateVMwithVolume,self).tearDown()
def get_target_host(self, virtualmachineid):
target_hosts = Host.listForMigration(self.apiclient,
@@ -1419,11 +1405,7 @@ class TestKVMLiveMigration(cloudstackTestCase):
@classmethod
def tearDownClass(cls):
- cls.apiclient = super(TestKVMLiveMigration, cls).getClsTestClient().getApiClient()
- try:
- cleanup_resources(cls.apiclient, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestKVMLiveMigration,cls).tearDownClass()
def setUp(self):
self.apiclient = self.testClient.getApiClient()
@@ -1442,16 +1424,12 @@ class TestKVMLiveMigration(cloudstackTestCase):
if len(self.hosts) < 2:
self.skipTest("Requires at least two hosts for performing migration related tests")
-
for host in self.hosts:
if host.details['Host.OS'] in ['CentOS']:
self.skipTest("live migration is not stabily supported on CentOS")
def tearDown(self):
- try:
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ super(TestKVMLiveMigration,self).tearDown()
def get_target_host(self, virtualmachineid):
target_hosts = Host.listForMigration(self.apiclient,
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 9cb324bc7ba..107403e2df3 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -17,7 +17,8 @@
""" BVT tests for Volumes
"""
#Import Local Modules
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
#from marvin.cloudstackException import *
from marvin.cloudstackAPI import (deleteVolume,
extractVolume,
@@ -44,7 +45,7 @@ from marvin.codes import SUCCESS, FAILED, XEN_SERVER
from nose.plugins.attrib import attr
#Import System modules
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import time
import tempfile
@@ -143,7 +144,7 @@ class TestCreateVolume(cloudstackTestCase):
# 2. Verify the size of volume with actual size allocated
self.volumes = []
- for k, v in self.services["volume_offerings"].items():
+ for k, v in list(self.services["volume_offerings"].items()):
volume = Volume.create(
self.apiClient,
v,
@@ -549,9 +550,9 @@ class TestVolumes(cloudstackTestCase):
#Attempt to download the volume and save contents locally
try:
- formatted_url = urllib.unquote_plus(extract_vol.url)
+ formatted_url = urllib.parse.unquote_plus(extract_vol.url)
self.debug("Attempting to download volume at url %s" % formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug("Saving volume %s to path %s" %(self.volume.id, path))
diff --git a/test/integration/smoke/test_vpc_redundant.py b/test/integration/smoke/test_vpc_redundant.py
index fe6b4108fbf..9144985d6ce 100644
--- a/test/integration/smoke/test_vpc_redundant.py
+++ b/test/integration/smoke/test_vpc_redundant.py
@@ -437,7 +437,7 @@ class TestVPCRedundancy(cloudstackTestCase):
)
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
diff --git a/test/integration/smoke/test_vpc_router_nics.py b/test/integration/smoke/test_vpc_router_nics.py
index 854ab567542..90323e075fe 100644
--- a/test/integration/smoke/test_vpc_router_nics.py
+++ b/test/integration/smoke/test_vpc_router_nics.py
@@ -306,7 +306,7 @@ class TestVPCNics(cloudstackTestCase):
self.logger.debug("Created network with ID: %s" % obj_network.id)
- except Exception, e:
+ except Exception as e:
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
o = networkO(obj_network)
diff --git a/test/integration/smoke/test_vpc_vpn.py b/test/integration/smoke/test_vpc_vpn.py
index 26b1daf946f..10046afa6bd 100644
--- a/test/integration/smoke/test_vpc_vpn.py
+++ b/test/integration/smoke/test_vpc_vpn.py
@@ -258,12 +258,12 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
self.logger.debug("Retrieving default VPC offering")
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# 1) Create VPC
vpcOffering = VpcOffering.list(self.apiclient, name="Default VPC offering")
- self.assert_(vpcOffering is not None and len(
+ self.assertTrue(vpcOffering is not None and len(
vpcOffering) > 0, "No VPC offerings found")
vpc = None
@@ -281,7 +281,7 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc is not None, "VPC creation failed")
+ self.assertTrue(vpc is not None, "VPC creation failed")
self.logger.debug("VPC %s created" % (vpc.id))
try:
@@ -314,9 +314,9 @@ class TestVpcRemoteAccessVpn(cloudstackTestCase):
networkids=ntwk.id,
hypervisor=self.hypervisor
)
- self.assert_(vm is not None, "VM failed to deploy")
+ self.assertTrue(vm is not None, "VM failed to deploy")
self.cleanup.append(vm)
- self.assert_(vm.state == 'Running', "VM is not running")
+ self.assertTrue(vm.state == 'Running', "VM is not running")
self.debug("VM %s deployed in VPC %s" % (vm.id, vpc.id))
except Exception as e:
self.fail(e)
@@ -528,12 +528,12 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# Create and Enable VPC offering
vpc_offering = self._create_vpc_offering('vpc_offering')
- self.assert_(vpc_offering is not None, "Failed to create VPC Offering")
+ self.assertTrue(vpc_offering is not None, "Failed to create VPC Offering")
vpc_offering.update(self.apiclient, state='Enabled')
vpc1 = None
@@ -551,7 +551,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc1 is not None, "VPC1 creation failed")
+ self.assertTrue(vpc1 is not None, "VPC1 creation failed")
self.cleanup.append(vpc1)
self.logger.debug("VPC1 %s created" % vpc1.id)
@@ -570,7 +570,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc2 is not None, "VPC2 creation failed")
+ self.assertTrue(vpc2 is not None, "VPC2 creation failed")
self.cleanup.append(vpc2)
self.logger.debug("VPC2 %s created" % vpc2.id)
@@ -632,8 +632,8 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm1 is not None, "VM failed to deploy")
- self.assert_(vm1.state == 'Running', "VM is not running")
+ self.assertTrue(vm1 is not None, "VM failed to deploy")
+ self.assertTrue(vm1.state == 'Running', "VM is not running")
self.cleanup.append(vm1)
self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
@@ -652,19 +652,19 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm2 is not None, "VM failed to deploy")
- self.assert_(vm2.state == 'Running', "VM is not running")
+ self.assertTrue(vm2 is not None, "VM failed to deploy")
+ self.assertTrue(vm2.state == 'Running', "VM is not running")
self.cleanup.append(vm2)
self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
# 4) Enable Site-to-Site VPN for VPC
vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
- self.assert_(
+ self.assertTrue(
vpn1_response is not None, "Failed to enable VPN Gateway 1")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
- self.assert_(
+ self.assertTrue(
vpn2_response is not None, "Failed to enable VPN Gateway 2")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
@@ -735,7 +735,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
vm2.public_ip is not None, "Failed to aqcuire public ip for vm2")
natrule = None
@@ -746,7 +746,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
natrule is not None, "Failed to create portforward for vm2")
time.sleep(20)
@@ -757,7 +757,7 @@ class TestVpcSite2SiteVpn(cloudstackTestCase):
# run ping test
packet_loss = ssh_client.execute("/bin/ping -c 3 -t 10 " + vm1.nic[0].ipaddress + " | grep packet | sed 's/.*received, //g' | sed 's/[% ]*packet.*//g'")[0]
# during startup, some packets may not reply due to link/ipsec-route setup
- self.assert_(int(packet_loss) < 50, "Ping did not succeed")
+ self.assertTrue(int(packet_loss) < 50, "Ping did not succeed")
else:
self.fail("Failed to setup ssh connection to %s" % vm2.public_ip)
@@ -899,13 +899,13 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# Create and enable redundant VPC offering
redundant_vpc_offering = self._create_vpc_offering(
'redundant_vpc_offering')
- self.assert_(redundant_vpc_offering is not None,
+ self.assertTrue(redundant_vpc_offering is not None,
"Failed to create redundant VPC Offering")
redundant_vpc_offering.update(self.apiclient, state='Enabled')
@@ -924,7 +924,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc1 is not None, "VPC1 creation failed")
+ self.assertTrue(vpc1 is not None, "VPC1 creation failed")
self.cleanup.append(vpc1)
self.logger.debug("VPC1 %s created" % vpc1.id)
@@ -943,7 +943,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc2 is not None, "VPC2 creation failed")
+ self.assertTrue(vpc2 is not None, "VPC2 creation failed")
self.cleanup.append(vpc2)
self.logger.debug("VPC2 %s created" % vpc2.id)
@@ -1005,8 +1005,8 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm1 is not None, "VM failed to deploy")
- self.assert_(vm1.state == 'Running', "VM is not running")
+ self.assertTrue(vm1 is not None, "VM failed to deploy")
+ self.assertTrue(vm1.state == 'Running', "VM is not running")
self.cleanup.append(vm1)
self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
@@ -1025,19 +1025,19 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm2 is not None, "VM failed to deploy")
- self.assert_(vm2.state == 'Running', "VM is not running")
+ self.assertTrue(vm2 is not None, "VM failed to deploy")
+ self.assertTrue(vm2.state == 'Running', "VM is not running")
self.cleanup.append(vm2)
self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
# 4) Enable Site-to-Site VPN for VPC
vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
- self.assert_(
+ self.assertTrue(
vpn1_response is not None, "Failed to enable VPN Gateway 1")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
- self.assert_(
+ self.assertTrue(
vpn2_response is not None, "Failed to enable VPN Gateway 2")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
@@ -1108,7 +1108,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
vm2.public_ip is not None, "Failed to aqcuire public ip for vm2")
# Create port forward to be able to ssh into vm2
@@ -1119,7 +1119,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
natrule is not None, "Failed to create portforward for vm2")
time.sleep(20)
@@ -1129,7 +1129,7 @@ class TestRVPCSite2SiteVpn(cloudstackTestCase):
if ssh_client:
# run ping test
packet_loss = ssh_client.execute("/bin/ping -c 3 -t 10 " + vm1.nic[0].ipaddress + " | grep packet | sed 's/.*received, //g' | sed 's/[% ]*packet.*//g'")[0]
- self.assert_(int(packet_loss) < 50, "Ping did not succeed")
+ self.assertTrue(int(packet_loss) < 50, "Ping did not succeed")
else:
self.fail("Failed to setup ssh connection to %s" % vm2.public_ip)
@@ -1280,12 +1280,12 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
# 0) Get the default network offering for VPC
networkOffering = NetworkOffering.list(
self.apiclient, name="DefaultIsolatedNetworkOfferingForVpcNetworks")
- self.assert_(networkOffering is not None and len(
+ self.assertTrue(networkOffering is not None and len(
networkOffering) > 0, "No VPC based network offering")
# Create and Enable VPC offering
vpc_offering = self._create_vpc_offering('vpc_offering')
- self.assert_(vpc_offering is not None, "Failed to create VPC Offering")
+ self.assertTrue(vpc_offering is not None, "Failed to create VPC Offering")
vpc_offering.update(self.apiclient, state='Enabled')
vpc1 = None
@@ -1303,7 +1303,7 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc1 is not None, "VPC1 creation failed")
+ self.assertTrue(vpc1 is not None, "VPC1 creation failed")
self.cleanup.append(vpc1)
self.logger.debug("VPC1 %s created" % vpc1.id)
@@ -1322,7 +1322,7 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vpc2 is not None, "VPC2 creation failed")
+ self.assertTrue(vpc2 is not None, "VPC2 creation failed")
self.cleanup.append(vpc2)
self.logger.debug("VPC2 %s created" % vpc2.id)
@@ -1384,8 +1384,8 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm1 is not None, "VM failed to deploy")
- self.assert_(vm1.state == 'Running', "VM is not running")
+ self.assertTrue(vm1 is not None, "VM failed to deploy")
+ self.assertTrue(vm1.state == 'Running', "VM is not running")
self.cleanup.append(vm1)
self.logger.debug("VM %s deployed in VPC %s" % (vm1.id, vpc1.id))
@@ -1404,8 +1404,8 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(vm2 is not None, "VM failed to deploy")
- self.assert_(vm2.state == 'Running', "VM is not running")
+ self.assertTrue(vm2 is not None, "VM failed to deploy")
+ self.assertTrue(vm2.state == 'Running', "VM is not running")
self.cleanup.append(vm2)
self.debug("VM %s deployed in VPC %s" % (vm2.id, vpc2.id))
@@ -1446,12 +1446,12 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
# 4) Enable Site-to-Site VPN for VPC
vpn1_response = Vpn.createVpnGateway(self.apiclient, vpc1.id)
- self.assert_(
+ self.assertTrue(
vpn1_response is not None, "Failed to enable VPN Gateway 1")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc1.id)
vpn2_response = Vpn.createVpnGateway(self.apiclient, vpc2.id)
- self.assert_(
+ self.assertTrue(
vpn2_response is not None, "Failed to enable VPN Gateway 2")
self.logger.debug("VPN gateway for VPC %s enabled" % vpc2.id)
@@ -1488,7 +1488,7 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
vm2.public_ip is not None, "Failed to aqcuire public ip for vm2")
natrule = None
@@ -1499,7 +1499,7 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
except Exception as e:
self.fail(e)
finally:
- self.assert_(
+ self.assertTrue(
natrule is not None, "Failed to create portforward for vm2")
time.sleep(20)
@@ -1559,7 +1559,7 @@ class TestVPCSite2SiteVPNMultipleOptions(cloudstackTestCase):
# run ping test
packet_loss = ssh_client.execute("/bin/ping -c 3 -t 10 " + vm1.nic[0].ipaddress + " | grep packet | sed 's/.*received, //g' | sed 's/[% ]*packet.*//g'")[0]
self.logger.debug("Packet loss %s" % packet_loss)
- self.assert_(int(packet_loss) < 50, "Ping did not succeed")
+ self.assertTrue(int(packet_loss) < 50, "Ping did not succeed")
# Cleanup
Vpn.deleteVpnConnection(self.apiclient, vpnconn1_response['id'])
diff --git a/test/integration/testpaths/testpath_snapshot_hadrning.py b/test/integration/testpaths/testpath_snapshot_hadrning.py
index cb31f0f2fce..feca9373e40 100755
--- a/test/integration/testpaths/testpath_snapshot_hadrning.py
+++ b/test/integration/testpaths/testpath_snapshot_hadrning.py
@@ -18,7 +18,8 @@
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs,
validateList)
@@ -1438,7 +1439,7 @@ class TestHardening(cloudstackTestCase):
# Check each clusterid has two Storage Pool Tags
# which indicate two Storage Pools exist.
assert (len(clusterid_tag_mapping)) >= 2 and\
- (len(tags) for tags in clusterid_tag_mapping.itervalues(
+ (len(tags) for tags in clusterid_tag_mapping.values(
)) >= 2, "There must be atleast two Clusters and\
each must have atleast two cluster wide storage pools in\
Up state in the setup"
diff --git a/test/integration/testpaths/testpath_storage_migration.py b/test/integration/testpaths/testpath_storage_migration.py
index d696f24485a..e9817f80039 100644
--- a/test/integration/testpaths/testpath_storage_migration.py
+++ b/test/integration/testpaths/testpath_storage_migration.py
@@ -17,7 +17,8 @@
""" Test cases for Test Paths Storage Migration
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources)
from marvin.lib.base import (Account,
ServiceOffering,
@@ -3539,7 +3540,7 @@ def check_files(self, vm, destinationHost):
self.apiclient,
virtualmachineid=vm.id,
listall=True)
- print vm_volumes
+ print(vm_volumes)
for vol in vm_volumes:
spool = list_storage_pools(self.apiclient, id=vol.storageid)
split_path = spool[0].path.split("/")
diff --git a/test/integration/testpaths/testpath_usage.py b/test/integration/testpaths/testpath_usage.py
index 5f36c694d7c..9d04ffaf09f 100644
--- a/test/integration/testpaths/testpath_usage.py
+++ b/test/integration/testpaths/testpath_usage.py
@@ -2989,19 +2989,19 @@ class TestUsageDataAggregatior(cloudstackTestCase):
"""
usageTypes = [
{
- "usagetypeid": 1, "description": u'Running Vm Usage'}, {
- "usagetypeid": 2, "description": u'Allocated Vm Usage'}, {
- "usagetypeid": 3, "description": u'IP Address Usage'}, {
- "usagetypeid": 4, "description": u'Network Usage (Bytes Sent)'}, {
- "usagetypeid": 5, "description": u'Network Usage (Bytes Received)'}, {
- "usagetypeid": 6, "description": u'Volume Usage'}, {
- "usagetypeid": 7, "description": u'Template Usage'}, {
- "usagetypeid": 8, "description": u'ISO Usage'}, {
- "usagetypeid": 9, "description": u'Snapshot Usage'}, {
- "usagetypeid": 11, "description": u'Load Balancer Usage'}, {
- "usagetypeid": 12, "description": u'Port Forwarding Usage'}, {
- "usagetypeid": 13, "description": u'Network Offering Usage'}, {
- "usagetypeid": 14, "description": u'VPN users usage'
+ "usagetypeid": 1, "description": 'Running Vm Usage'}, {
+ "usagetypeid": 2, "description": 'Allocated Vm Usage'}, {
+ "usagetypeid": 3, "description": 'IP Address Usage'}, {
+ "usagetypeid": 4, "description": 'Network Usage (Bytes Sent)'}, {
+ "usagetypeid": 5, "description": 'Network Usage (Bytes Received)'}, {
+ "usagetypeid": 6, "description": 'Volume Usage'}, {
+ "usagetypeid": 7, "description": 'Template Usage'}, {
+ "usagetypeid": 8, "description": 'ISO Usage'}, {
+ "usagetypeid": 9, "description": 'Snapshot Usage'}, {
+ "usagetypeid": 11, "description": 'Load Balancer Usage'}, {
+ "usagetypeid": 12, "description": 'Port Forwarding Usage'}, {
+ "usagetypeid": 13, "description": 'Network Offering Usage'}, {
+ "usagetypeid": 14, "description": 'VPN users usage'
}
]
listTypes = []
diff --git a/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py b/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py
index ffc6fd0615a..2c0d39bd048 100644
--- a/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py
+++ b/test/integration/testpaths/testpath_volume_cuncurrent_snapshots.py
@@ -19,7 +19,8 @@
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources, is_snapshot_on_nfs,
validateList)
from marvin.lib.base import (Account,
diff --git a/test/integration/testpaths/testpath_volume_recurring_snap.py b/test/integration/testpaths/testpath_volume_recurring_snap.py
index 23e0b3a73ac..828d4cf7266 100644
--- a/test/integration/testpaths/testpath_volume_recurring_snap.py
+++ b/test/integration/testpaths/testpath_volume_recurring_snap.py
@@ -17,7 +17,8 @@
""" Test cases for VM/Volume recurring snapshot Test Path
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs,
validateList
diff --git a/test/integration/testpaths/testpath_volume_snapshot.py b/test/integration/testpaths/testpath_volume_snapshot.py
index c0e609a289b..a9b0ae3cb48 100644
--- a/test/integration/testpaths/testpath_volume_snapshot.py
+++ b/test/integration/testpaths/testpath_volume_snapshot.py
@@ -17,7 +17,8 @@
""" Test cases for VM/Volume snapshot Test Path
"""
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
from marvin.lib.utils import (cleanup_resources,
is_snapshot_on_nfs,
validateList)
diff --git a/test/integration/testpaths/testpath_volumelifecycle.py b/test/integration/testpaths/testpath_volumelifecycle.py
index a2e8390df85..78733fcc968 100644
--- a/test/integration/testpaths/testpath_volumelifecycle.py
+++ b/test/integration/testpaths/testpath_volumelifecycle.py
@@ -17,7 +17,8 @@
"""Utilities functions
"""
# All tests inherit from cloudstackTestCase
-from marvin.cloudstackTestCase import cloudstackTestCase, unittest
+from marvin.cloudstackTestCase import cloudstackTestCase
+import unittest
# Import Integration Libraries
from marvin.codes import FAILED, PASS
# base - contains all resources as entities and defines create, delete,
@@ -41,7 +42,7 @@ from marvin.lib.common import (get_zone,
find_storage_pool_type)
from nose.plugins.attrib import attr
import os
-import urllib
+import urllib.request, urllib.parse, urllib.error
import tempfile
@@ -514,11 +515,11 @@ class TestPathVolume(cloudstackTestCase):
self.debug("extracted url is%s :" % self.extract_volume.url)
try:
- formatted_url = urllib.unquote_plus(self.extract_volume.url)
+ formatted_url = urllib.parse.unquote_plus(self.extract_volume.url)
self.debug(
"Attempting to download volume at url %s" %
formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug(
@@ -930,11 +931,11 @@ class TestPathVolume(cloudstackTestCase):
self.debug("extracted url is%s :" % self.extract_volume.url)
try:
- formatted_url = urllib.unquote_plus(self.extract_volume.url)
+ formatted_url = urllib.parse.unquote_plus(self.extract_volume.url)
self.debug(
"Attempting to download volume at url %s" %
formatted_url)
- response = urllib.urlopen(formatted_url)
+ response = urllib.request.urlopen(formatted_url)
self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp()
self.debug(
diff --git a/tools/marvin/marvin/asyncJobMgr.py b/tools/marvin/marvin/asyncJobMgr.py
index 42fabad382f..ca4b2b76b60 100644
--- a/tools/marvin/marvin/asyncJobMgr.py
+++ b/tools/marvin/marvin/asyncJobMgr.py
@@ -18,10 +18,10 @@
import threading
from marvin import cloudstackException
import time
-import Queue
+import queue
import copy
import sys
-import jsonHelper
+from . import jsonHelper
import datetime
@@ -45,7 +45,7 @@ class jobStatus(object):
def __str__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v)
- in self.__dict__.iteritems()))
+ in self.__dict__.items()))
class workThread(threading.Thread):
@@ -157,9 +157,9 @@ class outputDict(object):
class asyncJobMgr(object):
def __init__(self, apiClient, db):
- self.inqueue = Queue.Queue()
+ self.inqueue = queue.Queue()
self.output = outputDict()
- self.outqueue = Queue.Queue()
+ self.outqueue = queue.Queue()
self.apiClient = apiClient
self.db = db
@@ -196,7 +196,7 @@ class asyncJobMgr(object):
def waitForComplete(self, workers=10):
self.inqueue.join()
lock = threading.Lock()
- resultQueue = Queue.Queue()
+ resultQueue = queue.Queue()
'''intermediate result is stored in self.outqueue'''
for i in range(workers):
worker = workThread(self.outqueue, resultQueue, self.apiClient,
@@ -233,7 +233,7 @@ class asyncJobMgr(object):
submit one job and execute the same job ntimes, with nums_threads
of threads
'''
- inqueue1 = Queue.Queue()
+ inqueue1 = queue.Queue()
lock = threading.Condition()
for i in range(ntimes):
newjob = copy.copy(job)
@@ -248,7 +248,7 @@ class asyncJobMgr(object):
def submitJobs(self, jobs, nums_threads=1, interval=1):
'''submit n jobs, execute them with nums_threads of threads'''
- inqueue1 = Queue.Queue()
+ inqueue1 = queue.Queue()
lock = threading.Condition()
for job in jobs:
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index 826069742fe..c5cbb18dc9e 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -16,13 +16,13 @@
# under the License.
import requests
-import urllib
+import urllib.request, urllib.parse, urllib.error
import base64
import hmac
import hashlib
import time
-from cloudstackAPI import queryAsyncJobResult
-import jsonHelper
+from .cloudstackAPI import queryAsyncJobResult
+from . import jsonHelper
from marvin.codes import (
FAILED,
JOB_FAILED,
@@ -137,18 +137,20 @@ class CSConnection(object):
@Input: payload: dictionary of params be signed
@Output: the signature of the payload
"""
- params = zip(payload.keys(), payload.values())
+ params = list(zip(list(payload.keys()), list(payload.values())))
params.sort(key=lambda k: str.lower(k[0]))
hash_str = "&".join(
["=".join(
[str.lower(r[0]),
str.lower(
- urllib.quote_plus(str(r[1]), safe="*")
+ urllib.parse.quote_plus(str(r[1]), safe="*")
).replace("+", "%20")]
) for r in params]
)
- signature = base64.encodestring(hmac.new(
- self.securityKey, hash_str, hashlib.sha1).digest()).strip()
+ signature = base64.encodestring(
+ hmac.new(self.securityKey.encode('utf-8'),
+ hash_str.encode('utf-8'),
+ hashlib.sha1).digest()).strip()
return signature
def __sendPostReqToCS(self, url, payload):
@@ -264,7 +266,7 @@ class CSConnection(object):
self.__lastError = InvalidParameterException(
"Invalid Parameters")
return FAILED
- for param, value in payload.items():
+ for param, value in list(payload.items()):
if value is None:
payload.pop(param)
elif param == 'typeInfo':
@@ -279,7 +281,7 @@ class CSConnection(object):
payload.pop(param)
i = 0
for val in value:
- for k, v in val.iteritems():
+ for k, v in val.items():
payload["%s[%d].%s" % (param, i, k)] = v
i += 1
return cmd_name.strip(), isAsync, payload
diff --git a/tools/marvin/marvin/cloudstackTestCase.py b/tools/marvin/marvin/cloudstackTestCase.py
index 4a57ae2fb72..1697ae45f28 100644
--- a/tools/marvin/marvin/cloudstackTestCase.py
+++ b/tools/marvin/marvin/cloudstackTestCase.py
@@ -47,7 +47,7 @@ class cloudstackTestCase(unittest.case.TestCase):
when failed
'''
out = verifyElementInList(inp, toverify, responsevar, pos)
- unittest.TestCase.assertEquals(out[0], PASS, "msg:%s" % out[1])
+ unittest.TestCase.assertEqual(out[0], PASS, "msg:%s" % out[1])
@classmethod
def getClsTestClient(cls):
@@ -75,3 +75,11 @@ class cloudstackTestCase(unittest.case.TestCase):
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
+
+ def assertEqual(self, first, second, msg=None):
+ """Fail if the two objects are unequal as determined by the '=='
+ operator.
+ """
+ if isinstance(msg, str):
+ msg = msg.encode()
+ super(cloudstackTestCase,self).assertEqual(first,second,msg)
diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py
index 08b3f348c75..5add003202a 100644
--- a/tools/marvin/marvin/cloudstackTestClient.py
+++ b/tools/marvin/marvin/cloudstackTestClient.py
@@ -115,8 +115,8 @@ class CSTestClient(object):
self.__hypervisor = XEN_SERVER
return SUCCESS
except Exception as e:
- print "\n Exception Occurred Under __setHypervisorInfo " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __setHypervisorInfo " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def __createApiClient(self):
diff --git a/tools/marvin/marvin/codegenerator.py b/tools/marvin/marvin/codegenerator.py
index f583d526de4..45caf90b5a4 100644
--- a/tools/marvin/marvin/codegenerator.py
+++ b/tools/marvin/marvin/codegenerator.py
@@ -1,3 +1,4 @@
+#! /bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -21,7 +22,7 @@ from optparse import OptionParser
from textwrap import dedent
import os
import sys
-import urllib2
+from urllib.request import urlopen
class cmdParameterProperty(object):
@@ -40,7 +41,7 @@ class cloudStackCmd(object):
def __init__(self):
self.name = ""
self.desc = ""
- self.async = "false"
+ self.asyncmethod = "false"
self.request = []
self.response = []
@@ -121,15 +122,15 @@ class CodeGenerator(object):
self.code = self.license
self.code += self.newline
self.code += '"""%s"""\n' % self.cmd.desc
- self.code += 'from baseCmd import *\n'
- self.code += 'from baseResponse import *\n'
+ self.code += 'from .baseCmd import *\n'
+ self.code += 'from .baseResponse import *\n'
self.code += "class %sCmd (baseCmd):\n" % self.cmd.name
self.code += self.space
self.code += 'typeInfo = {}\n'
self.code += self.space + "def __init__(self):\n"
self.code += self.space + self.space
- self.code += 'self.isAsync = "%s"\n' % str(self.cmd.async).lower()
+ self.code += 'self.isAsync = "%s"\n' % str(self.cmd.asyncmethod).lower()
for req in self.cmd.request:
if req.desc is not None:
@@ -244,7 +245,7 @@ class CodeGenerator(object):
body += self.space + self.space + 'return response\n'
body += self.newline
- imports += 'from %s import %sResponse\n' % (cmdName, cmdName)
+ imports += 'from .%s import %sResponse\n' % (cmdName, cmdName)
initCmdsList += '"%s",' % cmdName
fp = open(self.outputFolder + '/cloudstackAPI/cloudstackAPIClient.py',
@@ -305,9 +306,9 @@ class CodeGenerator(object):
if desc:
csCmd.desc = desc
- async = getText(cmd.getElementsByTagName('isAsync'))
- if async:
- csCmd.async = async
+ asyncmethod = getText(cmd.getElementsByTagName('isAsync'))
+ if asyncmethod:
+ csCmd.asyncmethod = asyncmethod
argList = cmd.getElementsByTagName("request")[0].\
getElementsByTagName("arg")
@@ -398,7 +399,7 @@ class CodeGenerator(object):
csCmd.desc = cmd['description']
if 'isasync' in cmd:
- csCmd.async = cmd['isasync']
+ csCmd.asyncmethod = cmd['isasync']
for param in cmd['params']:
paramProperty = cmdParameterProperty()
@@ -436,7 +437,7 @@ class CodeGenerator(object):
@return: The classes in cloudstackAPI/ formed from api discovery json
"""
if endpointUrl.find('response=json') >= 0:
- apiStream = urllib2.urlopen(endpointUrl)
+ apiStream = urlopen(endpointUrl)
cmds = self.loadCmdFromJSON(apiStream)
for cmd in cmds:
self.generate(cmd)
@@ -468,17 +469,16 @@ if __name__ == "__main__":
try:
os.mkdir(apiModule)
except:
- print "Failed to create folder %s, due to %s" % (apiModule,
- sys.exc_info())
- print parser.print_help()
+ print ("Failed to create folder {0}, due to {1}".format(apiModule, sys.exc_info()))
+ print (parser.print_help())
exit(2)
apiSpecFile = "/etc/cloud/cli/commands.xml"
if options.spec is not None:
apiSpecFile = options.spec
if not os.path.exists(apiSpecFile):
- print "the spec file %s does not exists" % apiSpecFile
- print parser.print_help()
+ print ("the spec file %s does not exists" % apiSpecFile)
+ print (parser.print_help())
exit(1)
cg = CodeGenerator(folder)
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index 6055f46723e..ccf9db5a5c5 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -18,7 +18,7 @@
import json
import os
from optparse import OptionParser
-import jsonHelper
+from . import jsonHelper
from marvin.codes import *
from marvin.cloudstackException import GetDetailExceptionInfo
from marvin.config.test_data import test_data
@@ -96,12 +96,12 @@ class trafficType(object):
def __init__(self, typ, labeldict=None):
self.typ = typ # Guest/Management/Public
if labeldict:
- self.xen = labeldict['xen'] if 'xen' in labeldict.keys() else None
- self.kvm = labeldict['kvm'] if 'kvm' in labeldict.keys() else None
+ self.xen = labeldict['xen'] if 'xen' in list(labeldict.keys()) else None
+ self.kvm = labeldict['kvm'] if 'kvm' in list(labeldict.keys()) else None
self.vmware = labeldict['vmware']\
- if 'vmware' in labeldict.keys() else None
+ if 'vmware' in list(labeldict.keys()) else None
self.simulator = labeldict['simulator']\
- if 'simulator' in labeldict.keys() else None
+ if 'simulator' in list(labeldict.keys()) else None
class pod(object):
@@ -266,7 +266,7 @@ class netscaler(object):
return repr(self)
def __repr__(self):
- req = zip(self.__dict__.keys(), self.__dict__.values())
+ req = list(zip(list(self.__dict__.keys()), list(self.__dict__.values())))
return self.hostname + "?" + "&".join(["=".join([r[0], r[1]])
for r in req])
@@ -290,7 +290,7 @@ class srx(object):
return repr(self)
def __repr__(self):
- req = zip(self.__dict__.keys(), self.__dict__.values())
+ req = list(zip(list(self.__dict__.keys()), list(self.__dict__.values())))
return self.hostname + "?" + "&".join(["=".join([r[0], r[1]])
for r in req])
@@ -312,7 +312,7 @@ class bigip(object):
return repr(self)
def __repr__(self):
- req = zip(self.__dict__.keys(), self.__dict__.values())
+ req = list(zip(list(self.__dict__.keys()), list(self.__dict__.values())))
return self.hostname + "?" + "&".join(["=".join([r[0], r[1]])
for r in req])
@@ -389,8 +389,8 @@ class ConfigManager(object):
config_dict = config
except Exception as e:
# Will replace with log once we have logging done
- print "\n Exception occurred under ConfigManager:__parseConfig" \
- " :%s", GetDetailExceptionInfo(e)
+ print("\n Exception occurred under ConfigManager:__parseConfig" \
+ " :%s", GetDetailExceptionInfo(e))
finally:
return config_dict
@@ -417,7 +417,7 @@ class ConfigManager(object):
@Output:Section matching inside the parsed data
'''
if self.__parsedCfgDict is None or section is None:
- print "\nEither Parsed Dictionary is None or Section is None"
+ print("\nEither Parsed Dictionary is None or Section is None")
return INVALID_INPUT
if section is not None:
return self.__parsedCfgDict.get(section)
@@ -435,7 +435,7 @@ class ConfigManager(object):
def getDeviceUrl(obj):
- req = zip(obj.__dict__.keys(), obj.__dict__.values())
+ req = list(zip(list(obj.__dict__.keys()), list(obj.__dict__.values())))
if obj.hostname:
return "http://" + obj.hostname + "?" + "&".join(["=".join([r[0],
r[1]])
@@ -543,7 +543,7 @@ def descSetupInBasicMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -667,7 +667,7 @@ def descSetupInEipMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -788,7 +788,7 @@ def descSetupInAdvancedMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -900,7 +900,7 @@ def descSetupInAdvancedsgMode():
'expunge.interval': '60',
'expunge.workers': '3',
}
- for k, v in global_settings.iteritems():
+ for k, v in global_settings.items():
cfg = configuration()
cfg.name = k
cfg.value = v
@@ -931,8 +931,8 @@ def getSetupConfig(file):
config = json.loads("\n".join(configLines))
return jsonHelper.jsonLoader(config)
except Exception as e:
- print "\nException Occurred under getSetupConfig %s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred under getSetupConfig %s" % \
+ GetDetailExceptionInfo(e))
if __name__ == "__main__":
parser = OptionParser()
diff --git a/tools/marvin/marvin/dbConnection.py b/tools/marvin/marvin/dbConnection.py
index e7758a7cf46..04140bab3c2 100644
--- a/tools/marvin/marvin/dbConnection.py
+++ b/tools/marvin/marvin/dbConnection.py
@@ -17,11 +17,8 @@
import mysql
import contextlib
-from mysql import connector
from mysql.connector import errors
-from contextlib import closing
from marvin import cloudstackException
-import sys
import os
@@ -50,7 +47,9 @@ class DbConnection(object):
with contextlib.closing(conn.cursor(buffered=True)) as cursor:
cursor.execute(sql, params)
try:
- resultRow = cursor.fetchall()
+ if sql.lower().startswith('select') and cursor.rowcount > 0:
+ # we have more than just the row count/success
+ resultRow = cursor.fetchall()
except errors.InterfaceError:
# Raised on empty result - DML
resultRow = []
@@ -80,8 +79,8 @@ if __name__ == "__main__":
except cloudstackException.dbException, e:
print e
'''
- print db.execute("update vm_template set name='fjkd' where id=200")
+ print(db.execute("update vm_template set name='fjkd' where id=200"))
for i in range(10):
result = db.execute("select job_status, created, \
last_updated from async_job where id=%d" % i)
- print result
+ print(result)
diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py
index 34dc4b671b0..7a52afcdc93 100644
--- a/tools/marvin/marvin/deployAndRun.py
+++ b/tools/marvin/marvin/deployAndRun.py
@@ -44,11 +44,11 @@ class VerifyAndExit(object):
if original_func(*args, **kwargs) == FAILED:
exit_check = True
except Exception as e:
- print "===Exception.Please Check:===", e
+ print("===Exception.Please Check:===", e)
exit_check = True
finally:
if exit_check:
- print "==== %s ====" % self.msg
+ print("==== %s ====" % self.msg)
MarvinCliHelp.print_cmds_help()
sys.exit(1)
return new_function
@@ -135,12 +135,12 @@ class MarvinCliHelp(object):
@classmethod
def print_cmds_help(cls):
msg = ''
- for cmd_name, cmd_txt in MarvinCliCommands.cmds_info.items():
+ for cmd_name, cmd_txt in list(MarvinCliCommands.cmds_info.items()):
msg = msg + \
'\n----------------------------------------------------\n'
cmd_info = ShellColor.BOLD + ShellColor.RED + \
'cmd_name:%s' % str(cmd_name) + ShellColor.END
- for key, value in cmd_txt.iteritems():
+ for key, value in cmd_txt.items():
cmd_info = cmd_info + '\n' + \
str(key) + ' : ' + str(value).strip('\n')
msg = msg + cmd_info
@@ -199,7 +199,7 @@ class MarvinCli(cmd.Cmd, object):
self.__configFile = out_dict.get('config-file', '')
if not self.__configFile:
return FAILED
- print "\n==== Parsing Input Options Successful ===="
+ print("\n==== Parsing Input Options Successful ====")
return SUCCESS
return FAILED
@@ -222,7 +222,7 @@ class MarvinCli(cmd.Cmd, object):
self.__requiredHw = out_dict.get("required-hardware")
if not all([self.__tcPath, self.__configFile]):
return FAILED
- print "\n==== Parsing Input Options Successful ===="
+ print("\n==== Parsing Input Options Successful ====")
return SUCCESS
return FAILED
@@ -246,12 +246,12 @@ class MarvinCli(cmd.Cmd, object):
return SUCCESS
return FAILED
except Exception as e:
- print "====Exception Occurred under start_marvin: %s ====" % \
- GetDetailExceptionInfo(e)
+ print("====Exception Occurred under start_marvin: %s ====" % \
+ GetDetailExceptionInfo(e))
return FAILED
def run_test_suites(self):
- print "\n==== Started Running Test Cases ===="
+ print("\n==== Started Running Test Cases ====")
xunit_out_path = "/tmp/marvin_xunit_out" + \
str(random.randrange(1, 10000)) + ".xml"
marvin_tc_run_cmd = "nosetests-2.7 -s --with-marvin --marvin-config=%s --with-xunit --xunit-file=%s %s -a tags=advanced, required_hardware=%s --zone=%s --hypervisor=%s"
@@ -272,7 +272,7 @@ class MarvinCli(cmd.Cmd, object):
engine.loadTestsFromDir(self.__tcPath)
engine.run()
'''
- print "\n==== Running Test Cases Successful ===="
+ print("\n==== Running Test Cases Successful ====")
@VerifyAndExit(
"cmd failed, may be invalid input options, please check help")
@@ -283,7 +283,7 @@ class MarvinCli(cmd.Cmd, object):
self.start_marvin()
return SUCCESS
except Exception as e:
- print "==== deploy cmd failed :%s ==== " % str(e)
+ print("==== deploy cmd failed :%s ==== " % str(e))
return FAILED
@VerifyAndExit(
@@ -295,7 +295,7 @@ class MarvinCli(cmd.Cmd, object):
self.run_test_suites()
return SUCCESS
except Exception as e:
- print "==== deploydc cmd failed:%s ==== " % str(e)
+ print("==== deploydc cmd failed:%s ==== " % str(e))
return FAILED
@VerifyAndExit(
@@ -311,7 +311,7 @@ class MarvinCli(cmd.Cmd, object):
if os.path.exists(value):
api_spec_file = value
elif not os.path.exists(api_spec_file):
- print "=== Mentioned api spec file :%s does not exists ===" % str(api_spec_file)
+ print("=== Mentioned api spec file :%s does not exists ===" % str(api_spec_file))
sys.exit(1)
if key.lower() == 'cs-folder-path':
cs_api_folder = self.create_marvin_api_folder(value)
@@ -321,7 +321,7 @@ class MarvinCli(cmd.Cmd, object):
cg.generateCodeFromXML(api_spec_file)
return SUCCESS
except Exception as e:
- print "==== Generating apis from api spec file failed: %s ====" % str(e.message())
+ print("==== Generating apis from api spec file failed: %s ====" % str(e.message()))
return FAILED
return FAILED
@@ -354,7 +354,7 @@ response=json'
cg.generateCodeFromJSON(endpoint_url)
return SUCCESS
except Exception as e:
- print "==== Generating apis from end point failed: %s ====" % str(e.message())
+ print("==== Generating apis from end point failed: %s ====" % str(e.message()))
return FAILED
return FAILED
@@ -367,7 +367,7 @@ response=json'
self.run_test_suites()
return SUCCESS
except Exception as e:
- print "==== run test failed: %s ====" % str(e.message())
+ print("==== run test failed: %s ====" % str(e.message()))
return FAILED
def install_marvin(self):
@@ -375,9 +375,9 @@ response=json'
marvin_setup_file_path = self.__csFolder + "/tools/marvin/setup.py"
try:
os.system("python %s install" % str(marvin_setup_file_path))
- print "==== Marvin Installed Successfully ===="
+ print("==== Marvin Installed Successfully ====")
except Exception as e:
- print "==== Marvin Installation Failed ===="
+ print("==== Marvin Installation Failed ====")
@VerifyAndExit(
"cmd failed, may be invalid input options, please check help")
@@ -387,7 +387,7 @@ response=json'
self.install_marvin()
return SUCCESS
except Exception as e:
- print "==== build from end point and install marvin failed: %s ====" % str(e)
+ print("==== build from end point and install marvin failed: %s ====" % str(e))
return FAILED
@VerifyAndExit(
@@ -398,7 +398,7 @@ response=json'
self.install_marvin()
return SUCCESS
except Exception as e:
- print "==== sync from spec file and install marvin failed: %s ====" % str(e)
+ print("==== sync from spec file and install marvin failed: %s ====" % str(e))
return FAILED
@@ -427,12 +427,12 @@ def main():
MarvinCliHelp.help_printversion()
sys.exit(0)
if len(sys.argv) > 1:
- if sys.argv[1].lower() not in MarvinCliCommands.cmds_info.keys():
- print "\n==== Invalid Command ===="
+ if sys.argv[1].lower() not in list(MarvinCliCommands.cmds_info.keys()):
+ print("\n==== Invalid Command ====")
sys.exit(1)
args = ' '.join(args)
if '-h' in args or '--help' in args:
- print MarvinCliCommands.cmds_info[sys.argv[0]]
+ print(MarvinCliCommands.cmds_info[sys.argv[0]])
else:
MarvinCli().onecmd(args)
sys.exit(0)
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 1b6365a355d..c3e8511141f 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -74,17 +74,17 @@ class DeployDataCenters(object):
file_to_write = open(dc_file_path, 'w')
if file_to_write:
pickle.dump(self.__cleanUp, file_to_write)
- print "\n=== Data Center Settings are dumped to %s===" % dc_file_path
+ print("\n=== Data Center Settings are dumped to %s===" % dc_file_path)
self.__tcRunLogger.debug("\n=== Data Center Settings are dumped to %s===" % dc_file_path)
except Exception as e:
- print "Exception Occurred while persisting DC Settings: %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred while persisting DC Settings: %s" % \
+ GetDetailExceptionInfo(e))
def __cleanAndExit(self):
try:
- print "\n===deploy dc failed, so cleaning the created entries==="
+ print("\n===deploy dc failed, so cleaning the created entries===")
if not test_data.get("deleteDC", None):
- print "\n=== Deploy DC Clean Up flag not set. So, exiting ==="
+ print("\n=== Deploy DC Clean Up flag not set. So, exiting ===")
exit(1)
self.__tcRunLogger.debug(
"===Deploy DC Failed, So Cleaning to Exit===")
@@ -94,30 +94,30 @@ class DeployDataCenters(object):
)
if remove_dc_obj:
if remove_dc_obj.removeDataCenter() == FAILED:
- print "\n===Removing DataCenter Failed==="
+ print("\n===Removing DataCenter Failed===")
self.__tcRunLogger.debug(
"===Removing DataCenter Failed===")
else:
- print "\n===Removing DataCenter Successful==="
+ print("\n===Removing DataCenter Successful===")
self.__tcRunLogger.debug(
"===Removing DataCenter Successful===")
exit(1)
except Exception as e:
- print "Exception Occurred during DC CleanUp: %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred during DC CleanUp: %s" % \
+ GetDetailExceptionInfo(e))
def __addToCleanUp(self, type, id):
- if type not in self.__cleanUp.keys():
+ if type not in list(self.__cleanUp.keys()):
self.__cleanUp[type] = []
self.__cleanUp[type].append(id)
- if "order" not in self.__cleanUp.keys():
+ if "order" not in list(self.__cleanUp.keys()):
self.__cleanUp["order"] = []
if type not in self.__cleanUp["order"]:
self.__cleanUp["order"].append(type)
def addHosts(self, hosts, zoneId, podId, clusterId, hypervisor):
if hosts is None:
- print "\n === Invalid Hosts Information ===="
+ print("\n === Invalid Hosts Information ====")
return
failed_cnt = 0
for host in hosts:
@@ -144,7 +144,7 @@ class DeployDataCenters(object):
self.__addToCleanUp("Host", ret[0].id)
except Exception as e:
failed_cnt = failed_cnt + 1
- print "Exception Occurred :%s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred :%s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception(
"=== Adding Host Failed :%s===" % str(
host.url))
@@ -165,7 +165,7 @@ class DeployDataCenters(object):
self.__tcRunLogger.debug("=== Adding VmWare DC Successful===")
self.__addToCleanUp("VmwareDc", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("=== Adding VmWare DC Failed===")
self.__cleanAndExit()
@@ -184,7 +184,7 @@ class DeployDataCenters(object):
self.__tcRunLogger.debug("=== Adding Baremetal Rct file Successful===")
self.__addToCleanUp("BaremetalRct", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("=== Adding Baremetal Rct file Failed===")
self.__cleanAndExit()
@@ -224,7 +224,7 @@ class DeployDataCenters(object):
clusterId)
except Exception as e:
- print "Exception Occurred %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("====Cluster %s Creation Failed"
"=====" %
str(cluster.clustername))
@@ -247,8 +247,8 @@ class DeployDataCenters(object):
sleep(timeout)
retry = retry - 1
except Exception as e:
- print "\nException Occurred:%s" %\
- GetDetailExceptionInfo(e)
+ print("\nException Occurred:%s" %\
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("=== List Hosts Failed===")
self.__cleanAndExit()
@@ -263,7 +263,7 @@ class DeployDataCenters(object):
for primary in primaryStorages:
primarycmd = createStoragePool.createStoragePoolCmd()
if primary.details:
- for key, value in vars(primary.details).iteritems():
+ for key, value in vars(primary.details).items():
primarycmd.details.append({ key: value})
primarycmd.name = primary.name
@@ -283,7 +283,7 @@ class DeployDataCenters(object):
"=== Creating Storage Pool Successful===")
self.__addToCleanUp("StoragePool", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Create Storage Pool Failed===")
self.__cleanAndExit()
@@ -316,7 +316,7 @@ class DeployDataCenters(object):
self.createClusters(pod.clusters, zoneId, podId,
vmwareDc=pod.vmwaredc)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====Pod: %s Creation "
"Failed=====" % str(pod.name))
@@ -352,7 +352,7 @@ class DeployDataCenters(object):
"=== Creating Vlan Ip Range Successful===")
self.__addToCleanUp("VlanIpRange", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Create Vlan Ip Range Failed===")
self.__cleanAndExit()
@@ -368,7 +368,7 @@ class DeployDataCenters(object):
secondarycmd.details = []
if secondarycmd.provider.lower() in ('s3', "swift", "smb"):
- for key, value in vars(secondary.details).iteritems():
+ for key, value in vars(secondary.details).items():
secondarycmd.details.append({
'key': key,
'value': value
@@ -381,7 +381,7 @@ class DeployDataCenters(object):
"===Add Image Store Successful===")
self.__addToCleanUp("ImageStore", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Add Image Store Failed===")
self.__cleanAndExit()
@@ -399,7 +399,7 @@ class DeployDataCenters(object):
cachecmd.details = []
if cache.details:
- for key, value in vars(cache.details).iteritems():
+ for key, value in vars(cache.details).items():
cachecmd.details.append({
'key': key,
'value': value
@@ -410,7 +410,7 @@ class DeployDataCenters(object):
"===Creating Secondary StagingStore Successful===")
self.__addToCleanUp("SecondaryStagingStore", ret.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("=== Creating "
"SecondaryStagingStorage Failed===")
@@ -443,7 +443,7 @@ class DeployDataCenters(object):
self.__addToCleanUp("Network", networkId)
return networkId
except Exception as e:
- print "Exception Occurred %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====Network : %s "
"Creation Failed=====" % str(network.name))
@@ -468,7 +468,7 @@ class DeployDataCenters(object):
self.addTrafficTypes(phynetwrk.id, net.traffictypes)
return phynetwrk
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("====Physical Network "
"Creation Failed=====")
self.__cleanAndExit()
@@ -484,7 +484,7 @@ class DeployDataCenters(object):
ret = self.__apiClient.updatePhysicalNetwork(upnet)
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====Update Physical Network Failed=====")
self.__cleanAndExit()
@@ -500,7 +500,7 @@ class DeployDataCenters(object):
self.__tcRunLogger.debug(
"===Update Network Service Provider Successfull===")
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception(
"====Update Network Service Provider Failed=====")
@@ -640,7 +640,7 @@ class DeployDataCenters(object):
"type" % device)
self.enableProvider(result.id)
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("====List Network "
"Service Providers Failed=====")
@@ -669,7 +669,7 @@ class DeployDataCenters(object):
self.__addToCleanUp("TrafficType", ret.id)
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("==== Add TrafficType Failed=====")
self.__cleanAndExit()
@@ -684,7 +684,7 @@ class DeployDataCenters(object):
self.__tcRunLogger.debug("==== Enable Zone SuccessFul=====")
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("==== Enable Zone Failed=====")
self.__cleanAndExit()
@@ -698,7 +698,7 @@ class DeployDataCenters(object):
self.__tcRunLogger.debug("=== Update Zone SuccessFul===")
return ret
except Exception as e:
- print "Exception Occurred: %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred: %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("==== Update Zone Failed=====")
self.__cleanAndExit()
@@ -715,18 +715,18 @@ class DeployDataCenters(object):
self.__tcRunLogger.\
exception("====Zone : %s Creation Failed=====" %
str(zone.name))
- print "\n====Zone : %s Creation Failed=====" % str(zone.name)
+ print("\n====Zone : %s Creation Failed=====" % str(zone.name))
if not rec:
zone.name = zone.name + "_" + random_gen()
self.__tcRunLogger.\
debug("====Recreating Zone With New Name : "
"%s" % zone.name)
- print "\n====Recreating Zone With New Name ====", \
- str(zone.name)
+ print("\n====Recreating Zone With New Name ====", \
+ str(zone.name))
return self.createZone(zone, 1)
except Exception as e:
- print "\nException Occurred under createZone : %s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred under createZone : %s" % \
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("====Create Zone Failed ===")
return FAILED
@@ -762,10 +762,8 @@ class DeployDataCenters(object):
listNetworkOfferings.listNetworkOfferingsCmd()
listnetworkoffering.name =\
"DefaultSharedNetscalerEIPandELBNetworkOffering" \
- if len(filter(lambda x:
- x.typ == 'Public',
- zone.physical_networks[0].
- traffictypes)) > 0 \
+ if len([x for x in zone.physical_networks[0].
+ traffictypes if x.typ == 'Public']) > 0 \
else "DefaultSharedNetworkOfferingWithSGService"
if zone.networkofferingname is not None:
listnetworkoffering.name = zone.networkofferingname
@@ -840,13 +838,12 @@ class DeployDataCenters(object):
self.updateZoneDetails(zoneId, det)
return
except Exception as e:
- print "\nException Occurred %s" % GetDetailExceptionInfo(e)
+ print("\nException Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception("==== Create Zones Failed ===")
def isEipElbZone(self, zone):
if (zone.networktype == "Basic"
- and len(filter(lambda x: x.typ == 'Public',
- zone.physical_networks[0].traffictypes)) > 0):
+ and len([x for x in zone.physical_networks[0].traffictypes if x.typ == 'Public']) > 0):
return True
return False
@@ -870,15 +867,15 @@ class DeployDataCenters(object):
self.__tcRunLogger.debug(
"==UpdateConfiguration Successfull===")
except Exception as e:
- print "Exception Occurred %s" % GetDetailExceptionInfo(e)
+ print("Exception Occurred %s" % GetDetailExceptionInfo(e))
self.__tcRunLogger.\
exception("===UpdateConfiguration Failed===")
self.__cleanAndExit()
def copyAttributesToCommand(self, source, command):
- map(lambda attr: setattr(command, attr, getattr(source, attr, None)),
- filter(lambda attr: not attr.startswith("__") and attr not in
- ["required", "isAsync"], dir(command)))
+ list(map(lambda attr: setattr(command, attr, getattr(source, attr, None)),
+ [attr for attr in dir(command) if not attr.startswith("__") and attr not in
+ ["required", "isAsync"]]))
def configureS3(self, s3):
try:
@@ -896,7 +893,7 @@ class DeployDataCenters(object):
def deploy(self):
try:
- print "\n==== Deploy DC Started ===="
+ print("\n==== Deploy DC Started ====")
self.__tcRunLogger.debug("\n==== Deploy DC Started ====")
'''
Step1 : Set the Client
@@ -915,7 +912,7 @@ class DeployDataCenters(object):
Persist the Configuration to an external file post DC creation
'''
self.__persistDcConfig()
- print "\n====Deploy DC Successful====="
+ print("\n====Deploy DC Successful=====")
self.__tcRunLogger.debug("\n====Deploy DC Successful====")
'''
Upload baremetalSwitch configuration(.rct) file if enabled zone has baremetal isolated network.
@@ -925,10 +922,10 @@ class DeployDataCenters(object):
return SUCCESS
except Exception as e:
- print "\nException Occurred Under deploy :%s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred Under deploy :%s" % \
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.debug("\n====Deploy DC Failed====")
- print "\n====Deploy DC Failed===="
+ print("\n====Deploy DC Failed====")
self.__cleanAndExit()
return FAILED
@@ -982,7 +979,7 @@ class DeleteDataCenters:
list_host_cmd = listHosts.listHostsCmd()
list_host_cmd.id = cmd_obj.id
retries = 3
- for i in xrange(retries):
+ for i in range(retries):
list_host_resp = self.__apiClient.\
listHosts(list_host_cmd)
if (list_host_resp) and\
@@ -1000,7 +997,7 @@ class DeleteDataCenters:
list_store_cmd = listStoragePools.listStoragePoolsCmd()
list_store_cmd.id = cmd_obj.id
retries = 3
- for i in xrange(retries):
+ for i in range(retries):
store_maint_resp = self.__apiClient.\
listStoragePools(list_store_cmd)
if (store_maint_resp) and \
@@ -1023,9 +1020,9 @@ class DeleteDataCenters:
'''
try:
ret = FAILED
- if "order" in self.__dcCfg.keys() and len(self.__dcCfg["order"]):
+ if "order" in list(self.__dcCfg.keys()) and len(self.__dcCfg["order"]):
self.__dcCfg["order"].reverse()
- print "\n====Clean Up Entries===", self.__dcCfg
+ print("\n====Clean Up Entries===", self.__dcCfg)
for type in self.__dcCfg["order"]:
self.__tcRunLogger.debug(
"====CleanUp Started For Type: %s====" %
@@ -1059,8 +1056,8 @@ class DeleteDataCenters:
(type, id))
ret = SUCCESS
except Exception as e:
- print "\n==== Exception Under __cleanEntries: %s ==== % " \
- % GetDetailExceptionInfo(e)
+ print("\n==== Exception Under __cleanEntries: %s ==== % " \
+ % GetDetailExceptionInfo(e))
self.__tcRunLogger.exception(
"\n==== Exception Under __cleanEntries: %s ==== % " %
GetDetailExceptionInfo(e))
@@ -1077,7 +1074,7 @@ class DeleteDataCenters:
try:
self.__setClient()
self.__tcRunLogger.debug("====DeployDC: CleanUp Started====")
- print "\n====DeployDC: CleanUp Started===="
+ print("\n====DeployDC: CleanUp Started====")
ret = FAILED
if self.__dcCfgFile:
file_to_read = open(self.__dcCfgFile, 'r')
@@ -1086,8 +1083,8 @@ class DeleteDataCenters:
if self.__dcCfg:
ret = self.__cleanEntries()
except Exception as e:
- print "\n==== Exception Under removeDataCenter: %s ====" % \
- GetDetailExceptionInfo(e)
+ print("\n==== Exception Under removeDataCenter: %s ====" % \
+ GetDetailExceptionInfo(e))
self.__tcRunLogger.exception(
"===DeployDC CleanUp FAILED: %s ====" %
GetDetailExceptionInfo(e))
@@ -1132,8 +1129,8 @@ if __name__ == "__main__":
Verify the input validity
'''
if options.input is None and options.remove is None:
- print "\n==== For DeployDataCenter: Please Specify a valid Input Configuration File===="
- print "\n==== For DeleteDataCenters: Please Specify a valid Input Configuration File and DC Settings===="
+ print("\n==== For DeployDataCenter: Please Specify a valid Input Configuration File====")
+ print("\n==== For DeleteDataCenters: Please Specify a valid Input Configuration File and DC Settings====")
exit(1)
'''
@@ -1146,7 +1143,7 @@ if __name__ == "__main__":
Step1: Create the Logger
'''
if (options.input) and not (os.path.isfile(options.input)):
- print "\n=== Invalid Input Config File Path, Please Check ==="
+ print("\n=== Invalid Input Config File Path, Please Check ===")
exit(1)
log_obj = MarvinLog("CSLog")
@@ -1161,7 +1158,7 @@ if __name__ == "__main__":
log_folder_path = log_obj.getLogFolderPath()
tc_run_logger = log_obj.getLogger()
else:
- print "\n===Log Creation Failed. Please Check==="
+ print("\n===Log Creation Failed. Please Check===")
exit(1)
'''
@@ -1170,7 +1167,7 @@ if __name__ == "__main__":
obj_tc_client = CSTestClient(cfg.mgtSvr[0], cfg.dbSvr,
logger=tc_run_logger)
if obj_tc_client and obj_tc_client.createTestClient() == FAILED:
- print "\n=== TestClient Creation Failed==="
+ print("\n=== TestClient Creation Failed===")
exit(1)
'''
@@ -1187,7 +1184,7 @@ if __name__ == "__main__":
tc_run_logger,
log_folder_path=log_folder_path)
if deploy.deploy() == FAILED:
- print "\n===Deploy Failed==="
+ print("\n===Deploy Failed===")
tc_run_logger.debug("\n===Deploy Failed===");
exit(1)
@@ -1202,11 +1199,11 @@ if __name__ == "__main__":
)
if remove_dc_obj:
if remove_dc_obj.removeDataCenter() == FAILED:
- print "\n===Removing DataCenter Failed==="
+ print("\n===Removing DataCenter Failed===")
tc_run_logger.debug("\n===Removing DataCenter Failed===")
exit(1)
else:
- print "\n===Removing DataCenter Successful==="
+ print("\n===Removing DataCenter Successful===")
tc_run_logger.debug("\n===Removing DataCenter Successful===")
# All OK exit with 0 exitcode
diff --git a/tools/marvin/marvin/jsonHelper.py b/tools/marvin/marvin/jsonHelper.py
index 2cd342f615b..d2a6e5d11e1 100644
--- a/tools/marvin/marvin/jsonHelper.py
+++ b/tools/marvin/marvin/jsonHelper.py
@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-import cloudstackException
+from . import cloudstackException
import json
import inspect
from marvin.cloudstackAPI import *
@@ -51,11 +51,11 @@ class jsonLoader(object):
def __repr__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v)
- in self.__dict__.iteritems()))
+ in self.__dict__.items()))
def __str__(self):
return '{%s}' % str(', '.join('%s : %s' % (k, repr(v)) for (k, v)
- in self.__dict__.iteritems()))
+ in self.__dict__.items()))
class jsonDump(object):
@@ -63,7 +63,7 @@ class jsonDump(object):
@staticmethod
def __serialize(obj):
"""Recursively walk object's hierarchy."""
- if isinstance(obj, (bool, int, long, float, basestring)):
+ if isinstance(obj, (bool, int, float, str)):
return obj
elif isinstance(obj, dict):
obj = obj.copy()
@@ -115,18 +115,18 @@ def finalizeResultObj(result, responseName, responsecls):
responsecls)
return result
elif responsecls is not None:
- for k, v in result.__dict__.iteritems():
+ for k, v in result.__dict__.items():
if k in responsecls.__dict__:
return result
- attr = result.__dict__.keys()[0]
+ attr = list(result.__dict__.keys())[0]
value = getattr(result, attr)
if not isinstance(value, jsonLoader):
return result
findObj = False
- for k, v in value.__dict__.iteritems():
+ for k, v in value.__dict__.items():
if k in responsecls.__dict__:
findObj = True
break
@@ -141,8 +141,7 @@ def finalizeResultObj(result, responseName, responsecls):
def getResultObj(returnObj, responsecls=None):
if len(returnObj) == 0:
return None
- responseName = filter(lambda a: a != u'cloudstack-version',
- returnObj.keys())[0]
+ responseName = [a for a in list(returnObj.keys()) if a != 'cloudstack-version'][0]
response = returnObj[responseName]
if len(response) == 0:
@@ -156,7 +155,7 @@ def getResultObj(returnObj, responsecls=None):
raise cloudstackException.CloudstackAPIException(respname, errMsg)
if result.count is not None:
- for key in result.__dict__.iterkeys():
+ for key in result.__dict__.keys():
if key == "count":
continue
else:
@@ -186,7 +185,7 @@ if __name__ == "__main__":
} ]
} }'''
nsp = getResultObj(result)
- print nsp[0].id
+ print(nsp[0].id)
result = '''{ "listzonesresponse" : {
"count" : 1,
@@ -205,7 +204,7 @@ if __name__ == "__main__":
}
}'''
zones = getResultObj(result)
- print zones[0].id
+ print(zones[0].id)
res = authorizeSecurityGroupIngress.authorizeSecurityGroupIngressResponse()
result = '''{
"queryasyncjobresultresponse" : {
@@ -242,8 +241,8 @@ if __name__ == "__main__":
}
}'''
asynJob = getResultObj(result, res)
- print asynJob.jobid, repr(asynJob.jobresult)
- print asynJob.jobresult.ingressrule[0].account
+ print(asynJob.jobid, repr(asynJob.jobresult))
+ print(asynJob.jobresult.ingressrule[0].account)
result = '''{
"queryasyncjobresultresponse" : {
@@ -256,15 +255,15 @@ due to missing parameter jobid"
try:
asynJob = getResultObj(result)
except cloudstackException.CloudstackAPIException as e:
- print e
+ print(e)
result = '{ "queryasyncjobresultresponse" : {} }'
asynJob = getResultObj(result)
- print asynJob
+ print(asynJob)
result = '{}'
asynJob = getResultObj(result)
- print asynJob
+ print(asynJob)
result = '''{
"createzoneresponse" : {
@@ -280,15 +279,15 @@ due to missing parameter jobid"
}'''
res = createZone.createZoneResponse()
zone = getResultObj(result, res)
- print zone.id
+ print(zone.id)
result = '{ "attachvolumeresponse" : {"jobid":24} }'
res = attachVolume.attachVolumeResponse()
res = getResultObj(result, res)
- print res
+ print(res)
result = '{ "listtemplatesresponse" : { } }'
- print getResultObj(result, listTemplates.listTemplatesResponse())
+ print(getResultObj(result, listTemplates.listTemplatesResponse()))
result = '''{
"queryasyncjobresultresponse" : {
@@ -300,7 +299,7 @@ due to missing parameter jobid"
}
}
}'''
- print getResultObj(result, listTemplates.listTemplatesResponse())
+ print(getResultObj(result, listTemplates.listTemplatesResponse()))
result = '''{
"queryasyncjobresultresponse" : {
"jobid":41,"jobstatus":1,"jobprocstatus":0,
@@ -381,9 +380,9 @@ due to missing parameter jobid"
}'''
vm = getResultObj(result,
deployVirtualMachine.deployVirtualMachineResponse())
- print vm.jobresult.id
+ print(vm.jobresult.id)
cmd = deployVirtualMachine.deployVirtualMachineCmd()
responsename = cmd.__class__.__name__.replace("Cmd", "Response")
response = getclassFromName(cmd, responsename)
- print response.id
+ print(response.id)
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index b245d45558f..14432fb6a39 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -85,8 +85,8 @@ class Domain:
def list(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listDomains(cmd))
@@ -137,7 +137,7 @@ class Role:
cmd = updateRole.updateRoleCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateRole(cmd)
@classmethod
@@ -145,7 +145,7 @@ class Role:
"""List all Roles matching criteria"""
cmd = listRoles.listRolesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listRoles(cmd))
@@ -179,7 +179,7 @@ class RolePermission:
cmd = updateRolePermission.updateRolePermissionCmd()
cmd.roleid = self.roleid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateRolePermission(cmd)
@classmethod
@@ -187,7 +187,7 @@ class RolePermission:
"""List all role permissions matching criteria"""
cmd = listRolePermissions.listRolePermissionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listRolePermissions(cmd))
@@ -249,8 +249,8 @@ class Account:
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listAccounts(cmd))
@@ -322,8 +322,8 @@ class User:
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listUsers(cmd))
@@ -338,7 +338,7 @@ class User:
cmd = updateUser.updateUserCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateUser(cmd))
@classmethod
@@ -347,7 +347,7 @@ class User:
cmd = updateUser.updateUserCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateUser(cmd))
@classmethod
@@ -505,7 +505,7 @@ class VirtualMachine:
protocol='All',
cidrlist='0.0.0.0/0'
)
- except CloudstackAPIException, e:
+ except CloudstackAPIException as e:
# This could fail because we've already set up the same rule
if not "There is already a firewall rule specified".lower() in e.errorMsg.lower():
raise
@@ -610,7 +610,7 @@ class VirtualMachine:
cmd.hostid = hostid
if "userdata" in services:
- cmd.userdata = base64.urlsafe_b64encode(services["userdata"])
+ cmd.userdata = base64.urlsafe_b64encode(services["userdata"].encode()).decode()
if "dhcpoptionsnetworklist" in services:
cmd.dhcpoptionsnetworklist = services["dhcpoptionsnetworklist"]
@@ -626,7 +626,7 @@ class VirtualMachine:
if custommemory:
cmd.details[0]["memory"] = custommemory
- if rootdisksize >= 0:
+ if not rootdisksize is None and rootdisksize >= 0:
cmd.details[0]["rootdisksize"] = rootdisksize
if rootdiskcontroller:
@@ -636,7 +636,7 @@ class VirtualMachine:
cmd.group = group
cmd.datadisktemplatetodiskofferinglist = []
- for datadisktemplate, diskoffering in datadisktemplate_diskoffering_list.items():
+ for datadisktemplate, diskoffering in list(datadisktemplate_diskoffering_list.items()):
cmd.datadisktemplatetodiskofferinglist.append({
'datadisktemplateid': datadisktemplate,
'diskofferingid': diskoffering
@@ -665,7 +665,7 @@ class VirtualMachine:
virtual_machine = apiclient.deployVirtualMachine(cmd, method=method)
- if 'password' in virtual_machine.__dict__.keys():
+ if 'password' in list(virtual_machine.__dict__.keys()):
if virtual_machine.password:
services['password'] = virtual_machine.password
@@ -801,8 +801,8 @@ class VirtualMachine:
to expected state in given time else PASS
2) Reason - Reason for failure"""
- returnValue = [FAIL, "VM state not trasited to %s,\
- operation timed out" % state]
+ returnValue = [FAIL, Exception(f"VM state not transitioned to {state},\
+ operation timed out")]
while timeout > 0:
try:
@@ -814,7 +814,7 @@ class VirtualMachine:
validationresult = validateList(vms)
if validationresult[0] == FAIL:
raise Exception("VM list validation failed: %s" % validationresult[2])
- elif str(vms[0].state).lower().decode("string_escape") == str(state).lower():
+ elif str(vms[0].state).lower() == str(state).lower():
returnValue = [PASS, None]
break
except Exception as e:
@@ -829,7 +829,7 @@ class VirtualMachine:
cmd = resetSSHKeyForVirtualMachine.resetSSHKeyForVirtualMachineCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.resetSSHKeyForVirtualMachine(cmd))
def update(self, apiclient, **kwargs):
@@ -837,7 +837,7 @@ class VirtualMachine:
cmd = updateVirtualMachine.updateVirtualMachineCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateVirtualMachine(cmd))
def delete(self, apiclient, expunge=True, **kwargs):
@@ -845,7 +845,7 @@ class VirtualMachine:
cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
cmd.id = self.id
cmd.expunge = expunge
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
apiclient.destroyVirtualMachine(cmd)
def expunge(self, apiclient):
@@ -870,7 +870,7 @@ class VirtualMachine:
cmd.hostid = hostid
if migrateto:
migrateto = []
- for volume, pool in migrateto.items():
+ for volume, pool in list(migrateto.items()):
cmd.migrateto.append({
'volume': volume,
'pool': pool
@@ -958,8 +958,8 @@ class VirtualMachine:
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVirtualMachines(cmd))
@@ -1171,8 +1171,8 @@ class Volume:
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVolumes(cmd))
@@ -1180,7 +1180,7 @@ class Volume:
"""Resize a volume"""
cmd = resizeVolume.resizeVolumeCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.resizeVolume(cmd))
@classmethod
@@ -1201,7 +1201,7 @@ class Volume:
cmd.url = url
else:
cmd.url = services["url"]
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return Volume(apiclient.uploadVolume(cmd).__dict__)
def wait_for_upload(self, apiclient, timeout=10, interval=60):
@@ -1252,7 +1252,7 @@ class Volume:
def migrate(cls, apiclient, **kwargs):
"""Migrate a volume"""
cmd = migrateVolume.migrateVolumeCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.migrateVolume(cmd))
@@ -1298,8 +1298,8 @@ class Snapshot:
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSnapshots(cmd))
@@ -1593,7 +1593,7 @@ class Template:
cmd = updateTemplatePermissions.updateTemplatePermissionsCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateTemplatePermissions(cmd))
def update(self, apiclient, **kwargs):
@@ -1601,7 +1601,7 @@ class Template:
cmd = updateTemplate.updateTemplateCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateTemplate(cmd))
def copy(self, apiclient, sourcezoneid, destzoneid):
@@ -1619,8 +1619,8 @@ class Template:
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listTemplates(cmd))
@@ -1737,7 +1737,7 @@ class Iso:
cmd = updateIso.updateIsoCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateIso(cmd))
@classmethod
@@ -1756,8 +1756,8 @@ class Iso:
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listIsos(cmd))
@@ -1818,8 +1818,8 @@ class PublicIPAddress:
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPublicIpAddresses(cmd))
@@ -1904,8 +1904,8 @@ class NATRule:
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPortForwardingRules(cmd))
@@ -1967,8 +1967,8 @@ class StaticNATRule:
"""List all IP forwarding rules matching criteria"""
cmd = listIpForwardingRules.listIpForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listIpForwardingRules(cmd))
@@ -2037,8 +2037,8 @@ class EgressFireWallRule:
"""List all Egress Firewall Rules matching criteria"""
cmd = listEgressFirewallRules.listEgressFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listEgressFirewallRules(cmd))
@@ -2083,8 +2083,8 @@ class FireWallRule:
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listFirewallRules(cmd))
@@ -2100,7 +2100,7 @@ class Autoscale:
"""Lists all available Counters."""
cmd = listCounters.listCountersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listCounters(cmd))
@classmethod
@@ -2118,7 +2118,7 @@ class Autoscale:
"""Lists all available Conditions."""
cmd = listConditions.listConditionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listConditions(cmd))
@classmethod
@@ -2126,7 +2126,7 @@ class Autoscale:
"""Lists all available Autoscale Policies."""
cmd = listAutoScalePolicies.listAutoScalePoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listAutoScalePolicies(cmd))
@classmethod
@@ -2148,7 +2148,7 @@ class Autoscale:
cmd = updateAutoScalePolicy.updateAutoScalePolicyCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateAutoScalePolicy(cmd))
@classmethod
@@ -2156,7 +2156,7 @@ class Autoscale:
"""Lists all available AutoscaleVM Profiles."""
cmd = listAutoScaleVmProfiles.listAutoScaleVmProfilesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listAutoScaleVmProfiles(cmd))
@classmethod
@@ -2175,7 +2175,7 @@ class Autoscale:
cmd.destroyvmgraceperiod = destroyvmgraceperiod
if counterparam:
- for name, value in counterparam.items():
+ for name, value in list(counterparam.items()):
cmd.counterparam.append({
'name': name,
'value': value
@@ -2189,7 +2189,7 @@ class Autoscale:
cmd = updateAutoScaleVmProfile.updateAutoScaleVmProfileCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateAutoScaleVmProfile(cmd))
@classmethod
@@ -2214,7 +2214,7 @@ class Autoscale:
"""Lists all available AutoscaleVM Group."""
cmd = listAutoScaleVmGroups.listAutoScaleVmGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listAutoScaleVmGroups(cmd))
@classmethod
@@ -2223,7 +2223,7 @@ class Autoscale:
cmd = enableAutoScaleVmGroup.enableAutoScaleVmGroupCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.enableAutoScaleVmGroup(cmd))
@classmethod
@@ -2232,7 +2232,7 @@ class Autoscale:
cmd = disableAutoScaleVmGroup.disableAutoScaleVmGroupCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.disableAutoScaleVmGroup(cmd))
@classmethod
@@ -2241,7 +2241,7 @@ class Autoscale:
cmd = updateAutoScaleVmGroup.updateAutoScaleVmGroupCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateAutoScaleVmGroup(cmd))
@@ -2278,7 +2278,7 @@ class ServiceOffering:
if "serviceofferingdetails" in services:
count = 1
for i in services["serviceofferingdetails"]:
- for key, value in i.items():
+ for key, value in list(i.items()):
setattr(cmd, "serviceofferingdetails[%d].key" % count, key)
setattr(cmd, "serviceofferingdetails[%d].value" % count, value)
count = count + 1
@@ -2313,7 +2313,7 @@ class ServiceOffering:
elif "tags" in services:
cmd.tags = services["tags"]
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return ServiceOffering(apiclient.createServiceOffering(cmd).__dict__)
def delete(self, apiclient):
@@ -2328,8 +2328,8 @@ class ServiceOffering:
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listServiceOfferings(cmd))
@@ -2383,7 +2383,7 @@ class DiskOffering:
if "provisioningtype" in services:
cmd.provisioningtype = services["provisioningtype"]
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return DiskOffering(apiclient.createDiskOffering(cmd).__dict__)
def delete(self, apiclient):
@@ -2398,8 +2398,8 @@ class DiskOffering:
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listDiskOfferings(cmd))
@@ -2427,16 +2427,16 @@ class NetworkOffering:
cmd.forvpc = (services["useVpc"] == "on")
cmd.serviceproviderlist = []
if "serviceProviderList" in services:
- for service, provider in services["serviceProviderList"].items():
+ for service, provider in list(services["serviceProviderList"].items()):
cmd.serviceproviderlist.append({
'service': service,
'provider': provider
})
if "serviceCapabilityList" in services:
cmd.servicecapabilitylist = []
- for service, capability in services["serviceCapabilityList"]. \
- items():
- for ctype, value in capability.items():
+ for service, capability in list(services["serviceCapabilityList"]. \
+ items()):
+ for ctype, value in list(capability.items()):
cmd.servicecapabilitylist.append({
'service': service,
'capabilitytype': ctype,
@@ -2460,7 +2460,7 @@ class NetworkOffering:
cmd.availability = 'Optional'
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return NetworkOffering(apiclient.createNetworkOffering(cmd).__dict__)
@@ -2476,7 +2476,7 @@ class NetworkOffering:
cmd = updateNetworkOffering.updateNetworkOfferingCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateNetworkOffering(cmd))
@classmethod
@@ -2484,8 +2484,8 @@ class NetworkOffering:
"""Lists all available network offerings."""
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkOfferings(cmd))
@@ -2519,8 +2519,8 @@ class SnapshotPolicy:
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSnapshotPolicies(cmd))
@@ -2535,14 +2535,14 @@ class GuestOs:
def listMapping(cls, apiclient, **kwargs):
"""List all Guest Os Mappings matching criteria"""
cmd = listGuestOsMapping.listGuestOsMappingCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listGuestOsMapping(cmd))
@classmethod
def listCategories(cls, apiclient, **kwargs):
"""List all Os Categories"""
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listOsCategories(cmd))
@@ -2551,7 +2551,7 @@ class GuestOs:
"""List all Os Types matching criteria"""
cmd = listOsTypes.listOsTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listOsTypes(cmd))
@@ -2566,8 +2566,8 @@ class Hypervisor:
"""Lists hypervisors"""
cmd = listHypervisors.listHypervisorsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listHypervisors(cmd))
@@ -2656,7 +2656,7 @@ class LoadBalancerRule:
if name:
cmd.name = name
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateLoadBalancerRule(cmd)
def createSticky(
@@ -2671,7 +2671,7 @@ class LoadBalancerRule:
cmd.description = description
if param:
cmd.param = []
- for name, value in param.items():
+ for name, value in list(param.items()):
cmd.param.append({'name': name, 'value': value})
return apiclient.createLBStickinessPolicy(cmd)
@@ -2688,8 +2688,8 @@ class LoadBalancerRule:
cmd = listLBStickinessPolicies.listLBStickinessPoliciesCmd()
cmd.lbruleid = lbruleid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listLBStickinessPolicies(cmd)
@@ -2698,8 +2698,8 @@ class LoadBalancerRule:
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listLoadBalancerRules(cmd))
@@ -2713,7 +2713,7 @@ class LoadBalancerRule:
cmd.applied = applied
cmd.lbvmips = lbvmips
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.listLoadBalancerRuleInstances(cmd)
@@ -2763,8 +2763,8 @@ class Cluster:
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listClusters(cmd))
@@ -2773,7 +2773,7 @@ class Cluster:
"""Update cluster information"""
cmd = updateCluster.updateClusterCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateCluster(cmd))
@@ -2836,8 +2836,8 @@ class Host:
retries += -1
return FAILED
except Exception as e:
- print "Exception Occurred Under Host.create : %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred Under Host.create : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
@staticmethod
@@ -2855,7 +2855,7 @@ class Host:
if validationresult[0] == FAIL:
raise Exception("Host list validation failed: %s" % validationresult[2])
- if str(hosts[0].resourcestate).lower().decode("string_escape") == str(resourcestate).lower():
+ if str(hosts[0].resourcestate).lower() == str(resourcestate).lower():
return True, None
return False, "Host is not in the following state: " + str(resourcestate)
@@ -2902,8 +2902,8 @@ class Host:
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listHosts(cmd))
@@ -2912,8 +2912,8 @@ class Host:
"""List all Hosts for migration matching criteria"""
cmd = findHostsForMigration.findHostsForMigrationCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.findHostsForMigration(cmd))
@@ -2922,7 +2922,7 @@ class Host:
"""Update host information"""
cmd = updateHost.updateHostCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateHost(cmd))
@classmethod
@@ -2930,7 +2930,7 @@ class Host:
"""Reconnect the Host"""
cmd = reconnectHost.reconnectHostCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.reconnectHost(cmd))
@classmethod
@@ -2952,8 +2952,8 @@ class Host:
validationresult = validateList(hosts)
if validationresult[0] == FAIL:
raise Exception("Host list validation failed: %s" % validationresult[2])
- elif str(hosts[0].state).lower().decode("string_escape") == str(state).lower() and str(
- hosts[0].resourcestate).lower().decode("string_escape") == str(resourcestate).lower():
+ elif str(hosts[0].state).lower() == str(state).lower() and str(
+ hosts[0].resourcestate).lower() == str(resourcestate).lower():
returnValue = [PASS, None]
break
except Exception as e:
@@ -3061,8 +3061,8 @@ class StoragePool:
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listStoragePools(cmd))
@@ -3071,8 +3071,8 @@ class StoragePool:
"""List all storage pools for migration matching criteria"""
cmd = findStoragePoolsForMigration.findStoragePoolsForMigrationCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.findStoragePoolsForMigration(cmd))
@@ -3080,7 +3080,7 @@ class StoragePool:
def update(cls, apiclient, **kwargs):
"""Update storage pool"""
cmd = updateStoragePool.updateStoragePoolCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateStoragePool(cmd)
@classmethod
@@ -3102,7 +3102,7 @@ class StoragePool:
validationresult = validateList(pools)
if validationresult[0] == FAIL:
raise Exception("Pool list validation failed: %s" % validationresult[2])
- elif str(pools[0].state).lower().decode("string_escape") == str(state).lower():
+ elif str(pools[0].state).lower() == str(state).lower():
returnValue = [PASS, None]
break
except Exception as e:
@@ -3206,7 +3206,7 @@ class Network:
cmd = updateNetwork.updateNetworkCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateNetwork(cmd))
def restart(self, apiclient, cleanup=None, makeredundant=None):
@@ -3232,8 +3232,8 @@ class Network:
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworks(cmd))
@@ -3309,8 +3309,8 @@ class NetworkACL:
"""List Network ACLs"""
cmd = listNetworkACLs.listNetworkACLsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkACLs(cmd))
@@ -3356,8 +3356,8 @@ class NetworkACLList:
"""List Network ACL lists"""
cmd = listNetworkACLLists.listNetworkACLListsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkACLLists(cmd))
@@ -3427,14 +3427,14 @@ class Vpn:
def listVpnGateway(cls, apiclient, **kwargs):
"""List all VPN Gateways matching criteria"""
cmd = listVpnGateways.listVpnGatewaysCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listVpnGateways(cmd))
@classmethod
def listVpnConnection(cls, apiclient, **kwargs):
"""List all VPN Connections matching criteria"""
cmd = listVpnConnections.listVpnConnectionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listVpnConnections(cmd))
def delete(self, apiclient):
@@ -3449,8 +3449,8 @@ class Vpn:
"""List all VPN matching criteria"""
cmd = listRemoteAccessVpns.listRemoteAccessVpnsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listRemoteAccessVpns(cmd))
@@ -3495,8 +3495,8 @@ class VpnUser:
"""List all VPN Users matching criteria"""
cmd = listVpnUsers.listVpnUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVpnUsers(cmd))
@@ -3539,7 +3539,7 @@ class Zone:
cmd = updateZone.updateZoneCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateZone(cmd)
@classmethod
@@ -3547,8 +3547,8 @@ class Zone:
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listZones(cmd))
@@ -3584,8 +3584,8 @@ class Pod:
"Returns a default pod for specified zone"
cmd = listPods.listPodsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listPods(cmd)
@@ -3594,7 +3594,7 @@ class Pod:
"""Update the pod"""
cmd = updatePod.updatePodCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updatePod(cmd)
@@ -3640,8 +3640,8 @@ class PublicIpRange:
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVlanIpRanges(cmd))
@@ -3700,8 +3700,8 @@ class PortablePublicIpRange:
"""Lists all portable public IP ranges."""
cmd = listPortableIpRanges.listPortableIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPortableIpRanges(cmd))
@@ -3737,8 +3737,8 @@ class SecondaryStagingStore:
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listSecondaryStagingStores.listSecondaryStagingStoresCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSecondaryStagingStores(cmd))
@@ -3774,8 +3774,8 @@ class ImageStore:
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listImageStores.listImageStoresCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listImageStores(cmd))
@@ -3809,7 +3809,7 @@ class PhysicalNetwork:
cmd = updatePhysicalNetwork.updatePhysicalNetworkCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updatePhysicalNetwork(cmd)
def addTrafficType(self, apiclient, type):
@@ -3846,8 +3846,8 @@ class PhysicalNetwork:
"""Lists all dedicated guest vlan ranges"""
cmd = listDedicatedGuestVlanRanges.listDedicatedGuestVlanRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listDedicatedGuestVlanRanges(cmd)
@@ -3856,11 +3856,11 @@ class PhysicalNetwork:
"""Lists all physical networks"""
cmd = listPhysicalNetworks.listPhysicalNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
- return map(lambda pn: PhysicalNetwork(
- pn.__dict__), apiclient.listPhysicalNetworks(cmd))
+ return [PhysicalNetwork(
+ pn.__dict__) for pn in apiclient.listPhysicalNetworks(cmd)]
class SecurityGroup:
@@ -3953,7 +3953,7 @@ class SecurityGroup:
cmd.cidrlist = services["cidrlist"]
cmd.usersecuritygrouplist = []
- for account, group in user_secgrp_list.items():
+ for account, group in list(user_secgrp_list.items()):
cmd.usersecuritygrouplist.append({
'account': account,
'group': group
@@ -3973,8 +3973,8 @@ class SecurityGroup:
"""Lists all security groups."""
cmd = listSecurityGroups.listSecurityGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSecurityGroups(cmd))
@@ -4053,8 +4053,8 @@ class VpnCustomerGateway:
"""List all VPN customer Gateway"""
cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVpnCustomerGateways(cmd))
@@ -4094,7 +4094,7 @@ class Project:
cmd = updateProject.updateProjectCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateProject(cmd)
def activate(self, apiclient):
@@ -4162,8 +4162,8 @@ class Project:
"""Lists all accounts associated with projects."""
cmd = listProjectAccounts.listProjectAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listProjectAccounts(cmd))
@@ -4172,8 +4172,8 @@ class Project:
"""Lists all projects."""
cmd = listProjects.listProjectsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listProjects(cmd))
@@ -4212,8 +4212,8 @@ class ProjectInvitation:
"""Lists project invitations"""
cmd = listProjectInvitations.listProjectInvitationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listProjectInvitations(cmd))
@@ -4246,8 +4246,8 @@ class Configurations:
"""Lists configurations"""
cmd = listConfigurations.listConfigurationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listConfigurations(cmd))
@@ -4255,7 +4255,7 @@ class Configurations:
def listCapabilities(cls, apiclient, **kwargs):
"""Lists capabilities"""
cmd = listCapabilities.listCapabilitiesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listCapabilities(cmd))
@@ -4314,7 +4314,7 @@ class NetScaler:
cmd = configureNetscalerLoadBalancer. \
configureNetscalerLoadBalancerCmd()
cmd.lbdeviceid = self.lbdeviceid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.configureNetscalerLoadBalancer(cmd))
@classmethod
@@ -4322,8 +4322,8 @@ class NetScaler:
"""List already registered netscaler devices"""
cmd = listNetscalerLoadBalancers.listNetscalerLoadBalancersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetscalerLoadBalancers(cmd))
@@ -4374,8 +4374,8 @@ class NiciraNvp:
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listNiciraNvpDevices.listNiciraNvpDevicesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNiciraNvpDevices(cmd))
@@ -4409,7 +4409,7 @@ class NetworkServiceProvider:
cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateNetworkServiceProvider(cmd)
@classmethod
@@ -4418,7 +4418,7 @@ class NetworkServiceProvider:
cmd = updateNetworkServiceProvider.updateNetworkServiceProviderCmd()
cmd.id = id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateNetworkServiceProvider(cmd)
@classmethod
@@ -4426,8 +4426,8 @@ class NetworkServiceProvider:
"""List network service providers"""
cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNetworkServiceProviders(cmd))
@@ -4483,8 +4483,8 @@ class Router:
"""List routers"""
cmd = listRouters.listRoutersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listRouters(cmd))
@@ -4503,7 +4503,7 @@ class Tag:
cmd.resourceIds = resourceIds
cmd.resourcetype = resourceType
cmd.tags = []
- for key, value in tags.items():
+ for key, value in list(tags.items()):
cmd.tags.append({
'key': key,
'value': value
@@ -4518,7 +4518,7 @@ class Tag:
cmd.resourceIds = resourceIds
cmd.resourcetype = resourceType
cmd.tags = []
- for key, value in tags.items():
+ for key, value in list(tags.items()):
cmd.tags.append({
'key': key,
'value': value
@@ -4530,8 +4530,8 @@ class Tag:
"""List all tags matching the criteria"""
cmd = listTags.listTagsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listTags(cmd))
@@ -4553,7 +4553,7 @@ class VpcOffering:
cmd.displaytext = services["displaytext"]
cmd.supportedServices = services["supportedservices"]
if "serviceProviderList" in services:
- for service, provider in services["serviceProviderList"].items():
+ for service, provider in list(services["serviceProviderList"].items()):
providers = provider
if isinstance(provider, str):
providers = [provider]
@@ -4567,8 +4567,8 @@ class VpcOffering:
if "serviceCapabilityList" in services:
cmd.servicecapabilitylist = []
for service, capability in \
- services["serviceCapabilityList"].items():
- for ctype, value in capability.items():
+ list(services["serviceCapabilityList"].items()):
+ for ctype, value in list(capability.items()):
cmd.servicecapabilitylist.append({
'service': service,
'capabilitytype': ctype,
@@ -4594,8 +4594,8 @@ class VpcOffering:
"""List the VPC offerings based on criteria specified"""
cmd = listVPCOfferings.listVPCOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVPCOfferings(cmd))
@@ -4632,7 +4632,7 @@ class VPC:
cmd.domainid = domainid
if networkDomain:
cmd.networkDomain = networkDomain
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return VPC(apiclient.createVPC(cmd).__dict__)
def update(self, apiclient, name=None, displaytext=None):
@@ -4677,8 +4677,8 @@ class VPC:
"""List VPCs"""
cmd = listVPCs.listVPCsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVPCs(cmd))
@@ -4721,8 +4721,8 @@ class PrivateGateway:
"""List private gateways"""
cmd = listPrivateGateways.listPrivateGatewaysCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listPrivateGateways(cmd))
@@ -4756,8 +4756,8 @@ class AffinityGroup:
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listAffinityGroups.listAffinityGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return apiclient.listAffinityGroups(cmd)
@@ -4789,8 +4789,8 @@ class StaticRoute:
"""List static route"""
cmd = listStaticRoutes.listStaticRoutesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listStaticRoutes(cmd))
@@ -4824,8 +4824,8 @@ class VNMC:
"""List VNMC appliances"""
cmd = listCiscoVnmcResources.listCiscoVnmcResourcesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listCiscoVnmcResources(cmd))
@@ -4868,8 +4868,8 @@ class SSHKeyPair:
def list(cls, apiclient, **kwargs):
"""List all SSH key pairs"""
cmd = listSSHKeyPairs.listSSHKeyPairsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listSSHKeyPairs(cmd))
@@ -4882,8 +4882,8 @@ class Capacities:
"""Lists capacities"""
cmd = listCapacity.listCapacityCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listCapacity(cmd))
@@ -4896,8 +4896,8 @@ class Alert:
"""Lists alerts"""
cmd = listAlerts.listAlertsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listAlerts(cmd))
@@ -4935,15 +4935,15 @@ class InstanceGroup:
"""Updates the instance groups"""
cmd = updateInstanceGroup.updateInstanceGroupCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateInstanceGroup(cmd))
@classmethod
def list(cls, apiclient, **kwargs):
"""List all instance groups"""
cmd = listInstanceGroups.listInstanceGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listInstanceGroups(cmd))
@@ -5017,8 +5017,8 @@ class ASA1000V:
"""List ASA 1000v appliances"""
cmd = listCiscoAsa1000vResources.listCiscoAsa1000vResourcesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listCiscoAsa1000vResources(cmd))
@@ -5046,8 +5046,8 @@ class VmSnapshot:
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listVMSnapshot.listVMSnapshotCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listVMSnapshot(cmd))
@@ -5086,8 +5086,8 @@ class Region:
@classmethod
def list(cls, apiclient, **kwargs):
cmd = listRegions.listRegionsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
region = apiclient.listRegions(cmd)
return region
@@ -5197,8 +5197,8 @@ class ApplicationLoadBalancer:
def list(cls, apiclient, **kwargs):
"""List all appln load balancers"""
cmd = listLoadBalancers.listLoadBalancersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listLoadBalancerRules(cmd))
@@ -5214,8 +5214,8 @@ class Resources:
"""Lists resource limits"""
cmd = listResourceLimits.listResourceLimitsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listResourceLimits(cmd))
@@ -5224,7 +5224,7 @@ class Resources:
"""Updates resource limits"""
cmd = updateResourceLimit.updateResourceLimitCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateResourceLimit(cmd))
@classmethod
@@ -5232,7 +5232,7 @@ class Resources:
"""Updates resource count"""
cmd = updateResourceCount.updateResourceCountCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.updateResourceCount(cmd))
@@ -5263,8 +5263,8 @@ class NIC:
"""List NICs belonging to a virtual machine"""
cmd = listNics.listNicsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listNics(cmd))
@@ -5324,8 +5324,8 @@ class Usage:
def listRecords(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listUsageRecords.listUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listUsageRecords(cmd))
@@ -5333,8 +5333,8 @@ class Usage:
def listTypes(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listUsageTypes.listUsageTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall = True
return (apiclient.listUsageTypes(cmd))
@@ -5342,7 +5342,7 @@ class Usage:
def generateRecords(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = generateUsageRecords.generateUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.generateUsageRecords(cmd))
@@ -5357,7 +5357,7 @@ class TrafficType:
"""Lists traffic types"""
cmd = listTrafficTypes.listTrafficTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listTrafficTypes(cmd))
@@ -5372,7 +5372,7 @@ class StorageNetworkIpRange:
"""Lists Storage Network IP Ranges"""
cmd = listStorageNetworkIpRange.listStorageNetworkIpRangeCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listStorageNetworkIpRange(cmd))
@@ -5387,7 +5387,7 @@ class RegisteredServicePackage:
"""Lists service packages published by NCC"""
cmd = listRegisteredServicePackages.listRegisteredServicePackagesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listRegisteredServicePackages(cmd))
@@ -5402,7 +5402,7 @@ class ResourceDetails:
cmd.resourcetype = resourcetype
cmd.fordisplay = fordisplay
cmd.details = []
- for key, value in details.items():
+ for key, value in list(details.items()):
cmd.details.append({
'key': key,
'value': value
@@ -5412,7 +5412,7 @@ class ResourceDetails:
@classmethod
def list(self, apiclient, **kwargs):
cmd = listResourceDetails.listResourceDetailsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listResourceDetails(cmd))
@classmethod
@@ -5555,7 +5555,7 @@ class ProjectRole:
cmd = updateProjectRole.updateProjectRoleCmd()
cmd.projectid = projectid
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateProjectRole(cmd)
@classmethod
@@ -5564,7 +5564,7 @@ class ProjectRole:
cmd = listProjectRoles.listProjectRolesCmd()
cmd.projectid = projectid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listProjectRoles(cmd))
class ProjectRolePermission:
@@ -5600,7 +5600,7 @@ class ProjectRolePermission:
cmd = updateProjectRolePermission.updateProjectRolePermissionCmd()
cmd.projectid = projectid
cmd.projectroleid = self.projectroleid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateProjectRolePermission(cmd)
@classmethod
@@ -5609,5 +5609,5 @@ class ProjectRolePermission:
cmd = listProjectRolePermissions.listProjectRolePermissionsCmd()
cmd.projectid = projectid
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return (apiclient.listProjectRolePermissions(cmd))
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index cd896c909eb..0807ec82ab4 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -368,8 +368,8 @@ def get_test_template(apiclient, zone_id=None, hypervisor=None, test_templates=N
if hypervisor == 'simulator':
return get_template(apiclient, zone_id)
- if hypervisor not in test_templates.keys():
- print "Provided hypervisor has no test template"
+ if hypervisor not in list(test_templates.keys()):
+ print("Provided hypervisor has no test template")
return FAILED
test_template = test_templates[hypervisor]
@@ -729,8 +729,8 @@ def list_os_types(apiclient, **kwargs):
"""List all os types matching criteria"""
cmd = listOsTypes.listOsTypesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listOsTypes(cmd))
@@ -739,8 +739,8 @@ def list_routers(apiclient, **kwargs):
"""List all Routers matching criteria"""
cmd = listRouters.listRoutersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listRouters(cmd))
@@ -749,8 +749,8 @@ def list_zones(apiclient, **kwargs):
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listZones(cmd))
@@ -759,8 +759,8 @@ def list_networks(apiclient, **kwargs):
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listNetworks(cmd))
@@ -769,8 +769,8 @@ def list_clusters(apiclient, **kwargs):
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listClusters(cmd))
@@ -779,8 +779,8 @@ def list_ssvms(apiclient, **kwargs):
"""List all SSVMs matching criteria"""
cmd = listSystemVms.listSystemVmsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listSystemVms(cmd))
@@ -789,8 +789,8 @@ def list_storage_pools(apiclient, **kwargs):
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listStoragePools(cmd))
@@ -799,8 +799,8 @@ def list_virtual_machines(apiclient, **kwargs):
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVirtualMachines(cmd))
@@ -809,8 +809,8 @@ def list_hosts(apiclient, **kwargs):
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listHosts(cmd))
@@ -819,8 +819,8 @@ def list_configurations(apiclient, **kwargs):
"""List configuration with specified name"""
cmd = listConfigurations.listConfigurationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listConfigurations(cmd))
@@ -829,8 +829,8 @@ def list_publicIP(apiclient, **kwargs):
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listPublicIpAddresses(cmd))
@@ -839,8 +839,8 @@ def list_nat_rules(apiclient, **kwargs):
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listPortForwardingRules(cmd))
@@ -849,8 +849,8 @@ def list_lb_rules(apiclient, **kwargs):
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listLoadBalancerRules(cmd))
@@ -859,8 +859,8 @@ def list_lb_instances(apiclient, **kwargs):
"""List all Load balancing instances matching criteria"""
cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listLoadBalancerRuleInstances(cmd))
@@ -869,8 +869,8 @@ def list_firewall_rules(apiclient, **kwargs):
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listFirewallRules(cmd))
@@ -879,8 +879,8 @@ def list_volumes(apiclient, **kwargs):
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVolumes(cmd))
@@ -889,8 +889,8 @@ def list_isos(apiclient, **kwargs):
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listIsos(cmd))
@@ -899,8 +899,8 @@ def list_snapshots(apiclient, **kwargs):
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listSnapshots(cmd))
@@ -909,8 +909,8 @@ def list_templates(apiclient, **kwargs):
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listTemplates(cmd))
@@ -919,8 +919,8 @@ def list_domains(apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listDomains(cmd))
@@ -930,8 +930,8 @@ def list_accounts(apiclient, **kwargs):
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listAccounts(cmd))
@@ -941,8 +941,8 @@ def list_users(apiclient, **kwargs):
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listUsers(cmd))
@@ -951,8 +951,8 @@ def list_snapshot_policy(apiclient, **kwargs):
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listSnapshotPolicies(cmd))
@@ -961,8 +961,8 @@ def list_events(apiclient, **kwargs):
"""Lists events"""
cmd = listEvents.listEventsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listEvents(cmd))
@@ -971,8 +971,8 @@ def list_disk_offering(apiclient, **kwargs):
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listDiskOfferings(cmd))
@@ -981,8 +981,8 @@ def list_service_offering(apiclient, **kwargs):
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listServiceOfferings(cmd))
@@ -991,8 +991,8 @@ def list_vlan_ipranges(apiclient, **kwargs):
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVlanIpRanges(cmd))
@@ -1001,8 +1001,8 @@ def list_usage_records(apiclient, **kwargs):
"""Lists usage records for accounts"""
cmd = listUsageRecords.listUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listUsageRecords(cmd))
@@ -1011,8 +1011,8 @@ def list_nw_service_prividers(apiclient, **kwargs):
"""Lists Network service providers"""
cmd = listNetworkServiceProviders.listNetworkServiceProvidersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listNetworkServiceProviders(cmd))
@@ -1021,8 +1021,8 @@ def list_virtual_router_elements(apiclient, **kwargs):
"""Lists Virtual Router elements"""
cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVirtualRouterElements(cmd))
@@ -1031,8 +1031,8 @@ def list_network_offerings(apiclient, **kwargs):
"""Lists network offerings"""
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listNetworkOfferings(cmd))
@@ -1041,8 +1041,8 @@ def list_resource_limits(apiclient, **kwargs):
"""Lists resource limits"""
cmd = listResourceLimits.listResourceLimitsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listResourceLimits(cmd))
@@ -1051,8 +1051,8 @@ def list_vpc_offerings(apiclient, **kwargs):
""" Lists VPC offerings """
cmd = listVPCOfferings.listVPCOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
- if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
+ if 'account' in list(kwargs.keys()) and 'domainid' in list(kwargs.keys()):
cmd.listall=True
return(apiclient.listVPCOfferings(cmd))
@@ -2084,7 +2084,7 @@ def verifyVCenterPortGroups(
dvPortGroups = response[1]
expectedDVPortGroupNames.extend(dvPortGroups)
- vcenterPortGroups = list(itertools.chain(*(switchDict.values())))
+ vcenterPortGroups = list(itertools.chain(*(list(switchDict.values()))))
for expectedDVPortGroupName in expectedDVPortGroupNames:
assert expectedDVPortGroupName in vcenterPortGroups,\
diff --git a/tools/marvin/marvin/lib/ncc.py b/tools/marvin/marvin/lib/ncc.py
index 5c0ae32f383..7144558d8e1 100755
--- a/tools/marvin/marvin/lib/ncc.py
+++ b/tools/marvin/marvin/lib/ncc.py
@@ -27,7 +27,7 @@ from marvin.cloudstackException import (InvalidParameterException,
GetDetailExceptionInfo)
from os import system
from subprocess import call
-import requests, json, urllib
+import requests, json, urllib.request, urllib.parse, urllib.error
class NCC:
diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py
index f170e0dc3bf..41edfa82de1 100644
--- a/tools/marvin/marvin/lib/utils.py
+++ b/tools/marvin/marvin/lib/utils.py
@@ -27,7 +27,7 @@ import random
import imaplib
import email
import socket
-import urlparse
+import urllib.parse
import datetime
from marvin.cloudstackAPI import cloudstackAPIClient, listHosts, listRouters
from platform import system
@@ -181,7 +181,7 @@ def is_server_ssh_ready(ipaddress, port, username, password, retries=20, retryin
retries=retries,
delay=retryinterv,
timeout=timeout)
- except Exception, e:
+ except Exception as e:
raise Exception("SSH connection has Failed. Waited %ss. Error is %s" % (retries * retryinterv, str(e)))
else:
return ssh
@@ -220,13 +220,13 @@ def get_host_credentials(config, hostip):
for cluster in pod.clusters:
for host in cluster.hosts:
if str(host.url).startswith('http'):
- hostname = urlparse.urlsplit(str(host.url)).netloc
+ hostname = urllib.parse.urlsplit(str(host.url)).netloc
else:
hostname = str(host.url)
try:
if socket.getfqdn(hostip) == socket.getfqdn(hostname):
return host.username, host.password
- except socket.error, e:
+ except socket.error as e:
raise Exception("Unresolvable host %s error is %s" % (hostip, e))
raise KeyError("Please provide the marvin configuration file with credentials to your hosts")
@@ -322,7 +322,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
#Snapshot does not exist
return False
- from base import ImageStore
+ from .base import ImageStore
#pass store_id to get the exact storage pool where snapshot is stored
secondaryStores = ImageStore.list(apiclient, zoneid=zoneid, id=int(qresultset[0][1]))
@@ -340,8 +340,7 @@ def is_snapshot_on_nfs(apiclient, dbconn, config, zoneid, snapshotid):
snapshotPath = str(qresultset[0][0]) + snapshot_extensions[str(hypervisor).lower()]
nfsurl = secondaryStore.url
- from urllib2 import urlparse
- parse_url = urlparse.urlsplit(nfsurl, scheme='nfs')
+ parse_url = urllib.parse.urlsplit(nfsurl, scheme='nfs')
host, path = str(parse_url.netloc), str(parse_url.path)
if not config.mgtSvr:
@@ -502,9 +501,9 @@ def checkVolumeSize(ssh_handle=None,
if m and str(m.group(1)) == str(size_to_verify):
return [SUCCESS,str(m.group(1))]
return [FAILED,"Volume Not Found"]
- except Exception, e:
- print "\n Exception Occurred under getDiskUsage: " \
- "%s" %GetDetailExceptionInfo(e)
+ except Exception as e:
+ print("\n Exception Occurred under getDiskUsage: " \
+ "%s" %GetDetailExceptionInfo(e))
return [FAILED,GetDetailExceptionInfo(e)]
diff --git a/tools/marvin/marvin/lib/vcenter.py b/tools/marvin/marvin/lib/vcenter.py
index 916fb7e2d03..5d91cba1ee1 100644
--- a/tools/marvin/marvin/lib/vcenter.py
+++ b/tools/marvin/marvin/lib/vcenter.py
@@ -281,7 +281,7 @@ class Vcenter():
force=True)
task = cluster.AddHost(spec=hostspec, asConnected=True)
except Exception as e:
- print "Error adding host :%s" % e
+ print("Error adding host :%s" % e)
self.wait_for_task(task)
host = self._get_obj([vim.HostSystem], hostname)
return host
@@ -318,7 +318,7 @@ class Vcenter():
username=user,
password=passwd)
except Exception as e:
- print "Failed to create datacenter: %s" % e
+ print("Failed to create datacenter: %s" % e)
def wait_for_task(self, task):
@@ -328,7 +328,7 @@ class Vcenter():
if task.info.state == vim.TaskInfo.State.success:
if task.info.result is not None:
out = 'Task completed successfully, result: %s' % (task.info.result,)
- print out
+ print(out)
elif task.info.state == vim.TaskInfo.State.error:
out = 'Error - Task did not complete successfully: %s' % (task.info.error,)
raise ValueError(out)
@@ -355,30 +355,30 @@ if __name__ == '__main__':
vc_object = Vcenter("10.x.x.x", "username", "password")
- print '###get one dc########'
- print(vc_object.get_datacenters(name='testDC'))
+ print('###get one dc########')
+ print((vc_object.get_datacenters(name='testDC')))
- print '###get multiple dcs########'
+ print('###get multiple dcs########')
for i in vc_object.get_datacenters():
print(i)
- print '###get one dv########'
- print vc_object.get_dvswitches(name='dvSwitch')
+ print('###get one dv########')
+ print(vc_object.get_dvswitches(name='dvSwitch'))
- print '###get multiple dvs########'
+ print('###get multiple dvs########')
for i in vc_object.get_dvswitches():
print(i)
- print '###get one dvportgroup########'
- print(vc_object.get_dvportgroups(name='cloud.guest.207.200.1-dvSwitch'))
+ print('###get one dvportgroup########')
+ print((vc_object.get_dvportgroups(name='cloud.guest.207.200.1-dvSwitch')))
- print "###get one dvportgroup and the vms associated with it########"
+ print("###get one dvportgroup and the vms associated with it########")
for vm in vc_object.get_dvportgroups(name='cloud.guest.207.200.1-dvSwitch')[0]['dvportgroup']['vmlist']:
- print(vm.name)
- print(vm.network)
+ print((vm.name))
+ print((vm.network))
- print '###get multiple dvportgroups########'
+ print('###get multiple dvportgroups########')
for i in vc_object.get_dvportgroups():
print(i)
- print vc_object.get_vms(name='VM1')
+ print(vc_object.get_vms(name='VM1'))
diff --git a/tools/marvin/marvin/marvinInit.py b/tools/marvin/marvin/marvinInit.py
index c6ee1a2c7ad..234e930837e 100644
--- a/tools/marvin/marvin/marvinInit.py
+++ b/tools/marvin/marvin/marvinInit.py
@@ -67,14 +67,14 @@ class MarvinInit:
'''
try:
if not os.path.isfile(self.__configFile):
- print "\n=== Marvin Parse Config Init Failed ==="
+ print("\n=== Marvin Parse Config Init Failed ===")
return FAILED
self.__parsedConfig = getSetupConfig(self.__configFile)
- print "\n=== Marvin Parse Config Successful ==="
+ print("\n=== Marvin Parse Config Successful ===")
return SUCCESS
except Exception as e:
- print "\nException Occurred Under __parseConfig : " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\nException Occurred Under __parseConfig : " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def getParsedConfig(self):
@@ -126,8 +126,8 @@ class MarvinInit:
self.__hypervisorType = XEN_SERVER
return SUCCESS
except Exception as e:
- print "\n Exception Occurred Under init " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under init " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def init(self):
@@ -142,20 +142,20 @@ class MarvinInit:
@Output : SUCCESS or FAILED
'''
try:
- print "\n==== Marvin Init Started ===="
+ print("\n==== Marvin Init Started ====")
if ((self.__parseConfig() != FAILED) and
(self.__setHypervisorAndZoneInfo())and
(self.__setTestDataPath() != FAILED) and
(self.__initLogging() != FAILED) and
(self.__createTestClient() != FAILED) and
(self.__deployDC() != FAILED)):
- print "\n==== Marvin Init Successful ===="
+ print("\n==== Marvin Init Successful ====")
return SUCCESS
- print "\n==== Marvin Init Failed ===="
+ print("\n==== Marvin Init Failed ====")
return FAILED
except Exception as e:
- print "\n Exception Occurred Under init " \
- "%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under init " \
+ "%s" % GetDetailExceptionInfo(e))
return FAILED
def __initLogging(self):
@@ -181,12 +181,12 @@ class MarvinInit:
if ret != FAILED:
self.__logFolderPath = log_obj.getLogFolderPath()
self.__tcRunLogger = log_obj.getLogger()
- print "\n=== Marvin Init Logging Successful==="
+ print("\n=== Marvin Init Logging Successful===")
return SUCCESS
return FAILED
except Exception as e:
- print "\n Exception Occurred Under __initLogging " \
- ":%s" % GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __initLogging " \
+ ":%s" % GetDetailExceptionInfo(e))
return FAILED
def __createTestClient(self):
@@ -210,8 +210,8 @@ class MarvinInit:
return self.__testClient.createTestClient()
return FAILED
except Exception as e:
- print "\n Exception Occurred Under __createTestClient : %s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __createTestClient : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def __setTestDataPath(self):
@@ -224,11 +224,11 @@ class MarvinInit:
if ((self.__parsedConfig.TestData is not None) and
(self.__parsedConfig.TestData.Path is not None)):
self.__testDataFilePath = self.__parsedConfig.TestData.Path
- print "\n=== Marvin Setting TestData Successful==="
+ print("\n=== Marvin Setting TestData Successful===")
return SUCCESS
except Exception as e:
- print "\nException Occurred Under __setTestDataPath : %s" % \
- GetDetailExceptionInfo(e)
+ print("\nException Occurred Under __setTestDataPath : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def __deployDC(self):
@@ -245,9 +245,9 @@ class MarvinInit:
self.__tcRunLogger)
ret = deploy_obj.deploy()
if ret != SUCCESS:
- print "==== Deploy DC Failed ===="
+ print("==== Deploy DC Failed ====")
return ret
except Exception as e:
- print "\n Exception Occurred Under __deployDC : %s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __deployDC : %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
diff --git a/tools/marvin/marvin/marvinLog.py b/tools/marvin/marvin/marvinLog.py
index 582d2e14457..c720186172b 100644
--- a/tools/marvin/marvin/marvinLog.py
+++ b/tools/marvin/marvin/marvinLog.py
@@ -40,7 +40,7 @@ class MarvinLog:
def __new__(cls, logger_name):
if not cls._instance:
- cls._instance = super(MarvinLog, cls).__new__(cls, logger_name)
+ cls._instance = super(MarvinLog, cls).__new__(cls)
return cls._instance
def __init__(self, logger_name):
@@ -92,8 +92,8 @@ class MarvinLog:
self.__logger.addHandler(stream)
return SUCCESS
except Exception as e:
- print "\nException Occurred Under " \
- "__setLogHandler %s" % GetDetailExceptionInfo(e)
+ print("\nException Occurred Under " \
+ "__setLogHandler %s" % GetDetailExceptionInfo(e))
return FAILED
def __cleanPreviousLogs(self, logfolder_to_remove):
@@ -107,8 +107,8 @@ class MarvinLog:
if os.path.isdir(logfolder_to_remove):
os.rmdir(logfolder_to_remove)
except Exception as e:
- print "\n Exception Occurred Under __cleanPreviousLogs :%s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under __cleanPreviousLogs :%s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def getLogger(self):
@@ -155,7 +155,7 @@ class MarvinLog:
if user_provided_logpath:
temp_dir = os.path.join(user_provided_logpath, "MarvinLogs")
elif ((log_cfg is not None) and
- ('LogFolderPath' in log_cfg.__dict__.keys()) and
+ ('LogFolderPath' in list(log_cfg.__dict__.keys())) and
(log_cfg.__dict__.get('LogFolderPath') is not None)):
temp_dir = os.path.join(log_cfg.__dict__.get('LogFolderPath'), "MarvinLogs")
@@ -167,7 +167,7 @@ class MarvinLog:
else:
self.__logFolderDir = os.path.join(temp_dir, str(test_module_name))
- print "\n==== Log Folder Path: %s. All logs will be available here ====" % str(self.__logFolderDir)
+ print("\n==== Log Folder Path: %s. All logs will be available here ====" % str(self.__logFolderDir))
os.makedirs(self.__logFolderDir)
'''
@@ -187,6 +187,6 @@ class MarvinLog:
return SUCCESS
return FAILED
except Exception as e:
- print "\n Exception Occurred Under createLogs :%s" % \
- GetDetailExceptionInfo(e)
+ print("\n Exception Occurred Under createLogs :%s" % \
+ GetDetailExceptionInfo(e))
return FAILED
diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py
index bd55763cabd..ec75b6114f1 100644
--- a/tools/marvin/marvin/marvinPlugin.py
+++ b/tools/marvin/marvin/marvinPlugin.py
@@ -88,7 +88,7 @@ class MarvinPlugin(Plugin):
self.__userLogPath = options.logFolder
self.conf = conf
if self.startMarvin() == FAILED:
- print "\nStarting Marvin Failed, exiting. Please Check"
+ print("\nStarting Marvin Failed, exiting. Please Check")
exit(1)
def options(self, parser, env):
@@ -150,8 +150,8 @@ class MarvinPlugin(Plugin):
return True
return False
except ImportError as e:
- print "FileName :%s : Error : %s" % \
- (filename, GetDetailExceptionInfo(e))
+ print("FileName :%s : Error : %s" % \
+ (filename, GetDetailExceptionInfo(e)))
return False
def wantFile(self, filename):
@@ -171,7 +171,7 @@ class MarvinPlugin(Plugin):
if not self.__testName:
self.__testName = "test"
self.__testClient.identifier = '-'.\
- join([self.__identifier, self.__testName])
+ join([self.__identifier if self.__identifier != None else "marvinTest", self.__testName])
if self.__tcRunLogger:
self.__tcRunLogger.name = test.__str__()
@@ -193,7 +193,7 @@ class MarvinPlugin(Plugin):
GetDetailExceptionInfo(err)))
write_str = "=== TestName: %s | Status : %s ===\n" % (tname, status)
self.__resultStream.write(write_str)
- print write_str
+ print(write_str)
def addSuccess(self, test, capt):
'''
@@ -250,8 +250,8 @@ class MarvinPlugin(Plugin):
return SUCCESS
return FAILED
except Exception as e:
- print "Exception Occurred under startMarvin: %s" % \
- GetDetailExceptionInfo(e)
+ print("Exception Occurred under startMarvin: %s" % \
+ GetDetailExceptionInfo(e))
return FAILED
def stopTest(self, test):
@@ -306,7 +306,7 @@ class MarvinPlugin(Plugin):
dst = tmp + "/" + mod_name + "_" + random_gen()
cmd = "mv " + src + " " + dst
os.system(cmd)
- print "===final results are now copied to: %s===" % str(dst)
+ print("===final results are now copied to: %s===" % str(dst))
except Exception as e:
- print "=== Exception occurred under finalize :%s ===" % \
- str(GetDetailExceptionInfo(e))
+ print("=== Exception occurred under finalize :%s ===" % \
+ str(GetDetailExceptionInfo(e)))
diff --git a/tools/marvin/marvin/misc/build/advanced_env.py b/tools/marvin/marvin/misc/build/advanced_env.py
index 07991f1f408..659480056af 100644
--- a/tools/marvin/marvin/misc/build/advanced_env.py
+++ b/tools/marvin/marvin/misc/build/advanced_env.py
@@ -27,13 +27,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/misc/build/bashUtils.py b/tools/marvin/marvin/misc/build/bashUtils.py
index d4e74f3a6f7..c07c9b3bb71 100644
--- a/tools/marvin/marvin/misc/build/bashUtils.py
+++ b/tools/marvin/marvin/misc/build/bashUtils.py
@@ -42,7 +42,7 @@ class remoteSSHClient(object):
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
self.ssh.connect(str(host),int(port), user, passwd)
- except paramiko.SSHException, sshex:
+ except paramiko.SSHException as sshex:
logging.debug(repr(sshex))
def execute(self, command):
@@ -70,7 +70,7 @@ class remoteSSHClient(object):
rl, wl, xl = select.select([channel],[],[],0.0)
if len(rl) > 0:
logging.debug(channel.recv(bufsize))
- except paramiko.SSHException, e:
+ except paramiko.SSHException as e:
logging.debug(repr(e))
@@ -80,7 +80,7 @@ class remoteSSHClient(object):
sftp = paramiko.SFTPClient.from_transport(transport)
try:
sftp.put(srcFile, destPath)
- except IOError, e:
+ except IOError as e:
raise e
class bash:
diff --git a/tools/marvin/marvin/misc/build/buildGenerator.py b/tools/marvin/marvin/misc/build/buildGenerator.py
index 579406790c8..bb92b7f32e9 100644
--- a/tools/marvin/marvin/misc/build/buildGenerator.py
+++ b/tools/marvin/marvin/misc/build/buildGenerator.py
@@ -18,7 +18,7 @@
# under the License.
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
from jenkinsapi import api, jenkins, job
from time import sleep as delay
import jenkinsapi
@@ -49,7 +49,7 @@ class BuildGenerator(object):
try:
j = jenkins.Jenkins(self.hudsonurl, self.username, self.password)
self.jobclient = j.get_job(job)
- except Exception, e:
+ except Exception as e:
logging.error("Failed to login to Hudson")
raise e
else:
@@ -71,7 +71,7 @@ class BuildGenerator(object):
params = {}
if self.config:
logging.debug("build params found:")
- for k,v in dict(self.config.items('build_params')).iteritems():
+ for k,v in dict(self.config.items('build_params')).items():
logging.debug("%s : %s"%(k,v))
return dict(self.config.items('build_params'))
else:
@@ -141,7 +141,7 @@ class BuildGenerator(object):
def getBuildParamList(self, bld):
params = bld.get_actions()['parameters']
- return dict(map(self.sift, params))
+ return dict(list(map(self.sift, params)))
def resolveRepoPath(self):
tarball_list = ['CloudStack-' ,
diff --git a/tools/marvin/marvin/misc/build/configure.py b/tools/marvin/marvin/misc/build/configure.py
index 22d1880b8f3..07dae947d36 100644
--- a/tools/marvin/marvin/misc/build/configure.py
+++ b/tools/marvin/marvin/misc/build/configure.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
from bashUtils import bash
from marvin import configGenerator
from marvin import sshClient
@@ -28,12 +28,12 @@ import contextlib
import telnetlib
import logging
import threading
-import Queue
+import queue
import sys
import random
import string
-import urllib2
-import urlparse
+import urllib.request, urllib.error, urllib.parse
+import urllib.parse
import socket
WORKSPACE="."
@@ -83,11 +83,11 @@ def mkdirs(path):
def fetch(filename, url, path):
try:
- zipstream = urllib2.urlopen(url)
+ zipstream = urllib.request.urlopen(url)
tarball = open('/tmp/%s' % filename, 'wb')
tarball.write(zipstream.read())
tarball.close()
- except urllib2.URLError, u:
+ except urllib.error.URLError as u:
raise u
except IOError:
raise
@@ -95,7 +95,7 @@ def fetch(filename, url, path):
def cobblerHomeResolve(ip_address, param="gateway"):
ipAddr = IPAddress(ip_address)
- for nic, network in cobblerinfo.items():
+ for nic, network in list(cobblerinfo.items()):
subnet = IPNetwork(cobblerinfo[nic]["network"])
if ipAddr in subnet:
return cobblerinfo[nic][param]
@@ -142,7 +142,7 @@ def mountAndClean(host, path):
Will mount and clear the files on NFS host in the path given. Obviously the
NFS server should be mountable where this script runs
"""
- mnt_path = "/tmp/" + ''.join([random.choice(string.ascii_uppercase) for x in xrange(0, 10)])
+ mnt_path = "/tmp/" + ''.join([random.choice(string.ascii_uppercase) for x in range(0, 10)])
mkdirs(mnt_path)
logging.info("cleaning up %s:%s" % (host, path))
mnt = bash("mount -t nfs %s:%s %s" % (host, path, mnt_path))
@@ -157,8 +157,8 @@ def cleanPrimaryStorage(cscfg):
for pod in zone.pods:
for cluster in pod.clusters:
for primaryStorage in cluster.primaryStorages:
- if urlparse.urlsplit(primaryStorage.url).scheme == "nfs":
- mountAndClean(urlparse.urlsplit(primaryStorage.url).hostname, urlparse.urlsplit(primaryStorage.url).path)
+ if urllib.parse.urlsplit(primaryStorage.url).scheme == "nfs":
+ mountAndClean(urllib.parse.urlsplit(primaryStorage.url).hostname, urllib.parse.urlsplit(primaryStorage.url).path)
logging.info("Cleaned up primary stores")
def seedSecondaryStorage(cscfg, hypervisor):
@@ -172,8 +172,8 @@ def seedSecondaryStorage(cscfg, hypervisor):
bash("rm -f /etc/puppet/modules/cloudstack/files/secseeder.sh")
for zone in cscfg.zones:
for sstor in zone.secondaryStorages:
- shost = urlparse.urlsplit(sstor.url).hostname
- spath = urlparse.urlsplit(sstor.url).path
+ shost = urllib.parse.urlsplit(sstor.url).hostname
+ spath = urllib.parse.urlsplit(sstor.url).path
spath = ''.join([shost, ':', spath])
logging.info("seeding %s systemvm template on %s"%(hypervisor, spath))
bash("echo '/bin/bash /root/redeploy.sh -s %s -h %s' >> /etc/puppet/modules/cloudstack/files/secseeder.sh"%(spath, hypervisor))
@@ -189,7 +189,7 @@ def refreshHosts(cscfg, hypervisor="xenserver", profile="xenserver602"):
for pod in zone.pods:
for cluster in pod.clusters:
for host in cluster.hosts:
- hostname = urlparse.urlsplit(host.url).hostname
+ hostname = urllib.parse.urlsplit(host.url).hostname
logging.debug("attempting to refresh host %s"%hostname)
#revoke certs
bash("puppet cert clean %s.%s"%(hostname, DOMAIN))
@@ -234,7 +234,7 @@ def _isPortListening(host, port, timeout=120):
try:
tn = telnetlib.Telnet(host, port, timeout=timeout)
timeout = 0
- except Exception, e:
+ except Exception as e:
logging.debug("Failed to telnet connect to %s:%s with %s"%(host, port, e))
delay(5)
timeout = timeout - 5
@@ -257,7 +257,7 @@ def _isPortOpen(hostQueue, port=22):
try:
logging.debug("Attempting port=%s connect to host %s"%(port, host))
err = channel.connect_ex((host, port))
- except socket.error, e:
+ except socket.error as e:
logging.debug("encountered %s retrying in 5s"%e)
err = e.errno
delay(5)
@@ -274,7 +274,7 @@ def _isPortOpen(hostQueue, port=22):
def waitForHostReady(hostlist):
logging.info("Waiting for hosts %s to refresh"%hostlist)
- hostQueue = Queue.Queue()
+ hostQueue = queue.Queue()
for host in hostlist:
t = threading.Thread(name='HostWait-%s'%hostlist.index(host), target=_isPortOpen,
@@ -375,7 +375,7 @@ if __name__ == '__main__':
try:
with open(options.system, 'r') as cfg:
system.readfp(cfg)
- except IOError, e:
+ except IOError as e:
logging.error("Specify a valid path for the environment properties")
raise e
generate_system_tables(system)
diff --git a/tools/marvin/marvin/misc/build/openport.py b/tools/marvin/marvin/misc/build/openport.py
index 0c40b0ab684..0c3378b906d 100644
--- a/tools/marvin/marvin/misc/build/openport.py
+++ b/tools/marvin/marvin/misc/build/openport.py
@@ -24,9 +24,9 @@ def _openIntegrationPort():
dbpasswd = 'cloud'#csconfig.dbSvr.passwd
conn = dbConnection.dbConnection(dbhost, 3306, dbuser, dbpasswd, "cloud")
query = "update configuration set value='8096' where name='integration.api.port'"
- print conn.execute(query)
+ print(conn.execute(query))
query = "select name,value from configuration where name='integration.api.port'"
- print conn.execute(query)
+ print(conn.execute(query))
if __name__ == '__main__':
_openIntegrationPort()
diff --git a/tools/marvin/marvin/misc/build/restartMgmt.py b/tools/marvin/marvin/misc/build/restartMgmt.py
index be5c76abded..ab5c0fc9e33 100644
--- a/tools/marvin/marvin/misc/build/restartMgmt.py
+++ b/tools/marvin/marvin/misc/build/restartMgmt.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-from ConfigParser import ConfigParser
+from configparser import ConfigParser
from optparse import OptionParser
import marvin
from marvin import configGenerator
diff --git a/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py b/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py
index e119752689e..5bbbb69c1f8 100644
--- a/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py
+++ b/tools/marvin/marvin/misc/build/xunitmp/xunitmultiprocess.py
@@ -116,7 +116,7 @@ def exc_message(exc_info):
result = str(exc)
except UnicodeEncodeError:
try:
- result = unicode(exc)
+ result = str(exc)
except UnicodeError:
# Fallback to args as neither str nor
# unicode(Exception(u'\xe6')) work in Python < 2.6
@@ -145,7 +145,7 @@ class Xunitmp(Plugin):
def _quoteattr(self, attr):
"""Escape an XML attribute. Value can be unicode."""
attr = xml_safe(attr)
- if isinstance(attr, unicode) and not UNICODE_STRINGS:
+ if isinstance(attr, str) and not UNICODE_STRINGS:
attr = attr.encode(self.encoding)
return saxutils.quoteattr(attr)
@@ -213,8 +213,8 @@ class Xunitmp(Plugin):
def addstream(self,xml):
try:
self.xunitstream.append(xml)
- except Exception, e:
- print 'xunitmultiprocess add stream len=%d,%s'%(len(xml),str(e))
+ except Exception as e:
+ print('xunitmultiprocess add stream len=%d,%s'%(len(xml),str(e)))
def addError(self, test, err, capt=None):
"""Add error output to Xunit report.
diff --git a/tools/marvin/marvin/sandbox/advanced/advanced_env.py b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
index f3d30643f21..8b6c3978b91 100644
--- a/tools/marvin/marvin/sandbox/advanced/advanced_env.py
+++ b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
@@ -24,13 +24,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py b/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py
index 284ea2eb25b..e5cc22a317d 100644
--- a/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py
+++ b/tools/marvin/marvin/sandbox/advancedsg/advancedsg_env.py
@@ -24,13 +24,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/basic/basic_env.py b/tools/marvin/marvin/sandbox/basic/basic_env.py
index 6198163a866..32b7dd58e13 100644
--- a/tools/marvin/marvin/sandbox/basic/basic_env.py
+++ b/tools/marvin/marvin/sandbox/basic/basic_env.py
@@ -25,13 +25,13 @@
'''
import random
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
index 08b20cce67b..68fd828a47a 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
@@ -18,14 +18,14 @@
import marvin
-from ConfigParser import SafeConfigParser
+from configparser import SafeConfigParser
from optparse import OptionParser
from marvin.configGenerator import *
import random
def getGlobalSettings(config):
- for k, v in dict(config.items('globals')).iteritems():
+ for k, v in dict(config.items('globals')).items():
cfg = configuration()
cfg.name = k
cfg.value = v
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
index 7c8546c092c..f3c9c241f02 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/base.py
@@ -20,7 +20,7 @@
-Virtual machine, Volume, Snapshot etc
"""
-from utils import is_server_ssh_ready, random_gen
+from .utils import is_server_ssh_ready, random_gen
from marvin.cloudstackAPI import *
#Import System modules
import time
@@ -70,7 +70,7 @@ class Domain:
def list(cls, apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDomains(cmd))
@@ -115,7 +115,7 @@ class Account:
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listAccounts(cmd))
@@ -156,7 +156,7 @@ class User:
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listUsers(cmd))
@@ -282,7 +282,7 @@ class VirtualMachine:
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVirtualMachines(cmd))
@@ -372,7 +372,7 @@ class Volume:
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVolumes(cmd))
@@ -404,7 +404,7 @@ class Snapshot:
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshots(cmd))
@@ -536,7 +536,7 @@ class Template:
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listTemplates(cmd))
@@ -618,7 +618,7 @@ class Iso:
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listIsos(cmd))
@@ -654,7 +654,7 @@ class PublicIPAddress:
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPublicIpAddresses(cmd))
class NATRule:
@@ -692,7 +692,7 @@ class NATRule:
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPortForwardingRules(cmd))
@@ -735,7 +735,7 @@ class StaticNATRule:
"""List all IP forwarding rules matching criteria"""
cmd = listIpForwardingRules.listIpForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listIpForwardingRules(cmd))
@classmethod
@@ -792,7 +792,7 @@ class FireWallRule:
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listFirewallRules(cmd))
@@ -830,7 +830,7 @@ class ServiceOffering:
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listServiceOfferings(cmd))
class DiskOffering:
@@ -863,7 +863,7 @@ class DiskOffering:
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDiskOfferings(cmd))
@@ -896,7 +896,7 @@ class SnapshotPolicy:
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshotPolicies(cmd))
@@ -947,7 +947,7 @@ class LoadBalancerRule:
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listLoadBalancerRules(cmd))
@@ -997,7 +997,7 @@ class Cluster:
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listClusters(cmd))
@@ -1064,7 +1064,7 @@ class Host:
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listHosts(cmd))
@@ -1124,7 +1124,7 @@ class StoragePool:
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listStoragePools(cmd))
@@ -1161,7 +1161,7 @@ class Network:
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listNetworks(cmd))
@@ -1257,7 +1257,7 @@ class Zone:
cmd = updateZone.updateZoneCmd()
cmd.id = self.id
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.updateZone(cmd)
@@ -1266,7 +1266,7 @@ class Zone:
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listZones(cmd))
@@ -1301,7 +1301,7 @@ class Pod:
"Returns a default pod for specified zone"
cmd = listPods.listPodsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return apiclient.listPods(cmd)
@@ -1339,7 +1339,7 @@ class PublicIpRange:
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVlanIpRanges(cmd))
@@ -1432,5 +1432,5 @@ class SecurityGroup:
"""Lists all security groups."""
cmd = listSecurityGroups.listSecurityGroupsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSecurityGroups(cmd))
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py
index e0c452741b1..861fd719e2a 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/testcase/libs/common.py
@@ -23,8 +23,8 @@
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
import marvin.sshClient
-from utils import *
-from base import *
+from .utils import *
+from .base import *
#Import System modules
import time
@@ -258,133 +258,133 @@ def list_routers(apiclient, **kwargs):
"""List all Routers matching criteria"""
cmd = listRouters.listRoutersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listRouters(cmd))
def list_zones(apiclient, **kwargs):
"""List all Zones matching criteria"""
cmd = listZones.listZonesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listZones(cmd))
def list_networks(apiclient, **kwargs):
"""List all Networks matching criteria"""
cmd = listNetworks.listNetworksCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listNetworks(cmd))
def list_clusters(apiclient, **kwargs):
"""List all Clusters matching criteria"""
cmd = listClusters.listClustersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listClusters(cmd))
def list_ssvms(apiclient, **kwargs):
"""List all SSVMs matching criteria"""
cmd = listSystemVms.listSystemVmsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSystemVms(cmd))
def list_storage_pools(apiclient, **kwargs):
"""List all storage pools matching criteria"""
cmd = listStoragePools.listStoragePoolsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listStoragePools(cmd))
def list_virtual_machines(apiclient, **kwargs):
"""List all VMs matching criteria"""
cmd = listVirtualMachines.listVirtualMachinesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVirtualMachines(cmd))
def list_hosts(apiclient, **kwargs):
"""List all Hosts matching criteria"""
cmd = listHosts.listHostsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listHosts(cmd))
def list_configurations(apiclient, **kwargs):
"""List configuration with specified name"""
cmd = listConfigurations.listConfigurationsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listConfigurations(cmd))
def list_publicIP(apiclient, **kwargs):
"""List all Public IPs matching criteria"""
cmd = listPublicIpAddresses.listPublicIpAddressesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPublicIpAddresses(cmd))
def list_nat_rules(apiclient, **kwargs):
"""List all NAT rules matching criteria"""
cmd = listPortForwardingRules.listPortForwardingRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listPortForwardingRules(cmd))
def list_lb_rules(apiclient, **kwargs):
"""List all Load balancing rules matching criteria"""
cmd = listLoadBalancerRules.listLoadBalancerRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listLoadBalancerRules(cmd))
def list_lb_instances(apiclient, **kwargs):
"""List all Load balancing instances matching criteria"""
cmd = listLoadBalancerRuleInstances.listLoadBalancerRuleInstancesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listLoadBalancerRuleInstances(cmd))
def list_firewall_rules(apiclient, **kwargs):
"""List all Firewall Rules matching criteria"""
cmd = listFirewallRules.listFirewallRulesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listFirewallRules(cmd))
def list_volumes(apiclient, **kwargs):
"""List all volumes matching criteria"""
cmd = listVolumes.listVolumesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVolumes(cmd))
def list_isos(apiclient, **kwargs):
"""Lists all available ISO files."""
cmd = listIsos.listIsosCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listIsos(cmd))
def list_snapshots(apiclient, **kwargs):
"""List all snapshots matching criteria"""
cmd = listSnapshots.listSnapshotsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshots(cmd))
def list_templates(apiclient, **kwargs):
"""List all templates matching criteria"""
cmd = listTemplates.listTemplatesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listTemplates(cmd))
def list_domains(apiclient, **kwargs):
"""Lists domains"""
cmd = listDomains.listDomainsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDomains(cmd))
def list_accounts(apiclient, **kwargs):
@@ -392,7 +392,7 @@ def list_accounts(apiclient, **kwargs):
listed accounts"""
cmd = listAccounts.listAccountsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listAccounts(cmd))
def list_users(apiclient, **kwargs):
@@ -400,61 +400,61 @@ def list_users(apiclient, **kwargs):
listed users"""
cmd = listUsers.listUsersCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listUsers(cmd))
def list_snapshot_policy(apiclient, **kwargs):
"""Lists snapshot policies."""
cmd = listSnapshotPolicies.listSnapshotPoliciesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listSnapshotPolicies(cmd))
def list_events(apiclient, **kwargs):
"""Lists events"""
cmd = listEvents.listEventsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listEvents(cmd))
def list_disk_offering(apiclient, **kwargs):
"""Lists all available disk offerings."""
cmd = listDiskOfferings.listDiskOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listDiskOfferings(cmd))
def list_service_offering(apiclient, **kwargs):
"""Lists all available service offerings."""
cmd = listServiceOfferings.listServiceOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listServiceOfferings(cmd))
def list_vlan_ipranges(apiclient, **kwargs):
"""Lists all VLAN IP ranges."""
cmd = listVlanIpRanges.listVlanIpRangesCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listVlanIpRanges(cmd))
def list_usage_records(apiclient, **kwargs):
"""Lists usage records for accounts"""
cmd = listUsageRecords.listUsageRecordsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listUsageRecords(cmd))
def list_network_offerings(apiclient, **kwargs):
"""Lists network offerings"""
cmd = listNetworkOfferings.listNetworkOfferingsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listNetworkOfferings(cmd))
def list_resource_limits(apiclient, **kwargs):
"""Lists resource limits"""
cmd = listResourceLimits.listResourceLimitsCmd()
- [setattr(cmd, k, v) for k, v in kwargs.items()]
+ [setattr(cmd, k, v) for k, v in list(kwargs.items())]
return(apiclient.listResourceLimits(cmd))
diff --git a/tools/marvin/marvin/sshClient.py b/tools/marvin/marvin/sshClient.py
index e872256812c..8b8405cc8c8 100644
--- a/tools/marvin/marvin/sshClient.py
+++ b/tools/marvin/marvin/sshClient.py
@@ -211,4 +211,4 @@ if __name__ == "__main__":
with contextlib.closing(SshClient("127.0.0.1", 22, "root",
"asdf!@34")) as ssh:
ret = ssh.runCommand("ls -l")
- print ret
+ print(ret)
diff --git a/tools/marvin/marvin/tcExecuteEngine.py b/tools/marvin/marvin/tcExecuteEngine.py
index 11b5d093d31..22c06c2a680 100644
--- a/tools/marvin/marvin/tcExecuteEngine.py
+++ b/tools/marvin/marvin/tcExecuteEngine.py
@@ -70,7 +70,7 @@ class TestCaseExecuteEngine(object):
def run(self):
if self.__suite:
- print "\n==== Test Suite :%s Started ====" % (str(self.__suite))
+ print("\n==== Test Suite :%s Started ====" % (str(self.__suite)))
unittest.TextTestRunner(stream=self.__debugStream,
verbosity=2).run(self.__suite)
- print "\n==== Test Suite :%s Finished ====" % (str(self.__suite))
+ print("\n==== Test Suite :%s Finished ====" % (str(self.__suite)))
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index b33953607d2..8db1a0cf54f 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -69,7 +69,7 @@
${basedir}/marvin
- python
+ python3
codegenerator.py
-s
@@ -123,7 +123,7 @@
${basedir}/marvin
- python
+ python3
codegenerator.py
-e
diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py
index 275b6e3db85..8eb8932f875 100644
--- a/tools/marvin/setup.py
+++ b/tools/marvin/setup.py
@@ -57,7 +57,8 @@ setup(name="Marvin",
"ipmisim >= 0.7",
"pytz",
"retries",
- "PyCrypt"
+ "PyCrypt",
+ "urllib3"
],
py_modules=['marvin.marvinPlugin'],
zip_safe=False,
diff --git a/tools/travis/before_install.sh b/tools/travis/before_install.sh
index f2ecd973b62..0bb5c112bd6 100755
--- a/tools/travis/before_install.sh
+++ b/tools/travis/before_install.sh
@@ -83,6 +83,18 @@ fi
sudo apt-get -q -y -V install freeipmi-common libfreeipmi16 libgcrypt20 libgpg-error-dev libgpg-error0 libopenipmi0 ipmitool libpython-dev libssl-dev libffi-dev python-openssl build-essential --no-install-recommends > /dev/null
+sudo apt-get -y install python3 python3-pip
+sudo apt-get -y install python3-dev # in order to be able to pip3 install pycrypto
+# for now we need both:
+sudo apt-get -y install python2
+sudo apt-get -y install python2-dev # in order to be able to pip3 install pycrypto
+sudo apt-get -y install python2-pip
+
+echo -e "\nPython 3 version: "
+python3 --version
+echo -e "\nPython 2 version: "
+python2 --version
+
echo -e "\nIPMI version"
ipmitool -V
@@ -103,11 +115,18 @@ echo "
" > ~/.m2/settings.xml
+echo -e "\nChecking PIP Version: "
+python3 -m pip --version
+echo -e "\nUpgrading PIP if necessary: "
+python3 -m pip install --upgrade pip
+python3 -m pip --version
+
echo -e "\nInstalling some python packages: "
for ((i=0;i<$RETRY_COUNT;i++))
do
- pip install --user --upgrade lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid > /tmp/piplog
+ python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid > /tmp/piplog
+ python2 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid >> /tmp/piplog
if [[ $? -eq 0 ]]; then
echo -e "\npython packages installed successfully"
break;
@@ -117,4 +136,4 @@ do
done
echo -e "\nVersion of pip packages:\n"
-echo $(pip freeze)
\ No newline at end of file
+echo $(pip freeze)
diff --git a/tools/travis/before_script.sh b/tools/travis/before_script.sh
index 5b649dc4640..e0a021856e7 100755
--- a/tools/travis/before_script.sh
+++ b/tools/travis/before_script.sh
@@ -24,4 +24,4 @@ mvn -Dsimulator -Dorg.eclipse.jetty.annotations.maxWait=120 -pl :cloud-client-ui
while ! nc -vzw 5 localhost 8096 2>&1 > /dev/null; do grep Exception /tmp/jetty-log; sleep 10; done
echo -e "\nStarting DataCenter deployment"
-python tools/marvin/marvin/deployDataCenter.py -i setup/dev/advanced.cfg 2>&1 || true
+python3 tools/marvin/marvin/deployDataCenter.py -i setup/dev/advanced.cfg 2>&1 || true
diff --git a/tools/travis/install.sh b/tools/travis/install.sh
index c8c1b83dec8..57f4e315dfc 100755
--- a/tools/travis/install.sh
+++ b/tools/travis/install.sh
@@ -40,8 +40,20 @@ if [ $TEST_SEQUENCE_NUMBER -eq 1 ]; then
# npm lint, test and build
cd ui && npm install && npm run lint && npm run test:unit && npm run build
cd $DIR
+
+# TODO reinstate this when the systemvm code is fully ported to python3 (or some other processing system)
# Pylint/pep8 systemvm python codebase
- cd systemvm/test && bash -x runtests.sh
+# python3 -m pip install --user --upgrade setuptools pycodestyle pylint flask nose
+# pip install virtualenv
+# sudo virtualenv -p `which python2` py2
+# source py2/bin/activate
+# cd $DIR
+# which python
+# which python2
+# python --version
+# python2 -m pip install --user --upgrade setuptools pycodestyle pylint flask nose
+# cd systemvm/test && bash -x runtests.sh
+
# Build noredist
git clone https://github.com/rhtyd/cloudstack-nonoss.git nonoss && cd nonoss && bash -x install-non-oss.sh
cd $DIR && echo $DIR
@@ -54,10 +66,10 @@ else
fi
# Install mysql-connector-python
-pip install --user --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df 2>&1 > /dev/null
+python3 -m pip install --user --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df 2>&1 > /dev/null
# Install marvin
-pip install --user --upgrade tools/marvin/dist/Marvin-*.tar.gz
+python3 -m pip install --user --upgrade tools/marvin/dist/Marvin-*.tar.gz
# Deploy the database
mvn -q -Pdeveloper -pl developer -Ddeploydb
diff --git a/tools/travis/script.sh b/tools/travis/script.sh
index 4875a512837..7e36a0abc0c 100755
--- a/tools/travis/script.sh
+++ b/tools/travis/script.sh
@@ -33,4 +33,4 @@ for suite in "${TESTS[@]}" ; do
time nosetests --with-xunit --xunit-file=integration-test-results/$suite.xml --with-marvin --marvin-config=setup/dev/advanced.cfg test/integration/$suite.py -s -a tags=advanced,required_hardware=false --zone=Sandbox-simulator --hypervisor=simulator || true ;
done
-python ./tools/travis/xunit-reader.py integration-test-results/
+python3 ./tools/travis/xunit-reader.py integration-test-results/
diff --git a/tools/travis/xunit-reader.py b/tools/travis/xunit-reader.py
index 659d3e60af9..66d78feceff 100755
--- a/tools/travis/xunit-reader.py
+++ b/tools/travis/xunit-reader.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -102,7 +102,7 @@ def parse_reports(file_path_list):
if status not in ('Skipped', 'Success'):
table.add_row([name, status, time, file_path.replace(".xml", "").split("/")[-1]])
- print table.draw()
+ print(table.draw())
return exit_code