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 - openjdk11
python: python:
- "2.7" - "3.9"
node_js: node_js:
- 12 - 12

View File

@ -19,5 +19,5 @@
set -e set -e
pip install --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df python3 -m pip install --upgrade pip
pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz 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 Package: cloudstack-marvin
Architecture: all 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 Description: The CloudStack Marvin library
Package: cloudstack-integration-tests Package: cloudstack-integration-tests

View File

@ -48,6 +48,9 @@ BuildRequires: /usr/bin/mkisofs
BuildRequires: mysql-connector-python BuildRequires: mysql-connector-python
BuildRequires: maven => 3.0.0 BuildRequires: maven => 3.0.0
BuildRequires: python-setuptools BuildRequires: python-setuptools
BuildRequires: python3
BuildRequires: python3-pip
BuildRequires: python3-setuptools
BuildRequires: wget BuildRequires: wget
BuildRequires: nodejs BuildRequires: nodejs
@ -153,6 +156,9 @@ Apache CloudStack command line interface
%package marvin %package marvin
Summary: Apache CloudStack Marvin library Summary: Apache CloudStack Marvin library
Requires: python3
Requires: python3-devel
Requires: python3-pip
Requires: python-pip Requires: python-pip
Requires: gcc Requires: gcc
Requires: python-devel Requires: python-devel
@ -418,6 +424,8 @@ fi
# Install mysql-connector-python # 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 %{_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 /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" 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 %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 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 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 #No default permission as the permission setup is complex
%files management %files management

View File

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

View File

@ -18,12 +18,15 @@
# requires netaddr # requires netaddr
which python
python --version
export PYTHONPATH="../debian/opt/cloud/bin/" export PYTHONPATH="../debian/opt/cloud/bin/"
export PYTHONDONTWRITEBYTECODE=False export PYTHONDONTWRITEBYTECODE=False
echo "Running pycodestyle to check systemvm/python code for errors" echo "Running pycodestyle to check systemvm/python code for errors"
pycodestyle --max-line-length=179 *py python -m 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 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
if [ $? -gt 0 ] if [ $? -gt 0 ]
then then
echo "pycodestyle failed, please check your code" echo "pycodestyle failed, please check your code"
@ -31,8 +34,10 @@ then
fi fi
echo "Running pylint to check systemvm/python code for errors" echo "Running pylint to check systemvm/python code for errors"
pylint --disable=R,C,W *.py python --version
pylint --disable=R,C,W `find ../debian -name \*.py` pylint --version
pylint --disable=R,C,W,E *.py
pylint --disable=R,C,W,E `find ../debian -name \*.py`
if [ $? -gt 0 ] if [ $? -gt 0 ]
then then
echo "pylint failed, please check your code" echo "pylint failed, please check your code"
@ -40,5 +45,5 @@ then
fi fi
echo "Running systemvm/python unit tests" echo "Running systemvm/python unit tests"
nosetests . nosetests2.7 .
exit $? exit $?

View File

@ -19,7 +19,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import (migrateVirtualMachine, from marvin.cloudstackAPI import (migrateVirtualMachine,
prepareHostForMaintenance, prepareHostForMaintenance,
cancelHostMaintenance, cancelHostMaintenance,

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
# Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import (updateStoragePool, from marvin.cloudstackAPI import (updateStoragePool,
resizeVolume, resizeVolume,
listCapacity, listCapacity,

View File

@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki # Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase # All tests inherit from cloudstackTestCase
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
# Import Integration Libraries # Import Integration Libraries

View File

@ -24,7 +24,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.utils import (validateList,
cleanup_resources, cleanup_resources,
random_gen, random_gen,

View File

@ -26,7 +26,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.utils import (validateList,
cleanup_resources, cleanup_resources,
random_gen) random_gen)

View File

@ -15,7 +15,8 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
Domain, Template, Configurations,VirtualMachine,Snapshot,ServiceOffering Domain, Template, Configurations,VirtualMachine,Snapshot,ServiceOffering
) )
@ -161,7 +162,7 @@ class TestlistTemplates(cloudstackTestCase):
account=self.account.name, account=self.account.name,
domainid=self.account.domainid) domainid=self.account.domainid)
status = validateList(listfirst500template) status = validateList(listfirst500template)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"First 500 template list is empty") "First 500 template list is empty")
@ -173,7 +174,7 @@ class TestlistTemplates(cloudstackTestCase):
account=self.account.name, account=self.account.name,
domainid=self.account.domainid) domainid=self.account.domainid)
status = validateList(listremainingtemplate) status = validateList(listremainingtemplate)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Next 500 template list is empty") "Next 500 template list is empty")
@ -185,7 +186,7 @@ class TestlistTemplates(cloudstackTestCase):
account=self.account.name, account=self.account.name,
domainid=self.account.domainid) domainid=self.account.domainid)
status = validateList(listalltemplate) status = validateList(listalltemplate)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"entire template list is empty") "entire template list is empty")
@ -253,7 +254,7 @@ class TestlistTemplates(cloudstackTestCase):
) )
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed for user") self.fail("Template creation passed for user")
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e) self.assertRaises("Exception Raised : %s" % e)
# Register new public template as domain admin # Register new public template as domain admin
# Exception should be raised for registering public template # Exception should be raised for registering public template
@ -268,7 +269,7 @@ class TestlistTemplates(cloudstackTestCase):
) )
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed for domain admin") self.fail("Template creation passed for domain admin")
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e) self.assertRaises("Exception Raised : %s" % e)
if self.hypervisor.lower() in ['hyperv', 'lxc']: if self.hypervisor.lower() in ['hyperv', 'lxc']:
@ -314,7 +315,7 @@ class TestlistTemplates(cloudstackTestCase):
) )
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from snapshot for domain user") self.fail("Template creation passed from snapshot for domain user")
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e) self.assertRaises("Exception Raised : %s" % e)
VirtualMachine.stop(user_vm_created, self.user_api_client) VirtualMachine.stop(user_vm_created, self.user_api_client)
@ -324,7 +325,7 @@ class TestlistTemplates(cloudstackTestCase):
domainid=user_account.domainid, domainid=user_account.domainid,
state="Stopped") state="Stopped")
status = validateList(list_stopped_vms_after) status = validateList(list_stopped_vms_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Stopped VM is not in Stopped state" "Stopped VM is not in Stopped state"
@ -336,7 +337,7 @@ class TestlistTemplates(cloudstackTestCase):
) )
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from volume for domain user") self.fail("Template creation passed from volume for domain user")
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e) self.assertRaises("Exception Raised : %s" % e)
admin_vm_created = VirtualMachine.create( admin_vm_created = VirtualMachine.create(
@ -378,7 +379,7 @@ class TestlistTemplates(cloudstackTestCase):
) )
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from snapshot for domain admin") self.fail("Template creation passed from snapshot for domain admin")
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e) self.assertRaises("Exception Raised : %s" % e)
VirtualMachine.stop(admin_vm_created, self.admin_api_client) VirtualMachine.stop(admin_vm_created, self.admin_api_client)
@ -388,7 +389,7 @@ class TestlistTemplates(cloudstackTestCase):
domainid=self.account.domainid, domainid=self.account.domainid,
state="Stopped") state="Stopped")
status = validateList(list_stopped_vms_after) status = validateList(list_stopped_vms_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Stopped VM is not in Stopped state" "Stopped VM is not in Stopped state"
@ -400,7 +401,7 @@ class TestlistTemplates(cloudstackTestCase):
) )
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")
self.fail("Template creation passed from volume for domain admin") self.fail("Template creation passed from volume for domain admin")
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.assertRaises("Exception Raised : %s" % e) self.assertRaises("Exception Raised : %s" % e)
self.updateConfigurAndRestart("allow.public.user.templates", "true") self.updateConfigurAndRestart("allow.public.user.templates", "true")

View File

@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki # Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase # All tests inherit from cloudstackTestCase
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
# Import Integration Libraries # Import Integration Libraries

View File

@ -20,7 +20,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import (prepareHostForMaintenance, from marvin.cloudstackAPI import (prepareHostForMaintenance,
cancelHostMaintenance) cancelHostMaintenance)
from marvin.lib.utils import cleanup_resources from marvin.lib.utils import cleanup_resources

View File

@ -19,7 +19,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import (migrateVirtualMachine, from marvin.cloudstackAPI import (migrateVirtualMachine,
prepareHostForMaintenance, prepareHostForMaintenance,
cancelHostMaintenance) cancelHostMaintenance)

View File

@ -19,7 +19,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (VirtualMachine,
NetworkOffering, NetworkOffering,
VpcOffering, VpcOffering,

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
""" Tests for Multiple IP Ranges feature """ 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.utils import cleanup_resources, get_process_status
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
DiskOffering, DiskOffering,
@ -203,11 +204,11 @@ class TestMultipleIpRanges(cloudstackTestCase):
) )
self.ip_range = list( self.ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["vlan_ip_range"]["startip"]), unicode( self.testdata["vlan_ip_range"]["startip"]), str(
self.testdata["vlan_ip_range"]["endip"]))) self.testdata["vlan_ip_range"]["endip"])))
self.nic_ip = netaddr.IPAddress( self.nic_ip = netaddr.IPAddress(
unicode( str(
self.vm_response[0].nic[0].ipaddress)) self.vm_response[0].nic[0].ipaddress))
self.debug("vm got {} as ip address".format(self.nic_ip)) self.debug("vm got {} as ip address".format(self.nic_ip))
self.assertIn( self.assertIn(
@ -281,11 +282,11 @@ class TestMultipleIpRanges(cloudstackTestCase):
""" """
self.ip_range = list( self.ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["vlan_ip_range"]["startip"]), unicode( self.testdata["vlan_ip_range"]["startip"]), str(
self.testdata["vlan_ip_range"]["endip"]))) self.testdata["vlan_ip_range"]["endip"])))
self.nic_ip = netaddr.IPAddress( self.nic_ip = netaddr.IPAddress(
unicode( str(
self.vm_response[0].nic[0].ipaddress)) self.vm_response[0].nic[0].ipaddress))
self.debug("vm got {} as ip address".format(self.nic_ip)) self.debug("vm got {} as ip address".format(self.nic_ip))
self.assertIn( self.assertIn(

View File

@ -19,7 +19,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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.cloudstackAPI import migrateSystemVm
from marvin.lib.utils import cleanup_resources from marvin.lib.utils import cleanup_resources
from marvin.lib.base import (Host, from marvin.lib.base import (Host,

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
from nose.plugins.attrib import attr 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.utils import cleanup_resources
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
Host, Host,

View File

@ -19,7 +19,8 @@
# All tests inherit from cloudstack TestCase # All tests inherit from cloudstack TestCase
from marvin.cloudstackTestCase import cloudstackTestCase 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.codes import FAILED, PASS
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
VirtualMachine, VirtualMachine,

View File

@ -17,7 +17,8 @@
""" Test cases for Test Paths Storage Migration """ Test cases for Test Paths Storage Migration
""" """
from nose.plugins.attrib import attr 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.utils import (cleanup_resources,
validateList, validateList,
is_server_ssh_ready is_server_ssh_ready

File diff suppressed because it is too large Load Diff

View File

@ -57,10 +57,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.domain_1 = None cls.domain_1 = None
cls.domain_2 = None cls.domain_2 = None
cls.cleanup = [] cls._cleanup = []
try:
try:
# backup default apikey and secretkey # backup default apikey and secretkey
cls.default_apikey = cls.apiclient.connection.apiKey cls.default_apikey = cls.apiclient.connection.apiKey
cls.default_secretkey = cls.apiclient.connection.securityKey cls.default_secretkey = cls.apiclient.connection.securityKey
@ -70,25 +69,30 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.apiclient, cls.apiclient,
cls.acldata["domain1"] cls.acldata["domain1"]
) )
cls._cleanup.append(cls.domain_1)
cls.domain_11 = Domain.create( cls.domain_11 = Domain.create(
cls.apiclient, cls.apiclient,
cls.acldata["domain11"], cls.acldata["domain11"],
parentdomainid=cls.domain_1.id parentdomainid=cls.domain_1.id
) )
cls._cleanup.append(cls.domain_11)
cls.domain_111 = Domain.create( cls.domain_111 = Domain.create(
cls.apiclient, cls.apiclient,
cls.acldata["domain111"], cls.acldata["domain111"],
parentdomainid=cls.domain_11.id, parentdomainid=cls.domain_11.id,
) )
cls._cleanup.append(cls.domain_111)
cls.domain_12 = Domain.create( cls.domain_12 = Domain.create(
cls.apiclient, cls.apiclient,
cls.acldata["domain12"], cls.acldata["domain12"],
parentdomainid=cls.domain_1.id parentdomainid=cls.domain_1.id
) )
cls._cleanup.append(cls.domain_12)
cls.domain_2 = Domain.create( cls.domain_2 = Domain.create(
cls.apiclient, cls.apiclient,
cls.acldata["domain2"] cls.acldata["domain2"]
) )
cls._cleanup.append(cls.domain_2)
# Create 1 admin account and 2 user accounts for doamin_1 # Create 1 admin account and 2 user accounts for doamin_1
cls.account_d1 = Account.create( cls.account_d1 = Account.create(
cls.apiclient, cls.apiclient,
@ -96,8 +100,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=True, admin=True,
domainid=cls.domain_1.id domainid=cls.domain_1.id
) )
cls._cleanup.append(cls.account_d1)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1) user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
cls.user_d1_apikey = user.apikey cls.user_d1_apikey = user.apikey
cls.user_d1_secretkey = user.secretkey cls.user_d1_secretkey = user.secretkey
@ -107,19 +111,19 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_1.id domainid=cls.domain_1.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a) cls._cleanup.append(cls.account_d1a)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
cls.user_d1a_apikey = user.apikey cls.user_d1a_apikey = user.apikey
cls.user_d1a_secretkey = user.secretkey cls.user_d1a_secretkey = user.secretkey
cls.account_d1b = Account.create( cls.account_d1b = Account.create(
cls.apiclient, cls.apiclient,
cls.acldata["accountD1B"], cls.acldata["accountD1B"],
admin=False, admin=False,
domainid=cls.domain_1.id domainid=cls.domain_1.id
) )
cls._cleanup.append(cls.account_d1b)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b) user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
cls.user_d1b_apikey = user.apikey cls.user_d1b_apikey = user.apikey
cls.user_d1b_secretkey = user.secretkey cls.user_d1b_secretkey = user.secretkey
@ -130,7 +134,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=True, admin=True,
domainid=cls.domain_11.id domainid=cls.domain_11.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11) cls._cleanup.append(cls.account_d11)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
cls.user_d11_apikey = user.apikey cls.user_d11_apikey = user.apikey
cls.user_d11_secretkey = user.secretkey cls.user_d11_secretkey = user.secretkey
@ -140,7 +145,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_11.id domainid=cls.domain_11.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a) cls._cleanup.append(cls.account_d11a)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
cls.user_d11a_apikey = user.apikey cls.user_d11a_apikey = user.apikey
cls.user_d11a_secretkey = user.secretkey cls.user_d11a_secretkey = user.secretkey
@ -150,19 +156,20 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_11.id domainid=cls.domain_11.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b) cls._cleanup.append(cls.account_d11b)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
cls.user_d11b_apikey = user.apikey cls.user_d11b_apikey = user.apikey
cls.user_d11b_secretkey = user.secretkey cls.user_d11b_secretkey = user.secretkey
# Create 2 user accounts and 1 admin account for doamin_111 # Create 2 user accounts and 1 admin account for doamin_111
cls.account_d111 = Account.create( cls.account_d111 = Account.create(
cls.apiclient, cls.apiclient,
cls.acldata["accountD111"], cls.acldata["accountD111"],
admin=True, admin=True,
domainid=cls.domain_111.id domainid=cls.domain_111.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111) cls._cleanup.append(cls.account_d111)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
cls.user_d111_apikey = user.apikey cls.user_d111_apikey = user.apikey
cls.user_d111_secretkey = user.secretkey cls.user_d111_secretkey = user.secretkey
@ -172,7 +179,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_111.id domainid=cls.domain_111.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a) cls._cleanup.append(cls.account_d111a)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
cls.user_d111a_apikey = user.apikey cls.user_d111a_apikey = user.apikey
cls.user_d111a_secretkey = user.secretkey cls.user_d111a_secretkey = user.secretkey
@ -182,7 +190,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_111.id domainid=cls.domain_111.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b) cls._cleanup.append(cls.account_d111b)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
cls.user_d111b_apikey = user.apikey cls.user_d111b_apikey = user.apikey
cls.user_d111b_secretkey = user.secretkey cls.user_d111b_secretkey = user.secretkey
@ -193,7 +202,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_12.id domainid=cls.domain_12.id
) )
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a) cls._cleanup.append(cls.account_d12a)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
cls.user_d12a_apikey = user.apikey cls.user_d12a_apikey = user.apikey
cls.user_d12a_secretkey = user.secretkey cls.user_d12a_secretkey = user.secretkey
@ -203,8 +213,8 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_12.id domainid=cls.domain_12.id
) )
cls._cleanup.append(cls.account_d12b)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b) user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
cls.user_d12b_apikey = user.apikey cls.user_d12b_apikey = user.apikey
cls.user_d12b_secretkey = user.secretkey cls.user_d12b_secretkey = user.secretkey
@ -216,12 +226,11 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
admin=False, admin=False,
domainid=cls.domain_2.id domainid=cls.domain_2.id
) )
cls._cleanup.append(cls.account_d2a)
user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a) user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
cls.user_d2a_apikey = user.apikey cls.user_d2a_apikey = user.apikey
cls.user_d2a_secretkey = user.secretkey cls.user_d2a_secretkey = user.secretkey
# Create 1 user account and admin account in "ROOT" domain # Create 1 user account and admin account in "ROOT" domain
cls.account_roota = Account.create( cls.account_roota = Account.create(
@ -229,8 +238,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountROOTA"], cls.acldata["accountROOTA"],
admin=False, admin=False,
) )
cls._cleanup.append(cls.account_roota)
user = cls.generateKeysForUser(cls.apiclient,cls.account_roota) user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
cls.user_roota_apikey = user.apikey cls.user_roota_apikey = user.apikey
cls.user_roota_secretkey = user.secretkey cls.user_roota_secretkey = user.secretkey
@ -239,8 +249,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.acldata["accountROOT"], cls.acldata["accountROOT"],
admin=True, admin=True,
) )
cls._cleanup.append(cls.account_root)
user = cls.generateKeysForUser(cls.apiclient,cls.account_root) user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
cls.user_root_apikey = user.apikey cls.user_root_apikey = user.apikey
cls.user_root_secretkey = user.secretkey cls.user_root_secretkey = user.secretkey
@ -249,86 +260,77 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
cls.apiclient, cls.apiclient,
cls.acldata["service_offering"]["small"] cls.acldata["service_offering"]["small"]
) )
cls._cleanup.append(cls.service_offering)
cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests()) cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
cls.acldata['mode'] = cls.zone.networktype cls.acldata['mode'] = cls.zone.networktype
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"]) cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
cls.apiclient.connection.apiKey = cls.default_apikey cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey cls.apiclient.connection.securityKey = cls.default_secretkey
list_isolated_network_offerings_response = NetworkOffering.list( list_isolated_network_offerings_response = NetworkOffering.list(
cls.apiclient, cls.apiclient,
name="DefaultIsolatedNetworkOfferingWithSourceNatService" name="DefaultIsolatedNetworkOfferingWithSourceNatService"
) )
cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
## Create Network objects for Update API related test cases ## Create Network objects for Update API related test cases
cls.apiclient.connection.apiKey = cls.user_root_apikey cls.apiclient.connection.apiKey = cls.user_root_apikey
cls.apiclient.connection.securityKey = cls.user_root_secretkey cls.apiclient.connection.securityKey = cls.user_root_secretkey
cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone) cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d1_apikey cls.apiclient.connection.apiKey = cls.user_d1_apikey
cls.apiclient.connection.securityKey = cls.user_d1_secretkey cls.apiclient.connection.securityKey = cls.user_d1_secretkey
cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone) cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d1a_apikey cls.apiclient.connection.apiKey = cls.user_d1a_apikey
cls.apiclient.connection.securityKey = cls.user_d1a_secretkey cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone) cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d1b_apikey cls.apiclient.connection.apiKey = cls.user_d1b_apikey
cls.apiclient.connection.securityKey = cls.user_d1b_secretkey cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone) cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d11a_apikey cls.apiclient.connection.apiKey = cls.user_d11a_apikey
cls.apiclient.connection.securityKey = cls.user_d11a_secretkey cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone) cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d11b_apikey cls.apiclient.connection.apiKey = cls.user_d11b_apikey
cls.apiclient.connection.securityKey = cls.user_d11b_secretkey cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone) cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d12a_apikey cls.apiclient.connection.apiKey = cls.user_d12a_apikey
cls.apiclient.connection.securityKey = cls.user_d12a_secretkey cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone) cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_roota_apikey cls.apiclient.connection.apiKey = cls.user_roota_apikey
cls.apiclient.connection.securityKey = cls.user_roota_secretkey cls.apiclient.connection.securityKey = cls.user_roota_secretkey
cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone) cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d111a_apikey cls.apiclient.connection.apiKey = cls.user_d111a_apikey
cls.apiclient.connection.securityKey = cls.user_d111a_secretkey cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone) cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d111b_apikey cls.apiclient.connection.apiKey = cls.user_d111b_apikey
cls.apiclient.connection.securityKey = cls.user_d111b_secretkey cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone) cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
cls.apiclient.connection.apiKey = cls.user_d2a_apikey cls.apiclient.connection.apiKey = cls.user_d2a_apikey
cls.apiclient.connection.securityKey = cls.user_d2a_secretkey cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone) cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
cls.cleanup = [
cls.account_root,
cls.account_roota,
cls.service_offering,
]
except Exception as e: except Exception as e:
cls.domain_1.delete(cls.apiclient,cleanup="true") cls.tearDownClass()
cls.domain_2.delete(cls.apiclient,cleanup="true") raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
cleanup_resources(cls.apiclient, cls.cleanup)
raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
cls.apiclient = super(TestIsolatedNetworkDelete, cls).getClsTestClient().getApiClient()
cls.apiclient.connection.apiKey = cls.default_apikey cls.apiclient.connection.apiKey = cls.default_apikey
cls.apiclient.connection.securityKey = cls.default_secretkey cls.apiclient.connection.securityKey = cls.default_secretkey
cls.domain_1.delete(cls.apiclient,cleanup="true") super(TestIsolatedNetworkDelete,cls).tearDownClass()
cls.domain_2.delete(cls.apiclient,cleanup="true")
cleanup_resources(cls.apiclient, cls.cleanup)
return return
def setUp(cls): def setUp(cls):
@ -345,169 +347,169 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
@attr("simulator_only",tags=["advanced"],required_hardware="false") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_admin(self): def test_deleteNetwork_admin(self):
""" """
Validate that Admin should be able to delete network he owns Validate that Admin should be able to delete network he owns
""" """
self.apiclient.connection.apiKey = self.user_root_apikey self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey self.apiclient.connection.securityKey = self.user_root_secretkey
self.network_root.delete(self.apiclient) self.network_root.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_root.id) response = Network.list(self.apiclient,listall="true",id=self.network_root.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"Admin User is not able to restart network he owns") "Admin User is not able to restart network he owns")
self._cleanup.remove(self.network_root)
@attr("simulator_only",tags=["advanced"],required_hardware="false") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_admin_foruserinsamedomain(self): def test_deleteNetwork_admin_foruserinsamedomain(self):
"""
"""
Validate that Admin should be able to delete network for users in his domain Validate that Admin should be able to delete network for users in his domain
""" """
self.apiclient.connection.apiKey = self.user_root_apikey self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey self.apiclient.connection.securityKey = self.user_root_secretkey
self.network_roota.delete(self.apiclient) self.network_roota.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_roota.id) response = Network.list(self.apiclient,listall="true",id=self.network_roota.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"Admin User is not able to delete network owned by users his domain") "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") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_admin_foruserinotherdomain(self): def test_deleteNetwork_admin_foruserinotherdomain(self):
# Validate that Admin should be able to delete network for users in his sub domain # Validate that Admin should be able to delete network for users in his sub domain
self.apiclient.connection.apiKey = self.user_root_apikey self.apiclient.connection.apiKey = self.user_root_apikey
self.apiclient.connection.securityKey = self.user_root_secretkey self.apiclient.connection.securityKey = self.user_root_secretkey
self.network_d12a.delete(self.apiclient) self.network_d12a.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_d12a.id) response = Network.list(self.apiclient,listall="true",id=self.network_d12a.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"Admin User is not able to delete network owned other users in other domain") "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 ## Test cases relating to delete Network as domain admin user
@attr("simulator_only",tags=["advanced"],required_hardware="false") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin(self): def test_deleteNetwork_domaindmin(self):
""" """
Validate that Domain admin should be able to delete network for himslef Validate that Domain admin should be able to delete network for himslef
""" """
self.apiclient.connection.apiKey = self.user_d1_apikey self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey self.apiclient.connection.securityKey = self.user_d1_secretkey
self.network_d1.delete(self.apiclient) self.network_d1.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_d1.id) response = Network.list(self.apiclient,listall="true",id=self.network_d1.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"Domain admin User is not able to delete a network he owns") "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") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin_foruserinsamedomain(self): def test_deleteNetwork_domaindmin_foruserinsamedomain(self):
"""
"""
Validate that Domain admin should be able to delete network for users in his domain Validate that Domain admin should be able to delete network for users in his domain
""" """
self.apiclient.connection.apiKey = self.user_d1_apikey self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey self.apiclient.connection.securityKey = self.user_d1_secretkey
self.network_d1a.delete(self.apiclient) self.network_d1a.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_d1a.id) response = Network.list(self.apiclient,listall="true",id=self.network_d1a.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"Domain admin User is not able to delete a network that is owned by user in the same domain") "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") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin_foruserinsubdomain(self): def test_deleteNetwork_domaindmin_foruserinsubdomain(self):
"""
"""
Validate that Domain admin should be able to delete network for users in his sub domain Validate that Domain admin should be able to delete network for users in his sub domain
""" """
self.apiclient.connection.apiKey = self.user_d1_apikey self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey self.apiclient.connection.securityKey = self.user_d1_secretkey
self.network_d11a.delete(self.apiclient) self.network_d11a.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_d11a.id) response = Network.list(self.apiclient,listall="true",id=self.network_d11a.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"Domain admin User is not able to delete a network that is owned by user in the subdomain") "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") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_domaindmin_forcrossdomainuser(self): def test_deleteNetwork_domaindmin_forcrossdomainuser(self):
"""
"""
Validate that Domain admin should be able to delete network for users in his sub domain Validate that Domain admin should be able to delete network for users in his sub domain
""" """
self.apiclient.connection.apiKey = self.user_d1_apikey self.apiclient.connection.apiKey = self.user_d1_apikey
self.apiclient.connection.securityKey = self.user_d1_secretkey self.apiclient.connection.securityKey = self.user_d1_secretkey
try: try:
response = self.network_d2a.delete(self.apiclient) response = self.network_d2a.delete(self.apiclient)
self.fail("Domain admin is allowed to delete network for users not in his domain ") 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: except Exception as e:
self.debug ("When Domain admin tries to delete network for user in a different domain %s" %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): if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
self.fail("Error message validation failed when Domain admin tries to delete network for users not in his domain ") self.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 ## Test cases relating deleting network as regular user
@attr("simulator_only",tags=["advanced"],required_hardware="false") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_user(self): def test_deleteNetwork_user(self):
"""
"""
Validate that Regular should be able to delete network for himslef Validate that Regular should be able to delete network for himslef
""" """
self.apiclient.connection.apiKey = self.user_d111a_apikey self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey self.apiclient.connection.securityKey = self.user_d111a_secretkey
self.network_d111a.delete(self.apiclient) self.network_d111a.delete(self.apiclient)
response = Network.list(self.apiclient,listall="true",id=self.network_d111a.id) response = Network.list(self.apiclient,listall="true",id=self.network_d111a.id)
self.assertEqual(response, self.assertEqual(response,
None, None,
"User is not able to delete a network he owns") "User is not able to delete a network he owns")
self._cleanup.remove(self.network_d111a)
@attr("simulator_only",tags=["advanced"],required_hardware="false") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_user_foruserinsamedomain(self): def test_deleteNetwork_user_foruserinsamedomain(self):
"""
"""
Validate that Regular user should NOT be able to delete network for users in his domain Validate that Regular user should NOT be able to delete network for users in his domain
""" """
self.apiclient.connection.apiKey = self.user_d111a_apikey self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey self.apiclient.connection.securityKey = self.user_d111a_secretkey
try: try:
response = self.network_d111b.delete(self.apiclient) response = self.network_d111b.delete(self.apiclient)
self.fail("Regular user is allowed to delete network for users in his domain ") self._cleanup.remove(self.network_d111b)
self.fail("Regular user is allowed to delete network for users in his domain ")
except Exception as e: except Exception as e:
self.debug ("When user tries to delete network for users in his domain %s" %e) self.debug ("When user tries to delete network for users in his domain %s" %e)
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
self.fail("Regular user is allowed to delete network for users in his domain ") self.fail("Regular user is allowed to delete network for users in his domain ")
@attr("simulator_only",tags=["advanced"],required_hardware="false") @attr("simulator_only",tags=["advanced"],required_hardware="false")
def test_deleteNetwork_user_foruserinotherdomain(self): def test_deleteNetwork_user_foruserinotherdomain(self):
""" """
Validate that Domain admin should be NOT be able to delete network for users in other domains Validate that Domain admin should be NOT be able to delete network for users in other domains
""" """
self.apiclient.connection.apiKey = self.user_d111a_apikey self.apiclient.connection.apiKey = self.user_d111a_apikey
self.apiclient.connection.securityKey = self.user_d111a_secretkey self.apiclient.connection.securityKey = self.user_d111a_secretkey
try: try:
response = self.network_d11b.delete(self.apiclient) response = self.network_d11b.delete(self.apiclient)
self.fail("Regular user is allowed to delete network for users not in his domain ") 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: except Exception as e:
self.debug ("When user tries to delete network for users in other domain %s" %e) self.debug ("When user tries to delete network for users in other domain %s" %e)
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT): if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
self.fail("Error message validation failed when Regular user tries to delete network for users not in his domain ") self.fail("Error message validation failed when Regular user tries to delete network for users not in his domain ")
@staticmethod @staticmethod
def generateKeysForUser(apiclient,account): def generateKeysForUser(apiclient,account):
@ -522,25 +524,26 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
user.id user.id
)) ))
@staticmethod @classmethod
def createNetwork(apiclient,account,isolated_network_offering_id,zone): def createNetwork(cls,apiclient,account,isolated_network_offering_id,zone):
network= { network= {
"name": "Network-", "name": "Network-",
"displaytext": "Network-", "displaytext": "Network-",
"gateway" :"10.223.1.1", "gateway" :"10.223.1.1",
"netmask" :"255.255.255.0", "netmask" :"255.255.255.0",
"startip" :"10.223.1.2", "startip" :"10.223.1.2",
"endip" :"10.223.1.100", "endip" :"10.223.1.100",
} }
network["name"] = account.name +" -forupdate" network["name"] = account.name +" -forupdate"
network["displayname"] = account.name + "-forupdate" network["displayname"] = account.name + "-forupdate"
network = Network.create( network = Network.create(
apiclient, apiclient,
network, network,
networkofferingid=isolated_network_offering_id, networkofferingid=isolated_network_offering_id,
zoneid=zone.id zoneid=zone.id
) )
return network cls._cleanup.append(network)
return network

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,8 @@ Tests of acquiring a specified public IP for isolated network or vpc
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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.cloudstackAPI import createVlanIpRange
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,
cleanup_resources) cleanup_resources)

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,8 @@
""" P1 tests for networks in advanced zone with security groups """ 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 ddt import ddt, data
from marvin.lib.base import (Zone, from marvin.lib.base import (Zone,
ServiceOffering, ServiceOffering,
@ -2162,7 +2163,7 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase):
name=self.services["test_34_DeployVM_in_SecondSGNetwork"]["zone"] name=self.services["test_34_DeployVM_in_SecondSGNetwork"]["zone"]
) )
status = validateList(zone_list) 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 count = 0
""" """
In simulator environment default guest os template should be in ready state immediately after the ssvm is up. 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 #construct ip list using start and end ips in the network
for i in range(0,nwIPs): 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: if vm_ip not in ips_in_new_network:
self.fail("vm did not get the ip from new SG enabled shared network") self.fail("vm did not get the ip from new SG enabled shared network")
self.cleanup_vms.append(vm_2) self.cleanup_vms.append(vm_2)

View File

@ -15,7 +15,8 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import deleteAffinityGroup from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
random_gen) random_gen)
@ -187,8 +188,8 @@ class TestCreateAffinityGroup(cloudstackTestCase):
acc=self.account.name, domainid=self.account.domainid) acc=self.account.name, domainid=self.account.domainid)
self.debug("Created Affinity Group: %s" % aff_grp.name) self.debug("Created Affinity Group: %s" % aff_grp.name)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id) 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.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
self.assert_(list_aff_grps[0].id == aff_grp.id) self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.cleanup.append(aff_grp) self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false") @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"]) 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)
list_aff_grps = AffinityGroup.list(self.api_client, id=list_aff_grps[0].id) 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, 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): def delete_aff_group(self, apiclient, **kwargs):
cmd = deleteAffinityGroup.deleteAffinityGroupCmd() 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) return apiclient.deleteAffinityGroup(cmd)
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false") @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"]) aff_0 = self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
AffinityGroup.list(self.api_client, name=aff_0.name) AffinityGroup.list(self.api_client, name=aff_0.name)
self.delete_aff_group(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") @attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
def test_02_delete_aff_grp_for_acc(self): 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) 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) aff_0.delete(self.api_client)
vm_list = list_virtual_machines(self.apiclient, id=vm.id) 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) vm.delete(self.api_client)
#Wait for expunge interval to cleanup VM #Wait for expunge interval to cleanup VM
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"]) 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 # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import deleteAffinityGroup from marvin.cloudstackAPI import deleteAffinityGroup
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
random_gen) random_gen)
@ -218,9 +219,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
aff_grp = self.create_aff_grp() aff_grp = self.create_aff_grp()
self.debug("Created Affinity Group: %s" % aff_grp.name) self.debug("Created Affinity Group: %s" % aff_grp.name)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id) 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.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
self.assert_(list_aff_grps[0].id == aff_grp.id) self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.assert_(list_aff_grps[0].projectid == self.project.id) self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp) self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false") @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) 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) 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.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
self.assert_(list_aff_grps[0].id == aff_grp.id) self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.assert_(list_aff_grps[0].projectid == self.project.id) self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp) self.cleanup.append(aff_grp)
@attr(tags=["vogxn", "simulator", "basic", "advanced"], required_hardware="false") @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) aff_grp = self.create_aff_grp(api_client=self.account_api_client)
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id) 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.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
self.assert_(list_aff_grps[0].id == aff_grp.id) self.assertTrue(list_aff_grps[0].id == aff_grp.id)
self.assert_(list_aff_grps[0].projectid == self.project.id) self.assertTrue(list_aff_grps[0].projectid == self.project.id)
self.cleanup.append(aff_grp) self.cleanup.append(aff_grp)
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false") @attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
@ -670,7 +671,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
def delete_aff_group(self, apiclient, **kwargs): def delete_aff_group(self, apiclient, **kwargs):
cmd = deleteAffinityGroup.deleteAffinityGroupCmd() 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) return apiclient.deleteAffinityGroup(cmd)

View File

@ -28,7 +28,8 @@
from marvin.codes import (PASS, from marvin.codes import (PASS,
RECURRING) RECURRING)
from nose.plugins.attrib import attr 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, from marvin.lib.base import (ServiceOffering,
Account, Account,
@ -419,7 +420,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
hypervisor = host_list_validation_result[1].hypervisor 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(): if k.lower() == hypervisor.lower():
# Register new template # Register new template
template = Template.register( template = Template.register(

View File

@ -36,7 +36,8 @@ from marvin.lib.common import (get_zone,
get_builtin_template_info) get_builtin_template_info)
#Import Local Modules #Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import restartNetwork from marvin.cloudstackAPI import restartNetwork
from marvin.codes import PASS from marvin.codes import PASS
import time import time

View File

@ -19,7 +19,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import (listPhysicalNetworks, from marvin.cloudstackAPI import (listPhysicalNetworks,
listNetworkServiceProviders, listNetworkServiceProviders,
addNetworkServiceProvider, addNetworkServiceProvider,

View File

@ -20,7 +20,8 @@
import marvin import marvin
from nose.plugins.attrib import attr 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.cloudstackAPI import *
from marvin.lib.utils import * from marvin.lib.utils import *
from marvin.lib.base import * from marvin.lib.base import *
@ -160,7 +161,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_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) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -377,7 +378,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -427,7 +428,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -477,7 +478,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60) time.sleep(60)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -545,7 +546,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient, self.apiclient,
id=volid id=volid
) )
print list_volume_response[0] print(list_volume_response[0])
vmlist.attach_volume( vmlist.attach_volume(
self.apiclient, self.apiclient,
list_volume_response[0] list_volume_response[0]
@ -612,7 +613,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient, self.apiclient,
id=volid id=volid
) )
print list_volume_response[0] print(list_volume_response[0])
vmdetails.detach_volume(self.apiclient,list_volume_response[0]) vmdetails.detach_volume(self.apiclient,list_volume_response[0])
# Sleep to ensure the current state will reflected in other calls # Sleep to ensure the current state will reflected in other calls

View File

@ -19,7 +19,8 @@
import marvin import marvin
from nose.plugins.attrib import attr 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.cloudstackAPI import *
from marvin.lib.utils import * from marvin.lib.utils import *
from marvin.lib.base import * from marvin.lib.base import *
@ -32,7 +33,7 @@ import random
import string import string
import telnetlib import telnetlib
import os import os
import urllib import urllib.request, urllib.parse, urllib.error
import time import time
import tempfile import tempfile
_multiprocess_shared_ = True _multiprocess_shared_ = True

View File

@ -20,7 +20,8 @@
import marvin import marvin
from nose.plugins.attrib import attr 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.cloudstackAPI import *
from marvin.lib.utils import * from marvin.lib.utils import *
from marvin.lib.base import * from marvin.lib.base import *
@ -39,7 +40,7 @@ import string
import telnetlib import telnetlib
import os import os
import urllib import urllib.request, urllib.parse, urllib.error
import time import time
import tempfile import tempfile
_multiprocess_shared_ = True _multiprocess_shared_ = True
@ -136,7 +137,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_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) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -299,7 +300,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -425,7 +426,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60) time.sleep(60)
print results.status_code print(results.status_code)
if results.status_code == 200: if results.status_code == 200:
self.fail("Upload URL is allowed to reuse") 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) results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60) time.sleep(60)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -593,7 +594,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60) time.sleep(60)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -647,7 +648,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient, self.apiclient,
id=volid id=volid
) )
print list_volume_response[0] print(list_volume_response[0])
vmlist.attach_volume( vmlist.attach_volume(
self.apiclient, self.apiclient,
list_volume_response[0] list_volume_response[0]
@ -715,7 +716,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient, self.apiclient,
id=volid id=volid
) )
print list_volume_response[0] print(list_volume_response[0])
vmdetails.detach_volume(self.apiclient,list_volume_response[0]) vmdetails.detach_volume(self.apiclient,list_volume_response[0])
# Sleep to ensure the current state will reflected in other calls # Sleep to ensure the current state will reflected in other calls
@ -821,9 +822,9 @@ class TestBrowseUploadVolume(cloudstackTestCase):
extract_vol = self.apiclient.extractVolume(cmd) extract_vol = self.apiclient.extractVolume(cmd)
try: 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) 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()) self.debug("response from volume url %s" % response.getcode())
fd, path = tempfile.mkstemp() fd, path = tempfile.mkstemp()
self.debug("Saving volume %s to path %s" %(volumeid, path)) self.debug("Saving volume %s to path %s" %(volumeid, path))
@ -1185,7 +1186,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.apiclient, self.apiclient,
templatefilter='self') templatefilter='self')
self.assertEquals( self.assertEqual(
templates_before_size + 1, templates_before_size + 1,
len(list_templates_after), len(list_templates_after),
"Template creation failed from snapshot" "Template creation failed from snapshot"
@ -1763,7 +1764,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -1808,7 +1809,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -1916,7 +1917,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
@ -1955,7 +1956,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
print results.status_code print(results.status_code)
if results.status_code ==200: if results.status_code ==200:
return("FAIL") return("FAIL")
return("PASS") return("PASS")

View File

@ -58,8 +58,8 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
cls.supportedHypervisor = True cls.supportedHypervisor = True
if cls.hypervisor.lower() in [ if cls.hypervisor.lower() in [
"hyperv", "hyperv",
"lxc"]: "lxc"]:
cls.supportedHypervisor = False cls.supportedHypervisor = False
return return
@ -168,14 +168,14 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
name="concurrent.snapshots.threshold.perhost" name="concurrent.snapshots.threshold.perhost"
) )
if config[0].value: if config[0].value:
self.assertEqual( self.assertEqual(
isinstance( isinstance(
config, config,
list), list),
True, True,
"concurrent.snapshots.threshold.perhost should be present\ "concurrent.snapshots.threshold.perhost should be present\
in global config") in global config")
concurrentSnapshots = int(config[0].value) concurrentSnapshots = int(config[0].value)
self.debug("concurrent Snapshots: %s" % concurrentSnapshots) self.debug("concurrent Snapshots: %s" % concurrentSnapshots)
threads = [] threads = []
@ -228,14 +228,14 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
name="concurrent.snapshots.threshold.perhost" name="concurrent.snapshots.threshold.perhost"
) )
if config[0].value: if config[0].value:
self.assertEqual( self.assertEqual(
isinstance( isinstance(
config, config,
list), list),
True, True,
"concurrent.snapshots.threshold.perhost should be present\ "concurrent.snapshots.threshold.perhost should be present\
in global config") in global config")
concurrentSnapshots = int(config[0].value) concurrentSnapshots = int(config[0].value)
else: else:
self.skipTest("Skipping tests as the config value \ self.skipTest("Skipping tests as the config value \
concurrent.snapshots.threshold.perhost is Null") concurrent.snapshots.threshold.perhost is Null")
@ -304,9 +304,9 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
concurrent.snapshots.threshold.perhost parameter. concurrent.snapshots.threshold.perhost parameter.
""" """
with self.assertRaises(Exception): with self.assertRaises(Exception):
Configurations.update( Configurations.update(
self.apiclient, self.apiclient,
"concurrent.snapshots.threshold.perhost", "concurrent.snapshots.threshold.perhost",
"String" "String"
) )
return return

View File

@ -19,44 +19,46 @@
and password reset functionality with and password reset functionality with
ConfigDrive ConfigDrive
""" """
# Import Local Modules
from marvin.cloudstackAPI import (restartVPC)
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (
Account,
createVlanIpRange,
Configurations,
FireWallRule,
Host,
listVlanIpRanges,
Network,
NetworkACL,
NetworkACLList,
NetworkOffering,
NetworkServiceProvider,
PublicIPAddress,
Router,
ServiceOffering,
createSSHKeyPair,
deleteSSHKeyPair,
StaticNATRule,
VirtualMachine,
VPC,
VpcOffering,
Hypervisor, Template)
from marvin.lib.common import (
get_domain,
get_zone, get_test_template,
is_config_suitable)
from marvin.lib.utils import random_gen
# Import System Modules
import base64 import base64
import os import os
import socket import socket
# Import Local Modules
import subprocess import subprocess
import tempfile import tempfile
from contextlib import contextmanager
import time import time
from marvin.cloudstackAPI import (restartVPC) from contextlib import contextmanager
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.base import (Account,
createVlanIpRange,
Configurations,
FireWallRule,
Host,
listVlanIpRanges,
Network,
NetworkACL,
NetworkACLList,
NetworkOffering,
NetworkServiceProvider,
PublicIPAddress,
Router,
ServiceOffering,
createSSHKeyPair,
deleteSSHKeyPair,
StaticNATRule,
VirtualMachine,
VPC,
VpcOffering,
Hypervisor, Template)
from marvin.lib.common import (get_domain,
get_template,
get_zone, get_test_template,
is_config_suitable)
from marvin.lib.utils import random_gen
# Import System Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from retry import retry from retry import retry
@ -1000,7 +1002,7 @@ class ConfigDriveUtils:
:rtype: str :rtype: str
""" """
self.debug("Updating userdata for VM - %s" % vm.name) 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): with self.stopped_vm(vm):
vm.update(self.api_client, userdata=updated_user_data) vm.update(self.api_client, userdata=updated_user_data)
@ -2371,7 +2373,6 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils):
vm1, public_ip_1, vm1, public_ip_1,
metadata=True) metadata=True)
# ===================================================================== # =====================================================================
# Network restart tests # Network restart tests
# ===================================================================== # =====================================================================

View File

@ -191,7 +191,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin, users = {self.domain: self.admin,
self.child_domain: self.child_do_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.account = admin
self.domain = domain self.domain = domain
@ -267,7 +267,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin, users = {self.domain: self.admin,
self.child_domain: self.child_do_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.account = admin
self.domain = domain self.domain = domain
@ -328,7 +328,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin, users = {self.domain: self.admin,
self.child_domain: self.child_do_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.account = admin
self.domain = domain self.domain = domain
@ -392,7 +392,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
users = {self.domain: self.admin, users = {self.domain: self.admin,
self.child_domain: self.child_do_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.account = admin
self.domain = domain self.domain = domain

View File

@ -435,7 +435,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
@ -510,7 +510,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
@ -570,7 +570,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
@ -633,7 +633,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain

View File

@ -19,7 +19,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import ( from marvin.lib.base import (
Account, Account,
ServiceOffering, ServiceOffering,

View File

@ -19,7 +19,8 @@
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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.utils import (cleanup_resources,
random_gen, random_gen,
get_hypervisor_type) get_hypervisor_type)

View File

@ -18,7 +18,8 @@
# Test from the Marvin - Testing in Python wiki # Test from the Marvin - Testing in Python wiki
# All tests inherit from cloudstackTestCase # All tests inherit from cloudstackTestCase
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import changeServiceForVirtualMachine, startVirtualMachine from marvin.cloudstackAPI import changeServiceForVirtualMachine, startVirtualMachine
# Import Integration Libraries # 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 """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( network1 = Network.create(
self.apiclient, self.apiclient,
@ -166,10 +166,10 @@ class TestDeployVmWithUserDataMultiNic(cloudstackTestCase):
domainid=self.account.domainid, domainid=self.account.domainid,
id=deployVmResponse.id 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] vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state") self.assertTrue(vm.state == "Running", "VM is not in Running state")
try: try:
updateresponse = deployVmResponse.update(self.apiclient, userdata=self.userdata) updateresponse = deployVmResponse.update(self.apiclient, userdata=self.userdata)

View File

@ -110,8 +110,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
"""Test userdata as POST, size > 2k """Test userdata as POST, size > 2k
""" """
self.userdata = base64.encodestring(self.userdata.encode()).decode()
self.userdata=base64.b64encode(self.userdata)
self.services["virtual_machine"]["userdata"] = self.userdata self.services["virtual_machine"]["userdata"] = self.userdata
deployVmResponse = VirtualMachine.create( deployVmResponse = VirtualMachine.create(
@ -132,10 +131,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
domainid=self.account.domainid, domainid=self.account.domainid,
id=deployVmResponse.id 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] vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state") self.assertTrue(vm.state == "Running", "VM is not in Running state")
ip_addr=deployVmResponse.ipaddress ip_addr=deployVmResponse.ipaddress
if self.zone.networktype == "Basic": if self.zone.networktype == "Basic":
list_router_response = list_routers( list_router_response = list_routers(

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
""" Tests for DHCP DNS offload feature """ 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.utils import (random_gen, validateList, cleanup_resources, get_hypervisor_type)
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
NIC, NIC,
@ -321,7 +322,7 @@ class TestDeployVMs(cloudstackTestCase):
self.assertEqual(validateList(qresultset)[0], PASS, "sql query returned invalid response") self.assertEqual(validateList(qresultset)[0], PASS, "sql query returned invalid response")
self.assertEqual( self.assertEqual(
metadata["vm-id.txt"][0], 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" "vm id in metadata does not match with the vm id from cloud db"
) )
return return

View File

@ -25,7 +25,8 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/ Feature Specifications: https://cwiki.apache.org/confluence/display/
CLOUDSTACK/Dynamic+Compute+Offering+FS 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, from marvin.lib.utils import (cleanup_resources,
validateList, validateList,
random_gen, random_gen,

View File

@ -19,7 +19,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (Account,
Domain, Domain,
Router, Router,

View File

@ -19,7 +19,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import (authorizeSecurityGroupIngress, from marvin.cloudstackAPI import (authorizeSecurityGroupIngress,
disassociateIpAddress, disassociateIpAddress,
deleteLoadBalancerRule) deleteLoadBalancerRule)
@ -167,7 +168,7 @@ class TestEIP(cloudstackTestCase):
) )
if isinstance(ip_addrs, list): if isinstance(ip_addrs, list):
cls.source_nat = ip_addrs[0] cls.source_nat = ip_addrs[0]
print "source_nat ipaddress : ", cls.source_nat.ipaddress print("source_nat ipaddress : ", cls.source_nat.ipaddress)
else: else:
raise Exception( raise Exception(
"No Source NAT IP found for guest network: %s" % "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): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]] act_val = actual_vals[keys[i]]
@ -189,13 +189,13 @@ class TestIsos(cloudstackTestCase):
isofilter=self.services["templatefilter"] isofilter=self.services["templatefilter"]
) )
status = validateList(list_iso_after) status = validateList(list_iso_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO's creation failed" "ISO's creation failed"
) )
# Verifying that list size is pagesize + 1 # Verifying that list size is pagesize + 1
self.assertEquals( self.assertEqual(
self.services["pagesize"] + 1, self.services["pagesize"] + 1,
len(list_iso_after), len(list_iso_after),
"Failed to create pagesize + 1 number of ISO's" "Failed to create pagesize + 1 number of ISO's"
@ -209,13 +209,13 @@ class TestIsos(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_iso_page1) status = validateList(list_iso_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list ISO's in page 1" "Failed to list ISO's in page 1"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_iso_page1), len(list_iso_page1),
"Size of ISO's in page 1 is not matching" "Size of ISO's in page 1 is not matching"
@ -229,13 +229,13 @@ class TestIsos(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_iso_page2) status = validateList(list_iso_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list ISo's in page 2" "Failed to list ISo's in page 2"
) )
# Verifying the list size to be equal to 1 # Verifying the list size to be equal to 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_iso_page2), len(list_iso_page2),
"Size of ISO's in page 2 is not matching" "Size of ISO's in page 2 is not matching"
@ -251,7 +251,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id id=iso_created.id
) )
status = validateList(list_iso) status = validateList(list_iso)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list ISO by Id" "Failed to list ISO by Id"
@ -335,13 +335,13 @@ class TestIsos(cloudstackTestCase):
isofilter=self.services["templatefilter"] isofilter=self.services["templatefilter"]
) )
status = validateList(list_iso_after) status = validateList(list_iso_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO's creation failed" "ISO's creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_iso_after), len(list_iso_after),
"Failed to create an ISO's" "Failed to create an ISO's"
@ -357,7 +357,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id id=iso_created.id
) )
status = validateList(list_iso) status = validateList(list_iso)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list ISO by Id" "Failed to list ISO by Id"
@ -386,7 +386,7 @@ class TestIsos(cloudstackTestCase):
"Download ISO failed" "Download ISO failed"
) )
# Verifying the details of downloaded ISO # Verifying the details of downloaded ISO
self.assertEquals( self.assertEqual(
"DOWNLOAD_URL_CREATED", "DOWNLOAD_URL_CREATED",
download_iso.state, download_iso.state,
"Download URL not created for ISO" "Download URL not created for ISO"
@ -395,7 +395,7 @@ class TestIsos(cloudstackTestCase):
download_iso.url, download_iso.url,
"Download URL not created for ISO" "Download URL not created for ISO"
) )
self.assertEquals( self.assertEqual(
iso_created.id, iso_created.id,
download_iso.id, download_iso.id,
"Download ISO details are not same as ISO created" "Download ISO details are not same as ISO created"
@ -451,13 +451,13 @@ class TestIsos(cloudstackTestCase):
isofilter=self.services["templatefilter"] isofilter=self.services["templatefilter"]
) )
status = validateList(list_iso_after) status = validateList(list_iso_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO's creation failed" "ISO's creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_iso_after), len(list_iso_after),
"Failed to create an ISO's" "Failed to create an ISO's"
@ -473,7 +473,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id id=iso_created.id
) )
status = validateList(list_iso) status = validateList(list_iso)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list ISO by Id" "Failed to list ISO by Id"
@ -534,7 +534,7 @@ class TestIsos(cloudstackTestCase):
# Editing the ISO name, displaytext, ostypeid # Editing the ISO name, displaytext, ostypeid
ostype_list = list_os_types(self.userapiclient) ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list) status = validateList(ostype_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list OS Types" "Failed to list OS Types"
@ -618,7 +618,7 @@ class TestIsos(cloudstackTestCase):
available=True available=True
) )
status = validateList(zones_list) status = validateList(zones_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list Zones" "Failed to list Zones"
@ -669,13 +669,13 @@ class TestIsos(cloudstackTestCase):
zoneid=zones_list[0].id zoneid=zones_list[0].id
) )
status = validateList(list_isos_zone1) status = validateList(list_isos_zone1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO creation failed in Zone1" "ISO creation failed in Zone1"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_isos_zone1), len(list_isos_zone1),
"Failed to create a Template" "Failed to create a Template"
@ -703,7 +703,7 @@ class TestIsos(cloudstackTestCase):
id=iso_created.id id=iso_created.id
) )
status = validateList(list_iso) status = validateList(list_iso)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list ISO by Id" "Failed to list ISO by Id"
@ -739,13 +739,13 @@ class TestIsos(cloudstackTestCase):
zoneid=zones_list[0].id zoneid=zones_list[0].id
) )
status = validateList(list_isos_zone1) status = validateList(list_isos_zone1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO creation failed in Zone1" "ISO creation failed in Zone1"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_isos_zone1), len(list_isos_zone1),
"Failed to create a Template" "Failed to create a Template"
@ -758,23 +758,23 @@ class TestIsos(cloudstackTestCase):
zoneid=zones_list[1].id zoneid=zones_list[1].id
) )
status = validateList(list_isos_zone2) status = validateList(list_isos_zone2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO failed to copy into Zone2" "ISO failed to copy into Zone2"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_isos_zone2), len(list_isos_zone2),
"ISO failed to copy into Zone2" "ISO failed to copy into Zone2"
) )
self.assertNotEquals( self.assertNotEqual(
"Connection refused", "Connection refused",
list_isos_zone2[0].status, list_isos_zone2[0].status,
"Failed to copy ISO" "Failed to copy ISO"
) )
self.assertEquals( self.assertEqual(
True, True,
list_isos_zone2[0].isready, list_isos_zone2[0].isready,
"Failed to copy ISO" "Failed to copy ISO"

View File

@ -132,7 +132,7 @@ class TestNetworks_1(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]] act_val = actual_vals[keys[i]]
@ -168,7 +168,7 @@ class TestNetworks_1(cloudstackTestCase):
id=self.zone.id id=self.zone.id
) )
status = validateList(list_zones) 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 self.test_data["network_without_acl"]["zoneid"] = list_zones[0].id
# Listing the networks for a user # Listing the networks for a user
list_networks_before = Network.list( list_networks_before = Network.list(
@ -226,7 +226,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
type="Isolated") type="Isolated")
status = validateList(list_networks_after) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
len(list_networks_after), len(list_networks_after),
@ -242,7 +242,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_page1) 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( self.assertEqual(
len(list_networks_page1), len(list_networks_page1),
self.test_data["pagesize"], self.test_data["pagesize"],
@ -257,7 +257,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_page2) 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( self.assertEqual(
len(list_networks_page2), len(list_networks_page2),
1, 1,
@ -267,7 +267,7 @@ class TestNetworks_1(cloudstackTestCase):
network_page2 = list_networks_page2[0] network_page2 = list_networks_page2[0]
for i in range(0, len(list_networks_page1)): for i in range(0, len(list_networks_page1)):
network_page1 = list_networks_page1[i] network_page1 = list_networks_page1[i]
self.assertNotEquals( self.assertNotEqual(
network_page2.id, network_page2.id,
network_page1.id, network_page1.id,
"Network listed in page 2 is also listed in page 1" "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 # verify no vpc is present for newly created user
status = validateList(vpc_list) 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)): for i in range(0, (self.test_data["pagesize"] + 1)):
vpc_1 = VPC.create( vpc_1 = VPC.create(
self.userapiclient, self.userapiclient,
@ -354,13 +354,13 @@ class TestNetworks_1(cloudstackTestCase):
# verify vpc is created and not none # verify vpc is created and not none
self.assertIsNotNone(vpc_1, "VPC is not created") self.assertIsNotNone(vpc_1, "VPC is not created")
# Verify VPC name with test data # Verify VPC name with test data
self.assertNotEquals( self.assertNotEqual(
-1, -1,
vpc_1.name.find(self.test_data["vpc"]["name"]), vpc_1.name.find(self.test_data["vpc"]["name"]),
"VPC name not matched" "VPC name not matched"
) )
# verify zone with test data # verify zone with test data
self.assertEquals( self.assertEqual(
self.zone.id, self.zone.id,
vpc_1.zoneid, vpc_1.zoneid,
"Zone is not matching in the vpc created" "Zone is not matching in the vpc created"
@ -370,7 +370,7 @@ class TestNetworks_1(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.test_data["listall"]) listall=self.test_data["listall"])
status = validateList(vpc_count_after) 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( self.assertEqual(
len(vpc_count_after), len(vpc_count_after),
(self.test_data["pagesize"] + 1), (self.test_data["pagesize"] + 1),
@ -384,7 +384,7 @@ class TestNetworks_1(cloudstackTestCase):
pagesize=self.test_data["pagesize"] pagesize=self.test_data["pagesize"]
) )
status = validateList(list_vpcs_page1) 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( self.assertEqual(
len(list_vpcs_page1), len(list_vpcs_page1),
self.test_data["pagesize"], self.test_data["pagesize"],
@ -398,7 +398,7 @@ class TestNetworks_1(cloudstackTestCase):
pagesize=self.test_data["pagesize"] pagesize=self.test_data["pagesize"]
) )
status = validateList(list_vpcs_page2) 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( self.assertEqual(
1, 1,
len(list_vpcs_page2), len(list_vpcs_page2),
@ -410,7 +410,7 @@ class TestNetworks_1(cloudstackTestCase):
# is not present in page1 # is not present in page1
for i in range(0, len(list_vpcs_page1)): for i in range(0, len(list_vpcs_page1)):
vpc_page1 = list_vpcs_page1[i] vpc_page1 = list_vpcs_page1[i]
self.assertNotEquals( self.assertNotEqual(
vpc_page2.id, vpc_page2.id,
vpc_page1.id, vpc_page1.id,
"VPC listed in page 2 is also listed in page 1" "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 # No VPCs should be present for newly created user
status = validateList(vpc_list) 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_count_before = 0
vpc_1 = VPC.create( vpc_1 = VPC.create(
self.userapiclient, self.userapiclient,
@ -472,8 +472,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(vpc_list) status = validateList(vpc_list)
self.assertEquals(PASS, status[0], "VPC is not created") self.assertEqual(PASS, status[0], "VPC is not created")
self.assertEquals( self.assertEqual(
vpc_count_before + 1, vpc_count_before + 1,
len(vpc_list), len(vpc_list),
"VPC is not created" "VPC is not created"
@ -500,7 +500,7 @@ class TestNetworks_1(cloudstackTestCase):
network_offering_before_count = NetworkOffering.list( network_offering_before_count = NetworkOffering.list(
self.userapiclient) self.userapiclient)
status = validateList(network_offering_before_count) status = validateList(network_offering_before_count)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present") "Default network offering not present")
@ -515,7 +515,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_true_before_count) status = validateList(network_offering_vpc_true_before_count)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = true") "Default network offering not present for vpc = true")
@ -530,7 +530,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_false_before_count) status = validateList(network_offering_vpc_false_before_count)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = false") "Default network offering not present for vpc = false")
@ -548,12 +548,12 @@ class TestNetworks_1(cloudstackTestCase):
# List network offering # List network offering
network_offering_after_count = NetworkOffering.list(self.userapiclient) network_offering_after_count = NetworkOffering.list(self.userapiclient)
status = validateList(network_offering_after_count) status = validateList(network_offering_after_count)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Network Offering list results in null") "Network Offering list results in null")
# Verify that count is incremented by 1 # Verify that count is incremented by 1
self.assertEquals( self.assertEqual(
len(network_offering_before_count) + 1, len(network_offering_before_count) + 1,
len(network_offering_after_count), len(network_offering_after_count),
"Network offering is not created" "Network offering is not created"
@ -569,12 +569,12 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_true_after_count) status = validateList(network_offering_vpc_true_after_count)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Network Offering list results in null") "Network Offering list results in null")
# Verify that its count is same as step 1 # 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_before_count),
len(network_offering_vpc_true_after_count), len(network_offering_vpc_true_after_count),
"Default Network offering is created with vpc as true" "Default Network offering is created with vpc as true"
@ -590,12 +590,12 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_false_after_count) status = validateList(network_offering_vpc_false_after_count)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Network Offering list results in null") "Network Offering list results in null")
# Verify that its count is same as step 3 # 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_before_count) + 1,
len(network_offering_vpc_false_after_count), len(network_offering_vpc_false_after_count),
"Default Network offering is not created with vpc as false" "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 # No VPCs should be present for newly created user
status = validateList(vpc_list) 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_count_before = 0
vpc_1 = VPC.create( vpc_1 = VPC.create(
self.userapiclient, self.userapiclient,
@ -647,8 +647,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(vpc_list) status = validateList(vpc_list)
self.assertEquals(PASS, status[0], "VPC is not created") self.assertEqual(PASS, status[0], "VPC is not created")
self.assertEquals( self.assertEqual(
vpc_count_before + 1, vpc_count_before + 1,
len(vpc_list), len(vpc_list),
"VPC is not created" "VPC is not created"
@ -673,7 +673,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_true_list) status = validateList(network_offering_vpc_true_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = true") "Default network offering not present for vpc = true")
@ -733,7 +733,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
type="Isolated") type="Isolated")
status = validateList(list_networks_after) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
2, 2,
@ -746,7 +746,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_in_vpc) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
1, 1,
@ -760,7 +760,7 @@ class TestNetworks_1(cloudstackTestCase):
) )
# verify no vpc is present for newly created user # verify no vpc is present for newly created user
status = validateList(vpc_list) 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 # verify vpc name matches for newly created vpc name and vpc list name
self.assertEqual( self.assertEqual(
vpc_1.name, vpc_1.name,
@ -799,7 +799,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_false_list) status = validateList(network_offering_vpc_false_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = false") "Default network offering not present for vpc = false")
@ -845,7 +845,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_after) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
2, 2,
@ -861,14 +861,14 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_after_delete) 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( self.assertEqual(
1, 1,
len(list_networks_after_delete), len(list_networks_after_delete),
"Number of networks created is not matching expected" "Number of networks created is not matching expected"
) )
# Verify deleted network is not present # Verify deleted network is not present
self.assertNotEquals( self.assertNotEqual(
network_created.id, network_created.id,
list_networks_after_delete[0].id, list_networks_after_delete[0].id,
"Deleted network present" "Deleted network present"
@ -894,7 +894,7 @@ class TestNetworks_1(cloudstackTestCase):
self.assertIsNotNone( self.assertIsNotNone(
list_networks_before, list_networks_before,
"Network create failed at class level") "Network create failed at class level")
self.assertEquals( self.assertEqual(
1, 1,
len(list_networks_before), len(list_networks_before),
"More than 1 network created at class level" "More than 1 network created at class level"
@ -910,7 +910,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_false_list) status = validateList(network_offering_vpc_false_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = false") "Default network offering not present for vpc = false")
@ -949,7 +949,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
type="Isolated") type="Isolated")
status = validateList(list_networks_after) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
2, 2,
@ -969,7 +969,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
type="Isolated") type="Isolated")
status = validateList(list_networks_after_update) 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( self.assertEqual(
2, 2,
len(list_networks_after_update), len(list_networks_after_update),
@ -1056,7 +1056,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=list_networks_before[0].id networkid=list_networks_before[0].id
) )
status = validateList(list_instances_after) status = validateList(list_instances_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of instances after creation failed" "Listing of instances after creation failed"
@ -1076,7 +1076,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=list_networks_before[0].id networkid=list_networks_before[0].id
) )
status = validateList(list_instances_page1) status = validateList(list_instances_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of instances in page1 failed" "Listing of instances in page1 failed"
@ -1096,7 +1096,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=list_networks_before[0].id networkid=list_networks_before[0].id
) )
status = validateList(list_instances_page2) status = validateList(list_instances_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of instances in page2 failed" "Listing of instances in page2 failed"
@ -1155,7 +1155,7 @@ class TestNetworks_1(cloudstackTestCase):
) )
# No VPCs should be present for newly created user # No VPCs should be present for newly created user
status = validateList(vpc_list) 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_count_before = 0
vpc_1 = VPC.create( vpc_1 = VPC.create(
self.userapiclient, self.userapiclient,
@ -1170,8 +1170,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(vpc_list) status = validateList(vpc_list)
self.assertEquals(PASS, status[0], "VPC is not created") self.assertEqual(PASS, status[0], "VPC is not created")
self.assertEquals( self.assertEqual(
vpc_count_before + 1, vpc_count_before + 1,
len(vpc_list), len(vpc_list),
"VPC is not created" "VPC is not created"
@ -1196,7 +1196,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_true_list) status = validateList(network_offering_vpc_true_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = true") "Default network offering not present for vpc = true")
@ -1246,7 +1246,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
type="Isolated") type="Isolated")
status = validateList(list_networks_after) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
2, 2,
@ -1261,7 +1261,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_in_vpc) 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 # Verify network name matches for newly created network name and name
# from network list # from network list
self.assertEqual( self.assertEqual(
@ -1298,7 +1298,7 @@ class TestNetworks_1(cloudstackTestCase):
) )
# verify no vpc is present for newly created user # verify no vpc is present for newly created user
status = validateList(vpc_list) 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( vpc_1 = VPC.create(
self.userapiclient, self.userapiclient,
self.test_data["vpc"], self.test_data["vpc"],
@ -1309,13 +1309,13 @@ class TestNetworks_1(cloudstackTestCase):
self.cleanup.append(vpc_1) self.cleanup.append(vpc_1)
# verify vpc is created and not none # verify vpc is created and not none
# Verify VPC name with test data # Verify VPC name with test data
self.assertNotEquals( self.assertNotEqual(
-1, -1,
vpc_1.name.find(self.test_data["vpc"]["name"]), vpc_1.name.find(self.test_data["vpc"]["name"]),
"VPC name not matched" "VPC name not matched"
) )
# verify zone with test data # verify zone with test data
self.assertEquals( self.assertEqual(
self.zone.id, self.zone.id,
vpc_1.zoneid, vpc_1.zoneid,
"Zone is not matching in the vpc created" "Zone is not matching in the vpc created"
@ -1325,7 +1325,7 @@ class TestNetworks_1(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.test_data["listall"]) listall=self.test_data["listall"])
status = validateList(vpc_count_after) 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( self.assertEqual(
1, 1,
len(vpc_count_after), len(vpc_count_after),
@ -1344,7 +1344,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(list_vpcs_after_update) 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( self.assertEqual(
1, 1,
len(list_vpcs_after_update), len(list_vpcs_after_update),
@ -1403,7 +1403,7 @@ class TestNetworks_1(cloudstackTestCase):
) )
# No VPCs should be present for newly created user # No VPCs should be present for newly created user
status = validateList(vpc_list) 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_count_before = 0
vpc_1 = VPC.create( vpc_1 = VPC.create(
self.userapiclient, self.userapiclient,
@ -1418,8 +1418,8 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(vpc_list) status = validateList(vpc_list)
self.assertEquals(PASS, status[0], "VPC is not created") self.assertEqual(PASS, status[0], "VPC is not created")
self.assertEquals( self.assertEqual(
vpc_count_before + 1, vpc_count_before + 1,
len(vpc_list), len(vpc_list),
"VPC is not created" "VPC is not created"
@ -1445,7 +1445,7 @@ class TestNetworks_1(cloudstackTestCase):
state="Enabled" state="Enabled"
) )
status = validateList(network_offering_vpc_true_list) status = validateList(network_offering_vpc_true_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default network offering not present for vpc = true") "Default network offering not present for vpc = true")
@ -1505,7 +1505,7 @@ class TestNetworks_1(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
type="Isolated") type="Isolated")
status = validateList(list_networks_after) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
2, 2,
@ -1518,7 +1518,7 @@ class TestNetworks_1(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_in_vpc) 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 # Asserting for the length of the networks
self.assertEqual( self.assertEqual(
1, 1,
@ -1554,7 +1554,7 @@ class TestNetworks_1(cloudstackTestCase):
networkid=network_created.id networkid=network_created.id
) )
status = validateList(list_network_acl) status = validateList(list_network_acl)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"No networks acls found after creating") "No networks acls found after creating")
@ -1654,7 +1654,7 @@ class TestNetworks_2(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_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 # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient) list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after) status = validateList(list_vpc_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPC not as expected" "list VPC not as expected"
) )
# Verifying the list vpc size is increased by 1 # Verifying the list vpc size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpc_after), len(list_vpc_after),
"list VPC not equal as expected" "list VPC not equal as expected"
@ -1721,13 +1721,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(list_vpc_byid) status = validateList(list_vpc_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPC not as expected" "list VPC not as expected"
) )
# Verifying the list vpc size is 1 # Verifying the list vpc size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpc_byid), len(list_vpc_byid),
"list VPC not equal as expected" "list VPC not equal as expected"
@ -1829,13 +1829,13 @@ class TestNetworks_2(cloudstackTestCase):
# ipaddress for network # ipaddress for network
list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient) list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient)
status = validateList(list_public_ipaddress_after) status = validateList(list_public_ipaddress_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list Public IPAddress not as expected" "list Public IPAddress not as expected"
) )
# Verifying the list public ipaddress size is increased by 1 # Verifying the list public ipaddress size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_public_ipaddress_after), len(list_public_ipaddress_after),
"list Public IPAddress not equal as expected" "list Public IPAddress not equal as expected"
@ -1847,13 +1847,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(list_public_ipaddress_byid) status = validateList(list_public_ipaddress_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list public ipaddress not as expected" "list public ipaddress not as expected"
) )
# Verifying the list public ipaddress size is 1 # Verifying the list public ipaddress size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_public_ipaddress_byid), len(list_public_ipaddress_byid),
"list public ipaddress not equal as expected" "list public ipaddress not equal as expected"
@ -1966,8 +1966,8 @@ class TestNetworks_2(cloudstackTestCase):
) )
# Verifying PrivateGateways are listed # Verifying PrivateGateways are listed
status = validateList(list_private_gateways_after) status = validateList(list_private_gateways_after)
self.assertEquals(PASS, status[0], "Private Gateway Creation Failed") self.assertEqual(PASS, status[0], "Private Gateway Creation Failed")
self.assertEquals( self.assertEqual(
1, 1,
len(list_private_gateways_after), len(list_private_gateways_after),
"list Private Gateway not equal as expected" "list Private Gateway not equal as expected"
@ -1979,13 +1979,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id vpcid=vpc_created.id
) )
status = validateList(list_privategateway_byvpcid) status = validateList(list_privategateway_byvpcid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list private gateway not as expected" "list private gateway not as expected"
) )
# Verifying the list private gateway size is 1 # Verifying the list private gateway size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_privategateway_byvpcid), len(list_privategateway_byvpcid),
"list private gateway not equal as expected" "list private gateway not equal as expected"
@ -2089,13 +2089,13 @@ class TestNetworks_2(cloudstackTestCase):
type="Isolated" type="Isolated"
) )
status = validateList(list_networks_after) status = validateList(list_networks_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Network Creation Failed" "Network Creation Failed"
) )
# Verifying network list count is increased by 1 # Verifying network list count is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_networks_after), len(list_networks_after),
"Network Creation Failed" "Network Creation Failed"
@ -2131,13 +2131,13 @@ class TestNetworks_2(cloudstackTestCase):
networkid=network.id networkid=network.id
) )
status = validateList(list_egressfirewallrule_bynetworkid) status = validateList(list_egressfirewallrule_bynetworkid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list EgressFirewall Rule not as expected" "list EgressFirewall Rule not as expected"
) )
# Verifying the list EgressFirewall Rule size is 1 # Verifying the list EgressFirewall Rule size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_egressfirewallrule_bynetworkid), len(list_egressfirewallrule_bynetworkid),
"list EgressFirewall Rule not equal as expected" "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 # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient) list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after) status = validateList(list_vpc_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPC not as expected" "list VPC not as expected"
) )
# Verifying the list vpc size is increased by 1 # Verifying the list vpc size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpc_after), len(list_vpc_after),
"list VPC not equal as expected" "list VPC not equal as expected"
@ -2238,13 +2238,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"] listall=self.test_data["listall"]
) )
status = validateList(list_vpc_byid) status = validateList(list_vpc_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPC not as expected" "list VPC not as expected"
) )
# Verifying the list vpc size is 1 # Verifying the list vpc size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpc_byid), len(list_vpc_byid),
"list VPC not equal as expected" "list VPC not equal as expected"
@ -2291,13 +2291,13 @@ class TestNetworks_2(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient) list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after) status = validateList(list_vpc_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPC not as expected" "list VPC not as expected"
) )
# Verifying the list vpc size is increased by 1 # Verifying the list vpc size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpc_after), len(list_vpc_after),
"list VPC not equal as expected" "list VPC not equal as expected"
@ -2329,13 +2329,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id vpcid=vpc_created.id
) )
status = validateList(list_vpngateway_after) status = validateList(list_vpngateway_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"List VPN Gateway not equal as expected" "List VPN Gateway not equal as expected"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpngateway_after len(list_vpngateway_after
), ),
@ -2410,13 +2410,13 @@ class TestNetworks_2(cloudstackTestCase):
# Listing the vpc for a user after creating a vpc # Listing the vpc for a user after creating a vpc
list_vpc_after = VPC.list(self.userapiclient) list_vpc_after = VPC.list(self.userapiclient)
status = validateList(list_vpc_after) status = validateList(list_vpc_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPC not as expected" "list VPC not as expected"
) )
# Verifying the list vpc size is increased by 1 # Verifying the list vpc size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpc_after), len(list_vpc_after),
"list VPC not equal as expected" "list VPC not equal as expected"
@ -2448,13 +2448,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id vpcid=vpc_created.id
) )
status = validateList(list_vpngateway_after) status = validateList(list_vpngateway_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"List VPN Gateway not equal as expected" "List VPN Gateway not equal as expected"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpngateway_after len(list_vpngateway_after
), ),
@ -2491,13 +2491,13 @@ class TestNetworks_2(cloudstackTestCase):
listall=self.test_data["listall"], listall=self.test_data["listall"],
) )
status = validateList(list_vpncustomergateways_after) status = validateList(list_vpncustomergateways_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"VPN Customer Gateway list failed" "VPN Customer Gateway list failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpncustomergateways_after), len(list_vpncustomergateways_after),
"Failed to list VPN Customer Gateways" "Failed to list VPN Customer Gateways"
@ -2530,13 +2530,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id vpcid=vpc_created.id
) )
status = validateList(list_vpn_connection_after) status = validateList(list_vpn_connection_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPN Connection not as expected" "list VPN Connection not as expected"
) )
# Verifying the list vpn connection size is increased by 1 # Verifying the list vpn connection size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpn_connection_after), len(list_vpn_connection_after),
"list VPC Connection equal as expected" "list VPC Connection equal as expected"
@ -2553,13 +2553,13 @@ class TestNetworks_2(cloudstackTestCase):
vpcid=vpc_created.id vpcid=vpc_created.id
) )
status = validateList(list_vpn_connection_after_reset) status = validateList(list_vpn_connection_after_reset)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"list VPN Connection not as expected" "list VPN Connection not as expected"
) )
# Verifying the list vpn connection size is increased by 1 # Verifying the list vpn connection size is increased by 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpn_connection_after_reset), len(list_vpn_connection_after_reset),
"list VPN Connection not equal as expected" "list VPN Connection not equal as expected"
@ -2664,7 +2664,7 @@ class TestNetworks_2(cloudstackTestCase):
"Failed to list network acl list") "Failed to list network acl list")
# Verfying list is not none # Verfying list is not none
status = validateList(list_networkacl) status = validateList(list_networkacl)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list network acl list" "Failed to list network acl list"
@ -2711,8 +2711,8 @@ class TestNetworks_2(cloudstackTestCase):
) )
# Verifying PrivateGateways are listed # Verifying PrivateGateways are listed
status = validateList(list_private_gateways_after) status = validateList(list_private_gateways_after)
self.assertEquals(PASS, status[0], "Failed to list Private Gateway") self.assertEqual(PASS, status[0], "Failed to list Private Gateway")
self.assertEquals( self.assertEqual(
1, 1,
len(list_private_gateways_after), len(list_private_gateways_after),
"list Private Gateway not equal as expected" "list Private Gateway not equal as expected"

View File

@ -95,7 +95,7 @@ class TestSecurityGroups(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]] act_val = actual_vals[keys[i]]
@ -134,13 +134,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that default security group is created # Verifying that default security group is created
status = validateList(list_securitygroups_before) status = validateList(list_securitygroups_before)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default Security Groups creation failed" "Default Security Groups creation failed"
) )
# Verifying the size of the list is 1 # Verifying the size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_before), len(list_securitygroups_before),
"Count of Security Groups list is not matching" "Count of Security Groups list is not matching"
@ -167,13 +167,13 @@ class TestSecurityGroups(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_securitygroups_after) status = validateList(list_securitygroups_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Security Groups creation failed" "Security Groups creation failed"
) )
# Verifying that list size is pagesize + 1 # Verifying that list size is pagesize + 1
self.assertEquals( self.assertEqual(
self.services["pagesize"] + 1, self.services["pagesize"] + 1,
len(list_securitygroups_after), len(list_securitygroups_after),
"Failed to create pagesize + 1 number of Security Groups" "Failed to create pagesize + 1 number of Security Groups"
@ -186,13 +186,13 @@ class TestSecurityGroups(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_securitygroups_page1) status = validateList(list_securitygroups_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list security groups in page 1" "Failed to list security groups in page 1"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_securitygroups_page1), len(list_securitygroups_page1),
"Size of security groups in page 1 is not matching" "Size of security groups in page 1 is not matching"
@ -205,13 +205,13 @@ class TestSecurityGroups(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_securitygroups_page2) status = validateList(list_securitygroups_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list security groups in page 2" "Failed to list security groups in page 2"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_page2), len(list_securitygroups_page2),
"Size of security groups in page 2 is not matching" "Size of security groups in page 2 is not matching"
@ -262,13 +262,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that default security group is created # Verifying that default security group is created
status = validateList(list_securitygroups_before) status = validateList(list_securitygroups_before)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default Security Groups creation failed" "Default Security Groups creation failed"
) )
# Verifying the size of the list is 1 # Verifying the size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_before), len(list_securitygroups_before),
"Count of Security Groups list is not matching" "Count of Security Groups list is not matching"
@ -293,13 +293,13 @@ class TestSecurityGroups(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_securitygroups_after) status = validateList(list_securitygroups_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Security Groups creation failed" "Security Groups creation failed"
) )
# Verifying that list size is 2 # Verifying that list size is 2
self.assertEquals( self.assertEqual(
2, 2,
len(list_securitygroups_after), len(list_securitygroups_after),
"Failed to create Security Group" "Failed to create Security Group"
@ -320,13 +320,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that security group is listed # Verifying that security group is listed
status = validateList(list_securitygroups_byid) status = validateList(list_securitygroups_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of Security Groups by id failed" "Listing of Security Groups by id failed"
) )
# Verifying size of the list is 1 # Verifying size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_byid), len(list_securitygroups_byid),
"Count of the listing security group by id is not matching" "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 securitygroup_ingress = list_securitygroups_byid[0].ingressrule
# Validating the Ingress rule # Validating the Ingress rule
status = validateList(securitygroup_ingress) status = validateList(securitygroup_ingress)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Security Groups Ingress rule authorization failed" "Security Groups Ingress rule authorization failed"
) )
self.assertEquals( self.assertEqual(
1, 1,
len(securitygroup_ingress), len(securitygroup_ingress),
"Security Group Ingress rules count is not matching" "Security Group Ingress rules count is not matching"
@ -378,13 +378,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that security group is listed # Verifying that security group is listed
status = validateList(list_securitygroups_byid) status = validateList(list_securitygroups_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of Security Groups by id failed" "Listing of Security Groups by id failed"
) )
# Verifying size of the list is 1 # Verifying size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_byid), len(list_securitygroups_byid),
"Count of the listing security group by id is not matching" "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 securitygroup_ingress = list_securitygroups_byid[0].ingressrule
# Verifying that Ingress rule is empty(revoked) # Verifying that Ingress rule is empty(revoked)
status = validateList(securitygroup_ingress) status = validateList(securitygroup_ingress)
self.assertEquals( self.assertEqual(
EMPTY_LIST, EMPTY_LIST,
status[2], status[2],
"Security Groups Ingress rule is not revoked" "Security Groups Ingress rule is not revoked"
@ -426,13 +426,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that default security group is created # Verifying that default security group is created
status = validateList(list_securitygroups_before) status = validateList(list_securitygroups_before)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Default Security Groups creation failed" "Default Security Groups creation failed"
) )
# Verifying the size of the list is 1 # Verifying the size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_before), len(list_securitygroups_before),
"Count of Security Groups list is not matching" "Count of Security Groups list is not matching"
@ -457,13 +457,13 @@ class TestSecurityGroups(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_securitygroups_after) status = validateList(list_securitygroups_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Security Groups creation failed" "Security Groups creation failed"
) )
# Verifying that list size is 2 # Verifying that list size is 2
self.assertEquals( self.assertEqual(
2, 2,
len(list_securitygroups_after), len(list_securitygroups_after),
"Failed to create Security Group" "Failed to create Security Group"
@ -484,13 +484,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that security group is listed # Verifying that security group is listed
status = validateList(list_securitygroups_byid) status = validateList(list_securitygroups_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of Security Groups by id failed" "Listing of Security Groups by id failed"
) )
# Verifying size of the list is 1 # Verifying size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_byid), len(list_securitygroups_byid),
"Count of the listing security group by id is not matching" "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 securitygroup_egress = list_securitygroups_byid[0].egressrule
# Validating the Ingress rule # Validating the Ingress rule
status = validateList(securitygroup_egress) status = validateList(securitygroup_egress)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Security Groups Egress rule authorization failed" "Security Groups Egress rule authorization failed"
) )
self.assertEquals( self.assertEqual(
1, 1,
len(securitygroup_egress), len(securitygroup_egress),
"Security Group Egress rules count is not matching" "Security Group Egress rules count is not matching"
@ -542,13 +542,13 @@ class TestSecurityGroups(cloudstackTestCase):
) )
# Verifying that security group is listed # Verifying that security group is listed
status = validateList(list_securitygroups_byid) status = validateList(list_securitygroups_byid)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of Security Groups by id failed" "Listing of Security Groups by id failed"
) )
# Verifying size of the list is 1 # Verifying size of the list is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_securitygroups_byid), len(list_securitygroups_byid),
"Count of the listing security group by id is not matching" "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 securitygroup_egress = list_securitygroups_byid[0].egressrule
# Verifying that Ingress rule is empty(revoked) # Verifying that Ingress rule is empty(revoked)
status = validateList(securitygroup_egress) status = validateList(securitygroup_egress)
self.assertEquals( self.assertEqual(
EMPTY_LIST, EMPTY_LIST,
status[2], status[2],
"Security Groups Egress rule is not revoked" "Security Groups Egress rule is not revoked"

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
# Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import (VmSnapshot, from marvin.lib.base import (VmSnapshot,
Snapshot, Snapshot,
DiskOffering, DiskOffering,
@ -138,7 +139,7 @@ class TestSnapshots(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]] act_val = actual_vals[keys[i]]
@ -188,13 +189,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(volumes_list) status = validateList(volumes_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Root volume did not get created while deploying a VM" "Root volume did not get created while deploying a VM"
) )
# Verifying list size to be 1 # Verifying list size to be 1
self.assertEquals( self.assertEqual(
1, 1,
len(volumes_list), len(volumes_list),
"More than 1 root volume created for deployed VM" "More than 1 root volume created for deployed VM"
@ -218,13 +219,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_vol_snaps_after) status = validateList(list_vol_snaps_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Volume snapshot creation failed" "Volume snapshot creation failed"
) )
# Verifying that list size is pagesize + 1 # Verifying that list size is pagesize + 1
self.assertEquals( self.assertEqual(
self.services["pagesize"] + 1, self.services["pagesize"] + 1,
len(list_vol_snaps_after), len(list_vol_snaps_after),
"Failed to create pagesize + 1 number of Volume snapshots" "Failed to create pagesize + 1 number of Volume snapshots"
@ -237,13 +238,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_vol_snaps_page1) status = validateList(list_vol_snaps_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list volume snapshots in page 1" "Failed to list volume snapshots in page 1"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_vol_snaps_page1), len(list_vol_snaps_page1),
"Size of volume snapshots in page 1 is not matching" "Size of volume snapshots in page 1 is not matching"
@ -256,13 +257,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_vol_snaps_page2) status = validateList(list_vol_snaps_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list volume snapshots in page 2" "Failed to list volume snapshots in page 2"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
1, 1,
len(list_vol_snaps_page2), len(list_vol_snaps_page2),
"Size of volume snapshots in page 2 is not matching" "Size of volume snapshots in page 2 is not matching"
@ -319,13 +320,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(volumes_list) status = validateList(volumes_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Root volume did not get created while deploying a VM" "Root volume did not get created while deploying a VM"
) )
# Verifying list size to be 1 # Verifying list size to be 1
self.assertEquals( self.assertEqual(
1, 1,
len(volumes_list), len(volumes_list),
"More than 1 root volume created for deployed VM" "More than 1 root volume created for deployed VM"
@ -347,13 +348,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_vol_snaps_after) status = validateList(list_vol_snaps_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Volume snapshot creation failed" "Volume snapshot creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vol_snaps_after), len(list_vol_snaps_after),
"Failed to create Volume snapshot" "Failed to create Volume snapshot"
@ -365,13 +366,13 @@ class TestSnapshots(cloudstackTestCase):
id=snapshot_created.id id=snapshot_created.id
) )
status = validateList(list_vol_snapshot) status = validateList(list_vol_snapshot)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list Volume snapshot by Id" "Failed to list Volume snapshot by Id"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vol_snapshot), len(list_vol_snapshot),
"Size of the list volume snapshot by Id is not matching" "Size of the list volume snapshot by Id is not matching"
@ -454,13 +455,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_vm_snaps_after) status = validateList(list_vm_snaps_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"VM snapshot creation failed" "VM snapshot creation failed"
) )
# Verifying that list size is pagesize + 1 # Verifying that list size is pagesize + 1
self.assertEquals( self.assertEqual(
self.services["pagesize"] + 1, self.services["pagesize"] + 1,
len(list_vm_snaps_after), len(list_vm_snaps_after),
"Failed to create pagesize + 1 number of VM snapshots" "Failed to create pagesize + 1 number of VM snapshots"
@ -473,13 +474,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_vm_snaps_page1) status = validateList(list_vm_snaps_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list vm snapshots in page 1" "Failed to list vm snapshots in page 1"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_vm_snaps_page1), len(list_vm_snaps_page1),
"Size of vm snapshots in page 1 is not matching" "Size of vm snapshots in page 1 is not matching"
@ -492,13 +493,13 @@ class TestSnapshots(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_vm_snaps_page2) status = validateList(list_vm_snaps_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list vm snapshots in page 2" "Failed to list vm snapshots in page 2"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
1, 1,
len(list_vm_snaps_page2), len(list_vm_snaps_page2),
"Size of vm snapshots in page 2 is not matching" "Size of vm snapshots in page 2 is not matching"
@ -526,13 +527,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"], listall=self.services["listall"],
) )
status = validateList(list_vm_snaps) status = validateList(list_vm_snaps)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"All VM snapshots deleted" "All VM snapshots deleted"
) )
# Verifying that list size is equal to page size # Verifying that list size is equal to page size
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_vm_snaps), len(list_vm_snaps),
"VM Snapshots count is not matching" "VM Snapshots count is not matching"
@ -586,13 +587,13 @@ class TestSnapshots(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_vm_snaps_after) status = validateList(list_vm_snaps_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"VM snapshot creation failed" "VM snapshot creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vm_snaps_after), len(list_vm_snaps_after),
"Failed to create VM snapshot" "Failed to create VM snapshot"
@ -604,13 +605,13 @@ class TestSnapshots(cloudstackTestCase):
vmsnapshotid=snapshot_created.id vmsnapshotid=snapshot_created.id
) )
status = validateList(list_vm_snapshot) status = validateList(list_vm_snapshot)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list VM snapshot by Id" "Failed to list VM snapshot by Id"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vm_snapshot), len(list_vm_snapshot),
"Size of the list vm snapshot by Id is not matching" "Size of the list vm snapshot by Id is not matching"

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
# Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
validateList) validateList)
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
@ -118,7 +119,7 @@ class TestTemplates(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]] act_val = actual_vals[keys[i]]
@ -231,13 +232,13 @@ class TestTemplates(cloudstackTestCase):
templatefilter=self.services["templatefilter"] templatefilter=self.services["templatefilter"]
) )
status = validateList(list_templates_after) status = validateList(list_templates_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Templates creation failed" "Templates creation failed"
) )
# Verifying that list size is pagesize + 1 # Verifying that list size is pagesize + 1
self.assertEquals( self.assertEqual(
self.services["pagesize"] + 1, self.services["pagesize"] + 1,
len(list_templates_after), len(list_templates_after),
"Failed to create pagesize + 1 number of Templates" "Failed to create pagesize + 1 number of Templates"
@ -251,13 +252,13 @@ class TestTemplates(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_templates_page1) status = validateList(list_templates_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list Templates in page 1" "Failed to list Templates in page 1"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_templates_page1), len(list_templates_page1),
"Size of Templates in page 1 is not matching" "Size of Templates in page 1 is not matching"
@ -271,13 +272,13 @@ class TestTemplates(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_templates_page2) status = validateList(list_templates_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list Templates in page 2" "Failed to list Templates in page 2"
) )
# Verifying the list size to be equal to 1 # Verifying the list size to be equal to 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_templates_page2), len(list_templates_page2),
"Size of Templates in page 2 is not matching" "Size of Templates in page 2 is not matching"
@ -354,13 +355,13 @@ class TestTemplates(cloudstackTestCase):
templatefilter=self.services["templatefilter"] templatefilter=self.services["templatefilter"]
) )
status = validateList(list_templates_after) status = validateList(list_templates_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Templates creation failed" "Templates creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_templates_after), len(list_templates_after),
"Failed to create a Template" "Failed to create a Template"
@ -381,7 +382,7 @@ class TestTemplates(cloudstackTestCase):
"Download Template failed" "Download Template failed"
) )
# Verifying the details of downloaded template # Verifying the details of downloaded template
self.assertEquals( self.assertEqual(
"DOWNLOAD_URL_CREATED", "DOWNLOAD_URL_CREATED",
download_template.state, download_template.state,
"Download URL not created for Template" "Download URL not created for Template"
@ -390,7 +391,7 @@ class TestTemplates(cloudstackTestCase):
download_template.url, download_template.url,
"Download URL not created for Template" "Download URL not created for Template"
) )
self.assertEquals( self.assertEqual(
template_created.id, template_created.id,
download_template.id, download_template.id,
"Download Template details are not same as Template created" "Download Template details are not same as Template created"
@ -453,13 +454,13 @@ class TestTemplates(cloudstackTestCase):
templatefilter=self.services["templatefilter"] templatefilter=self.services["templatefilter"]
) )
status = validateList(list_templates_after) status = validateList(list_templates_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Templates creation failed" "Templates creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_templates_after), len(list_templates_after),
"Failed to create a Template" "Failed to create a Template"
@ -551,7 +552,7 @@ class TestTemplates(cloudstackTestCase):
# Editing the Template ostypeid # Editing the Template ostypeid
ostype_list = list_os_types(self.userapiclient) ostype_list = list_os_types(self.userapiclient)
status = validateList(ostype_list) status = validateList(ostype_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list OS Types" "Failed to list OS Types"
@ -716,7 +717,7 @@ class TestTemplates(cloudstackTestCase):
available=True available=True
) )
status = validateList(zones_list) status = validateList(zones_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list Zones" "Failed to list Zones"
@ -756,7 +757,7 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[0].id zoneid=zones_list[0].id
) )
status = validateList(zones_list) status = validateList(zones_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list Hypervisors in Zone 1" "Failed to list Hypervisors in Zone 1"
@ -780,13 +781,13 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[0].id zoneid=zones_list[0].id
) )
status = validateList(list_templates_zone1) status = validateList(list_templates_zone1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Templates creation failed in Zone1" "Templates creation failed in Zone1"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_templates_zone1), len(list_templates_zone1),
"Failed to create a Template" "Failed to create a Template"
@ -825,13 +826,13 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[0].id zoneid=zones_list[0].id
) )
status = validateList(list_templates_zone1) status = validateList(list_templates_zone1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Templates creation failed in Zone1" "Templates creation failed in Zone1"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_templates_zone1), len(list_templates_zone1),
"Failed to create a Template" "Failed to create a Template"
@ -844,23 +845,23 @@ class TestTemplates(cloudstackTestCase):
zoneid=zones_list[1].id zoneid=zones_list[1].id
) )
status = validateList(list_templates_zone2) status = validateList(list_templates_zone2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Template failed to copy into Zone2" "Template failed to copy into Zone2"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_templates_zone2), len(list_templates_zone2),
"Template failed to copy into Zone2" "Template failed to copy into Zone2"
) )
self.assertNotEquals( self.assertNotEqual(
"Connection refused", "Connection refused",
list_templates_zone2[0].status, list_templates_zone2[0].status,
"Failed to copy Template" "Failed to copy Template"
) )
self.assertEquals( self.assertEqual(
True, True,
list_templates_zone2[0].isready, list_templates_zone2[0].isready,
"Failed to copy Template" "Failed to copy Template"

View File

@ -252,7 +252,7 @@ class TestVMware(cloudstackTestCase):
isready="true" isready="true"
) )
status = validateList(list_default_iso_response) status = validateList(list_default_iso_response)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO list is empty") "ISO list is empty")
@ -260,7 +260,7 @@ class TestVMware(cloudstackTestCase):
"Registered a ISO with name {}".format(list_default_iso_response[0].name)) "Registered a ISO with name {}".format(list_default_iso_response[0].name))
try: try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0]) vm.attach_iso(self.userapiclient,list_default_iso_response[0])
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e) self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id) response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response) status = validateList(response)
@ -316,7 +316,7 @@ class TestVMware(cloudstackTestCase):
isready="true" isready="true"
) )
status = validateList(list_default_iso_response) status = validateList(list_default_iso_response)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"ISO list is empty") "ISO list is empty")
@ -324,7 +324,7 @@ class TestVMware(cloudstackTestCase):
"Registered a ISO with name {}".format(list_default_iso_response[0].name)) "Registered a ISO with name {}".format(list_default_iso_response[0].name))
try: try:
vm.attach_iso(self.userapiclient,list_default_iso_response[0]) vm.attach_iso(self.userapiclient,list_default_iso_response[0])
except CloudstackAPIException as e: except CloudstackAPIException as e:
self.fail("Attached ISO failed : %s" % e) self.fail("Attached ISO failed : %s" % e)
response = VirtualMachine.list(self.userapiclient, id=vm.id) response = VirtualMachine.list(self.userapiclient, id=vm.id)
status = validateList(response) status = validateList(response)

View File

@ -16,7 +16,8 @@
# under the License. # under the License.
# Import Local Modules # Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.cloudstackAPI import createVolume, createTemplate from marvin.cloudstackAPI import createVolume, createTemplate
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
random_gen, validateList) random_gen, validateList)
@ -149,7 +150,7 @@ class TestVolumes(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_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 # Verifying that the volume on page 2 is not present in page1
for i in range(0, len(list_volumes_page1)): for i in range(0, len(list_volumes_page1)):
volume_page1 = list_volumes_page1[i] volume_page1 = list_volumes_page1[i]
self.assertNotEquals( self.assertNotEqual(
volume_page2.id, volume_page2.id,
volume_page1.id, volume_page1.id,
"Volume listed in page 2 is also listed in page 1" "Volume listed in page 2 is also listed in page 1"
@ -482,7 +483,7 @@ class TestVolumes(cloudstackTestCase):
list_volumes_after = Volume.list( list_volumes_after = Volume.list(
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Data volume creation failed" "Data volume creation failed"
@ -505,7 +506,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -563,7 +564,7 @@ class TestVolumes(cloudstackTestCase):
) )
self.assertIsNotNone(resized_volume, "Resize Volume failed") self.assertIsNotNone(resized_volume, "Resize Volume failed")
# Verifying data volume size is increased # Verifying data volume size is increased
self.assertEquals( self.assertEqual(
new_size, new_size,
(resized_volume.size / (1024 * 1024 * 1024)), (resized_volume.size / (1024 * 1024 * 1024)),
"volume not resized to expected value" "volume not resized to expected value"
@ -637,7 +638,7 @@ class TestVolumes(cloudstackTestCase):
# Verifyign that volume list is increased by 1 after creation of # Verifyign that volume list is increased by 1 after creation of
# custion volume # custion volume
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Custom volume did not get created" "Custom volume did not get created"
@ -659,7 +660,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -691,7 +692,7 @@ class TestVolumes(cloudstackTestCase):
size=new_size) size=new_size)
self.assertIsNotNone(resized_volume, "Resize Volume failed") self.assertIsNotNone(resized_volume, "Resize Volume failed")
# Verifying that custom disk size is increased # Verifying that custom disk size is increased
self.assertEquals( self.assertEqual(
new_size, new_size,
(resized_volume.size / (1024 * 1024 * 1024)), (resized_volume.size / (1024 * 1024 * 1024)),
"volume not resized to expected value" "volume not resized to expected value"
@ -731,7 +732,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -753,7 +754,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -911,7 +912,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
templatefilter='self') templatefilter='self')
self.assertEquals( self.assertEqual(
templates_before_size + 1, templates_before_size + 1,
len(list_templates_after), len(list_templates_after),
"Template creation failed from snapshot" "Template creation failed from snapshot"
@ -955,7 +956,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -978,7 +979,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -1049,7 +1050,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after, list_snapshot_policy_after,
"Hourly Snapshot policy creation failed" "Hourly Snapshot policy creation failed"
) )
self.assertEquals( self.assertEqual(
snapshot_policy_before_size + 1, snapshot_policy_before_size + 1,
len(list_snapshot_policy_after), len(list_snapshot_policy_after),
"Hourly Snapshot policy creation failed" "Hourly Snapshot policy creation failed"
@ -1093,7 +1094,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -1115,7 +1116,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -1186,7 +1187,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after, list_snapshot_policy_after,
"Daily Snapshot policy creation failed" "Daily Snapshot policy creation failed"
) )
self.assertEquals( self.assertEqual(
snapshot_policy_before_size + 1, snapshot_policy_before_size + 1,
len(list_snapshot_policy_after), len(list_snapshot_policy_after),
"Daily Snapshot policy creation failed" "Daily Snapshot policy creation failed"
@ -1230,7 +1231,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -1252,7 +1253,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -1323,7 +1324,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after, list_snapshot_policy_after,
"Weekly Snapshot policy creation failed" "Weekly Snapshot policy creation failed"
) )
self.assertEquals( self.assertEqual(
snapshot_policy_before_size + 1, snapshot_policy_before_size + 1,
len(list_snapshot_policy_after), len(list_snapshot_policy_after),
"Weekly Snapshot policy creation failed" "Weekly Snapshot policy creation failed"
@ -1369,7 +1370,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -1390,7 +1391,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -1459,7 +1460,7 @@ class TestVolumes(cloudstackTestCase):
list_snapshot_policy_after, list_snapshot_policy_after,
"Monthly Snapshot policy creation failed" "Monthly Snapshot policy creation failed"
) )
self.assertEquals( self.assertEqual(
snapshot_policy_before_size + 1, snapshot_policy_before_size + 1,
len(list_snapshot_policy_after), len(list_snapshot_policy_after),
"Monthly Snapshot policy creation failed" "Monthly Snapshot policy creation failed"
@ -1518,7 +1519,7 @@ class TestVolumes(cloudstackTestCase):
self.userapiclient, self.userapiclient,
listall=self.services["listall"]) listall=self.services["listall"])
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -1539,7 +1540,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -1579,7 +1580,7 @@ class TestVolumes(cloudstackTestCase):
) )
self.assertIsNotNone(snapshot_created, "Snapshot not created") self.assertIsNotNone(snapshot_created, "Snapshot not created")
self.assertEquals( self.assertEqual(
volume_created.id, volume_created.id,
snapshot_created.volumeid, snapshot_created.volumeid,
"Snapshot not created for given volume" "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 # Verifying that the snapshot on page 2 is not present in page1
for i in range(0, len(list_snapshots_page1)): for i in range(0, len(list_snapshots_page1)):
snapshot_page1 = list_snapshots_page1[i] snapshot_page1 = list_snapshots_page1[i]
self.assertNotEquals( self.assertNotEqual(
snapshot_page2.id, snapshot_page2.id,
snapshot_page1.id, snapshot_page1.id,
"Snapshot listed in page 2 is also listed in page 1" "Snapshot listed in page 2 is also listed in page 1"
@ -1705,7 +1706,7 @@ class TestVolumes(cloudstackTestCase):
list_volumes_after, list_volumes_after,
"volume creation failed" "volume creation failed"
) )
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"Volume not created" "Volume not created"
@ -1726,7 +1727,7 @@ class TestVolumes(cloudstackTestCase):
attached_volume.vmname, attached_volume.vmname,
"VM is not attached to Volume" "VM is not attached to Volume"
) )
self.assertEquals( self.assertEqual(
self.virtual_machine.name, self.virtual_machine.name,
attached_volume.vmname, attached_volume.vmname,
"VM Name is not matching with attached vm" "VM Name is not matching with attached vm"
@ -1758,7 +1759,7 @@ class TestVolumes(cloudstackTestCase):
extract_volume_response, extract_volume_response,
"Extract/Download volume failed") "Extract/Download volume failed")
self.assertEquals( self.assertEqual(
"DOWNLOAD_URL_CREATED", "DOWNLOAD_URL_CREATED",
extract_volume_response.state, extract_volume_response.state,
"Failed to create Download URL" "Failed to create Download URL"
@ -1771,7 +1772,7 @@ class TestVolumes(cloudstackTestCase):
(extract_volume_response.url.find("http") != -1), (extract_volume_response.url.find("http") != -1),
"Extract/Download volume URL doesnot contain http" "Extract/Download volume URL doesnot contain http"
) )
self.assertEquals( self.assertEqual(
volume_created.id, volume_created.id,
extract_volume_response.id, extract_volume_response.id,
"Extracted/Downloaded volume is not matching with original volume" "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" "volume not created for the vm launched at class level"
) )
# Asserting that the list volume length after upload is increased by 1 # Asserting that the list volume length after upload is increased by 1
self.assertEquals( self.assertEqual(
len(list_volumes_before) + 1, len(list_volumes_before) + 1,
len(list_volumes_after), len(list_volumes_after),
"upload volume failed" "upload volume failed"

View File

@ -120,7 +120,7 @@ class TestVpnCustomerGateways(cloudstackTestCase):
if len(expected_vals) != len(actual_vals): if len(expected_vals) != len(actual_vals):
return False return False
keys = expected_vals.keys() keys = list(expected_vals.keys())
for i in range(0, len(expected_vals)): for i in range(0, len(expected_vals)):
exp_val = expected_vals[keys[i]] exp_val = expected_vals[keys[i]]
act_val = actual_vals[keys[i]] act_val = actual_vals[keys[i]]
@ -186,13 +186,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_vpncustomergateways_after) status = validateList(list_vpncustomergateways_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"VPN Customer Gateway creation failed" "VPN Customer Gateway creation failed"
) )
# Verifying that list size is pagesize + 1 # Verifying that list size is pagesize + 1
self.assertEquals( self.assertEqual(
self.services["pagesize"] + 1, self.services["pagesize"] + 1,
len(list_vpncustomergateways_after), len(list_vpncustomergateways_after),
"Failed to create pagesize + 1 number of VPN Customer Gateways" "Failed to create pagesize + 1 number of VPN Customer Gateways"
@ -205,13 +205,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_vpncustomergateways_page1) status = validateList(list_vpncustomergateways_page1)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list VPN Customer Gateways in page 1" "Failed to list VPN Customer Gateways in page 1"
) )
# Verifying the list size to be equal to pagesize # Verifying the list size to be equal to pagesize
self.assertEquals( self.assertEqual(
self.services["pagesize"], self.services["pagesize"],
len(list_vpncustomergateways_page1), len(list_vpncustomergateways_page1),
"Size of VPN Customer Gateways in page 1 is not matching" "Size of VPN Customer Gateways in page 1 is not matching"
@ -224,13 +224,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
pagesize=self.services["pagesize"] pagesize=self.services["pagesize"]
) )
status = validateList(list_vpncustomergateways_page2) status = validateList(list_vpncustomergateways_page2)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list VPN Customer Gateways in page 2" "Failed to list VPN Customer Gateways in page 2"
) )
# Verifying the list size to be equal to 1 # Verifying the list size to be equal to 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpncustomergateways_page2), len(list_vpncustomergateways_page2),
"Size of VPN Customer Gateways in page 2 is not matching" "Size of VPN Customer Gateways in page 2 is not matching"
@ -301,13 +301,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
listall=self.services["listall"] listall=self.services["listall"]
) )
status = validateList(list_vpncustomergateways_after) status = validateList(list_vpncustomergateways_after)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"VPN Customer Gateway creation failed" "VPN Customer Gateway creation failed"
) )
# Verifying that list size is 1 # Verifying that list size is 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpncustomergateways_after), len(list_vpncustomergateways_after),
"Failed to create VPN Customer Gateways" "Failed to create VPN Customer Gateways"
@ -332,13 +332,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
id=vpncustomergateway_created.id id=vpncustomergateway_created.id
) )
status = validateList(list_vpncustomergateway) status = validateList(list_vpncustomergateway)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Failed to list VPN Customer Gateways by Id" "Failed to list VPN Customer Gateways by Id"
) )
# Verifying the list size to be equal to 1 # Verifying the list size to be equal to 1
self.assertEquals( self.assertEqual(
1, 1,
len(list_vpncustomergateway), len(list_vpncustomergateway),
"Size of VPN Customer Gateways by id is not matching" "Size of VPN Customer Gateways by id is not matching"

View File

@ -412,7 +412,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
self.virtual_machine_2], self.virtual_machine_2],
services=services) 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" % self.debug("Creating stickiness policy for the LB rule: %s" %
lb_rule.id) lb_rule.id)
policies = self.configure_Stickiness_Policy(lb_rule, 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 #TODO: Add code to check the AppCookie and LbCookie Stickiness policies
configs = {"SourceBased": {"tablesize": '100k'}} configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods: 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.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method)) (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 #TODO: Add code to check the AppCookie and LbCookie Stickiness policies
configs = {"SourceBased": {"tablesize": '100k'}} configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods: 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.debug("Creating load balancing rule on IP %s & algo %s" %
(self.public_ip.ipaddress.ipaddress, lb_method)) (self.public_ip.ipaddress.ipaddress, lb_method))
@ -632,7 +632,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
configs = {"SourceBased": {"tablesize": '100k'}} configs = {"SourceBased": {"tablesize": '100k'}}
for lb_method in lb_methods: 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") self.debug("Setting up environment - acquire public IP")
public_ip = self.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 # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
from __builtin__ import False
""" BVT tests for Hosts Test """ BVT tests for Hosts Test
""" """

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
from __builtin__ import False
""" BVT tests for Hosts Maintenance """ BVT tests for Hosts Maintenance
""" """
@ -198,7 +197,7 @@ class TestHostHA(cloudstackTestCase):
"Check if listStoragePools returns a valid response" "Check if listStoragePools returns a valid response"
) )
for storage_pool in storage_pools: for storage_pool in storage_pools:
if storage_pool.type == u'NetworkFilesystem': if storage_pool.type == 'NetworkFilesystem':
return True return True
return False return False
@ -218,7 +217,7 @@ class TestHostHA(cloudstackTestCase):
"Check if listStoragePools returns a valid response" "Check if listStoragePools returns a valid response"
) )
for storage_pool in storage_pools: for storage_pool in storage_pools:
if storage_pool.type == u'NetworkFilesystem': if storage_pool.type == 'NetworkFilesystem':
return False return False
return True return True
@ -238,7 +237,7 @@ class TestHostHA(cloudstackTestCase):
"Check if listStoragePools returns a valid response" "Check if listStoragePools returns a valid response"
) )
for storage_pool in storage_pools: for storage_pool in storage_pools:
if storage_pool.type == u'NetworkFilesystem': if storage_pool.type == 'NetworkFilesystem':
return True return True
return False return False

View File

@ -1156,10 +1156,10 @@ class TestXDCCPInterop(cloudstackTestCase):
domainid=self.account.domainid, domainid=self.account.domainid,
id=deployVmResponse.id 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] vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state") self.assertTrue(vm.state == "Running", "VM is not in Running state")
return return
@attr(tags=["devcloud", "basic", "advanced"], required_hardware="true") @attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
@ -1181,10 +1181,10 @@ class TestXDCCPInterop(cloudstackTestCase):
domainid=self.account.domainid, domainid=self.account.domainid,
id=deployVmResponse.id 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] vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test") self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state") self.assertTrue(vm.state == "Running", "VM is not in Running state")
return return

View File

@ -22,7 +22,8 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network 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.utils import validateList, cleanup_resources, verifyRouterState
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
Network, Network,
@ -762,7 +763,7 @@ class TestUpdateIPReservation(cloudstackTestCase):
try: try:
virtual_machine_1 = createVirtualMachine(self, network_id=isolated_network.id, 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: except Exception as e:
self.fail("VM creation failed: %s" % e) self.fail("VM creation failed: %s" % e)

View File

@ -30,7 +30,8 @@
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import ( from marvin.lib.base import (
Account, Account,
ServiceOffering, ServiceOffering,

View File

@ -89,7 +89,7 @@ class TestLdap(cloudstackTestCase):
else: else:
self.delflag = 1 self.delflag = 1
self.acctRes = self.apiClient.createAccount(self.acct) 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 return
def tearDown(self): def tearDown(self):
@ -134,13 +134,13 @@ class TestLdap(cloudstackTestCase):
self.services["configurableData"]["ldap_configuration"]["ldapUsername"], self.services["configurableData"]["ldap_configuration"]["ldapUsername"],
self.services["configurableData"]["ldap_configuration"]["ldapPassword"]) self.services["configurableData"]["ldap_configuration"]["ldapPassword"])
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
else: else:
self.debug("LDAP Configuration failed with exception") self.debug("LDAP Configuration failed with exception")
self.assertEquals( self.assertEqual(
self.ldapconfRes, self.ldapconfRes,
1, 1,
self.reason) self.reason)
@ -250,7 +250,7 @@ class TestLdap(cloudstackTestCase):
tn = telnetlib.Telnet(ldapConfiguration['hostname'], ldapConfiguration['port'], timeout=15) tn = telnetlib.Telnet(ldapConfiguration['hostname'], ldapConfiguration['port'], timeout=15)
if tn is not None: if tn is not None:
tn.set_debuglevel(1) 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")) self.debug("Ldap Server is Up and listening on the port %s" % tn.msg("Connected to the server"))
flag = True flag = True
tn.close() tn.close()

View File

@ -143,7 +143,7 @@ def checkLdapConfiguration(cls, ldapConfiguration):
timeout=15) timeout=15)
if tn is not None: if tn is not None:
tn.set_debuglevel(1) tn.set_debuglevel(1)
print tn.msg("Connected to the server") print(tn.msg("Connected to the server"))
cls.debug( cls.debug(
"Ldap Server is Up and listening on the port %s" % "Ldap Server is Up and listening on the port %s" %
tn.msg("Connected to the server")) tn.msg("Connected to the server"))
@ -251,7 +251,7 @@ class TestLdap(cloudstackTestCase):
else: else:
self.delflag1 = 1 self.delflag1 = 1
self.ldaplinkRes = self.apiClient.linkDomainToLdap(self.ldaplink) self.ldaplinkRes = self.apiClient.linkDomainToLdap(self.ldaplink)
self.assertEquals( self.assertEqual(
self.delflag1, self.delflag1,
1, 1,
"Linking LDAP failed,please check the configuration") "Linking LDAP failed,please check the configuration")
@ -260,7 +260,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
lsap_user = Account.list(self.api_client, lsap_user = Account.list(self.api_client,
domainid=self.parent_domain.id, domainid=self.parent_domain.id,
@ -328,7 +328,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_03_ldap(self): def test_03_ldap(self):
@ -340,7 +340,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, None, self.reason) self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_04_ldap(self): def test_04_ldap(self):
@ -353,7 +353,7 @@ class TestLdap(cloudstackTestCase):
"", "",
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, None, self.reason) self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_05_ldap(self): def test_05_ldap(self):
@ -362,7 +362,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, None, self.reason) self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_06_ldap(self): def test_06_ldap(self):
@ -395,7 +395,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_07_ldap(self): def test_07_ldap(self):
@ -414,7 +414,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, None, self.reason) self.assertEqual(loginRes, None, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_08_ldap(self): def test_08_ldap(self):
@ -428,7 +428,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
self.domain2 = Domain.create( self.domain2 = Domain.create(
self.apiclient, self.apiclient,
@ -465,7 +465,7 @@ class TestLdap(cloudstackTestCase):
self.delflag2 = 1 self.delflag2 = 1
self.ldaplinkRes2 = self.apiClient.linkDomainToLdap( self.ldaplinkRes2 = self.apiClient.linkDomainToLdap(
self.ldaplink2) self.ldaplink2)
self.assertEquals( self.assertEqual(
self.delflag2, self.delflag2,
1, 1,
"Linking LDAP failed,please check the configuration") "Linking LDAP failed,please check the configuration")
@ -477,7 +477,7 @@ class TestLdap(cloudstackTestCase):
self.domain2.name, self.domain2.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
self.domain3 = Domain.create( self.domain3 = Domain.create(
self.apiclient, self.apiclient,
@ -511,7 +511,7 @@ class TestLdap(cloudstackTestCase):
self.delflag3 = 1 self.delflag3 = 1
self.ldaplinkRes3 = self.apiClient.linkDomainToLdap( self.ldaplinkRes3 = self.apiClient.linkDomainToLdap(
self.ldaplink3) self.ldaplink3)
self.assertEquals( self.assertEqual(
self.delflag3, self.delflag3,
1, 1,
"Linking LDAP failed,please check the configuration") "Linking LDAP failed,please check the configuration")
@ -522,7 +522,7 @@ class TestLdap(cloudstackTestCase):
self.domain2.name, self.domain2.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
finally: finally:
try: try:
@ -556,7 +556,7 @@ class TestLdap(cloudstackTestCase):
self.parent_domain.name, self.parent_domain.name,
method="POST") method="POST")
self.debug(loginRes) self.debug(loginRes)
self.assertEquals(loginRes, 1, self.reason) self.assertEqual(loginRes, 1, self.reason)
@attr(tags=["advanced", "basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_10_ldap(self): def test_10_ldap(self):
@ -584,7 +584,7 @@ class TestLdap(cloudstackTestCase):
dbChecking[0][2]) == \ dbChecking[0][2]) == \
self.services["configurableData"]["link_ldap_details"]["accounttype"]: self.services["configurableData"]["link_ldap_details"]["accounttype"]:
db_check = 0 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") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_11_ldap(self): def test_11_ldap(self):
@ -593,6 +593,6 @@ class TestLdap(cloudstackTestCase):
self, self,
"", "", self.parent_domain.name, method="POST") "", "", self.parent_domain.name, method="POST")
self.debug(loginRes) 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 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.utils import (cleanup_resources)
from marvin.lib.base import (Pod, Cluster, Capacities) from marvin.lib.base import (Pod, Cluster, Capacities)
from marvin.cloudstackAPI import (updateConfiguration) from marvin.cloudstackAPI import (updateConfiguration)

View File

@ -16,25 +16,26 @@
# under the License. # under the License.
""" P1 tests for memory resource limits """ P1 tests for memory resource limits
""" """
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Resources,
Domain
)
from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
findSuitableHostForMigration,
get_resource_type
)
from marvin.lib.utils import cleanup_resources
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
from marvin.lib.base import (
Account,
ServiceOffering,
VirtualMachine,
Resources,
Domain
)
from marvin.lib.common import (get_domain,
get_zone,
get_template,
wait_for_cleanup,
findSuitableHostForMigration,
get_resource_type
)
from marvin.lib.utils import cleanup_resources
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
class Services: class Services:
"""Test memory resource limit services """Test memory resource limit services
@ -42,50 +43,51 @@ class Services:
def __init__(self): def __init__(self):
self.services = { self.services = {
"account": { "account": {
"email": "test@test.com", "email": "test@test.com",
"firstname": "Test", "firstname": "Test",
"lastname": "User", "lastname": "User",
"username": "resource", "username": "resource",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "password", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 2048, # In MBs "memory": 2048, # In MBs
}, },
"virtual_machine": { "virtual_machine": {
"displayname": "TestVM", "displayname": "TestVM",
"username": "root", "username": "root",
"password": "password", "password": "password",
"ssh_port": 22, "ssh_port": 22,
"hypervisor": 'KVM', "hypervisor": 'KVM',
"privateport": 22, "privateport": 22,
"publicport": 22, "publicport": 22,
"protocol": 'TCP', "protocol": 'TCP',
}, },
"network": { "network": {
"name": "Test Network", "name": "Test Network",
"displaytext": "Test Network", "displaytext": "Test Network",
"netmask": '255.255.255.0' "netmask": '255.255.255.0'
}, },
"project": { "project": {
"name": "Project", "name": "Project",
"displaytext": "Test project", "displaytext": "Test project",
}, },
"domain": { "domain": {
"name": "Domain", "name": "Domain",
}, },
"ostype": 'CentOS 5.3 (64-bit)', "ostype": 'CentOS 5.3 (64-bit)',
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode": 'advanced', "mode": 'advanced',
# Networking mode: Advanced, Basic # Networking mode: Advanced, Basic
} }
class TestMemoryLimits(cloudstackTestCase): class TestMemoryLimits(cloudstackTestCase):
@ -102,17 +104,17 @@ class TestMemoryLimits(cloudstackTestCase):
cls.services["mode"] = cls.zone.networktype cls.services["mode"] = cls.zone.networktype
cls.template = get_template( cls.template = get_template(
cls.api_client, cls.api_client,
cls.zone.id, cls.zone.id,
cls.services["ostype"] cls.services["ostype"]
) )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
) )
cls._cleanup = [cls.service_offering, ] cls._cleanup = [cls.service_offering, ]
return return
@ -130,13 +132,13 @@ class TestMemoryLimits(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.account = Account.create( self.account = Account.create(
self.apiclient, self.apiclient,
self.services["account"], self.services["account"],
admin=True admin=True
) )
self.debug("Creating an instance with service offering: %s" % self.debug("Creating an instance with service offering: %s" %
self.service_offering.name) self.service_offering.name)
self.vm = self.createInstance(service_off=self.service_offering) self.vm = self.createInstance(service_off=self.service_offering)
self.cleanup = [self.account, ] self.cleanup = [self.account, ]
@ -153,20 +155,20 @@ class TestMemoryLimits(cloudstackTestCase):
def createInstance(self, service_off, networks=None, api_client=None): def createInstance(self, service_off, networks=None, api_client=None):
"""Creates an instance in account""" """Creates an instance in account"""
self.debug("Deploying an instance in account: %s" % self.debug("Deploying an instance in account: %s" %
self.account.name) self.account.name)
if api_client is None: if api_client is None:
api_client = self.apiclient api_client = self.apiclient
try: try:
vm = VirtualMachine.create( vm = VirtualMachine.create(
api_client, api_client,
self.services["virtual_machine"], self.services["virtual_machine"],
templateid=self.template.id, templateid=self.template.id,
accountid=self.account.name, accountid=self.account.name,
domainid=self.account.domainid, domainid=self.account.domainid,
networkids=networks, networkids=networks,
serviceofferingid=service_off.id) serviceofferingid=service_off.id)
vms = VirtualMachine.list(api_client, id=vm.id, listall=True) vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
self.assertIsInstance(vms, self.assertIsInstance(vms,
list, list,
@ -177,7 +179,7 @@ class TestMemoryLimits(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Failed to deploy an instance: %s" % e) self.fail("Failed to deploy an instance: %s" % e)
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_01_stop_start_instance(self): def test_01_stop_start_instance(self):
"""Test Deploy VM with specified RAM & verify the usage""" """Test Deploy VM with specified RAM & verify the usage"""
@ -229,7 +231,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should be same after stopping the instance") "Resource count should be same after stopping the instance")
return return
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="true") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="true")
def test_02_migrate_instance(self): def test_02_migrate_instance(self):
"""Test Deploy VM with specified RAM & verify the usage""" """Test Deploy VM with specified RAM & verify the usage"""
@ -273,7 +275,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should be same after stopping the instance") "Resource count should be same after stopping the instance")
return return
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_03_delete_instance(self): def test_03_delete_instance(self):
"""Test Deploy VM with specified GB RAM & verify the usage""" """Test Deploy VM with specified GB RAM & verify the usage"""
@ -300,8 +302,8 @@ class TestMemoryLimits(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Failed to delete instance: %s" % e) self.fail("Failed to delete instance: %s" % e)
# Wait for expunge interval to cleanup Memory # Wait for expunge interval to cleanup Memory
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"]) wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
account_list = Account.list(self.apiclient, id=self.account.id) account_list = Account.list(self.apiclient, id=self.account.id)
self.assertIsInstance(account_list, self.assertIsInstance(account_list,
@ -309,10 +311,10 @@ class TestMemoryLimits(cloudstackTestCase):
"List Accounts should return a valid response" "List Accounts should return a valid response"
) )
resource_count_after_delete = account_list[0].memorytotal resource_count_after_delete = account_list[0].memorytotal
self.assertEqual(resource_count_after_delete, 0 , "Resource count for %s should be 0" % get_resource_type(resource_id=9))#RAM self.assertEqual(resource_count_after_delete, 0, "Resource count for %s should be 0" % get_resource_type(resource_id=9)) # RAM
return return
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_04_deploy_multiple_vm(self): def test_04_deploy_multiple_vm(self):
"""Test Deploy multiple VM with specified RAM & verify the usage""" """Test Deploy multiple VM with specified RAM & verify the usage"""
@ -335,7 +337,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should match with the expected resource count") "Resource count should match with the expected resource count")
self.debug("Creating two instances with service offering: %s" % self.debug("Creating two instances with service offering: %s" %
self.service_offering.name) self.service_offering.name)
vm_1 = self.createInstance(service_off=self.service_offering) vm_1 = self.createInstance(service_off=self.service_offering)
self.createInstance(service_off=self.service_offering) self.createInstance(service_off=self.service_offering)
@ -346,7 +348,7 @@ class TestMemoryLimits(cloudstackTestCase):
) )
resource_count_new = account_list[0].memorytotal resource_count_new = account_list[0].memorytotal
expected_resource_count = int(self.services["service_offering"]["memory"]) * 3 #Total 3 VMs expected_resource_count = int(self.services["service_offering"]["memory"]) * 3 # Total 3 VMs
self.assertEqual(resource_count_new, expected_resource_count, self.assertEqual(resource_count_new, expected_resource_count,
"Resource count should match with the expected resource count") "Resource count should match with the expected resource count")
@ -370,6 +372,7 @@ class TestMemoryLimits(cloudstackTestCase):
"Resource count should match with the expected resource count") "Resource count should match with the expected resource count")
return return
class TestDomainMemoryLimitsConfiguration(cloudstackTestCase): class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
@classmethod @classmethod
@ -384,17 +387,17 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
cls.services["mode"] = cls.zone.networktype cls.services["mode"] = cls.zone.networktype
cls.template = get_template( cls.template = get_template(
cls.api_client, cls.api_client,
cls.zone.id, cls.zone.id,
cls.services["ostype"] cls.services["ostype"]
) )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
) )
cls._cleanup = [cls.service_offering, ] cls._cleanup = [cls.service_offering, ]
return return
@ -426,20 +429,20 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
def createInstance(self, service_off, networks=None, api_client=None): def createInstance(self, service_off, networks=None, api_client=None):
"""Creates an instance in account""" """Creates an instance in account"""
self.debug("Deploying an instance in account: %s" % self.debug("Deploying an instance in account: %s" %
self.account.name) self.account.name)
if api_client is None: if api_client is None:
api_client = self.apiclient api_client = self.apiclient
try: try:
vm = VirtualMachine.create( vm = VirtualMachine.create(
api_client, api_client,
self.services["virtual_machine"], self.services["virtual_machine"],
templateid=self.template.id, templateid=self.template.id,
accountid=self.account.name, accountid=self.account.name,
domainid=self.account.domainid, domainid=self.account.domainid,
networkids=networks, networkids=networks,
serviceofferingid=service_off.id) serviceofferingid=service_off.id)
vms = VirtualMachine.list(api_client, id=vm.id, listall=True) vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
self.assertIsInstance(vms, self.assertIsInstance(vms,
list, list,
@ -458,11 +461,11 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
parentdomainid=self.domain.id) parentdomainid=self.domain.id)
self.child_do_admin_1 = Account.create( self.child_do_admin_1 = Account.create(
self.apiclient, self.apiclient,
self.services["account"], self.services["account"],
admin=True, admin=True,
domainid=self.child_domain_1.id domainid=self.child_domain_1.id
) )
# Cleanup the resources created at end of test # Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin_1) self.cleanup.append(self.child_do_admin_1)
self.cleanup.append(self.child_domain_1) self.cleanup.append(self.child_domain_1)
@ -470,21 +473,21 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.debug("Creating a domain under: %s" % self.domain.name) self.debug("Creating a domain under: %s" % self.domain.name)
self.child_domain_2 = Domain.create(self.apiclient, self.child_domain_2 = Domain.create(self.apiclient,
services=self.services["domain"], services=self.services["domain"],
parentdomainid=self.domain.id) parentdomainid=self.domain.id)
self.child_do_admin_2 = Account.create( self.child_do_admin_2 = Account.create(
self.apiclient, self.apiclient,
self.services["account"], self.services["account"],
admin=True, admin=True,
domainid=self.child_domain_2.id) domainid=self.child_domain_2.id)
# Cleanup the resources created at end of test # Cleanup the resources created at end of test
self.cleanup.append(self.child_do_admin_2) self.cleanup.append(self.child_do_admin_2)
self.cleanup.append(self.child_domain_2) self.cleanup.append(self.child_domain_2)
return return
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_01_stop_start_instance(self): def test_01_stop_start_instance(self):
"""Test Deploy VM with 5 GB memory & verify the usage""" """Test Deploy VM with 5 GB memory & verify the usage"""
@ -499,16 +502,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
api_client = self.testClient.getUserApiClient( api_client = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain) DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" % self.debug("Creating an instance with service offering: %s" %
self.service_offering.name) self.service_offering.name)
vm = self.createInstance(service_off=self.service_offering, api_client=api_client) vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
account_list = Account.list(self.apiclient, id=self.account.id) account_list = Account.list(self.apiclient, id=self.account.id)
@ -521,7 +524,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count = int(self.services["service_offering"]["memory"]) expected_resource_count = int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count, expected_resource_count, self.assertEqual(resource_count, expected_resource_count,
"Initial resource count should match with the expected resource count") "Initial resource count should match with the expected resource count")
self.debug("Stopping instance: %s" % vm.name) self.debug("Stopping instance: %s" % vm.name)
try: try:
@ -537,7 +540,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
resource_count_after_stop = account_list[0].memorytotal resource_count_after_stop = account_list[0].memorytotal
self.assertEqual(resource_count, resource_count_after_stop, self.assertEqual(resource_count, resource_count_after_stop,
"Resource count should be same after stopping the instance") "Resource count should be same after stopping the instance")
self.debug("Starting instance: %s" % vm.name) self.debug("Starting instance: %s" % vm.name)
try: try:
@ -553,10 +556,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
resource_count_after_start = account_list[0].memorytotal resource_count_after_start = account_list[0].memorytotal
self.assertEqual(resource_count_after_stop, resource_count_after_start, self.assertEqual(resource_count_after_stop, resource_count_after_start,
"Resource count should be same after starting the instance") "Resource count should be same after starting the instance")
return return
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="true") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="true")
def test_02_migrate_instance(self): def test_02_migrate_instance(self):
"""Test Deploy VM with specified memory & verify the usage""" """Test Deploy VM with specified memory & verify the usage"""
@ -574,16 +577,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
api_client = self.testClient.getUserApiClient( api_client = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain) DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" % self.debug("Creating an instance with service offering: %s" %
self.service_offering.name) self.service_offering.name)
vm = self.createInstance(service_off=self.service_offering, api_client=api_client) vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
account_list = Account.list(self.apiclient, id=self.account.id) account_list = Account.list(self.apiclient, id=self.account.id)
@ -596,13 +599,13 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count = int(self.services["service_offering"]["memory"]) expected_resource_count = int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count, expected_resource_count, self.assertEqual(resource_count, expected_resource_count,
"Initial resource count should with the expected resource count") "Initial resource count should with the expected resource count")
host = findSuitableHostForMigration(self.apiclient, vm.id) host = findSuitableHostForMigration(self.apiclient, vm.id)
if host is None: if host is None:
self.skipTest(ERROR_NO_HOST_FOR_MIGRATION) self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
self.debug("Migrating instance: %s to host: %s" % self.debug("Migrating instance: %s to host: %s" %
(vm.name, host.name)) (vm.name, host.name))
try: try:
vm.migrate(self.apiclient, host.id) vm.migrate(self.apiclient, host.id)
except Exception as e: except Exception as e:
@ -616,10 +619,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
resource_count_after_migrate = account_list[0].memorytotal resource_count_after_migrate = account_list[0].memorytotal
self.assertEqual(resource_count, resource_count_after_migrate, self.assertEqual(resource_count, resource_count_after_migrate,
"Resource count should be same after starting the instance") "Resource count should be same after starting the instance")
return return
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false") @attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
def test_03_delete_instance(self): def test_03_delete_instance(self):
"""Test Deploy VM with specified RAM & verify the usage""" """Test Deploy VM with specified RAM & verify the usage"""
@ -634,16 +637,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
api_client = self.testClient.getUserApiClient( api_client = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain) DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" % self.debug("Creating an instance with service offering: %s" %
self.service_offering.name) self.service_offering.name)
vm = self.createInstance(service_off=self.service_offering, api_client=api_client) vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
account_list = Account.list(self.apiclient, id=self.account.id) account_list = Account.list(self.apiclient, id=self.account.id)
@ -656,7 +659,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count = int(self.services["service_offering"]["memory"]) expected_resource_count = int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count, expected_resource_count, self.assertEqual(resource_count, expected_resource_count,
"Initial resource count should match with the expected resource count") "Initial resource count should match with the expected resource count")
self.debug("Destroying instance: %s" % vm.name) self.debug("Destroying instance: %s" % vm.name)
try: try:
@ -670,14 +673,14 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
"List Accounts should return a valid response" "List Accounts should return a valid response"
) )
resource_count = account_list[0].memorytotal resource_count = account_list[0].memorytotal
self.assertEqual(resource_count, 0 , "Resource count for %s should be 0" % get_resource_type(resource_id=9))#RAM self.assertEqual(resource_count, 0, "Resource count for %s should be 0" % get_resource_type(resource_id=9)) # RAM
return return
@attr(tags=["advanced", "advancedns","simulator"]) @attr(tags=["advanced", "advancedns", "simulator"])
@attr(configuration='max.account.memory') @attr(configuration='max.account.memory')
def test_04_deploy_multiple_vm(self): def test_04_deploy_multiple_vm(self):
"""Test Deploy multiple VM with 2 GB memory & verify the usage""" """Test Deploy multiple VM with 2 GB memory & verify the usage"""
#keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM) # keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)
# Validate the following # Validate the following
# 1. Create compute offering with 2 GB RAM # 1. Create compute offering with 2 GB RAM
@ -687,9 +690,9 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.debug("Creating service offering with 2 GB RAM") self.debug("Creating service offering with 2 GB RAM")
self.service_offering = ServiceOffering.create( self.service_offering = ServiceOffering.create(
self.apiclient, self.apiclient,
self.services["service_offering"] self.services["service_offering"]
) )
# Adding to cleanup list after execution # Adding to cleanup list after execution
self.cleanup.append(self.service_offering) self.cleanup.append(self.service_offering)
@ -698,25 +701,25 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
users = {self.child_domain_1: self.child_do_admin_1, users = {self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
memory_account_gc = Resources.list(self.apiclient, memory_account_gc = Resources.list(self.apiclient,
resourcetype = 9, #Memory resourcetype=9, # Memory
account = self.account.name, account=self.account.name,
domainid = self.domain.id domainid=self.domain.id
) )
if memory_account_gc[0].max != 8192: if memory_account_gc[0].max != 8192:
self.skipTest("This test case requires configuration value max.account.memory to be 8192") self.skipTest("This test case requires configuration value max.account.memory to be 8192")
api_client = self.testClient.getUserApiClient( api_client = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain) DomainName=self.account.domain)
self.debug("Creating an instance with service offering: %s" % self.debug("Creating an instance with service offering: %s" %
self.service_offering.name) self.service_offering.name)
vm_1 = self.createInstance(service_off=self.service_offering, api_client=api_client) vm_1 = self.createInstance(service_off=self.service_offering, api_client=api_client)
vm_2 = self.createInstance(service_off=self.service_offering, api_client=api_client) vm_2 = self.createInstance(service_off=self.service_offering, api_client=api_client)
self.createInstance(service_off=self.service_offering, api_client=api_client) self.createInstance(service_off=self.service_offering, api_client=api_client)
@ -733,10 +736,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
) )
resource_count = account_list[0].memorytotal resource_count = account_list[0].memorytotal
expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 #Total 4 vms expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 # Total 4 vms
self.assertEqual(resource_count, expected_resource_count, self.assertEqual(resource_count, expected_resource_count,
"Initial resource count should with the expected resource count") "Initial resource count should with the expected resource count")
self.debug("Destroying instance: %s" % vm_1.name) self.debug("Destroying instance: %s" % vm_1.name)
try: try:
@ -754,7 +757,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
expected_resource_count -= int(self.services["service_offering"]["memory"]) expected_resource_count -= int(self.services["service_offering"]["memory"])
self.assertEqual(resource_count_after_delete, expected_resource_count, self.assertEqual(resource_count_after_delete, expected_resource_count,
"Resource count should match with the expected resource count") "Resource count should match with the expected resource count")
host = findSuitableHostForMigration(self.apiclient, vm_2.id) host = findSuitableHostForMigration(self.apiclient, vm_2.id)
if host is None: if host is None:
@ -775,5 +778,5 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
self.debug(resource_count_after_migrate) self.debug(resource_count_after_migrate)
self.assertEqual(resource_count_after_delete, resource_count_after_migrate, self.assertEqual(resource_count_after_delete, resource_count_after_migrate,
"Resource count should be same after migrating the instance") "Resource count should be same after migrating the instance")
return return

View File

@ -18,7 +18,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import ( from marvin.lib.base import (
Account, Account,
ServiceOffering, ServiceOffering,
@ -225,7 +226,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
users = { self.child_domain_1: self.child_do_admin_1, users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
@ -369,7 +370,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
users = { self.child_domain_1: self.child_do_admin_1, users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
self.debug("Creating an instance with service offering: %s" % 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, users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
self.debug("Creating an instance with service offering: %s" % 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, users = { self.child_domain_1: self.child_do_admin_1,
self.child_domain_2: self.child_do_admin_2 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.account = admin
self.domain = domain self.domain = domain
self.debug("Creating an instance with service offering: %s" % self.debug("Creating an instance with service offering: %s" %

View File

@ -18,7 +18,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import ( from marvin.lib.base import (
Account, Account,
ServiceOffering, ServiceOffering,

View File

@ -18,7 +18,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.base import ( from marvin.lib.base import (
Account, Account,
ServiceOffering, ServiceOffering,

View File

@ -19,7 +19,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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.sshClient import SshClient
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,
cleanup_resources, cleanup_resources,

View File

@ -1011,7 +1011,7 @@ class TestVPCPortForwarding(cloudstackTestCase):
) )
logger.debug("Created network with ID: %s" % obj_network.id) logger.debug("Created network with ID: %s" % obj_network.id)
return obj_network 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)) 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): 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) logger.debug("Created network with ID: %s" % obj_network.id)
return obj_network 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)) 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): 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 nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter from marvin.cloudstackAPI import rebootRouter
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,
get_host_credentials, get_host_credentials,
get_process_status, 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 nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter from marvin.cloudstackAPI import rebootRouter
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,
get_host_credentials, get_host_credentials,
get_process_status, 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 nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter from marvin.cloudstackAPI import rebootRouter
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,
get_host_credentials, get_host_credentials,
get_process_status, 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 nose.plugins.attrib import attr
from marvin.cloudstackAPI import rebootRouter from marvin.cloudstackAPI import rebootRouter
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,
get_host_credentials, get_host_credentials,
get_process_status, get_process_status,

View File

@ -785,7 +785,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
issystem = "true" issystem = "true"
) )
status = validateList(vr_sys_off_res) status = validateList(vr_sys_off_res)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of VR system offering failed" "Listing of VR system offering failed"
@ -815,17 +815,17 @@ class TestNOVirtualRouter(cloudstackTestCase):
id=self.network_offering.id id=self.network_offering.id
) )
status = validateList(network_off_res) status = validateList(network_off_res)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of network offerings failed" "Listing of network offerings failed"
) )
self.assertEquals( self.assertEqual(
len(network_off_res), len(network_off_res),
1, 1,
"More than one network offerings are created" "More than one network offerings are created"
) )
self.assertEquals( self.assertEqual(
network_off_res[0].serviceofferingid, network_off_res[0].serviceofferingid,
vr_sys_off.id, vr_sys_off.id,
"FAIL: Network offering has been created with default system offering" "FAIL: Network offering has been created with default system offering"

View File

@ -176,7 +176,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlans = xsplit(vlan,[',']) vlans = xsplit(vlan,[','])
for virtualLan in vlans: 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)) is not present in physical network: %s" % (virtualLan, physicalNetworkId))
return return
@ -193,7 +193,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlan1 = self.existingvlan + "," + self.vlan["partial_range"][0] vlan1 = self.existingvlan + "," + self.vlan["partial_range"][0]
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan1) 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) 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 \ 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] vlan2 = vlan1 + "," + self.vlan["partial_range"][1]
updatePhysicalNetworkResponse2 = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2) 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) 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 \ 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"] vlan2 = vlan1 + "," + self.vlan["full_range"]
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2) 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) msg="couldn't extend the physical network with vlan %s"%vlan2)
extendedvlan = self.existingvlan + "," + self.vlan["full_range"] extendedvlan = self.existingvlan + "," + self.vlan["full_range"]
@ -289,7 +289,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
vlanranges= physicalnetworks[0].vlan 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 return

File diff suppressed because it is too large Load Diff

View File

@ -394,7 +394,7 @@ class Overcommit (cloudstackTestCase):
"check list cluster response for zone id %s" % "check list cluster response for zone id %s" %
self.zone.id) self.zone.id)
k = len(list_cluster) k = len(list_cluster)
for id in xrange(k): for id in range(k):
Configurations.update(self.apiclient, Configurations.update(self.apiclient,
clusterid=list_cluster[id].id, clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor", name="mem.overprovisioning.factor",
@ -414,7 +414,7 @@ class Overcommit (cloudstackTestCase):
"check list capacity response for zone id %s" % "check list capacity response for zone id %s" %
self.zone.id) self.zone.id)
cpu, mem = capacity_parser(capacity) cpu, mem = capacity_parser(capacity)
for id in xrange(k): for id in range(k):
Configurations.update(self.apiclient, Configurations.update(self.apiclient,
clusterid=list_cluster[id].id, clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor", name="mem.overprovisioning.factor",
@ -452,7 +452,7 @@ class Overcommit (cloudstackTestCase):
self.assertEqual(mem[2], self.assertEqual(mem[2],
mem1[2], mem1[2],
"check mem capacity % used") "check mem capacity % used")
for id in xrange(k): for id in range(k):
Configurations.update(self.apiclient, Configurations.update(self.apiclient,
clusterid=list_cluster[id].id, clusterid=list_cluster[id].id,
name="mem.overprovisioning.factor", name="mem.overprovisioning.factor",

View File

@ -44,7 +44,8 @@ from marvin.lib.common import (get_domain,
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL, FAILED from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient from marvin.sshClient import SshClient
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from ddt import ddt, data from ddt import ddt, data
import time import time

View File

@ -18,7 +18,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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.cloudstackAPI import *
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
validateList) validateList)

View File

@ -18,7 +18,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (VirtualMachine,
Account, Account,
Project, Project,

View File

@ -18,7 +18,8 @@
""" """
#Import Local Modules #Import Local Modules
from nose.plugins.attrib import attr 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.cloudstackAPI import deleteVolume
from marvin.lib.utils import (cleanup_resources, validateList) from marvin.lib.utils import (cleanup_resources, validateList)
from marvin.lib.base import (Project, from marvin.lib.base import (Project,

View File

@ -21,7 +21,8 @@ Tests protocol number support for security groups
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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.cloudstackAPI import authorizeSecurityGroupIngress, revokeSecurityGroupIngress, authorizeSecurityGroupEgress, revokeSecurityGroupEgress
from marvin.sshClient import SshClient from marvin.sshClient import SshClient
from marvin.lib.utils import (validateList, from marvin.lib.utils import (validateList,

View File

@ -25,7 +25,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (Account,
ServiceOffering, ServiceOffering,
VirtualMachine, VirtualMachine,
@ -366,7 +367,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
templatesize = (self.template.size / (1024 ** 3)) templatesize = (self.template.size / (1024 ** 3))
for domain, admin in users.items(): for domain, admin in list(users.items()):
self.account = admin self.account = admin
self.domain = domain self.domain = domain
@ -454,7 +455,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
templatesize = (self.template.size / (1024 ** 3)) templatesize = (self.template.size / (1024 ** 3))
for domain, admin in users.items(): for domain, admin in list(users.items()):
self.account = admin self.account = admin
self.domain = domain self.domain = domain
@ -562,7 +563,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
result[1]) result[1])
users = result[2] users = result[2]
for domain, admin in users.items(): for domain, admin in list(users.items()):
self.account = admin self.account = admin
self.domain = domain self.domain = domain
@ -724,7 +725,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
self.assertEqual(result[0], PASS, result[1]) self.assertEqual(result[0], PASS, result[1])
users = result[2] users = result[2]
for domain, admin in users.items(): for domain, admin in list(users.items()):
self.account = admin self.account = admin
self.domain = domain self.domain = domain
try: try:

View File

@ -23,31 +23,36 @@
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
""" """
# Import Local Modules import unittest
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import cloudstackTestCase, 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 ( from marvin.lib.base import (
Account, Account,
ServiceOffering, ServiceOffering,
VirtualMachine, VirtualMachine,
Domain, Domain,
Volume, Volume,
DiskOffering) DiskOffering)
from marvin.lib.common import (get_domain, from marvin.lib.common import (
get_zone, get_domain,
get_template, get_zone,
matchResourceCount, get_template,
createSnapshotFromVirtualMachineVolume, matchResourceCount,
isVmExpunged, createSnapshotFromVirtualMachineVolume,
find_storage_pool_type) isVmExpunged,
find_storage_pool_type)
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
validateList) validateList)
from marvin.codes import (PASS, # Import Local Modules
FAIL, from nose.plugins.attrib import attr
RESOURCE_PRIMARY_STORAGE,
CHILD_DOMAIN_ADMIN,
ROOT_DOMAIN_ADMIN)
from ddt import ddt, data
@ddt @ddt
class TestVolumeLimits(cloudstackTestCase): class TestVolumeLimits(cloudstackTestCase):
@ -55,7 +60,7 @@ class TestVolumeLimits(cloudstackTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cloudstackTestClient = super(TestVolumeLimits, cloudstackTestClient = super(TestVolumeLimits,
cls).getClsTestClient() cls).getClsTestClient()
cls.api_client = cloudstackTestClient.getApiClient() cls.api_client = cloudstackTestClient.getApiClient()
cls.hypervisor = cloudstackTestClient.getHypervisorInfo() cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
# Fill services from the external config file # Fill services from the external config file
@ -72,10 +77,10 @@ class TestVolumeLimits(cloudstackTestCase):
return return
cls.template = get_template( cls.template = get_template(
cls.api_client, cls.api_client,
cls.zone.id, cls.zone.id,
cls.services["ostype"] cls.services["ostype"]
) )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id cls.services["virtual_machine"]["template"] = cls.template.id
@ -108,8 +113,8 @@ class TestVolumeLimits(cloudstackTestCase):
try: try:
self.services["disk_offering"]["disksize"] = 2 self.services["disk_offering"]["disksize"] = 2
self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"]) self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"])
self.assertNotEqual(self.disk_offering, None,\ self.assertNotEqual(self.disk_offering, None, \
"Disk offering is None") "Disk offering is None")
self.cleanup.append(self.disk_offering) self.cleanup.append(self.disk_offering)
except Exception as e: except Exception as e:
self.tearDown() self.tearDown()
@ -131,19 +136,19 @@ class TestVolumeLimits(cloudstackTestCase):
try: try:
if accountType == CHILD_DOMAIN_ADMIN: if accountType == CHILD_DOMAIN_ADMIN:
self.domain = Domain.create(self.apiclient, self.domain = Domain.create(self.apiclient,
services=self.services["domain"], services=self.services["domain"],
parentdomainid=self.domain.id) parentdomainid=self.domain.id)
self.account = Account.create(self.apiclient, self.services["account"], self.account = Account.create(self.apiclient, self.services["account"],
domainid=self.domain.id, admin=True) domainid=self.domain.id, admin=True)
self.cleanup.append(self.account) self.cleanup.append(self.account)
if accountType == CHILD_DOMAIN_ADMIN: if accountType == CHILD_DOMAIN_ADMIN:
self.cleanup.append(self.domain) self.cleanup.append(self.domain)
self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"], self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
accountid=self.account.name, domainid=self.account.domainid, accountid=self.account.name, domainid=self.account.domainid,
diskofferingid=self.disk_offering.id, diskofferingid=self.disk_offering.id,
serviceofferingid=self.service_offering.id) serviceofferingid=self.service_offering.id)
accounts = Account.list(self.apiclient, id=self.account.id) accounts = Account.list(self.apiclient, id=self.account.id)
@ -156,7 +161,7 @@ class TestVolumeLimits(cloudstackTestCase):
return [PASS, None] return [PASS, None]
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic"], required_hardware="false") @attr(tags=["advanced", "basic"], required_hardware="false")
def test_stop_start_vm(self, value): def test_stop_start_vm(self, value):
"""Test Deploy VM with 5 GB volume & verify the usage """Test Deploy VM with 5 GB volume & verify the usage
@ -175,9 +180,9 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Failed to stop instance: %s" % e) self.fail("Failed to stop instance: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
# Starting instance # Starting instance
@ -187,15 +192,15 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failed to start instance: %s" % e) self.fail("Failed to start instance: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return
@unittest.skip("skip") @unittest.skip("skip")
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic"], required_hardware="false") @attr(tags=["advanced", "basic"], required_hardware="false")
def test_destroy_recover_vm(self, value): def test_destroy_recover_vm(self, value):
"""Test delete and recover instance """Test delete and recover instance
@ -214,9 +219,9 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Failed to destroy instance: %s" % e) self.fail("Failed to destroy instance: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
# Recovering instance # Recovering instance
@ -226,14 +231,14 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failed to start instance: %s" % e) self.fail("Failed to start instance: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic"], required_hardware="false") @attr(tags=["advanced", "basic"], required_hardware="false")
def test_attach_detach_volume(self, value): def test_attach_detach_volume(self, value):
"""Stop attach and detach volume from VM """Stop attach and detach volume from VM
@ -251,9 +256,9 @@ class TestVolumeLimits(cloudstackTestCase):
apiclient = self.apiclient apiclient = self.apiclient
if value == CHILD_DOMAIN_ADMIN: if value == CHILD_DOMAIN_ADMIN:
apiclient = self.testClient.getUserApiClient( apiclient = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain DomainName=self.account.domain
) )
self.assertNotEqual(apiclient, FAIL, "Failure while getting\ self.assertNotEqual(apiclient, FAIL, "Failure while getting\
api client of account: %s" % self.account.name) api client of account: %s" % self.account.name)
@ -261,32 +266,32 @@ class TestVolumeLimits(cloudstackTestCase):
self.services["disk_offering"]["disksize"] = 4 self.services["disk_offering"]["disksize"] = 4
expectedCount = self.initialResourceCount + int(self.services["disk_offering"]["disksize"]) expectedCount = self.initialResourceCount + int(self.services["disk_offering"]["disksize"])
disk_offering = DiskOffering.create(self.apiclient, disk_offering = DiskOffering.create(self.apiclient,
services=self.services["disk_offering"]) services=self.services["disk_offering"])
self.cleanup.append(disk_offering) self.cleanup.append(disk_offering)
volume = Volume.create( volume = Volume.create(
apiclient,self.services["volume"],zoneid=self.zone.id, apiclient, self.services["volume"], zoneid=self.zone.id,
account=self.account.name,domainid=self.account.domainid, account=self.account.name, domainid=self.account.domainid,
diskofferingid=disk_offering.id) diskofferingid=disk_offering.id)
except Exception as e: except Exception as e:
self.fail("Failure: %s" % e) self.fail("Failure: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
self.virtualMachine.attach_volume(apiclient, volume=volume) self.virtualMachine.attach_volume(apiclient, volume=volume)
except Exception as e: except Exception as e:
self.fail("Failed while attaching volume to VM: %s" % e) self.fail("Failed while attaching volume to VM: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
@ -295,14 +300,14 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failure while detaching volume: %s" % e) self.fail("Failure while detaching volume: %s" % e)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic"], required_hardware="false") @attr(tags=["advanced", "basic"], required_hardware="false")
def test_create_multiple_volumes(self, value): def test_create_multiple_volumes(self, value):
"""Test create multiple volumes """Test create multiple volumes
@ -323,33 +328,33 @@ class TestVolumeLimits(cloudstackTestCase):
apiclient = self.apiclient apiclient = self.apiclient
if value == CHILD_DOMAIN_ADMIN: if value == CHILD_DOMAIN_ADMIN:
apiclient = self.testClient.getUserApiClient( apiclient = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain DomainName=self.account.domain
) )
self.assertNotEqual(apiclient, FAIL, "Failure while getting\ self.assertNotEqual(apiclient, FAIL, "Failure while getting\
api client of account %s" % self.account.name) api client of account %s" % self.account.name)
try: try:
self.services["disk_offering"]["disksize"] = 5 self.services["disk_offering"]["disksize"] = 5
disk_offering_5_GB = DiskOffering.create(self.apiclient, disk_offering_5_GB = DiskOffering.create(self.apiclient,
services=self.services["disk_offering"]) services=self.services["disk_offering"])
self.cleanup.append(disk_offering_5_GB) self.cleanup.append(disk_offering_5_GB)
self.services["disk_offering"]["disksize"] = 10 self.services["disk_offering"]["disksize"] = 10
disk_offering_10_GB = DiskOffering.create(self.apiclient, disk_offering_10_GB = DiskOffering.create(self.apiclient,
services=self.services["disk_offering"]) services=self.services["disk_offering"])
self.cleanup.append(disk_offering_10_GB) self.cleanup.append(disk_offering_10_GB)
volume_1 = Volume.create( volume_1 = Volume.create(
apiclient,self.services["volume"],zoneid=self.zone.id, apiclient, self.services["volume"], zoneid=self.zone.id,
account=self.account.name,domainid=self.account.domainid, account=self.account.name, domainid=self.account.domainid,
diskofferingid=disk_offering_5_GB.id) diskofferingid=disk_offering_5_GB.id)
volume_2 = Volume.create( volume_2 = Volume.create(
apiclient,self.services["volume"],zoneid=self.zone.id, apiclient, self.services["volume"], zoneid=self.zone.id,
account=self.account.name,domainid=self.account.domainid, account=self.account.name, domainid=self.account.domainid,
diskofferingid=disk_offering_10_GB.id) diskofferingid=disk_offering_10_GB.id)
self.debug("Attaching volume %s to vm %s" % (volume_1.name, self.virtualMachine.name)) self.debug("Attaching volume %s to vm %s" % (volume_1.name, self.virtualMachine.name))
self.virtualMachine.attach_volume(apiclient, volume=volume_1) self.virtualMachine.attach_volume(apiclient, volume=volume_1)
@ -359,11 +364,11 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Failure: %s" % e) self.fail("Failure: %s" % e)
expectedCount = self.initialResourceCount + 15 # (5 + 10) expectedCount = self.initialResourceCount + 15 # (5 + 10)
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
@ -373,11 +378,11 @@ class TestVolumeLimits(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Failure while volume operation: %s" % e) self.fail("Failure while volume operation: %s" % e)
expectedCount -= 5 #After deleting first volume expectedCount -= 5 # After deleting first volume
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
@ -389,14 +394,14 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount -= 10 expectedCount -= 10
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic"], required_hardware="false") @attr(tags=["advanced", "basic"], required_hardware="false")
def test_deploy_multiple_vm(self, value): def test_deploy_multiple_vm(self, value):
"""Test Deploy multiple VMs with & verify the usage """Test Deploy multiple VMs with & verify the usage
# Validate the following # Validate the following
@ -411,32 +416,32 @@ class TestVolumeLimits(cloudstackTestCase):
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
self.virtualMachine_2 = VirtualMachine.create(self.api_client, self.services["virtual_machine"], self.virtualMachine_2 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
accountid=self.account.name, domainid=self.account.domainid, accountid=self.account.name, domainid=self.account.domainid,
diskofferingid=self.disk_offering.id, diskofferingid=self.disk_offering.id,
serviceofferingid=self.service_offering.id) serviceofferingid=self.service_offering.id)
expectedCount = (self.initialResourceCount * 2) #Total 2 vms expectedCount = (self.initialResourceCount * 2) # Total 2 vms
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
self.virtualMachine_3 = VirtualMachine.create(self.api_client, self.services["virtual_machine"], self.virtualMachine_3 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
accountid=self.account.name, domainid=self.account.domainid, accountid=self.account.name, domainid=self.account.domainid,
diskofferingid=self.disk_offering.id, diskofferingid=self.disk_offering.id,
serviceofferingid=self.service_offering.id) serviceofferingid=self.service_offering.id)
expectedCount = (self.initialResourceCount * 3) #Total 3 vms expectedCount = (self.initialResourceCount * 3) # Total 3 vms
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
self.debug("Destroying instance: %s" % self.virtualMachine_2.name) self.debug("Destroying instance: %s" % self.virtualMachine_2.name)
try: try:
self.virtualMachine_2.delete(self.apiclient) self.virtualMachine_2.delete(self.apiclient)
except Exception as e: except Exception as e:
self.fail("Failed to delete instance: %s" % e) self.fail("Failed to delete instance: %s" % e)
@ -445,14 +450,14 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount -= (self.template.size / (1024 ** 3)) expectedCount -= (self.template.size / (1024 ** 3))
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic","selfservice"]) @attr(tags=["advanced", "basic", "selfservice"])
def test_assign_vm_different_account(self, value): def test_assign_vm_different_account(self, value):
"""Test assign Vm to different account """Test assign Vm to different account
# Validate the following # Validate the following
@ -468,44 +473,44 @@ class TestVolumeLimits(cloudstackTestCase):
try: try:
account_2 = Account.create(self.apiclient, self.services["account"], account_2 = Account.create(self.apiclient, self.services["account"],
domainid=self.domain.id, admin=True) domainid=self.domain.id, admin=True)
self.cleanup.insert(0, account_2) self.cleanup.insert(0, account_2)
except Exception as e: except Exception as e:
self.fail("Failed to create account: %s" % e) self.fail("Failed to create account: %s" % e)
expectedCount = self.initialResourceCount expectedCount = self.initialResourceCount
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
self.virtualMachine.stop(self.apiclient) self.virtualMachine.stop(self.apiclient)
self.virtualMachine.assign_virtual_machine(self.apiclient, self.virtualMachine.assign_virtual_machine(self.apiclient,
account_2.name ,account_2.domainid) account_2.name, account_2.domainid)
except Exception as e: except Exception as e:
self.fail("Failed to assign virtual machine to account %s: %s" % self.fail("Failed to assign virtual machine to account %s: %s" %
(account_2.name,e)) (account_2.name, e))
# Checking resource count for account 2 # Checking resource count for account 2
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=account_2.id) accountid=account_2.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
expectedCount = 0 expectedCount = 0
# Checking resource count for original account # Checking resource count for original account
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
@attr(tags=["advanced","basic"], required_hardware="true") @attr(tags=["advanced", "basic"], required_hardware="true")
def test_create_template_snapshot(self, value): def test_create_template_snapshot(self, value):
"""Test create snapshot and templates from volume """Test create snapshot and templates from volume
@ -526,9 +531,9 @@ class TestVolumeLimits(cloudstackTestCase):
apiclient = self.apiclient apiclient = self.apiclient
if value == CHILD_DOMAIN_ADMIN: if value == CHILD_DOMAIN_ADMIN:
apiclient = self.testClient.getUserApiClient( apiclient = self.testClient.getUserApiClient(
UserName=self.account.name, UserName=self.account.name,
DomainName=self.account.domain DomainName=self.account.domain
) )
self.assertNotEqual(apiclient, FAIL, "Failure while getting api\ self.assertNotEqual(apiclient, FAIL, "Failure while getting api\
client of account: %s" % self.account.name) client of account: %s" % self.account.name)
@ -538,9 +543,9 @@ class TestVolumeLimits(cloudstackTestCase):
self.fail("Failed to stop instance: %s" % e) self.fail("Failed to stop instance: %s" % e)
expectedCount = self.initialResourceCount expectedCount = self.initialResourceCount
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
self.debug("Creating snapshot from ROOT volume: %s" % self.virtualMachine.name) self.debug("Creating snapshot from ROOT volume: %s" % self.virtualMachine.name)
@ -549,18 +554,18 @@ class TestVolumeLimits(cloudstackTestCase):
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
snapshot = response[1] snapshot = response[1]
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
self.services["volume"]["size"] = self.services["disk_offering"]["disksize"] self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
volume = Volume.create_from_snapshot(apiclient, volume = Volume.create_from_snapshot(apiclient,
snapshot_id=snapshot.id, snapshot_id=snapshot.id,
services=self.services["volume"], services=self.services["volume"],
account=self.account.name, account=self.account.name,
domainid=self.account.domainid) domainid=self.account.domainid)
self.debug("Attaching the volume to vm: %s" % self.virtualMachine.name) self.debug("Attaching the volume to vm: %s" % self.virtualMachine.name)
self.virtualMachine.attach_volume(apiclient, volume) self.virtualMachine.attach_volume(apiclient, volume)
@ -569,9 +574,9 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount += int(self.services["volume"]["size"]) expectedCount += int(self.services["volume"]["size"])
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
try: try:
@ -587,8 +592,8 @@ class TestVolumeLimits(cloudstackTestCase):
expectedCount -= int(self.services["volume"]["size"]) expectedCount -= int(self.services["volume"]["size"])
response = matchResourceCount( response = matchResourceCount(
self.apiclient, expectedCount, self.apiclient, expectedCount,
RESOURCE_PRIMARY_STORAGE, RESOURCE_PRIMARY_STORAGE,
accountid=self.account.id) accountid=self.account.id)
self.assertEqual(response[0], PASS, response[1]) self.assertEqual(response[0], PASS, response[1])
return return

View File

@ -25,7 +25,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (Account,
ServiceOffering, ServiceOffering,
VirtualMachine, VirtualMachine,

View File

@ -25,7 +25,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (Account,
ServiceOffering, ServiceOffering,
VirtualMachine, VirtualMachine,

View File

@ -28,7 +28,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (Account,
ServiceOffering, ServiceOffering,
VirtualMachine, VirtualMachine,

View File

@ -32,7 +32,8 @@ from marvin.lib.common import (get_domain,
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
random_gen, random_gen,
validateList) validateList)
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.codes import PASS, RUNNING from marvin.codes import PASS, RUNNING
#Import System modules #Import System modules

View File

@ -24,7 +24,8 @@
""" """
# Import Local Modules # Import Local Modules
from nose.plugins.attrib import attr 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, from marvin.lib.base import (Account,
ServiceOffering, ServiceOffering,
VirtualMachine, VirtualMachine,
@ -641,7 +642,7 @@ class TestResizeVolume(cloudstackTestCase):
list(self.apiclient, list(self.apiclient,
vmsnapshotid=virtualmachine_snapshot.id) vmsnapshotid=virtualmachine_snapshot.id)
status = validateList(virtulmachine_snapshot_list) status = validateList(virtulmachine_snapshot_list)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"Listing of configuration failed") "Listing of configuration failed")
@ -1030,7 +1031,7 @@ class TestResizeVolume(cloudstackTestCase):
self.assertNotEqual(res[2], INVALID_INPUT, "Check DB Query result set") self.assertNotEqual(res[2], INVALID_INPUT, "Check DB Query result set")
qresult = int(qresultsize[0][0]) qresult = int(qresultsize[0][0])
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
self.assertEquals( self.assertEqual(
qresult, qresult,
(newsize * 1024 * 1024 * 1024), (newsize * 1024 * 1024 * 1024),
"Usage event not logged properly with right volume" "Usage event not logged properly with right volume"

View File

@ -14,7 +14,6 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
from __builtin__ import False
""" Tests for Secondary Storage with Local Storage """ Tests for Secondary Storage with Local Storage
""" """
@ -93,7 +92,7 @@ class TestSecSRMount(cloudstackTestCase):
"Check if listStoragePools returns a valid response" "Check if listStoragePools returns a valid response"
) )
for storage_pool in storage_pools: for storage_pool in storage_pools:
if storage_pool.type == u'NetworkFilesystem': if storage_pool.type == 'NetworkFilesystem':
return False return False
return True return True

View File

@ -18,7 +18,8 @@
""" P1 tests for shared networks """ P1 tests for shared networks
""" """
from nose.plugins.attrib import attr 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.cloudstackAPI import rebootRouter, stopRouter, startRouter
from marvin.lib.base import (Account, from marvin.lib.base import (Account,
Network, Network,
@ -796,10 +797,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list( ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["shared_network"]["startip"]), unicode( self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"]))) 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( self.fail(
"Virtual machine ip should be from the ip range assigned to\ "Virtual machine ip should be from the ip range assigned to\
network created.") network created.")
@ -834,10 +835,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list( ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["shared_network"]["startip"]), unicode( self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"]))) 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( self.fail(
"Virtual machine ip should be from the ip range assigned to\ "Virtual machine ip should be from the ip range assigned to\
network created.") network created.")
@ -1107,10 +1108,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list( ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["shared_network"]["startip"]), unicode( self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"]))) 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( self.fail(
"Virtual machine ip should be from the ip range assigned\ "Virtual machine ip should be from the ip range assigned\
to network created.") to network created.")
@ -1449,10 +1450,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list( ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["shared_network"]["startip"]), unicode( self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"]))) 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( self.fail(
"Virtual machine ip should be from the ip range\ "Virtual machine ip should be from the ip range\
assigned to network created.") assigned to network created.")
@ -1484,10 +1485,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list( ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["shared_network"]["startip"]), unicode( self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"]))) 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( self.fail(
"Virtual machine ip should be from the ip range assigne\ "Virtual machine ip should be from the ip range assigne\
to network created.") to network created.")
@ -1777,10 +1778,10 @@ class TestSharedNetworks(cloudstackTestCase):
ip_range = list( ip_range = list(
netaddr.iter_iprange( netaddr.iter_iprange(
unicode( str(
self.testdata["shared_network"]["startip"]), unicode( self.testdata["shared_network"]["startip"]), str(
self.testdata["shared_network"]["endip"]))) 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( self.fail(
"Virtual machine ip should be from the ip range assigned\ "Virtual machine ip should be from the ip range assigned\
to network created.") to network created.")
@ -3144,7 +3145,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.shared_network_offering.id id=self.shared_network_offering.id
) )
status = validateList(list_network_offerings_response) status = validateList(list_network_offerings_response)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"listNetworkOfferings returned invalid object in response." "listNetworkOfferings returned invalid object in response."
@ -3170,7 +3171,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.shared_network_offering.id id=self.shared_network_offering.id
) )
status = validateList(list_network_offerings_response) status = validateList(list_network_offerings_response)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"listNetworkOfferings returned invalid object in\ "listNetworkOfferings returned invalid object in\
@ -3200,7 +3201,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.network.id id=self.network.id
) )
status = validateList(list_accounts_response) status = validateList(list_accounts_response)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"listNetworks returned invalid object in response." "listNetworks returned invalid object in response."
@ -3246,7 +3247,7 @@ class TestSharedNetworks(cloudstackTestCase):
id=self.network2.id id=self.network2.id
) )
status = validateList(list_networks_response) status = validateList(list_networks_response)
self.assertEquals( self.assertEqual(
PASS, PASS,
status[0], status[0],
"listNetworks returned invalid object in response after\ "listNetworks returned invalid object in response after\

View File

@ -17,7 +17,8 @@
#Import Local Modules #Import Local Modules
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackTestCase import cloudstackTestCase
import unittest
from marvin.lib.utils import (cleanup_resources, from marvin.lib.utils import (cleanup_resources,
validateList) validateList)
from marvin.lib.base import (ServiceOffering, from marvin.lib.base import (ServiceOffering,

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