python3: Migrate Marvin and smoketests to python3 (#4727)

This PR prepares marvin and tests for python3. it was part of #4479, until nose2 was decided to be abandoned from that PR.

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

Co-authored-by: Daan Hoogland <dahn@onecht.net>
Co-authored-by: Gabriel Beims Bräscher <gabriel@apache.org>
Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
dahn 2021-05-04 19:49:37 +02:00 committed by GitHub
parent 1abd10199c
commit a1f825e7c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
240 changed files with 12544 additions and 12627 deletions

View File

@ -1 +1 @@
system
3.6

View File

@ -25,7 +25,7 @@ jdk:
- openjdk11
python:
- "2.7"
- "3.9"
node_js:
- 12

View File

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

2
debian/control vendored
View File

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

View File

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

View File

@ -974,6 +974,7 @@
<exclude>**/*.md</exclude>
<exclude>.java-version</exclude>
<exclude>.python-version</exclude>
<exclude>systemvm/.pythen-version</exclude>
<exclude>.idea/</exclude>
<exclude>.metadata/**</exclude>
<exclude>.git/**</exclude>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,11 +35,11 @@ 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
@ -54,45 +54,48 @@ class TestIsolatedNetwork(cloudstackTestCase):
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.acldata["network"]["vlan"] = None
cls.domain_1 = None
cls.domain_2 = None
cls.cleanup = []
try:
cls._cleanup = []
# 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._cleanup.append(cls.domain_1)
cls.domain_11 = Domain.create(
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._cleanup.append(cls.domain_111)
cls.domain_12 = Domain.create(
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._cleanup.append(cls.domain_2)
# Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create(
cls.apiclient,
@ -100,6 +103,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -111,18 +115,18 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
)
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
@ -134,6 +138,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -144,6 +149,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -154,6 +160,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -166,6 +173,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -176,6 +184,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -186,6 +195,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -197,6 +207,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -207,7 +218,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -220,12 +231,11 @@ class TestIsolatedNetwork(cloudstackTestCase):
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(
@ -233,7 +243,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -243,7 +253,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
@ -253,6 +263,7 @@ class TestIsolatedNetwork(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
@ -319,48 +330,39 @@ class TestIsolatedNetwork(cloudstackTestCase):
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,
]
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)
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
@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
"""
@ -375,15 +377,13 @@ class TestIsolatedNetwork(cloudstackTestCase):
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")
@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
"""
@ -400,14 +400,14 @@ class TestIsolatedNetwork(cloudstackTestCase):
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")
@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
"""
@ -424,16 +424,16 @@ class TestIsolatedNetwork(cloudstackTestCase):
accountid=self.account_d11a.name,
domainid=self.account_d11a.domainid
)
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")
## 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
"""
@ -448,7 +448,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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")
@ -456,7 +456,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -473,14 +472,14 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -497,14 +496,14 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -521,6 +520,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -531,7 +531,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -546,15 +545,14 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -572,6 +570,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -580,7 +579,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -598,18 +596,17 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -625,15 +622,14 @@ class TestIsolatedNetwork(cloudstackTestCase):
templateid=self.template.id,
networkids=self.network_root.id
)
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")
def test_12_deployvm_admin_foruserinsamedomain(self):
"""
# Validate that Admin should be able to deploy Vm for users in his domain
"""
@ -651,14 +647,13 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -676,14 +671,13 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -701,6 +695,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -711,7 +706,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -727,15 +721,14 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -753,13 +746,13 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -777,13 +770,13 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -802,6 +795,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -810,7 +804,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -828,6 +821,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -838,7 +832,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -854,14 +847,13 @@ class TestIsolatedNetwork(cloudstackTestCase):
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
"""
@ -880,6 +872,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -888,7 +881,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -907,6 +899,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -915,7 +908,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -931,6 +923,7 @@ class TestIsolatedNetwork(cloudstackTestCase):
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)
@ -941,7 +934,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -954,10 +946,8 @@ class TestIsolatedNetwork(cloudstackTestCase):
True,
"Admin User is not able to restart network he owns")
@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
"""
@ -972,7 +962,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -985,11 +974,11 @@ class TestIsolatedNetwork(cloudstackTestCase):
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")
def test_24_restartNetwork_domaindmin(self):
"""
# Validate that Domain admin should be able to restart network for himslef
"""
@ -1002,10 +991,8 @@ class TestIsolatedNetwork(cloudstackTestCase):
True,
"Domain admin User is not able to restart network for himself")
@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
"""
@ -1019,7 +1006,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -1033,7 +1019,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -1052,7 +1037,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -1064,10 +1048,8 @@ class TestIsolatedNetwork(cloudstackTestCase):
True,
"User is not able to restart network he owns")
@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
"""
@ -1084,7 +1066,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
@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
"""
@ -1092,7 +1073,6 @@ class TestIsolatedNetwork(cloudstackTestCase):
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 ")
except Exception as e:
@ -1113,8 +1093,8 @@ class TestIsolatedNetwork(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-",
@ -1133,11 +1113,11 @@ class TestIsolatedNetwork(cloudstackTestCase):
networkofferingid=isolated_network_offering_id,
zoneid=zone.id
)
cls._cleanup.append(network)
return network
@staticmethod
def createVM(apiclient,zoneId,serviceOfferingId,templateId,networkId):
@classmethod
def createVM(cls, apiclient, zoneId, serviceOfferingId, templateId, networkId):
vmData = {"name": "prereq", "dispayname": "prereq"}
vm = VirtualMachine.create(
@ -1148,5 +1128,5 @@ class TestIsolatedNetwork(cloudstackTestCase):
templateid=templateId,
networkids=networkId
)
cls._cleanup.append(vm)
return vm

View File

@ -57,10 +57,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -70,25 +69,30 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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._cleanup.append(cls.domain_11)
cls.domain_111 = Domain.create(
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._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,7 +100,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -107,18 +111,18 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
)
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
@ -130,6 +134,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -140,6 +145,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -150,18 +156,19 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
)
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
@ -172,6 +179,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -182,6 +190,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -193,6 +202,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -203,7 +213,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -216,12 +226,11 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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(
@ -229,6 +238,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -239,6 +249,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -249,6 +260,7 @@ 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
@ -310,25 +322,15 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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.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)
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):
@ -357,11 +359,11 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
"""
@ -374,10 +376,10 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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.securityKey = self.user_root_secretkey
@ -388,6 +390,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
@ -405,11 +408,10 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
"""
@ -421,10 +423,10 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
"""
@ -437,10 +439,10 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
"""
@ -449,18 +451,17 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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 ")
## 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
"""
@ -473,11 +474,10 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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
"""
@ -486,6 +486,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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)
@ -503,6 +504,7 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
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)
@ -522,8 +524,8 @@ 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-",
@ -542,5 +544,6 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
networkofferingid=isolated_network_offering_id,
zoneid=zone.id
)
cls._cleanup.append(network)
return network

View File

@ -30,6 +30,7 @@ import time
_multiprocess_shared_ = True
class TestSnapshotList(cloudstackTestCase):
@classmethod
def setUpClass(cls):
@ -108,7 +109,6 @@ class TestSnapshotList(cloudstackTestCase):
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
@ -198,7 +198,6 @@ class TestSnapshotList(cloudstackTestCase):
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
# Create admin user account
cls.account_a = Account.create(
@ -234,7 +233,6 @@ class TestSnapshotList(cloudstackTestCase):
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(
@ -373,7 +371,8 @@ class TestSnapshotList(cloudstackTestCase):
try:
cls.domain_2.delete(cls.apiclient, cleanup="true")
cls.domain_1.delete(cls.apiclient, cleanup="true")
except: pass
except:
pass
cleanup_resources(cls.apiclient, cls.cleanup)
def setUp(cls):
@ -724,7 +723,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -809,7 +807,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -894,7 +891,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -972,7 +968,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when account and domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1288,7 +1283,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_rootadmin_listall_false_rec_false(self):
"""
@ -1301,7 +1295,6 @@ class TestSnapshotList(cloudstackTestCase):
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!!")
@ -1315,7 +1308,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases without passing listall paramter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1330,7 +1322,6 @@ class TestSnapshotList(cloudstackTestCase):
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!!")
@ -1478,7 +1469,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1563,7 +1553,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1648,7 +1637,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1726,7 +1714,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1804,7 +1791,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall not passed
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1882,7 +1868,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2012,7 +1997,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_listall_false_rec_false(self):
"""
@ -2025,7 +2009,6 @@ class TestSnapshotList(cloudstackTestCase):
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!!")
@ -2039,7 +2022,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases without passing listall paramter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2054,7 +2036,6 @@ class TestSnapshotList(cloudstackTestCase):
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!!")
@ -2195,7 +2176,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2223,7 +2203,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_false_rec_true(self):
"""
@ -2249,8 +2228,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_listall_false_rec_false(self):
"""
@ -2276,7 +2253,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2304,7 +2280,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_true_rec_true(self):
"""
@ -2330,8 +2305,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid__rec_false(self):
"""
@ -2357,7 +2330,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2435,7 +2407,6 @@ class TestSnapshotList(cloudstackTestCase):
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")
@ -2463,7 +2434,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_listall_false_rec_true(self):
"""
@ -2514,7 +2484,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when account and domainId is passed with listall not passed
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2542,7 +2511,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_rec_true(self):
"""
@ -2568,7 +2536,6 @@ class TestSnapshotList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_as_regularuser_domainid_accountid_rec_false(self):
"""
@ -2610,7 +2577,6 @@ class TestSnapshotList(cloudstackTestCase):
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")
def test_listSnapshot_as_regularuser_cross_domainid(self):
"""
@ -2625,7 +2591,6 @@ class TestSnapshotList(cloudstackTestCase):
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")
def test_listSnapshot_as_domainadmin_cross_domainid_accountid(self):
"""
@ -2640,7 +2605,6 @@ class TestSnapshotList(cloudstackTestCase):
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")
def test_listSnapshot_as_domainadmin_cross_domainid(self):
"""
@ -2655,7 +2619,6 @@ class TestSnapshotList(cloudstackTestCase):
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")
def test_listSnapshot_by_id_as_domainadmin_owns(self):
@ -2743,7 +2706,6 @@ class TestSnapshotList(cloudstackTestCase):
1,
"Domain Admin is not able to list Snapshotss from his sub domains")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listSnapshot_by_id_as_rootadmin_owns(self):
"""
@ -2794,7 +2756,6 @@ class TestSnapshotList(cloudstackTestCase):
self.apiclient.connection.securityKey = self.user_d11a_secretkey
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")
@ -2831,7 +2792,6 @@ class TestSnapshotList(cloudstackTestCase):
None,
"Regular User is able to list Snapshotss from other domains")
@staticmethod
def generateKeysForUser(apiclient, account):
user = User.list(
@ -2854,4 +2814,3 @@ class TestSnapshotList(cloudstackTestCase):
if list[num].id == attributeValue:
return True
return False

View File

@ -30,6 +30,7 @@ import time
_multiprocess_shared_ = True
class TestVMList(cloudstackTestCase):
@classmethod
def setUpClass(cls):
@ -42,7 +43,6 @@ class TestVMList(cloudstackTestCase):
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.apiclient = cls.testclient.getApiClient()
@ -105,7 +105,6 @@ class TestVMList(cloudstackTestCase):
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
@ -195,7 +194,6 @@ class TestVMList(cloudstackTestCase):
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
# Create admin user account
cls.account_a = Account.create(
@ -346,7 +344,8 @@ class TestVMList(cloudstackTestCase):
try:
cls.domain_2.delete(cls.apiclient, cleanup="true")
cls.domain_1.delete(cls.apiclient, cleanup="true")
except: pass
except:
pass
cleanup_resources(cls.apiclient, cls.cleanup)
def setUp(cls):
@ -697,7 +696,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -782,7 +780,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -867,7 +864,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -945,7 +941,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when account and domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1261,7 +1256,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_rootadmin_listall_false_rec_false(self):
"""
@ -1274,7 +1268,6 @@ class TestVMList(cloudstackTestCase):
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!!")
@ -1288,7 +1281,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases without passing listall paramter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1303,7 +1295,6 @@ class TestVMList(cloudstackTestCase):
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!!")
@ -1451,7 +1442,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1537,7 +1527,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1622,7 +1611,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1700,7 +1688,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1778,7 +1765,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall not passed
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1856,7 +1842,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1986,7 +1971,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_listall_false_rec_false(self):
"""
@ -1999,7 +1983,6 @@ class TestVMList(cloudstackTestCase):
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!!")
@ -2013,7 +1996,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases without passing listall paramter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2028,7 +2010,6 @@ class TestVMList(cloudstackTestCase):
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!!")
@ -2169,7 +2150,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2197,7 +2177,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_false_rec_true(self):
"""
@ -2223,8 +2202,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_listall_false_rec_false(self):
"""
@ -2250,7 +2227,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2278,7 +2254,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_true_rec_true(self):
"""
@ -2304,8 +2279,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid__rec_false(self):
"""
@ -2331,7 +2304,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2409,7 +2381,6 @@ class TestVMList(cloudstackTestCase):
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")
@ -2437,7 +2408,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_listall_false_rec_true(self):
"""
@ -2488,7 +2458,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when account and domainId is passed with listall not passed
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2516,7 +2485,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_rec_true(self):
"""
@ -2542,7 +2510,6 @@ class TestVMList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_as_regularuser_domainid_accountid_rec_false(self):
"""
@ -2584,7 +2551,6 @@ class TestVMList(cloudstackTestCase):
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")
def test_listVM_as_regularuser_cross_domainid(self):
"""
@ -2599,7 +2565,6 @@ class TestVMList(cloudstackTestCase):
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")
def test_listVM_as_domainadmin_cross_domainid_accountid(self):
"""
@ -2614,7 +2579,6 @@ class TestVMList(cloudstackTestCase):
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")
def test_listVM_as_domainadmin_cross_domainid(self):
"""
@ -2629,7 +2593,6 @@ class TestVMList(cloudstackTestCase):
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")
def test_listVM_by_id_as_domainadmin_owns(self):
@ -2717,7 +2680,6 @@ class TestVMList(cloudstackTestCase):
1,
"Domain Admin is not able to list Vms from his sub domains")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVM_by_id_as_rootadmin_owns(self):
"""
@ -2768,7 +2730,6 @@ class TestVMList(cloudstackTestCase):
self.apiclient.connection.securityKey = self.user_d11a_secretkey
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")
@ -2805,7 +2766,6 @@ class TestVMList(cloudstackTestCase):
None,
"Regular User is able to list Vms from other domains")
@staticmethod
def generateKeysForUser(apiclient, account):
user = User.list(
@ -2828,4 +2788,3 @@ class TestVMList(cloudstackTestCase):
if list[num].id == attributeValue:
return True
return False

View File

@ -30,6 +30,7 @@ import time
_multiprocess_shared_ = True
class TestVolumeList(cloudstackTestCase):
@classmethod
def setUpClass(cls):
@ -105,7 +106,6 @@ class TestVolumeList(cloudstackTestCase):
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
@ -195,7 +195,6 @@ class TestVolumeList(cloudstackTestCase):
cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey
# Create admin user account
cls.account_a = Account.create(
@ -350,8 +349,6 @@ class TestVolumeList(cloudstackTestCase):
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(TestVolumeList, cls).getClsTestClient().getApiClient()
@ -361,7 +358,8 @@ class TestVolumeList(cloudstackTestCase):
try:
cls.domain_2.delete(cls.apiclient, cleanup="true")
cls.domain_1.delete(cls.apiclient, cleanup="true")
except: pass
except:
pass
def setUp(cls):
cls.apiclient = cls.testClient.getApiClient()
@ -711,7 +709,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -794,7 +791,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -878,7 +874,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -956,7 +951,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Domain Admin - Test cases when account and domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1271,7 +1265,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_rootadmin_listall_false_rec_false(self):
"""
@ -1284,7 +1277,6 @@ class TestVolumeList(cloudstackTestCase):
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!!")
@ -1298,7 +1290,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases without passing listall paramter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1313,7 +1304,6 @@ class TestVolumeList(cloudstackTestCase):
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!!")
@ -1461,7 +1451,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1546,7 +1535,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1631,7 +1619,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1709,7 +1696,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1787,7 +1773,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## ROOT Admin - Test cases when account and domainId is passed with listall not passed
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1865,7 +1850,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -1995,7 +1979,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_listall_false_rec_false(self):
"""
@ -2008,7 +1991,6 @@ class TestVolumeList(cloudstackTestCase):
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!!")
@ -2022,7 +2004,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases without passing listall paramter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2037,7 +2018,6 @@ class TestVolumeList(cloudstackTestCase):
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!!")
@ -2178,7 +2158,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when domainId is passed with listall=false
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2206,7 +2185,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_false_rec_true(self):
"""
@ -2232,8 +2210,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_listall_false_rec_false(self):
"""
@ -2259,7 +2235,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when domainId is passed with no listall parameter
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2287,7 +2262,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_true_rec_true(self):
"""
@ -2313,8 +2287,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid__rec_false(self):
"""
@ -2340,7 +2312,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when account and domainId is passed with listall =true
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2418,7 +2389,6 @@ class TestVolumeList(cloudstackTestCase):
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")
@ -2446,7 +2416,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@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
@ -2495,7 +2464,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
## Regular User - Test cases when account and domainId is passed with listall not passed
@attr("simulator_only", tags=["advanced"], required_hardware="false")
@ -2523,7 +2491,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_rec_true(self):
"""
@ -2549,7 +2516,6 @@ class TestVolumeList(cloudstackTestCase):
True,
"Account access check failed!!")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_as_regularuser_domainid_accountid_rec_false(self):
"""
@ -2605,7 +2571,6 @@ class TestVolumeList(cloudstackTestCase):
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")
def test_listVolume_as_domainadmin_cross_domainid_accountid(self):
"""
@ -2620,7 +2585,6 @@ class TestVolumeList(cloudstackTestCase):
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")
def test_listVolume_as_domainadmin_cross_domainid(self):
"""
@ -2635,7 +2599,6 @@ class TestVolumeList(cloudstackTestCase):
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")
def test_listVolume_by_id_as_domainadmin_owns(self):
@ -2723,7 +2686,6 @@ class TestVolumeList(cloudstackTestCase):
1,
"Domain Admin is not able to list Volumes from his sub domains")
@attr("simulator_only", tags=["advanced"], required_hardware="false")
def test_listVolume_by_id_as_rootadmin_owns(self):
"""
@ -2774,7 +2736,6 @@ class TestVolumeList(cloudstackTestCase):
self.apiclient.connection.securityKey = self.user_d11a_secretkey
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")
@ -2811,7 +2772,6 @@ class TestVolumeList(cloudstackTestCase):
None,
"Regular User is able to list Volumes from other domains")
@staticmethod
def generateKeysForUser(apiclient, account):
user = User.list(
@ -2834,4 +2794,3 @@ class TestVolumeList(cloudstackTestCase):
if list[num].id == attributeValue:
return True
return False

View File

@ -31,6 +31,7 @@ import time
_multiprocess_shared_ = True
class TestSharedNetworkImpersonation(cloudstackTestCase):
@classmethod
@ -112,7 +113,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey
cls.account_d1b = Account.create(
cls.apiclient,
cls.acldata["accountD1B"],
@ -222,7 +222,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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(
@ -370,7 +369,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_domainadminuser(self):
"""
@ -399,7 +397,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_admin_scope_all_subdomainuser(self):
"""
@ -510,7 +507,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_domainadminuser(self):
"""
@ -567,8 +563,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_subdomainadminuser(self):
@ -597,8 +593,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_parentdomainuser(self):
@ -627,8 +623,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_parentdomainadminuser(self):
@ -657,9 +653,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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 ")
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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_nosubdomainaccess_ROOTuser(self):
@ -688,7 +683,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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
@ -720,7 +716,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_domainadminuser(self):
"""
@ -830,7 +825,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_parentdomainadminuser(self):
@ -859,8 +855,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_domain_withsubdomainaccess_ROOTuser(self):
@ -889,8 +885,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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
@ -921,8 +917,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_domainadminuser(self):
@ -951,7 +947,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_user(self):
@ -1008,8 +1005,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_admin_scope_account_ROOTuser(self):
@ -1038,7 +1035,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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
@ -1069,7 +1067,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_domainadminuser(self):
"""
@ -1097,7 +1094,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_subdomainuser(self):
"""
@ -1178,7 +1174,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_all_crossdomainuser(self):
"""
@ -1205,7 +1200,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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 ")
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
@ -1236,7 +1232,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_domainadminuser(self):
"""
@ -1292,8 +1287,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_subdomainadminuser(self):
@ -1322,8 +1317,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_parentdomainuser(self):
@ -1352,8 +1347,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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 ")
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_parentdomainadminuser(self):
@ -1382,9 +1377,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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 ")
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_nosubdomainaccess_ROOTuser(self):
@ -1412,9 +1406,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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
@ -1445,7 +1438,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_domainadminuser(self):
"""
@ -1551,7 +1543,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_parentdomainadminuser(self):
@ -1580,8 +1573,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_domain_withsubdomainaccess_ROOTuser(self):
@ -1609,8 +1602,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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
@ -1640,8 +1633,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_domainadminuser(self):
@ -1669,8 +1662,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_user(self):
@ -1725,8 +1718,8 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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.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")
def test_deployVM_in_sharedNetwork_as_domainadmin_scope_account_ROOTuser(self):
@ -1786,7 +1779,6 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
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")
def test_deployVM_in_sharedNetwork_as_regularuser_scope_all_crossdomain(self):
"""
@ -1827,5 +1819,3 @@ class TestSharedNetworkImpersonation(cloudstackTestCase):
apiclient,
user.id
))

View File

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

View File

@ -27,7 +27,8 @@
# 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,
@ -66,6 +67,7 @@ from marvin.codes import PASS
import random
import time
class Services:
"""Test Add Remove Network Services
"""
@ -178,6 +180,7 @@ class Services:
},
}
@ddt
class TestAddNetworkToVirtualMachine(cloudstackTestCase):
@ -735,6 +738,7 @@ class TestAddNetworkToVirtualMachine(cloudstackTestCase):
return
class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
@classmethod
@ -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
@ -1120,6 +1124,7 @@ class TestRemoveNetworkFromVirtualMachine(cloudstackTestCase):
)
return
class TestUpdateVirtualMachineNIC(cloudstackTestCase):
@classmethod
@ -1338,6 +1343,7 @@ class TestUpdateVirtualMachineNIC(cloudstackTestCase):
return
class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
@classmethod
@ -1576,6 +1582,7 @@ class TestFailureScenariosAddNetworkToVM(cloudstackTestCase):
return
class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
@classmethod
@ -1760,6 +1767,7 @@ class TestFailureScenariosRemoveNicFromVM(cloudstackTestCase):
return
class TestFailureScenariosUpdateVirtualMachineNIC(cloudstackTestCase):
@classmethod

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,18 +19,12 @@
and password reset functionality with
ConfigDrive
"""
import base64
import os
import socket
# Import Local Modules
import subprocess
import tempfile
from contextlib import contextmanager
import time
# Import Local Modules
from marvin.cloudstackAPI import (restartVPC)
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (Account,
from marvin.lib.base import (
Account,
createVlanIpRange,
Configurations,
FireWallRule,
@ -51,12 +45,20 @@ from marvin.lib.base import (Account,
VPC,
VpcOffering,
Hypervisor, Template)
from marvin.lib.common import (get_domain,
get_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 subprocess
import tempfile
import time
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
# =====================================================================

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,9 +16,8 @@
# under the License.
""" P1 tests for memory resource limits
"""
# Import Local Modules
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
from marvin.lib.base import (
Account,
ServiceOffering,
@ -34,7 +33,9 @@ from marvin.lib.common import (get_domain,
get_resource_type
)
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
# Import Local Modules
from nose.plugins.attrib import attr
class Services:
"""Test memory resource limit services
@ -87,6 +88,7 @@ class Services:
# Networking mode: Advanced, Basic
}
class TestMemoryLimits(cloudstackTestCase):
@classmethod
@ -370,6 +372,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should match with the expected resource count")
return
class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
@classmethod
@ -499,7 +502,7 @@ 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
@ -574,7 +577,7 @@ 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
@ -634,7 +637,7 @@ 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
@ -698,7 +701,7 @@ 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,29 +19,32 @@
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 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:
cls.testclient = super(TestOrganizationStates, cls).getClsTestClient()
cls.apiclient = cls.testclient.getApiClient()
cls.testdata = cls.testClient.getParsedTestDataConfig()
@ -72,7 +75,6 @@ class TestOrganizationStates(cloudstackTestCase):
userAccountName = "-".join(("TestOrgUser", random_gen()))
adminAccountName = "-".join(("TestOrgAdmin", random_gen()))
cls.user_apiclient = cls.testclient.getUserApiClient(
UserName=userAccountName,
DomainName="ROOT"
@ -163,7 +165,6 @@ class TestOrganizationStates(cloudstackTestCase):
"Disabled",
"Disabling Zone did not set the alloctionstate to Disabled")
@attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_12_disableZone_admin_deployVM(self):
"""
@ -181,7 +182,6 @@ class TestOrganizationStates(cloudstackTestCase):
"Running",
"Admin is not able to deploy Vm in a disabled Zone! ")
@attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_13_disableZone_admin_stop_startVM(self):
"""
@ -218,7 +218,6 @@ class TestOrganizationStates(cloudstackTestCase):
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):
"""
@ -280,7 +279,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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):
"""
@ -298,7 +296,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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):
"""
@ -335,7 +332,6 @@ class TestOrganizationStates(cloudstackTestCase):
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):
"""
@ -375,7 +371,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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")
@ -398,7 +393,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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):
"""
@ -416,7 +410,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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):
"""
@ -453,7 +446,6 @@ class TestOrganizationStates(cloudstackTestCase):
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):
"""
@ -515,7 +507,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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):
"""
@ -534,7 +525,6 @@ class TestOrganizationStates(cloudstackTestCase):
"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):
"""
@ -555,7 +545,6 @@ class TestOrganizationStates(cloudstackTestCase):
"Running",
"Admin is not able to deploy Vm in a disabled Host! ")
@attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_44_disableHost_admin_stop_startVM(self):
"""
@ -594,7 +583,6 @@ class TestOrganizationStates(cloudstackTestCase):
except Exception as e:
self.debug("Exception thrown when deploying Virtual Machine on a disabled host - %s" % e)
@attr("disruptive", "simulator_only", tags=["advanced"], required_hardware="false")
def test_46_disableHost_user_stop_startVM(self):
"""
@ -636,4 +624,3 @@ class TestOrganizationStates(cloudstackTestCase):
self.assertEqual(hostlistResp[0].resourcestate,
"Enabled",
"Enabling Host did not set the alloctionstate to Enabled")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,9 +23,16 @@
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,
@ -33,7 +40,8 @@ from marvin.lib.base import (
Domain,
Volume,
DiskOffering)
from marvin.lib.common import (get_domain,
from marvin.lib.common import (
get_domain,
get_zone,
get_template,
matchResourceCount,
@ -42,12 +50,9 @@ from marvin.lib.common import (get_domain,
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):

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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