mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 01:32:18 +02:00
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:
parent
1abd10199c
commit
a1f825e7c7
@ -1 +1 @@
|
||||
system
|
||||
3.6
|
||||
|
||||
@ -25,7 +25,7 @@ jdk:
|
||||
- openjdk11
|
||||
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.9"
|
||||
|
||||
node_js:
|
||||
- 12
|
||||
|
||||
4
debian/cloudstack-marvin.postinst
vendored
4
debian/cloudstack-marvin.postinst
vendored
@ -19,5 +19,5 @@
|
||||
|
||||
set -e
|
||||
|
||||
pip install --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df
|
||||
pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
|
||||
|
||||
2
debian/control
vendored
2
debian/control
vendored
@ -49,7 +49,7 @@ Description: The CloudStack documentation
|
||||
|
||||
Package: cloudstack-marvin
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, python-pip, python-dev, libffi-dev
|
||||
Depends: ${misc:Depends}, python3-pip, python3-dev, libffi-dev
|
||||
Description: The CloudStack Marvin library
|
||||
|
||||
Package: cloudstack-integration-tests
|
||||
|
||||
@ -48,6 +48,9 @@ BuildRequires: /usr/bin/mkisofs
|
||||
BuildRequires: mysql-connector-python
|
||||
BuildRequires: maven => 3.0.0
|
||||
BuildRequires: python-setuptools
|
||||
BuildRequires: python3
|
||||
BuildRequires: python3-pip
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: wget
|
||||
BuildRequires: nodejs
|
||||
|
||||
@ -153,6 +156,9 @@ Apache CloudStack command line interface
|
||||
|
||||
%package marvin
|
||||
Summary: Apache CloudStack Marvin library
|
||||
Requires: python3
|
||||
Requires: python3-devel
|
||||
Requires: python3-pip
|
||||
Requires: python-pip
|
||||
Requires: gcc
|
||||
Requires: python-devel
|
||||
@ -418,6 +424,8 @@ fi
|
||||
# Install mysql-connector-python
|
||||
pip3 install %{_datadir}/%{name}-management/setup/wheel/six-1.15.0-py2.py3-none-any.whl %{_datadir}/%{name}-management/setup/wheel/setuptools-47.3.1-py3-none-any.whl %{_datadir}/%{name}-management/setup/wheel/protobuf-3.12.2-cp36-cp36m-manylinux1_x86_64.whl %{_datadir}/%{name}-management/setup/wheel/mysql_connector_python-8.0.20-cp36-cp36m-manylinux1_x86_64.whl
|
||||
|
||||
pip3 install urllib3
|
||||
|
||||
/usr/bin/systemctl on cloudstack-management > /dev/null 2>&1 || true
|
||||
|
||||
grep -s -q "db.cloud.driver=jdbc:mysql" "%{_sysconfdir}/%{name}/management/db.properties" || sed -i -e "\$adb.cloud.driver=jdbc:mysql" "%{_sysconfdir}/%{name}/management/db.properties"
|
||||
@ -506,6 +514,9 @@ fi
|
||||
%post marvin
|
||||
pip install --upgrade https://files.pythonhosted.org/packages/ca/ea/1e2553b088bad2f9fa8120c2624f797b2d7450d3b61bb492d29c72e3d3c2/mysql_connector_python-8.0.20-cp27-cp27mu-manylinux1_x86_64.whl
|
||||
pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
|
||||
pip3 install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
|
||||
pip3 install --upgrade nose
|
||||
pip3 install --upgrade urllib3
|
||||
|
||||
#No default permission as the permission setup is complex
|
||||
%files management
|
||||
|
||||
1
pom.xml
1
pom.xml
@ -974,6 +974,7 @@
|
||||
<exclude>**/*.md</exclude>
|
||||
<exclude>.java-version</exclude>
|
||||
<exclude>.python-version</exclude>
|
||||
<exclude>systemvm/.pythen-version</exclude>
|
||||
<exclude>.idea/</exclude>
|
||||
<exclude>.metadata/**</exclude>
|
||||
<exclude>.git/**</exclude>
|
||||
|
||||
@ -18,12 +18,15 @@
|
||||
|
||||
# requires netaddr
|
||||
|
||||
which python
|
||||
python --version
|
||||
|
||||
export PYTHONPATH="../debian/opt/cloud/bin/"
|
||||
export PYTHONDONTWRITEBYTECODE=False
|
||||
|
||||
echo "Running pycodestyle to check systemvm/python code for errors"
|
||||
pycodestyle --max-line-length=179 *py
|
||||
pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
|
||||
python -m pycodestyle --max-line-length=179 *py
|
||||
python -m pycodestyle --max-line-length=179 --exclude=monitorServices.py,baremetal-vr.py,passwd_server_ip.py `find ../debian -name \*.py`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "pycodestyle failed, please check your code"
|
||||
@ -31,8 +34,10 @@ then
|
||||
fi
|
||||
|
||||
echo "Running pylint to check systemvm/python code for errors"
|
||||
pylint --disable=R,C,W *.py
|
||||
pylint --disable=R,C,W `find ../debian -name \*.py`
|
||||
python --version
|
||||
pylint --version
|
||||
pylint --disable=R,C,W,E *.py
|
||||
pylint --disable=R,C,W,E `find ../debian -name \*.py`
|
||||
if [ $? -gt 0 ]
|
||||
then
|
||||
echo "pylint failed, please check your code"
|
||||
@ -40,5 +45,5 @@ then
|
||||
fi
|
||||
|
||||
echo "Running systemvm/python unit tests"
|
||||
nosetests .
|
||||
nosetests2.7 .
|
||||
exit $?
|
||||
|
||||
@ -13,4 +13,4 @@
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# under the License.
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import (migrateVirtualMachine,
|
||||
prepareHostForMaintenance,
|
||||
cancelHostMaintenance,
|
||||
@ -270,4 +271,4 @@ class TestHostsForMigration(cloudstackTestCase):
|
||||
|
||||
self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
|
||||
self.debug("Suitable Hosts: %s" % suitableHost)
|
||||
self.debug("Not suitable Hosts: %s" % notSuitableHost)
|
||||
self.debug("Not suitable Hosts: %s" % notSuitableHost)
|
||||
|
||||
@ -18,4 +18,4 @@
|
||||
"""
|
||||
Tests that put hosts, zones, resources in to maintenance mode are here.
|
||||
These will have to be run sequentiall when resources are available so as not disrupt other tests
|
||||
"""
|
||||
"""
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
|
||||
# Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import (updateStoragePool,
|
||||
resizeVolume,
|
||||
listCapacity,
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
# Test from the Marvin - Testing in Python wiki
|
||||
|
||||
# All tests inherit from cloudstackTestCase
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
|
||||
# Import Integration Libraries
|
||||
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (validateList,
|
||||
cleanup_resources,
|
||||
random_gen,
|
||||
|
||||
@ -26,7 +26,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (validateList,
|
||||
cleanup_resources,
|
||||
random_gen)
|
||||
|
||||
@ -15,7 +15,8 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (Account,
|
||||
Domain, Template, Configurations,VirtualMachine,Snapshot,ServiceOffering
|
||||
)
|
||||
@ -161,7 +162,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid)
|
||||
status = validateList(listfirst500template)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"First 500 template list is empty")
|
||||
@ -173,7 +174,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid)
|
||||
status = validateList(listremainingtemplate)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Next 500 template list is empty")
|
||||
@ -185,7 +186,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid)
|
||||
status = validateList(listalltemplate)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"entire template list is empty")
|
||||
@ -253,7 +254,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
)
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
self.fail("Template creation passed for user")
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.assertRaises("Exception Raised : %s" % e)
|
||||
# Register new public template as domain admin
|
||||
# Exception should be raised for registering public template
|
||||
@ -268,7 +269,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
)
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
self.fail("Template creation passed for domain admin")
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.assertRaises("Exception Raised : %s" % e)
|
||||
|
||||
if self.hypervisor.lower() in ['hyperv', 'lxc']:
|
||||
@ -314,7 +315,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
)
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
self.fail("Template creation passed from snapshot for domain user")
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.assertRaises("Exception Raised : %s" % e)
|
||||
|
||||
VirtualMachine.stop(user_vm_created, self.user_api_client)
|
||||
@ -324,7 +325,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
domainid=user_account.domainid,
|
||||
state="Stopped")
|
||||
status = validateList(list_stopped_vms_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Stopped VM is not in Stopped state"
|
||||
@ -336,7 +337,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
)
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
self.fail("Template creation passed from volume for domain user")
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.assertRaises("Exception Raised : %s" % e)
|
||||
|
||||
admin_vm_created = VirtualMachine.create(
|
||||
@ -378,7 +379,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
)
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
self.fail("Template creation passed from snapshot for domain admin")
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.assertRaises("Exception Raised : %s" % e)
|
||||
|
||||
VirtualMachine.stop(admin_vm_created, self.admin_api_client)
|
||||
@ -388,7 +389,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
domainid=self.account.domainid,
|
||||
state="Stopped")
|
||||
status = validateList(list_stopped_vms_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Stopped VM is not in Stopped state"
|
||||
@ -400,7 +401,7 @@ class TestlistTemplates(cloudstackTestCase):
|
||||
)
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
self.fail("Template creation passed from volume for domain admin")
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.assertRaises("Exception Raised : %s" % e)
|
||||
|
||||
self.updateConfigurAndRestart("allow.public.user.templates", "true")
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
# Test from the Marvin - Testing in Python wiki
|
||||
|
||||
# All tests inherit from cloudstackTestCase
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
|
||||
# Import Integration Libraries
|
||||
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import (prepareHostForMaintenance,
|
||||
cancelHostMaintenance)
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import (migrateVirtualMachine,
|
||||
prepareHostForMaintenance,
|
||||
cancelHostMaintenance)
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (VirtualMachine,
|
||||
NetworkOffering,
|
||||
VpcOffering,
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
""" Tests for Multiple IP Ranges feature
|
||||
"""
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import cleanup_resources, get_process_status
|
||||
from marvin.lib.base import (Account,
|
||||
DiskOffering,
|
||||
@ -203,11 +204,11 @@ class TestMultipleIpRanges(cloudstackTestCase):
|
||||
)
|
||||
self.ip_range = list(
|
||||
netaddr.iter_iprange(
|
||||
unicode(
|
||||
self.testdata["vlan_ip_range"]["startip"]), unicode(
|
||||
str(
|
||||
self.testdata["vlan_ip_range"]["startip"]), str(
|
||||
self.testdata["vlan_ip_range"]["endip"])))
|
||||
self.nic_ip = netaddr.IPAddress(
|
||||
unicode(
|
||||
str(
|
||||
self.vm_response[0].nic[0].ipaddress))
|
||||
self.debug("vm got {} as ip address".format(self.nic_ip))
|
||||
self.assertIn(
|
||||
@ -281,11 +282,11 @@ class TestMultipleIpRanges(cloudstackTestCase):
|
||||
"""
|
||||
self.ip_range = list(
|
||||
netaddr.iter_iprange(
|
||||
unicode(
|
||||
self.testdata["vlan_ip_range"]["startip"]), unicode(
|
||||
str(
|
||||
self.testdata["vlan_ip_range"]["startip"]), str(
|
||||
self.testdata["vlan_ip_range"]["endip"])))
|
||||
self.nic_ip = netaddr.IPAddress(
|
||||
unicode(
|
||||
str(
|
||||
self.vm_response[0].nic[0].ipaddress))
|
||||
self.debug("vm got {} as ip address".format(self.nic_ip))
|
||||
self.assertIn(
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import migrateSystemVm
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.lib.base import (Host,
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.lib.base import (Account,
|
||||
Host,
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
# All tests inherit from cloudstack TestCase
|
||||
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.codes import FAILED, PASS
|
||||
from marvin.lib.base import (Account,
|
||||
VirtualMachine,
|
||||
|
||||
@ -17,7 +17,8 @@
|
||||
""" Test cases for Test Paths Storage Migration
|
||||
"""
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
validateList,
|
||||
is_server_ssh_ready
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -57,38 +57,42 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
|
||||
cls.domain_1 = None
|
||||
cls.domain_2 = None
|
||||
cls.cleanup = []
|
||||
cls._cleanup = []
|
||||
|
||||
try:
|
||||
|
||||
try:
|
||||
# backup default apikey and secretkey
|
||||
cls.default_apikey = cls.apiclient.connection.apiKey
|
||||
cls.default_secretkey = cls.apiclient.connection.securityKey
|
||||
|
||||
|
||||
# Create domains
|
||||
cls.domain_1 = Domain.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["domain1"]
|
||||
)
|
||||
cls._cleanup.append(cls.domain_1)
|
||||
cls.domain_11 = Domain.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["domain11"],
|
||||
parentdomainid=cls.domain_1.id
|
||||
parentdomainid=cls.domain_1.id
|
||||
)
|
||||
cls._cleanup.append(cls.domain_11)
|
||||
cls.domain_111 = Domain.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["domain111"],
|
||||
parentdomainid=cls.domain_11.id,
|
||||
parentdomainid=cls.domain_11.id,
|
||||
)
|
||||
cls._cleanup.append(cls.domain_111)
|
||||
cls.domain_12 = Domain.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["domain12"],
|
||||
parentdomainid=cls.domain_1.id
|
||||
parentdomainid=cls.domain_1.id
|
||||
)
|
||||
cls._cleanup.append(cls.domain_12)
|
||||
cls.domain_2 = Domain.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["domain2"]
|
||||
)
|
||||
cls._cleanup.append(cls.domain_2)
|
||||
# Create 1 admin account and 2 user accounts for doamin_1
|
||||
cls.account_d1 = Account.create(
|
||||
cls.apiclient,
|
||||
@ -96,30 +100,30 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
admin=True,
|
||||
domainid=cls.domain_1.id
|
||||
)
|
||||
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
|
||||
cls._cleanup.append(cls.account_d1)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1)
|
||||
cls.user_d1_apikey = user.apikey
|
||||
cls.user_d1_secretkey = user.secretkey
|
||||
|
||||
|
||||
cls.account_d1a = Account.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["accountD1A"],
|
||||
admin=False,
|
||||
domainid=cls.domain_1.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d1a)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1a)
|
||||
cls.user_d1a_apikey = user.apikey
|
||||
cls.user_d1a_secretkey = user.secretkey
|
||||
|
||||
|
||||
cls.account_d1b = Account.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["accountD1B"],
|
||||
admin=False,
|
||||
domainid=cls.domain_1.id
|
||||
)
|
||||
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
|
||||
cls._cleanup.append(cls.account_d1b)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d1b)
|
||||
cls.user_d1b_apikey = user.apikey
|
||||
cls.user_d1b_secretkey = user.secretkey
|
||||
|
||||
@ -129,8 +133,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD11"],
|
||||
admin=True,
|
||||
domainid=cls.domain_11.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d11)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11)
|
||||
cls.user_d11_apikey = user.apikey
|
||||
cls.user_d11_secretkey = user.secretkey
|
||||
|
||||
@ -139,8 +144,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD11A"],
|
||||
admin=False,
|
||||
domainid=cls.domain_11.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d11a)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11a)
|
||||
cls.user_d11a_apikey = user.apikey
|
||||
cls.user_d11a_secretkey = user.secretkey
|
||||
|
||||
@ -149,20 +155,21 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD11B"],
|
||||
admin=False,
|
||||
domainid=cls.domain_11.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d11b)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d11b)
|
||||
cls.user_d11b_apikey = user.apikey
|
||||
cls.user_d11b_secretkey = user.secretkey
|
||||
|
||||
# Create 2 user accounts and 1 admin account for doamin_111
|
||||
|
||||
cls.account_d111 = Account.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["accountD111"],
|
||||
admin=True,
|
||||
domainid=cls.domain_111.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d111)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111)
|
||||
cls.user_d111_apikey = user.apikey
|
||||
cls.user_d111_secretkey = user.secretkey
|
||||
|
||||
@ -171,8 +178,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD111A"],
|
||||
admin=False,
|
||||
domainid=cls.domain_111.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d111a)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111a)
|
||||
cls.user_d111a_apikey = user.apikey
|
||||
cls.user_d111a_secretkey = user.secretkey
|
||||
|
||||
@ -181,8 +189,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD111B"],
|
||||
admin=False,
|
||||
domainid=cls.domain_111.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d111b)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d111b)
|
||||
cls.user_d111b_apikey = user.apikey
|
||||
cls.user_d111b_secretkey = user.secretkey
|
||||
|
||||
@ -192,8 +201,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD12A"],
|
||||
admin=False,
|
||||
domainid=cls.domain_12.id
|
||||
)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d12a)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12a)
|
||||
cls.user_d12a_apikey = user.apikey
|
||||
cls.user_d12a_secretkey = user.secretkey
|
||||
|
||||
@ -202,9 +212,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountD12B"],
|
||||
admin=False,
|
||||
domainid=cls.domain_12.id
|
||||
)
|
||||
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
|
||||
)
|
||||
cls._cleanup.append(cls.account_d12b)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d12b)
|
||||
cls.user_d12b_apikey = user.apikey
|
||||
cls.user_d12b_secretkey = user.secretkey
|
||||
|
||||
@ -216,21 +226,21 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
admin=False,
|
||||
domainid=cls.domain_2.id
|
||||
)
|
||||
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
|
||||
cls._cleanup.append(cls.account_d2a)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_d2a)
|
||||
cls.user_d2a_apikey = user.apikey
|
||||
cls.user_d2a_secretkey = user.secretkey
|
||||
|
||||
|
||||
|
||||
# Create 1 user account and admin account in "ROOT" domain
|
||||
|
||||
|
||||
cls.account_roota = Account.create(
|
||||
cls.apiclient,
|
||||
cls.acldata["accountROOTA"],
|
||||
admin=False,
|
||||
)
|
||||
cls._cleanup.append(cls.account_roota)
|
||||
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_roota)
|
||||
cls.user_roota_apikey = user.apikey
|
||||
cls.user_roota_secretkey = user.secretkey
|
||||
|
||||
@ -239,8 +249,9 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.acldata["accountROOT"],
|
||||
admin=True,
|
||||
)
|
||||
cls._cleanup.append(cls.account_root)
|
||||
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
|
||||
user = cls.generateKeysForUser(cls.apiclient,cls.account_root)
|
||||
cls.user_root_apikey = user.apikey
|
||||
cls.user_root_secretkey = user.secretkey
|
||||
|
||||
@ -249,86 +260,77 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
cls.apiclient,
|
||||
cls.acldata["service_offering"]["small"]
|
||||
)
|
||||
|
||||
cls._cleanup.append(cls.service_offering)
|
||||
|
||||
cls.zone = get_zone(cls.apiclient,cls.testclient.getZoneForTests())
|
||||
cls.acldata['mode'] = cls.zone.networktype
|
||||
cls.template = get_template(cls.apiclient, cls.zone.id, cls.acldata["ostype"])
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.default_apikey
|
||||
cls.apiclient.connection.apiKey = cls.default_apikey
|
||||
cls.apiclient.connection.securityKey = cls.default_secretkey
|
||||
|
||||
list_isolated_network_offerings_response = NetworkOffering.list(
|
||||
cls.apiclient,
|
||||
name="DefaultIsolatedNetworkOfferingWithSourceNatService"
|
||||
)
|
||||
cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
|
||||
cls.isolated_network_offering_id = list_isolated_network_offerings_response[0].id
|
||||
|
||||
## Create Network objects for Update API related test cases
|
||||
## Create Network objects for Update API related test cases
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_root_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_root_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_root_secretkey
|
||||
cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_root = cls.createNetwork(cls.apiclient,cls.account_root,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d1_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d1_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d1_secretkey
|
||||
cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d1 = cls.createNetwork(cls.apiclient,cls.account_d1,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d1a_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d1a_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d1a_secretkey
|
||||
cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d1a = cls.createNetwork(cls.apiclient,cls.account_d1a,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d1b_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d1b_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d1b_secretkey
|
||||
cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d1b = cls.createNetwork(cls.apiclient,cls.account_d1b,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d11a_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d11a_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d11a_secretkey
|
||||
cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d11a = cls.createNetwork(cls.apiclient,cls.account_d11a,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d11b_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d11b_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d11b_secretkey
|
||||
cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d11b = cls.createNetwork(cls.apiclient,cls.account_d11b,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d12a_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d12a_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d12a_secretkey
|
||||
cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d12a = cls.createNetwork(cls.apiclient,cls.account_d12a,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_roota_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_roota_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_roota_secretkey
|
||||
cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_roota = cls.createNetwork(cls.apiclient,cls.account_roota,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d111a_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d111a_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d111a_secretkey
|
||||
cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d111a = cls.createNetwork(cls.apiclient,cls.account_d111a,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d111b_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d111b_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d111b_secretkey
|
||||
cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d111b = cls.createNetwork(cls.apiclient,cls.account_d111b,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
|
||||
cls.apiclient.connection.apiKey = cls.user_d2a_apikey
|
||||
cls.apiclient.connection.apiKey = cls.user_d2a_apikey
|
||||
cls.apiclient.connection.securityKey = cls.user_d2a_secretkey
|
||||
cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
|
||||
cls.network_d2a = cls.createNetwork(cls.apiclient,cls.account_d2a,cls.isolated_network_offering_id,cls.zone)
|
||||
|
||||
cls.cleanup = [
|
||||
cls.account_root,
|
||||
cls.account_roota,
|
||||
cls.service_offering,
|
||||
]
|
||||
except Exception as e:
|
||||
cls.domain_1.delete(cls.apiclient,cleanup="true")
|
||||
cls.domain_2.delete(cls.apiclient,cleanup="true")
|
||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||
raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
|
||||
cls.tearDownClass()
|
||||
raise Exception("Failed to create the setup required to execute the test cases: %s" % e)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
cls.apiclient = super(TestIsolatedNetworkDelete, cls).getClsTestClient().getApiClient()
|
||||
cls.apiclient.connection.apiKey = cls.default_apikey
|
||||
cls.apiclient.connection.securityKey = cls.default_secretkey
|
||||
cls.domain_1.delete(cls.apiclient,cleanup="true")
|
||||
cls.domain_2.delete(cls.apiclient,cleanup="true")
|
||||
cleanup_resources(cls.apiclient, cls.cleanup)
|
||||
super(TestIsolatedNetworkDelete,cls).tearDownClass()
|
||||
return
|
||||
|
||||
def setUp(cls):
|
||||
@ -345,169 +347,169 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_admin(self):
|
||||
"""
|
||||
"""
|
||||
Validate that Admin should be able to delete network he owns
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_root_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_root_apikey
|
||||
self.apiclient.connection.securityKey = self.user_root_secretkey
|
||||
|
||||
self.network_root.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_root.id)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_root.id)
|
||||
|
||||
self.assertEqual(response,
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"Admin User is not able to restart network he owns")
|
||||
self._cleanup.remove(self.network_root)
|
||||
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_admin_foruserinsamedomain(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Admin should be able to delete network for users in his domain
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_root_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_root_apikey
|
||||
self.apiclient.connection.securityKey = self.user_root_secretkey
|
||||
|
||||
self.network_roota.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_roota.id)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_roota.id)
|
||||
|
||||
self.assertEqual(response,
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"Admin User is not able to delete network owned by users his domain")
|
||||
self._cleanup.remove(self.network_roota)
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_admin_foruserinotherdomain(self):
|
||||
|
||||
# Validate that Admin should be able to delete network for users in his sub domain
|
||||
self.apiclient.connection.apiKey = self.user_root_apikey
|
||||
self.apiclient.connection.apiKey = self.user_root_apikey
|
||||
self.apiclient.connection.securityKey = self.user_root_secretkey
|
||||
|
||||
self.network_d12a.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d12a.id)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d12a.id)
|
||||
|
||||
self.assertEqual(response,
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"Admin User is not able to delete network owned other users in other domain")
|
||||
self._cleanup.remove(self.network_d12a)
|
||||
|
||||
## Test cases relating to delete Network as domain admin user
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_domaindmin(self):
|
||||
"""
|
||||
"""
|
||||
Validate that Domain admin should be able to delete network for himslef
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d1_secretkey
|
||||
|
||||
self.network_d1.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d1.id)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d1.id)
|
||||
|
||||
self.assertEqual(response,
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"Domain admin User is not able to delete a network he owns")
|
||||
|
||||
self._cleanup.remove(self.network_d1)
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_domaindmin_foruserinsamedomain(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Domain admin should be able to delete network for users in his domain
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d1_secretkey
|
||||
|
||||
self.network_d1a.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d1a.id)
|
||||
self.assertEqual(response,
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d1a.id)
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"Domain admin User is not able to delete a network that is owned by user in the same domain")
|
||||
self._cleanup.remove(self.network_d1a)
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_domaindmin_foruserinsubdomain(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Domain admin should be able to delete network for users in his sub domain
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d1_secretkey
|
||||
|
||||
self.network_d11a.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d11a.id)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d11a.id)
|
||||
|
||||
self.assertEqual(response,
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"Domain admin User is not able to delete a network that is owned by user in the subdomain")
|
||||
self._cleanup.remove(self.network_d11a)
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_domaindmin_forcrossdomainuser(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Domain admin should be able to delete network for users in his sub domain
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d1_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d1_secretkey
|
||||
|
||||
try:
|
||||
response = self.network_d2a.delete(self.apiclient)
|
||||
self.fail("Domain admin is allowed to delete network for users not in his domain ")
|
||||
try:
|
||||
response = self.network_d2a.delete(self.apiclient)
|
||||
self._cleanup.remove(self.network_d2a)
|
||||
self.fail("Domain admin is allowed to delete network for users not in his domain ")
|
||||
except Exception as e:
|
||||
self.debug ("When Domain admin tries to delete network for user in a different domain %s" %e)
|
||||
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
|
||||
self.fail("Error message validation failed when Domain admin tries to delete network for users not in his domain ")
|
||||
|
||||
self.debug ("When Domain admin tries to delete network for user in a different domain %s" %e)
|
||||
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_DOMAIN):
|
||||
self.fail("Error message validation failed when Domain admin tries to delete network for users not in his domain ")
|
||||
|
||||
## Test cases relating deleting network as regular user
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_user(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Regular should be able to delete network for himslef
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d111a_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d111a_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d111a_secretkey
|
||||
|
||||
self.network_d111a.delete(self.apiclient)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d111a.id)
|
||||
response = Network.list(self.apiclient,listall="true",id=self.network_d111a.id)
|
||||
|
||||
self.assertEqual(response,
|
||||
self.assertEqual(response,
|
||||
None,
|
||||
"User is not able to delete a network he owns")
|
||||
|
||||
self._cleanup.remove(self.network_d111a)
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_user_foruserinsamedomain(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Regular user should NOT be able to delete network for users in his domain
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d111a_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d111a_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d111a_secretkey
|
||||
|
||||
try:
|
||||
response = self.network_d111b.delete(self.apiclient)
|
||||
self.fail("Regular user is allowed to delete network for users in his domain ")
|
||||
try:
|
||||
response = self.network_d111b.delete(self.apiclient)
|
||||
self._cleanup.remove(self.network_d111b)
|
||||
self.fail("Regular user is allowed to delete network for users in his domain ")
|
||||
except Exception as e:
|
||||
self.debug ("When user tries to delete network for users in his domain %s" %e)
|
||||
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
|
||||
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
|
||||
self.fail("Regular user is allowed to delete network for users in his domain ")
|
||||
|
||||
@attr("simulator_only",tags=["advanced"],required_hardware="false")
|
||||
def test_deleteNetwork_user_foruserinotherdomain(self):
|
||||
|
||||
"""
|
||||
"""
|
||||
Validate that Domain admin should be NOT be able to delete network for users in other domains
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d111a_apikey
|
||||
"""
|
||||
self.apiclient.connection.apiKey = self.user_d111a_apikey
|
||||
self.apiclient.connection.securityKey = self.user_d111a_secretkey
|
||||
|
||||
try:
|
||||
response = self.network_d11b.delete(self.apiclient)
|
||||
self.fail("Regular user is allowed to delete network for users not in his domain ")
|
||||
|
||||
try:
|
||||
response = self.network_d11b.delete(self.apiclient)
|
||||
self._cleanup.remove(self.network_d11b)
|
||||
self.fail("Regular user is allowed to delete network for users not in his domain ")
|
||||
except Exception as e:
|
||||
self.debug ("When user tries to delete network for users in other domain %s" %e)
|
||||
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
|
||||
self.fail("Error message validation failed when Regular user tries to delete network for users not in his domain ")
|
||||
self.debug ("When user tries to delete network for users in other domain %s" %e)
|
||||
if not CloudstackAclException.verifyMsginException(e,CloudstackAclException.NO_PERMISSION_TO_OPERATE_ACCOUNT):
|
||||
self.fail("Error message validation failed when Regular user tries to delete network for users not in his domain ")
|
||||
|
||||
@staticmethod
|
||||
def generateKeysForUser(apiclient,account):
|
||||
@ -522,25 +524,26 @@ class TestIsolatedNetworkDelete(cloudstackTestCase):
|
||||
user.id
|
||||
))
|
||||
|
||||
@staticmethod
|
||||
def createNetwork(apiclient,account,isolated_network_offering_id,zone):
|
||||
@classmethod
|
||||
def createNetwork(cls,apiclient,account,isolated_network_offering_id,zone):
|
||||
network= {
|
||||
"name": "Network-",
|
||||
"displaytext": "Network-",
|
||||
"gateway" :"10.223.1.1",
|
||||
"netmask" :"255.255.255.0",
|
||||
"startip" :"10.223.1.2",
|
||||
"endip" :"10.223.1.100",
|
||||
}
|
||||
"name": "Network-",
|
||||
"displaytext": "Network-",
|
||||
"gateway" :"10.223.1.1",
|
||||
"netmask" :"255.255.255.0",
|
||||
"startip" :"10.223.1.2",
|
||||
"endip" :"10.223.1.100",
|
||||
}
|
||||
|
||||
network["name"] = account.name +" -forupdate"
|
||||
network["displayname"] = account.name + "-forupdate"
|
||||
network["name"] = account.name +" -forupdate"
|
||||
network["displayname"] = account.name + "-forupdate"
|
||||
|
||||
network = Network.create(
|
||||
apiclient,
|
||||
network,
|
||||
networkofferingid=isolated_network_offering_id,
|
||||
zoneid=zone.id
|
||||
)
|
||||
return network
|
||||
apiclient,
|
||||
network,
|
||||
networkofferingid=isolated_network_offering_id,
|
||||
zoneid=zone.id
|
||||
)
|
||||
cls._cleanup.append(network)
|
||||
return network
|
||||
|
||||
|
||||
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
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,8 @@ Tests of acquiring a specified public IP for isolated network or vpc
|
||||
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import createVlanIpRange
|
||||
from marvin.lib.utils import (validateList,
|
||||
cleanup_resources)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -17,7 +17,8 @@
|
||||
|
||||
""" P1 tests for networks in advanced zone with security groups
|
||||
"""
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from ddt import ddt, data
|
||||
from marvin.lib.base import (Zone,
|
||||
ServiceOffering,
|
||||
@ -2162,7 +2163,7 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase):
|
||||
name=self.services["test_34_DeployVM_in_SecondSGNetwork"]["zone"]
|
||||
)
|
||||
status = validateList(zone_list)
|
||||
self.assertEquals(status[0], PASS, "Failed to list the zones")
|
||||
self.assertEqual(status[0], PASS, "Failed to list the zones")
|
||||
count = 0
|
||||
"""
|
||||
In simulator environment default guest os template should be in ready state immediately after the ssvm is up.
|
||||
@ -2260,7 +2261,7 @@ class TestNetworksInAdvancedSG_VmOperations(cloudstackTestCase):
|
||||
)
|
||||
#construct ip list using start and end ips in the network
|
||||
for i in range(0,nwIPs):
|
||||
ips_in_new_network.append(str(ip_gen.next()))
|
||||
ips_in_new_network.append(str(next(ip_gen)))
|
||||
if vm_ip not in ips_in_new_network:
|
||||
self.fail("vm did not get the ip from new SG enabled shared network")
|
||||
self.cleanup_vms.append(vm_2)
|
||||
|
||||
@ -15,7 +15,8 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import deleteAffinityGroup
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
random_gen)
|
||||
@ -187,8 +188,8 @@ class TestCreateAffinityGroup(cloudstackTestCase):
|
||||
acc=self.account.name, domainid=self.account.domainid)
|
||||
self.debug("Created Affinity Group: %s" % aff_grp.name)
|
||||
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
|
||||
self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assert_(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
|
||||
self.cleanup.append(aff_grp)
|
||||
|
||||
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
|
||||
@ -455,7 +456,7 @@ class TestListAffinityGroups(cloudstackTestCase):
|
||||
"""
|
||||
|
||||
self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
|
||||
print self.aff_grp[0].__dict__
|
||||
print(self.aff_grp[0].__dict__)
|
||||
list_aff_grps = AffinityGroup.list(self.api_client)
|
||||
list_aff_grps = AffinityGroup.list(self.api_client, id=list_aff_grps[0].id)
|
||||
self.assertEqual(list_aff_grps[0].name, self.aff_grp[0].name,
|
||||
@ -646,7 +647,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
|
||||
|
||||
def delete_aff_group(self, apiclient, **kwargs):
|
||||
cmd = deleteAffinityGroup.deleteAffinityGroupCmd()
|
||||
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||
[setattr(cmd, k, v) for k, v in list(kwargs.items())]
|
||||
return apiclient.deleteAffinityGroup(cmd)
|
||||
|
||||
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
|
||||
@ -658,7 +659,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
|
||||
aff_0 = self.create_aff_grp(aff_grp=self.services["host_anti_affinity"])
|
||||
AffinityGroup.list(self.api_client, name=aff_0.name)
|
||||
self.delete_aff_group(self.api_client, name=aff_0.name)
|
||||
self.assert_(AffinityGroup.list(self.api_client, name=aff_0.name) is None)
|
||||
self.assertTrue(AffinityGroup.list(self.api_client, name=aff_0.name) is None)
|
||||
|
||||
@attr(tags=["simulator", "basic", "advanced", "multihost"], required_hardware="false")
|
||||
def test_02_delete_aff_grp_for_acc(self):
|
||||
@ -688,7 +689,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
|
||||
vm, hostid = self.create_vm_in_aff_grps([aff_0.name, aff_1.name], account_name=self.account.name, domain_id=self.domain.id)
|
||||
aff_0.delete(self.api_client)
|
||||
vm_list = list_virtual_machines(self.apiclient, id=vm.id)
|
||||
self.assert_(vm_list is not None)
|
||||
self.assertTrue(vm_list is not None)
|
||||
vm.delete(self.api_client)
|
||||
#Wait for expunge interval to cleanup VM
|
||||
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
|
||||
|
||||
@ -15,7 +15,8 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import deleteAffinityGroup
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
random_gen)
|
||||
@ -218,9 +219,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
|
||||
aff_grp = self.create_aff_grp()
|
||||
self.debug("Created Affinity Group: %s" % aff_grp.name)
|
||||
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
|
||||
self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assert_(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assert_(list_aff_grps[0].projectid == self.project.id)
|
||||
self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assertTrue(list_aff_grps[0].projectid == self.project.id)
|
||||
self.cleanup.append(aff_grp)
|
||||
|
||||
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
|
||||
@ -231,9 +232,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
|
||||
"""
|
||||
aff_grp = self.create_aff_grp(api_client=self.domain_api_client)
|
||||
list_aff_grps = AffinityGroup.list(self.domain_api_client, id=aff_grp.id)
|
||||
self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assert_(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assert_(list_aff_grps[0].projectid == self.project.id)
|
||||
self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assertTrue(list_aff_grps[0].projectid == self.project.id)
|
||||
self.cleanup.append(aff_grp)
|
||||
|
||||
@attr(tags=["vogxn", "simulator", "basic", "advanced"], required_hardware="false")
|
||||
@ -244,9 +245,9 @@ class TestCreateAffinityGroup(cloudstackTestCase):
|
||||
"""
|
||||
aff_grp = self.create_aff_grp(api_client=self.account_api_client)
|
||||
list_aff_grps = AffinityGroup.list(self.api_client, id=aff_grp.id)
|
||||
self.assert_(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assert_(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assert_(list_aff_grps[0].projectid == self.project.id)
|
||||
self.assertTrue(isinstance(list_aff_grps, list) and len(list_aff_grps) > 0)
|
||||
self.assertTrue(list_aff_grps[0].id == aff_grp.id)
|
||||
self.assertTrue(list_aff_grps[0].projectid == self.project.id)
|
||||
self.cleanup.append(aff_grp)
|
||||
|
||||
@attr(tags=["simulator", "basic", "advanced"], required_hardware="false")
|
||||
@ -670,7 +671,7 @@ class TestDeleteAffinityGroups(cloudstackTestCase):
|
||||
|
||||
def delete_aff_group(self, apiclient, **kwargs):
|
||||
cmd = deleteAffinityGroup.deleteAffinityGroupCmd()
|
||||
[setattr(cmd, k, v) for k, v in kwargs.items()]
|
||||
[setattr(cmd, k, v) for k, v in list(kwargs.items())]
|
||||
return apiclient.deleteAffinityGroup(cmd)
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
from marvin.codes import (PASS,
|
||||
RECURRING)
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
|
||||
from marvin.lib.base import (ServiceOffering,
|
||||
Account,
|
||||
@ -419,7 +420,7 @@ class TestBaseImageUpdate(cloudstackTestCase):
|
||||
|
||||
hypervisor = host_list_validation_result[1].hypervisor
|
||||
|
||||
for k, v in self.services["templates"].items():
|
||||
for k, v in list(self.services["templates"].items()):
|
||||
if k.lower() == hypervisor.lower():
|
||||
# Register new template
|
||||
template = Template.register(
|
||||
|
||||
@ -36,7 +36,8 @@ from marvin.lib.common import (get_zone,
|
||||
get_builtin_template_info)
|
||||
|
||||
#Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import restartNetwork
|
||||
from marvin.codes import PASS
|
||||
import time
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import (listPhysicalNetworks,
|
||||
listNetworkServiceProviders,
|
||||
addNetworkServiceProvider,
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
|
||||
import marvin
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
@ -160,7 +161,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -284,7 +285,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -377,7 +378,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -427,7 +428,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -477,7 +478,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
time.sleep(60)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -545,7 +546,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=volid
|
||||
)
|
||||
print list_volume_response[0]
|
||||
print(list_volume_response[0])
|
||||
vmlist.attach_volume(
|
||||
self.apiclient,
|
||||
list_volume_response[0]
|
||||
@ -612,7 +613,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=volid
|
||||
)
|
||||
print list_volume_response[0]
|
||||
print(list_volume_response[0])
|
||||
vmdetails.detach_volume(self.apiclient,list_volume_response[0])
|
||||
|
||||
# Sleep to ensure the current state will reflected in other calls
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
|
||||
import marvin
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
@ -32,7 +33,7 @@ import random
|
||||
import string
|
||||
import telnetlib
|
||||
import os
|
||||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import time
|
||||
import tempfile
|
||||
_multiprocess_shared_ = True
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
|
||||
import marvin
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import *
|
||||
from marvin.lib.base import *
|
||||
@ -39,7 +40,7 @@ import string
|
||||
|
||||
import telnetlib
|
||||
import os
|
||||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import time
|
||||
import tempfile
|
||||
_multiprocess_shared_ = True
|
||||
@ -136,7 +137,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -213,7 +214,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -299,7 +300,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -425,7 +426,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
time.sleep(60)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code == 200:
|
||||
self.fail("Upload URL is allowed to reuse")
|
||||
|
||||
@ -547,7 +548,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
time.sleep(60)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -593,7 +594,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
time.sleep(60)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -647,7 +648,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=volid
|
||||
)
|
||||
print list_volume_response[0]
|
||||
print(list_volume_response[0])
|
||||
vmlist.attach_volume(
|
||||
self.apiclient,
|
||||
list_volume_response[0]
|
||||
@ -715,7 +716,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
id=volid
|
||||
)
|
||||
print list_volume_response[0]
|
||||
print(list_volume_response[0])
|
||||
vmdetails.detach_volume(self.apiclient,list_volume_response[0])
|
||||
|
||||
# Sleep to ensure the current state will reflected in other calls
|
||||
@ -821,9 +822,9 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
extract_vol = self.apiclient.extractVolume(cmd)
|
||||
|
||||
try:
|
||||
formatted_url = urllib.unquote_plus(extract_vol.url)
|
||||
formatted_url = urllib.parse.unquote_plus(extract_vol.url)
|
||||
self.debug("Attempting to download volume at url %s" % formatted_url)
|
||||
response = urllib.urlopen(formatted_url)
|
||||
response = urllib.request.urlopen(formatted_url)
|
||||
self.debug("response from volume url %s" % response.getcode())
|
||||
fd, path = tempfile.mkstemp()
|
||||
self.debug("Saving volume %s to path %s" %(volumeid, path))
|
||||
@ -1185,7 +1186,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
self.apiclient,
|
||||
templatefilter='self')
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
templates_before_size + 1,
|
||||
len(list_templates_after),
|
||||
"Template creation failed from snapshot"
|
||||
@ -1763,7 +1764,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -1808,7 +1809,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -1916,7 +1917,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code !=200:
|
||||
self.fail("Upload is not fine")
|
||||
|
||||
@ -1955,7 +1956,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
|
||||
|
||||
results = requests.post(posturl,files=files,headers=headers,verify=False)
|
||||
|
||||
print results.status_code
|
||||
print(results.status_code)
|
||||
if results.status_code ==200:
|
||||
return("FAIL")
|
||||
return("PASS")
|
||||
|
||||
@ -58,8 +58,8 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
|
||||
cls.supportedHypervisor = True
|
||||
|
||||
if cls.hypervisor.lower() in [
|
||||
"hyperv",
|
||||
"lxc"]:
|
||||
"hyperv",
|
||||
"lxc"]:
|
||||
cls.supportedHypervisor = False
|
||||
return
|
||||
|
||||
@ -168,14 +168,14 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
|
||||
name="concurrent.snapshots.threshold.perhost"
|
||||
)
|
||||
if config[0].value:
|
||||
self.assertEqual(
|
||||
isinstance(
|
||||
config,
|
||||
list),
|
||||
True,
|
||||
"concurrent.snapshots.threshold.perhost should be present\
|
||||
in global config")
|
||||
concurrentSnapshots = int(config[0].value)
|
||||
self.assertEqual(
|
||||
isinstance(
|
||||
config,
|
||||
list),
|
||||
True,
|
||||
"concurrent.snapshots.threshold.perhost should be present\
|
||||
in global config")
|
||||
concurrentSnapshots = int(config[0].value)
|
||||
self.debug("concurrent Snapshots: %s" % concurrentSnapshots)
|
||||
|
||||
threads = []
|
||||
@ -228,14 +228,14 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
|
||||
name="concurrent.snapshots.threshold.perhost"
|
||||
)
|
||||
if config[0].value:
|
||||
self.assertEqual(
|
||||
isinstance(
|
||||
config,
|
||||
list),
|
||||
True,
|
||||
"concurrent.snapshots.threshold.perhost should be present\
|
||||
in global config")
|
||||
concurrentSnapshots = int(config[0].value)
|
||||
self.assertEqual(
|
||||
isinstance(
|
||||
config,
|
||||
list),
|
||||
True,
|
||||
"concurrent.snapshots.threshold.perhost should be present\
|
||||
in global config")
|
||||
concurrentSnapshots = int(config[0].value)
|
||||
else:
|
||||
self.skipTest("Skipping tests as the config value \
|
||||
concurrent.snapshots.threshold.perhost is Null")
|
||||
@ -304,9 +304,9 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
|
||||
concurrent.snapshots.threshold.perhost parameter.
|
||||
"""
|
||||
with self.assertRaises(Exception):
|
||||
Configurations.update(
|
||||
self.apiclient,
|
||||
"concurrent.snapshots.threshold.perhost",
|
||||
"String"
|
||||
)
|
||||
return
|
||||
Configurations.update(
|
||||
self.apiclient,
|
||||
"concurrent.snapshots.threshold.perhost",
|
||||
"String"
|
||||
)
|
||||
return
|
||||
|
||||
@ -19,44 +19,46 @@
|
||||
and password reset functionality with
|
||||
ConfigDrive
|
||||
"""
|
||||
|
||||
# Import Local Modules
|
||||
from marvin.cloudstackAPI import (restartVPC)
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
createVlanIpRange,
|
||||
Configurations,
|
||||
FireWallRule,
|
||||
Host,
|
||||
listVlanIpRanges,
|
||||
Network,
|
||||
NetworkACL,
|
||||
NetworkACLList,
|
||||
NetworkOffering,
|
||||
NetworkServiceProvider,
|
||||
PublicIPAddress,
|
||||
Router,
|
||||
ServiceOffering,
|
||||
createSSHKeyPair,
|
||||
deleteSSHKeyPair,
|
||||
StaticNATRule,
|
||||
VirtualMachine,
|
||||
VPC,
|
||||
VpcOffering,
|
||||
Hypervisor, Template)
|
||||
from marvin.lib.common import (
|
||||
get_domain,
|
||||
get_zone, get_test_template,
|
||||
is_config_suitable)
|
||||
from marvin.lib.utils import random_gen
|
||||
|
||||
# Import System Modules
|
||||
import base64
|
||||
import os
|
||||
import socket
|
||||
# Import Local Modules
|
||||
import subprocess
|
||||
import tempfile
|
||||
from contextlib import contextmanager
|
||||
|
||||
import time
|
||||
from marvin.cloudstackAPI import (restartVPC)
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.lib.base import (Account,
|
||||
createVlanIpRange,
|
||||
Configurations,
|
||||
FireWallRule,
|
||||
Host,
|
||||
listVlanIpRanges,
|
||||
Network,
|
||||
NetworkACL,
|
||||
NetworkACLList,
|
||||
NetworkOffering,
|
||||
NetworkServiceProvider,
|
||||
PublicIPAddress,
|
||||
Router,
|
||||
ServiceOffering,
|
||||
createSSHKeyPair,
|
||||
deleteSSHKeyPair,
|
||||
StaticNATRule,
|
||||
VirtualMachine,
|
||||
VPC,
|
||||
VpcOffering,
|
||||
Hypervisor, Template)
|
||||
from marvin.lib.common import (get_domain,
|
||||
get_template,
|
||||
get_zone, get_test_template,
|
||||
is_config_suitable)
|
||||
from marvin.lib.utils import random_gen
|
||||
# Import System Modules
|
||||
from contextlib import contextmanager
|
||||
from nose.plugins.attrib import attr
|
||||
from retry import retry
|
||||
|
||||
@ -1000,7 +1002,7 @@ class ConfigDriveUtils:
|
||||
:rtype: str
|
||||
"""
|
||||
self.debug("Updating userdata for VM - %s" % vm.name)
|
||||
updated_user_data = base64.b64encode(new_user_data)
|
||||
updated_user_data = base64.encodestring(new_user_data.encode()).decode()
|
||||
with self.stopped_vm(vm):
|
||||
vm.update(self.api_client, userdata=updated_user_data)
|
||||
|
||||
@ -2371,7 +2373,6 @@ class TestConfigDrive(cloudstackTestCase, ConfigDriveUtils):
|
||||
vm1, public_ip_1,
|
||||
metadata=True)
|
||||
|
||||
|
||||
# =====================================================================
|
||||
# Network restart tests
|
||||
# =====================================================================
|
||||
|
||||
@ -191,7 +191,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
|
||||
users = {self.domain: self.admin,
|
||||
self.child_domain: self.child_do_admin
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -267,7 +267,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
|
||||
users = {self.domain: self.admin,
|
||||
self.child_domain: self.child_do_admin
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -328,7 +328,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
|
||||
users = {self.domain: self.admin,
|
||||
self.child_domain: self.child_do_admin
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -392,7 +392,7 @@ class TestDomainCPULimitsUpdateResources(cloudstackTestCase):
|
||||
users = {self.domain: self.admin,
|
||||
self.child_domain: self.child_do_admin
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
|
||||
@ -435,7 +435,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -510,7 +510,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -570,7 +570,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -633,7 +633,7 @@ class TestDomainCPULimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
# Import Local Modules
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
random_gen,
|
||||
get_hypervisor_type)
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
# Test from the Marvin - Testing in Python wiki
|
||||
|
||||
# All tests inherit from cloudstackTestCase
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import changeServiceForVirtualMachine, startVirtualMachine
|
||||
|
||||
# Import Integration Libraries
|
||||
|
||||
@ -126,7 +126,7 @@ class TestDeployVmWithUserDataMultiNic(cloudstackTestCase):
|
||||
"""Test userdata update when non default nic is without userdata for deploy and update
|
||||
"""
|
||||
|
||||
self.userdata = base64.b64encode(self.userdata)
|
||||
self.userdata = base64.encodestring(self.userdata.encode()).decode()
|
||||
|
||||
network1 = Network.create(
|
||||
self.apiclient,
|
||||
@ -166,10 +166,10 @@ class TestDeployVmWithUserDataMultiNic(cloudstackTestCase):
|
||||
domainid=self.account.domainid,
|
||||
id=deployVmResponse.id
|
||||
)
|
||||
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
vm = vms[0]
|
||||
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assert_(vm.state == "Running", "VM is not in Running state")
|
||||
self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assertTrue(vm.state == "Running", "VM is not in Running state")
|
||||
|
||||
try:
|
||||
updateresponse = deployVmResponse.update(self.apiclient, userdata=self.userdata)
|
||||
|
||||
@ -110,8 +110,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
|
||||
"""Test userdata as POST, size > 2k
|
||||
"""
|
||||
|
||||
|
||||
self.userdata=base64.b64encode(self.userdata)
|
||||
self.userdata = base64.encodestring(self.userdata.encode()).decode()
|
||||
self.services["virtual_machine"]["userdata"] = self.userdata
|
||||
|
||||
deployVmResponse = VirtualMachine.create(
|
||||
@ -132,10 +131,10 @@ class TestDeployVmWithUserData(cloudstackTestCase):
|
||||
domainid=self.account.domainid,
|
||||
id=deployVmResponse.id
|
||||
)
|
||||
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
vm = vms[0]
|
||||
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assert_(vm.state == "Running", "VM is not in Running state")
|
||||
self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assertTrue(vm.state == "Running", "VM is not in Running state")
|
||||
ip_addr=deployVmResponse.ipaddress
|
||||
if self.zone.networktype == "Basic":
|
||||
list_router_response = list_routers(
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
""" Tests for DHCP DNS offload feature
|
||||
"""
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (random_gen, validateList, cleanup_resources, get_hypervisor_type)
|
||||
from marvin.lib.base import (Account,
|
||||
NIC,
|
||||
@ -321,7 +322,7 @@ class TestDeployVMs(cloudstackTestCase):
|
||||
self.assertEqual(validateList(qresultset)[0], PASS, "sql query returned invalid response")
|
||||
self.assertEqual(
|
||||
metadata["vm-id.txt"][0],
|
||||
unicode(qresultset[0][0]),
|
||||
str(qresultset[0][0]),
|
||||
"vm id in metadata does not match with the vm id from cloud db"
|
||||
)
|
||||
return
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
Feature Specifications: https://cwiki.apache.org/confluence/display/
|
||||
CLOUDSTACK/Dynamic+Compute+Offering+FS
|
||||
"""
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
validateList,
|
||||
random_gen,
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (Account,
|
||||
Domain,
|
||||
Router,
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import (authorizeSecurityGroupIngress,
|
||||
disassociateIpAddress,
|
||||
deleteLoadBalancerRule)
|
||||
@ -167,7 +168,7 @@ class TestEIP(cloudstackTestCase):
|
||||
)
|
||||
if isinstance(ip_addrs, list):
|
||||
cls.source_nat = ip_addrs[0]
|
||||
print "source_nat ipaddress : ", cls.source_nat.ipaddress
|
||||
print("source_nat ipaddress : ", cls.source_nat.ipaddress)
|
||||
else:
|
||||
raise Exception(
|
||||
"No Source NAT IP found for guest network: %s" %
|
||||
|
||||
@ -164,4 +164,4 @@ class TestlistTemplatesDomainAdmin(cloudstackTestCase):
|
||||
|
||||
else:
|
||||
retries = retries - 1
|
||||
raise Exception("Template download failed exception.")
|
||||
raise Exception("Template download failed exception.")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -121,7 +121,7 @@ class TestIsos(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -189,13 +189,13 @@ class TestIsos(cloudstackTestCase):
|
||||
isofilter=self.services["templatefilter"]
|
||||
)
|
||||
status = validateList(list_iso_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO's creation failed"
|
||||
)
|
||||
# Verifying that list size is pagesize + 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"] + 1,
|
||||
len(list_iso_after),
|
||||
"Failed to create pagesize + 1 number of ISO's"
|
||||
@ -209,13 +209,13 @@ class TestIsos(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_iso_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list ISO's in page 1"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_iso_page1),
|
||||
"Size of ISO's in page 1 is not matching"
|
||||
@ -229,13 +229,13 @@ class TestIsos(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_iso_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list ISo's in page 2"
|
||||
)
|
||||
# Verifying the list size to be equal to 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_iso_page2),
|
||||
"Size of ISO's in page 2 is not matching"
|
||||
@ -251,7 +251,7 @@ class TestIsos(cloudstackTestCase):
|
||||
id=iso_created.id
|
||||
)
|
||||
status = validateList(list_iso)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list ISO by Id"
|
||||
@ -335,13 +335,13 @@ class TestIsos(cloudstackTestCase):
|
||||
isofilter=self.services["templatefilter"]
|
||||
)
|
||||
status = validateList(list_iso_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO's creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_iso_after),
|
||||
"Failed to create an ISO's"
|
||||
@ -357,7 +357,7 @@ class TestIsos(cloudstackTestCase):
|
||||
id=iso_created.id
|
||||
)
|
||||
status = validateList(list_iso)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list ISO by Id"
|
||||
@ -386,7 +386,7 @@ class TestIsos(cloudstackTestCase):
|
||||
"Download ISO failed"
|
||||
)
|
||||
# Verifying the details of downloaded ISO
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
"DOWNLOAD_URL_CREATED",
|
||||
download_iso.state,
|
||||
"Download URL not created for ISO"
|
||||
@ -395,7 +395,7 @@ class TestIsos(cloudstackTestCase):
|
||||
download_iso.url,
|
||||
"Download URL not created for ISO"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
iso_created.id,
|
||||
download_iso.id,
|
||||
"Download ISO details are not same as ISO created"
|
||||
@ -451,13 +451,13 @@ class TestIsos(cloudstackTestCase):
|
||||
isofilter=self.services["templatefilter"]
|
||||
)
|
||||
status = validateList(list_iso_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO's creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_iso_after),
|
||||
"Failed to create an ISO's"
|
||||
@ -473,7 +473,7 @@ class TestIsos(cloudstackTestCase):
|
||||
id=iso_created.id
|
||||
)
|
||||
status = validateList(list_iso)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list ISO by Id"
|
||||
@ -534,7 +534,7 @@ class TestIsos(cloudstackTestCase):
|
||||
# Editing the ISO name, displaytext, ostypeid
|
||||
ostype_list = list_os_types(self.userapiclient)
|
||||
status = validateList(ostype_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list OS Types"
|
||||
@ -618,7 +618,7 @@ class TestIsos(cloudstackTestCase):
|
||||
available=True
|
||||
)
|
||||
status = validateList(zones_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list Zones"
|
||||
@ -669,13 +669,13 @@ class TestIsos(cloudstackTestCase):
|
||||
zoneid=zones_list[0].id
|
||||
)
|
||||
status = validateList(list_isos_zone1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO creation failed in Zone1"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_isos_zone1),
|
||||
"Failed to create a Template"
|
||||
@ -703,7 +703,7 @@ class TestIsos(cloudstackTestCase):
|
||||
id=iso_created.id
|
||||
)
|
||||
status = validateList(list_iso)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list ISO by Id"
|
||||
@ -739,13 +739,13 @@ class TestIsos(cloudstackTestCase):
|
||||
zoneid=zones_list[0].id
|
||||
)
|
||||
status = validateList(list_isos_zone1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO creation failed in Zone1"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_isos_zone1),
|
||||
"Failed to create a Template"
|
||||
@ -758,23 +758,23 @@ class TestIsos(cloudstackTestCase):
|
||||
zoneid=zones_list[1].id
|
||||
)
|
||||
status = validateList(list_isos_zone2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO failed to copy into Zone2"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_isos_zone2),
|
||||
"ISO failed to copy into Zone2"
|
||||
)
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
"Connection refused",
|
||||
list_isos_zone2[0].status,
|
||||
"Failed to copy ISO"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
True,
|
||||
list_isos_zone2[0].isready,
|
||||
"Failed to copy ISO"
|
||||
|
||||
@ -132,7 +132,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -168,7 +168,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
id=self.zone.id
|
||||
)
|
||||
status = validateList(list_zones)
|
||||
self.assertEquals(PASS, status[0], "No Zones found for a given id")
|
||||
self.assertEqual(PASS, status[0], "No Zones found for a given id")
|
||||
self.test_data["network_without_acl"]["zoneid"] = list_zones[0].id
|
||||
# Listing the networks for a user
|
||||
list_networks_before = Network.list(
|
||||
@ -226,7 +226,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
type="Isolated")
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
len(list_networks_after),
|
||||
@ -242,7 +242,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_page1)
|
||||
self.assertEquals(PASS, status[0], "No networks found at page 1")
|
||||
self.assertEqual(PASS, status[0], "No networks found at page 1")
|
||||
self.assertEqual(
|
||||
len(list_networks_page1),
|
||||
self.test_data["pagesize"],
|
||||
@ -257,7 +257,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_page2)
|
||||
self.assertEquals(PASS, status[0], "No networks found at page 2")
|
||||
self.assertEqual(PASS, status[0], "No networks found at page 2")
|
||||
self.assertEqual(
|
||||
len(list_networks_page2),
|
||||
1,
|
||||
@ -267,7 +267,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
network_page2 = list_networks_page2[0]
|
||||
for i in range(0, len(list_networks_page1)):
|
||||
network_page1 = list_networks_page1[i]
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
network_page2.id,
|
||||
network_page1.id,
|
||||
"Network listed in page 2 is also listed in page 1"
|
||||
@ -341,7 +341,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# verify no vpc is present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
|
||||
self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
|
||||
for i in range(0, (self.test_data["pagesize"] + 1)):
|
||||
vpc_1 = VPC.create(
|
||||
self.userapiclient,
|
||||
@ -354,13 +354,13 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
# verify vpc is created and not none
|
||||
self.assertIsNotNone(vpc_1, "VPC is not created")
|
||||
# Verify VPC name with test data
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
-1,
|
||||
vpc_1.name.find(self.test_data["vpc"]["name"]),
|
||||
"VPC name not matched"
|
||||
)
|
||||
# verify zone with test data
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.zone.id,
|
||||
vpc_1.zoneid,
|
||||
"Zone is not matching in the vpc created"
|
||||
@ -370,7 +370,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.test_data["listall"])
|
||||
status = validateList(vpc_count_after)
|
||||
self.assertEquals(PASS, status[0], "VPC list count is null")
|
||||
self.assertEqual(PASS, status[0], "VPC list count is null")
|
||||
self.assertEqual(
|
||||
len(vpc_count_after),
|
||||
(self.test_data["pagesize"] + 1),
|
||||
@ -384,7 +384,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
pagesize=self.test_data["pagesize"]
|
||||
)
|
||||
status = validateList(list_vpcs_page1)
|
||||
self.assertEquals(PASS, status[0], "No vpcs found in Page 1")
|
||||
self.assertEqual(PASS, status[0], "No vpcs found in Page 1")
|
||||
self.assertEqual(
|
||||
len(list_vpcs_page1),
|
||||
self.test_data["pagesize"],
|
||||
@ -398,7 +398,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
pagesize=self.test_data["pagesize"]
|
||||
)
|
||||
status = validateList(list_vpcs_page2)
|
||||
self.assertEquals(PASS, status[0], "No vpc found in Page 2")
|
||||
self.assertEqual(PASS, status[0], "No vpc found in Page 2")
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpcs_page2),
|
||||
@ -410,7 +410,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
# is not present in page1
|
||||
for i in range(0, len(list_vpcs_page1)):
|
||||
vpc_page1 = list_vpcs_page1[i]
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
vpc_page2.id,
|
||||
vpc_page1.id,
|
||||
"VPC listed in page 2 is also listed in page 1"
|
||||
@ -456,7 +456,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# No VPCs should be present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
|
||||
self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
|
||||
vpc_count_before = 0
|
||||
vpc_1 = VPC.create(
|
||||
self.userapiclient,
|
||||
@ -472,8 +472,8 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(PASS, status[0], "VPC is not created")
|
||||
self.assertEquals(
|
||||
self.assertEqual(PASS, status[0], "VPC is not created")
|
||||
self.assertEqual(
|
||||
vpc_count_before + 1,
|
||||
len(vpc_list),
|
||||
"VPC is not created"
|
||||
@ -500,7 +500,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
network_offering_before_count = NetworkOffering.list(
|
||||
self.userapiclient)
|
||||
status = validateList(network_offering_before_count)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present")
|
||||
@ -515,7 +515,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_true_before_count)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = true")
|
||||
@ -530,7 +530,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_false_before_count)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = false")
|
||||
@ -548,12 +548,12 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
# List network offering
|
||||
network_offering_after_count = NetworkOffering.list(self.userapiclient)
|
||||
status = validateList(network_offering_after_count)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Network Offering list results in null")
|
||||
# Verify that count is incremented by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(network_offering_before_count) + 1,
|
||||
len(network_offering_after_count),
|
||||
"Network offering is not created"
|
||||
@ -569,12 +569,12 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_true_after_count)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Network Offering list results in null")
|
||||
# Verify that its count is same as step 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(network_offering_vpc_true_before_count),
|
||||
len(network_offering_vpc_true_after_count),
|
||||
"Default Network offering is created with vpc as true"
|
||||
@ -590,12 +590,12 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_false_after_count)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Network Offering list results in null")
|
||||
# Verify that its count is same as step 3
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(network_offering_vpc_false_before_count) + 1,
|
||||
len(network_offering_vpc_false_after_count),
|
||||
"Default Network offering is not created with vpc as false"
|
||||
@ -632,7 +632,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# No VPCs should be present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
|
||||
self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
|
||||
vpc_count_before = 0
|
||||
vpc_1 = VPC.create(
|
||||
self.userapiclient,
|
||||
@ -647,8 +647,8 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(PASS, status[0], "VPC is not created")
|
||||
self.assertEquals(
|
||||
self.assertEqual(PASS, status[0], "VPC is not created")
|
||||
self.assertEqual(
|
||||
vpc_count_before + 1,
|
||||
len(vpc_list),
|
||||
"VPC is not created"
|
||||
@ -673,7 +673,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_true_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = true")
|
||||
@ -733,7 +733,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
type="Isolated")
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
2,
|
||||
@ -746,7 +746,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_in_vpc)
|
||||
self.assertEquals(PASS, status[0], "No networks found in vpc")
|
||||
self.assertEqual(PASS, status[0], "No networks found in vpc")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
1,
|
||||
@ -760,7 +760,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# verify no vpc is present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(PASS, status[0], "VPCs not found.")
|
||||
self.assertEqual(PASS, status[0], "VPCs not found.")
|
||||
# verify vpc name matches for newly created vpc name and vpc list name
|
||||
self.assertEqual(
|
||||
vpc_1.name,
|
||||
@ -799,7 +799,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_false_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = false")
|
||||
@ -845,7 +845,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
2,
|
||||
@ -861,14 +861,14 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_after_delete)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_networks_after_delete),
|
||||
"Number of networks created is not matching expected"
|
||||
)
|
||||
# Verify deleted network is not present
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
network_created.id,
|
||||
list_networks_after_delete[0].id,
|
||||
"Deleted network present"
|
||||
@ -894,7 +894,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
self.assertIsNotNone(
|
||||
list_networks_before,
|
||||
"Network create failed at class level")
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_networks_before),
|
||||
"More than 1 network created at class level"
|
||||
@ -910,7 +910,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_false_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = false")
|
||||
@ -949,7 +949,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
type="Isolated")
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
2,
|
||||
@ -969,7 +969,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
type="Isolated")
|
||||
status = validateList(list_networks_after_update)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(
|
||||
2,
|
||||
len(list_networks_after_update),
|
||||
@ -1056,7 +1056,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
networkid=list_networks_before[0].id
|
||||
)
|
||||
status = validateList(list_instances_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of instances after creation failed"
|
||||
@ -1076,7 +1076,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
networkid=list_networks_before[0].id
|
||||
)
|
||||
status = validateList(list_instances_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of instances in page1 failed"
|
||||
@ -1096,7 +1096,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
networkid=list_networks_before[0].id
|
||||
)
|
||||
status = validateList(list_instances_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of instances in page2 failed"
|
||||
@ -1155,7 +1155,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# No VPCs should be present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
|
||||
self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
|
||||
vpc_count_before = 0
|
||||
vpc_1 = VPC.create(
|
||||
self.userapiclient,
|
||||
@ -1170,8 +1170,8 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(PASS, status[0], "VPC is not created")
|
||||
self.assertEquals(
|
||||
self.assertEqual(PASS, status[0], "VPC is not created")
|
||||
self.assertEqual(
|
||||
vpc_count_before + 1,
|
||||
len(vpc_list),
|
||||
"VPC is not created"
|
||||
@ -1196,7 +1196,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_true_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = true")
|
||||
@ -1246,7 +1246,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
type="Isolated")
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
2,
|
||||
@ -1261,7 +1261,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_in_vpc)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Verify network name matches for newly created network name and name
|
||||
# from network list
|
||||
self.assertEqual(
|
||||
@ -1298,7 +1298,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# verify no vpc is present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
|
||||
self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
|
||||
vpc_1 = VPC.create(
|
||||
self.userapiclient,
|
||||
self.test_data["vpc"],
|
||||
@ -1309,13 +1309,13 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
self.cleanup.append(vpc_1)
|
||||
# verify vpc is created and not none
|
||||
# Verify VPC name with test data
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
-1,
|
||||
vpc_1.name.find(self.test_data["vpc"]["name"]),
|
||||
"VPC name not matched"
|
||||
)
|
||||
# verify zone with test data
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.zone.id,
|
||||
vpc_1.zoneid,
|
||||
"Zone is not matching in the vpc created"
|
||||
@ -1325,7 +1325,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.test_data["listall"])
|
||||
status = validateList(vpc_count_after)
|
||||
self.assertEquals(PASS, status[0], "VPC list count is null")
|
||||
self.assertEqual(PASS, status[0], "VPC list count is null")
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(vpc_count_after),
|
||||
@ -1344,7 +1344,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(list_vpcs_after_update)
|
||||
self.assertEquals(PASS, status[0], "No vpcs found using list call")
|
||||
self.assertEqual(PASS, status[0], "No vpcs found using list call")
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpcs_after_update),
|
||||
@ -1403,7 +1403,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
)
|
||||
# No VPCs should be present for newly created user
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(FAIL, status[0], "VPCs found for newly created user")
|
||||
self.assertEqual(FAIL, status[0], "VPCs found for newly created user")
|
||||
vpc_count_before = 0
|
||||
vpc_1 = VPC.create(
|
||||
self.userapiclient,
|
||||
@ -1418,8 +1418,8 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(vpc_list)
|
||||
self.assertEquals(PASS, status[0], "VPC is not created")
|
||||
self.assertEquals(
|
||||
self.assertEqual(PASS, status[0], "VPC is not created")
|
||||
self.assertEqual(
|
||||
vpc_count_before + 1,
|
||||
len(vpc_list),
|
||||
"VPC is not created"
|
||||
@ -1445,7 +1445,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
state="Enabled"
|
||||
)
|
||||
status = validateList(network_offering_vpc_true_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default network offering not present for vpc = true")
|
||||
@ -1505,7 +1505,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
type="Isolated")
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(PASS, status[0], "No networks found using list call")
|
||||
self.assertEqual(PASS, status[0], "No networks found using list call")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
2,
|
||||
@ -1518,7 +1518,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_in_vpc)
|
||||
self.assertEquals(PASS, status[0], "No networks found in vpc")
|
||||
self.assertEqual(PASS, status[0], "No networks found in vpc")
|
||||
# Asserting for the length of the networks
|
||||
self.assertEqual(
|
||||
1,
|
||||
@ -1554,7 +1554,7 @@ class TestNetworks_1(cloudstackTestCase):
|
||||
networkid=network_created.id
|
||||
)
|
||||
status = validateList(list_network_acl)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"No networks acls found after creating")
|
||||
@ -1654,7 +1654,7 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -1703,13 +1703,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
# Listing the vpc for a user after creating a vpc
|
||||
list_vpc_after = VPC.list(self.userapiclient)
|
||||
status = validateList(list_vpc_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPC not as expected"
|
||||
)
|
||||
# Verifying the list vpc size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpc_after),
|
||||
"list VPC not equal as expected"
|
||||
@ -1721,13 +1721,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(list_vpc_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPC not as expected"
|
||||
)
|
||||
# Verifying the list vpc size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpc_byid),
|
||||
"list VPC not equal as expected"
|
||||
@ -1829,13 +1829,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
# ipaddress for network
|
||||
list_public_ipaddress_after = PublicIPAddress.list(self.userapiclient)
|
||||
status = validateList(list_public_ipaddress_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list Public IPAddress not as expected"
|
||||
)
|
||||
# Verifying the list public ipaddress size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_public_ipaddress_after),
|
||||
"list Public IPAddress not equal as expected"
|
||||
@ -1847,13 +1847,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(list_public_ipaddress_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list public ipaddress not as expected"
|
||||
)
|
||||
# Verifying the list public ipaddress size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_public_ipaddress_byid),
|
||||
"list public ipaddress not equal as expected"
|
||||
@ -1966,8 +1966,8 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
)
|
||||
# Verifying PrivateGateways are listed
|
||||
status = validateList(list_private_gateways_after)
|
||||
self.assertEquals(PASS, status[0], "Private Gateway Creation Failed")
|
||||
self.assertEquals(
|
||||
self.assertEqual(PASS, status[0], "Private Gateway Creation Failed")
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_private_gateways_after),
|
||||
"list Private Gateway not equal as expected"
|
||||
@ -1979,13 +1979,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
vpcid=vpc_created.id
|
||||
)
|
||||
status = validateList(list_privategateway_byvpcid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list private gateway not as expected"
|
||||
)
|
||||
# Verifying the list private gateway size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_privategateway_byvpcid),
|
||||
"list private gateway not equal as expected"
|
||||
@ -2089,13 +2089,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
type="Isolated"
|
||||
)
|
||||
status = validateList(list_networks_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Network Creation Failed"
|
||||
)
|
||||
# Verifying network list count is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_networks_after),
|
||||
"Network Creation Failed"
|
||||
@ -2131,13 +2131,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
networkid=network.id
|
||||
)
|
||||
status = validateList(list_egressfirewallrule_bynetworkid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list EgressFirewall Rule not as expected"
|
||||
)
|
||||
# Verifying the list EgressFirewall Rule size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_egressfirewallrule_bynetworkid),
|
||||
"list EgressFirewall Rule not equal as expected"
|
||||
@ -2215,13 +2215,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
# Listing the vpc for a user after creating a vpc
|
||||
list_vpc_after = VPC.list(self.userapiclient)
|
||||
status = validateList(list_vpc_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPC not as expected"
|
||||
)
|
||||
# Verifying the list vpc size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpc_after),
|
||||
"list VPC not equal as expected"
|
||||
@ -2238,13 +2238,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
listall=self.test_data["listall"]
|
||||
)
|
||||
status = validateList(list_vpc_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPC not as expected"
|
||||
)
|
||||
# Verifying the list vpc size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpc_byid),
|
||||
"list VPC not equal as expected"
|
||||
@ -2291,13 +2291,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
# Listing the vpc for a user after creating a vpc
|
||||
list_vpc_after = VPC.list(self.userapiclient)
|
||||
status = validateList(list_vpc_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPC not as expected"
|
||||
)
|
||||
# Verifying the list vpc size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpc_after),
|
||||
"list VPC not equal as expected"
|
||||
@ -2329,13 +2329,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
vpcid=vpc_created.id
|
||||
)
|
||||
status = validateList(list_vpngateway_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"List VPN Gateway not equal as expected"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpngateway_after
|
||||
),
|
||||
@ -2410,13 +2410,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
# Listing the vpc for a user after creating a vpc
|
||||
list_vpc_after = VPC.list(self.userapiclient)
|
||||
status = validateList(list_vpc_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPC not as expected"
|
||||
)
|
||||
# Verifying the list vpc size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpc_after),
|
||||
"list VPC not equal as expected"
|
||||
@ -2448,13 +2448,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
vpcid=vpc_created.id
|
||||
)
|
||||
status = validateList(list_vpngateway_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"List VPN Gateway not equal as expected"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpngateway_after
|
||||
),
|
||||
@ -2491,13 +2491,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
listall=self.test_data["listall"],
|
||||
)
|
||||
status = validateList(list_vpncustomergateways_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"VPN Customer Gateway list failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpncustomergateways_after),
|
||||
"Failed to list VPN Customer Gateways"
|
||||
@ -2530,13 +2530,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
vpcid=vpc_created.id
|
||||
)
|
||||
status = validateList(list_vpn_connection_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPN Connection not as expected"
|
||||
)
|
||||
# Verifying the list vpn connection size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpn_connection_after),
|
||||
"list VPC Connection equal as expected"
|
||||
@ -2553,13 +2553,13 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
vpcid=vpc_created.id
|
||||
)
|
||||
status = validateList(list_vpn_connection_after_reset)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"list VPN Connection not as expected"
|
||||
)
|
||||
# Verifying the list vpn connection size is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpn_connection_after_reset),
|
||||
"list VPN Connection not equal as expected"
|
||||
@ -2664,7 +2664,7 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
"Failed to list network acl list")
|
||||
# Verfying list is not none
|
||||
status = validateList(list_networkacl)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list network acl list"
|
||||
@ -2711,8 +2711,8 @@ class TestNetworks_2(cloudstackTestCase):
|
||||
)
|
||||
# Verifying PrivateGateways are listed
|
||||
status = validateList(list_private_gateways_after)
|
||||
self.assertEquals(PASS, status[0], "Failed to list Private Gateway")
|
||||
self.assertEquals(
|
||||
self.assertEqual(PASS, status[0], "Failed to list Private Gateway")
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_private_gateways_after),
|
||||
"list Private Gateway not equal as expected"
|
||||
|
||||
@ -95,7 +95,7 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -134,13 +134,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that default security group is created
|
||||
status = validateList(list_securitygroups_before)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default Security Groups creation failed"
|
||||
)
|
||||
# Verifying the size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_before),
|
||||
"Count of Security Groups list is not matching"
|
||||
@ -167,13 +167,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_securitygroups_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Security Groups creation failed"
|
||||
)
|
||||
# Verifying that list size is pagesize + 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"] + 1,
|
||||
len(list_securitygroups_after),
|
||||
"Failed to create pagesize + 1 number of Security Groups"
|
||||
@ -186,13 +186,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_securitygroups_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list security groups in page 1"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_securitygroups_page1),
|
||||
"Size of security groups in page 1 is not matching"
|
||||
@ -205,13 +205,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_securitygroups_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list security groups in page 2"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_page2),
|
||||
"Size of security groups in page 2 is not matching"
|
||||
@ -262,13 +262,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that default security group is created
|
||||
status = validateList(list_securitygroups_before)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default Security Groups creation failed"
|
||||
)
|
||||
# Verifying the size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_before),
|
||||
"Count of Security Groups list is not matching"
|
||||
@ -293,13 +293,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_securitygroups_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Security Groups creation failed"
|
||||
)
|
||||
# Verifying that list size is 2
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
2,
|
||||
len(list_securitygroups_after),
|
||||
"Failed to create Security Group"
|
||||
@ -320,13 +320,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that security group is listed
|
||||
status = validateList(list_securitygroups_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of Security Groups by id failed"
|
||||
)
|
||||
# Verifying size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_byid),
|
||||
"Count of the listing security group by id is not matching"
|
||||
@ -334,12 +334,12 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
securitygroup_ingress = list_securitygroups_byid[0].ingressrule
|
||||
# Validating the Ingress rule
|
||||
status = validateList(securitygroup_ingress)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Security Groups Ingress rule authorization failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(securitygroup_ingress),
|
||||
"Security Group Ingress rules count is not matching"
|
||||
@ -378,13 +378,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that security group is listed
|
||||
status = validateList(list_securitygroups_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of Security Groups by id failed"
|
||||
)
|
||||
# Verifying size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_byid),
|
||||
"Count of the listing security group by id is not matching"
|
||||
@ -392,7 +392,7 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
securitygroup_ingress = list_securitygroups_byid[0].ingressrule
|
||||
# Verifying that Ingress rule is empty(revoked)
|
||||
status = validateList(securitygroup_ingress)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
EMPTY_LIST,
|
||||
status[2],
|
||||
"Security Groups Ingress rule is not revoked"
|
||||
@ -426,13 +426,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that default security group is created
|
||||
status = validateList(list_securitygroups_before)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Default Security Groups creation failed"
|
||||
)
|
||||
# Verifying the size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_before),
|
||||
"Count of Security Groups list is not matching"
|
||||
@ -457,13 +457,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_securitygroups_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Security Groups creation failed"
|
||||
)
|
||||
# Verifying that list size is 2
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
2,
|
||||
len(list_securitygroups_after),
|
||||
"Failed to create Security Group"
|
||||
@ -484,13 +484,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that security group is listed
|
||||
status = validateList(list_securitygroups_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of Security Groups by id failed"
|
||||
)
|
||||
# Verifying size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_byid),
|
||||
"Count of the listing security group by id is not matching"
|
||||
@ -498,12 +498,12 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
securitygroup_egress = list_securitygroups_byid[0].egressrule
|
||||
# Validating the Ingress rule
|
||||
status = validateList(securitygroup_egress)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Security Groups Egress rule authorization failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(securitygroup_egress),
|
||||
"Security Group Egress rules count is not matching"
|
||||
@ -542,13 +542,13 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
)
|
||||
# Verifying that security group is listed
|
||||
status = validateList(list_securitygroups_byid)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of Security Groups by id failed"
|
||||
)
|
||||
# Verifying size of the list is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_securitygroups_byid),
|
||||
"Count of the listing security group by id is not matching"
|
||||
@ -556,7 +556,7 @@ class TestSecurityGroups(cloudstackTestCase):
|
||||
securitygroup_egress = list_securitygroups_byid[0].egressrule
|
||||
# Verifying that Ingress rule is empty(revoked)
|
||||
status = validateList(securitygroup_egress)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
EMPTY_LIST,
|
||||
status[2],
|
||||
"Security Groups Egress rule is not revoked"
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
|
||||
# Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (VmSnapshot,
|
||||
Snapshot,
|
||||
DiskOffering,
|
||||
@ -138,7 +139,7 @@ class TestSnapshots(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -188,13 +189,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(volumes_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Root volume did not get created while deploying a VM"
|
||||
)
|
||||
# Verifying list size to be 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(volumes_list),
|
||||
"More than 1 root volume created for deployed VM"
|
||||
@ -218,13 +219,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_vol_snaps_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Volume snapshot creation failed"
|
||||
)
|
||||
# Verifying that list size is pagesize + 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"] + 1,
|
||||
len(list_vol_snaps_after),
|
||||
"Failed to create pagesize + 1 number of Volume snapshots"
|
||||
@ -237,13 +238,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_vol_snaps_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list volume snapshots in page 1"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_vol_snaps_page1),
|
||||
"Size of volume snapshots in page 1 is not matching"
|
||||
@ -256,13 +257,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_vol_snaps_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list volume snapshots in page 2"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vol_snaps_page2),
|
||||
"Size of volume snapshots in page 2 is not matching"
|
||||
@ -319,13 +320,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(volumes_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Root volume did not get created while deploying a VM"
|
||||
)
|
||||
# Verifying list size to be 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(volumes_list),
|
||||
"More than 1 root volume created for deployed VM"
|
||||
@ -347,13 +348,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_vol_snaps_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Volume snapshot creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vol_snaps_after),
|
||||
"Failed to create Volume snapshot"
|
||||
@ -365,13 +366,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
id=snapshot_created.id
|
||||
)
|
||||
status = validateList(list_vol_snapshot)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list Volume snapshot by Id"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vol_snapshot),
|
||||
"Size of the list volume snapshot by Id is not matching"
|
||||
@ -454,13 +455,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_vm_snaps_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"VM snapshot creation failed"
|
||||
)
|
||||
# Verifying that list size is pagesize + 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"] + 1,
|
||||
len(list_vm_snaps_after),
|
||||
"Failed to create pagesize + 1 number of VM snapshots"
|
||||
@ -473,13 +474,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_vm_snaps_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list vm snapshots in page 1"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_vm_snaps_page1),
|
||||
"Size of vm snapshots in page 1 is not matching"
|
||||
@ -492,13 +493,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_vm_snaps_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list vm snapshots in page 2"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vm_snaps_page2),
|
||||
"Size of vm snapshots in page 2 is not matching"
|
||||
@ -526,13 +527,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"],
|
||||
)
|
||||
status = validateList(list_vm_snaps)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"All VM snapshots deleted"
|
||||
)
|
||||
# Verifying that list size is equal to page size
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_vm_snaps),
|
||||
"VM Snapshots count is not matching"
|
||||
@ -586,13 +587,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_vm_snaps_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"VM snapshot creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vm_snaps_after),
|
||||
"Failed to create VM snapshot"
|
||||
@ -604,13 +605,13 @@ class TestSnapshots(cloudstackTestCase):
|
||||
vmsnapshotid=snapshot_created.id
|
||||
)
|
||||
status = validateList(list_vm_snapshot)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list VM snapshot by Id"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vm_snapshot),
|
||||
"Size of the list vm snapshot by Id is not matching"
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
|
||||
# Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
validateList)
|
||||
from marvin.lib.base import (Account,
|
||||
@ -118,7 +119,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -231,13 +232,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
templatefilter=self.services["templatefilter"]
|
||||
)
|
||||
status = validateList(list_templates_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Templates creation failed"
|
||||
)
|
||||
# Verifying that list size is pagesize + 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"] + 1,
|
||||
len(list_templates_after),
|
||||
"Failed to create pagesize + 1 number of Templates"
|
||||
@ -251,13 +252,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_templates_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list Templates in page 1"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_templates_page1),
|
||||
"Size of Templates in page 1 is not matching"
|
||||
@ -271,13 +272,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_templates_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list Templates in page 2"
|
||||
)
|
||||
# Verifying the list size to be equal to 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_templates_page2),
|
||||
"Size of Templates in page 2 is not matching"
|
||||
@ -354,13 +355,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
templatefilter=self.services["templatefilter"]
|
||||
)
|
||||
status = validateList(list_templates_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Templates creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_templates_after),
|
||||
"Failed to create a Template"
|
||||
@ -381,7 +382,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
"Download Template failed"
|
||||
)
|
||||
# Verifying the details of downloaded template
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
"DOWNLOAD_URL_CREATED",
|
||||
download_template.state,
|
||||
"Download URL not created for Template"
|
||||
@ -390,7 +391,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
download_template.url,
|
||||
"Download URL not created for Template"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
template_created.id,
|
||||
download_template.id,
|
||||
"Download Template details are not same as Template created"
|
||||
@ -453,13 +454,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
templatefilter=self.services["templatefilter"]
|
||||
)
|
||||
status = validateList(list_templates_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Templates creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_templates_after),
|
||||
"Failed to create a Template"
|
||||
@ -551,7 +552,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
# Editing the Template ostypeid
|
||||
ostype_list = list_os_types(self.userapiclient)
|
||||
status = validateList(ostype_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list OS Types"
|
||||
@ -716,7 +717,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
available=True
|
||||
)
|
||||
status = validateList(zones_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list Zones"
|
||||
@ -756,7 +757,7 @@ class TestTemplates(cloudstackTestCase):
|
||||
zoneid=zones_list[0].id
|
||||
)
|
||||
status = validateList(zones_list)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list Hypervisors in Zone 1"
|
||||
@ -780,13 +781,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
zoneid=zones_list[0].id
|
||||
)
|
||||
status = validateList(list_templates_zone1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Templates creation failed in Zone1"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_templates_zone1),
|
||||
"Failed to create a Template"
|
||||
@ -825,13 +826,13 @@ class TestTemplates(cloudstackTestCase):
|
||||
zoneid=zones_list[0].id
|
||||
)
|
||||
status = validateList(list_templates_zone1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Templates creation failed in Zone1"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_templates_zone1),
|
||||
"Failed to create a Template"
|
||||
@ -844,23 +845,23 @@ class TestTemplates(cloudstackTestCase):
|
||||
zoneid=zones_list[1].id
|
||||
)
|
||||
status = validateList(list_templates_zone2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Template failed to copy into Zone2"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_templates_zone2),
|
||||
"Template failed to copy into Zone2"
|
||||
)
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
"Connection refused",
|
||||
list_templates_zone2[0].status,
|
||||
"Failed to copy Template"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
True,
|
||||
list_templates_zone2[0].isready,
|
||||
"Failed to copy Template"
|
||||
|
||||
@ -252,7 +252,7 @@ class TestVMware(cloudstackTestCase):
|
||||
isready="true"
|
||||
)
|
||||
status = validateList(list_default_iso_response)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO list is empty")
|
||||
@ -260,7 +260,7 @@ class TestVMware(cloudstackTestCase):
|
||||
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
|
||||
try:
|
||||
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.fail("Attached ISO failed : %s" % e)
|
||||
response = VirtualMachine.list(self.userapiclient, id=vm.id)
|
||||
status = validateList(response)
|
||||
@ -316,7 +316,7 @@ class TestVMware(cloudstackTestCase):
|
||||
isready="true"
|
||||
)
|
||||
status = validateList(list_default_iso_response)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"ISO list is empty")
|
||||
@ -324,7 +324,7 @@ class TestVMware(cloudstackTestCase):
|
||||
"Registered a ISO with name {}".format(list_default_iso_response[0].name))
|
||||
try:
|
||||
vm.attach_iso(self.userapiclient,list_default_iso_response[0])
|
||||
except CloudstackAPIException as e:
|
||||
except CloudstackAPIException as e:
|
||||
self.fail("Attached ISO failed : %s" % e)
|
||||
response = VirtualMachine.list(self.userapiclient, id=vm.id)
|
||||
status = validateList(response)
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
# under the License.
|
||||
|
||||
# Import Local Modules
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import createVolume, createTemplate
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
random_gen, validateList)
|
||||
@ -149,7 +150,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -266,7 +267,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
# Verifying that the volume on page 2 is not present in page1
|
||||
for i in range(0, len(list_volumes_page1)):
|
||||
volume_page1 = list_volumes_page1[i]
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
volume_page2.id,
|
||||
volume_page1.id,
|
||||
"Volume listed in page 2 is also listed in page 1"
|
||||
@ -482,7 +483,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
list_volumes_after = Volume.list(
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Data volume creation failed"
|
||||
@ -505,7 +506,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -563,7 +564,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
)
|
||||
self.assertIsNotNone(resized_volume, "Resize Volume failed")
|
||||
# Verifying data volume size is increased
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
new_size,
|
||||
(resized_volume.size / (1024 * 1024 * 1024)),
|
||||
"volume not resized to expected value"
|
||||
@ -637,7 +638,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
|
||||
# Verifyign that volume list is increased by 1 after creation of
|
||||
# custion volume
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Custom volume did not get created"
|
||||
@ -659,7 +660,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -691,7 +692,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
size=new_size)
|
||||
self.assertIsNotNone(resized_volume, "Resize Volume failed")
|
||||
# Verifying that custom disk size is increased
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
new_size,
|
||||
(resized_volume.size / (1024 * 1024 * 1024)),
|
||||
"volume not resized to expected value"
|
||||
@ -731,7 +732,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -753,7 +754,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -911,7 +912,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
templatefilter='self')
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
templates_before_size + 1,
|
||||
len(list_templates_after),
|
||||
"Template creation failed from snapshot"
|
||||
@ -955,7 +956,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -978,7 +979,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -1049,7 +1050,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
list_snapshot_policy_after,
|
||||
"Hourly Snapshot policy creation failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
snapshot_policy_before_size + 1,
|
||||
len(list_snapshot_policy_after),
|
||||
"Hourly Snapshot policy creation failed"
|
||||
@ -1093,7 +1094,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -1115,7 +1116,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -1186,7 +1187,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
list_snapshot_policy_after,
|
||||
"Daily Snapshot policy creation failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
snapshot_policy_before_size + 1,
|
||||
len(list_snapshot_policy_after),
|
||||
"Daily Snapshot policy creation failed"
|
||||
@ -1230,7 +1231,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -1252,7 +1253,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -1323,7 +1324,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
list_snapshot_policy_after,
|
||||
"Weekly Snapshot policy creation failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
snapshot_policy_before_size + 1,
|
||||
len(list_snapshot_policy_after),
|
||||
"Weekly Snapshot policy creation failed"
|
||||
@ -1369,7 +1370,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -1390,7 +1391,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -1459,7 +1460,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
list_snapshot_policy_after,
|
||||
"Monthly Snapshot policy creation failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
snapshot_policy_before_size + 1,
|
||||
len(list_snapshot_policy_after),
|
||||
"Monthly Snapshot policy creation failed"
|
||||
@ -1518,7 +1519,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
self.userapiclient,
|
||||
listall=self.services["listall"])
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -1539,7 +1540,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -1579,7 +1580,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
)
|
||||
self.assertIsNotNone(snapshot_created, "Snapshot not created")
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
volume_created.id,
|
||||
snapshot_created.volumeid,
|
||||
"Snapshot not created for given volume"
|
||||
@ -1630,7 +1631,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
# Verifying that the snapshot on page 2 is not present in page1
|
||||
for i in range(0, len(list_snapshots_page1)):
|
||||
snapshot_page1 = list_snapshots_page1[i]
|
||||
self.assertNotEquals(
|
||||
self.assertNotEqual(
|
||||
snapshot_page2.id,
|
||||
snapshot_page1.id,
|
||||
"Snapshot listed in page 2 is also listed in page 1"
|
||||
@ -1705,7 +1706,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
list_volumes_after,
|
||||
"volume creation failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"Volume not created"
|
||||
@ -1726,7 +1727,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
attached_volume.vmname,
|
||||
"VM is not attached to Volume"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.virtual_machine.name,
|
||||
attached_volume.vmname,
|
||||
"VM Name is not matching with attached vm"
|
||||
@ -1758,7 +1759,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
extract_volume_response,
|
||||
"Extract/Download volume failed")
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
"DOWNLOAD_URL_CREATED",
|
||||
extract_volume_response.state,
|
||||
"Failed to create Download URL"
|
||||
@ -1771,7 +1772,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
(extract_volume_response.url.find("http") != -1),
|
||||
"Extract/Download volume URL doesnot contain http"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
volume_created.id,
|
||||
extract_volume_response.id,
|
||||
"Extracted/Downloaded volume is not matching with original volume"
|
||||
@ -1815,7 +1816,7 @@ class TestVolumes(cloudstackTestCase):
|
||||
"volume not created for the vm launched at class level"
|
||||
)
|
||||
# Asserting that the list volume length after upload is increased by 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(list_volumes_before) + 1,
|
||||
len(list_volumes_after),
|
||||
"upload volume failed"
|
||||
|
||||
@ -120,7 +120,7 @@ class TestVpnCustomerGateways(cloudstackTestCase):
|
||||
if len(expected_vals) != len(actual_vals):
|
||||
return False
|
||||
|
||||
keys = expected_vals.keys()
|
||||
keys = list(expected_vals.keys())
|
||||
for i in range(0, len(expected_vals)):
|
||||
exp_val = expected_vals[keys[i]]
|
||||
act_val = actual_vals[keys[i]]
|
||||
@ -186,13 +186,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_vpncustomergateways_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"VPN Customer Gateway creation failed"
|
||||
)
|
||||
# Verifying that list size is pagesize + 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"] + 1,
|
||||
len(list_vpncustomergateways_after),
|
||||
"Failed to create pagesize + 1 number of VPN Customer Gateways"
|
||||
@ -205,13 +205,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_vpncustomergateways_page1)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list VPN Customer Gateways in page 1"
|
||||
)
|
||||
# Verifying the list size to be equal to pagesize
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.services["pagesize"],
|
||||
len(list_vpncustomergateways_page1),
|
||||
"Size of VPN Customer Gateways in page 1 is not matching"
|
||||
@ -224,13 +224,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
|
||||
pagesize=self.services["pagesize"]
|
||||
)
|
||||
status = validateList(list_vpncustomergateways_page2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list VPN Customer Gateways in page 2"
|
||||
)
|
||||
# Verifying the list size to be equal to 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpncustomergateways_page2),
|
||||
"Size of VPN Customer Gateways in page 2 is not matching"
|
||||
@ -301,13 +301,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
|
||||
listall=self.services["listall"]
|
||||
)
|
||||
status = validateList(list_vpncustomergateways_after)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"VPN Customer Gateway creation failed"
|
||||
)
|
||||
# Verifying that list size is 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpncustomergateways_after),
|
||||
"Failed to create VPN Customer Gateways"
|
||||
@ -332,13 +332,13 @@ class TestVpnCustomerGateways(cloudstackTestCase):
|
||||
id=vpncustomergateway_created.id
|
||||
)
|
||||
status = validateList(list_vpncustomergateway)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Failed to list VPN Customer Gateways by Id"
|
||||
)
|
||||
# Verifying the list size to be equal to 1
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
1,
|
||||
len(list_vpncustomergateway),
|
||||
"Size of VPN Customer Gateways by id is not matching"
|
||||
|
||||
@ -412,7 +412,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
|
||||
self.virtual_machine_2],
|
||||
services=services)
|
||||
|
||||
for method, params in configs.items():
|
||||
for method, params in list(configs.items()):
|
||||
self.debug("Creating stickiness policy for the LB rule: %s" %
|
||||
lb_rule.id)
|
||||
policies = self.configure_Stickiness_Policy(lb_rule,
|
||||
@ -496,7 +496,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
|
||||
#TODO: Add code to check the AppCookie and LbCookie Stickiness policies
|
||||
configs = {"SourceBased": {"tablesize": '100k'}}
|
||||
for lb_method in lb_methods:
|
||||
for method, params in configs.items():
|
||||
for method, params in list(configs.items()):
|
||||
self.debug("Creating load balancing rule on IP %s & algo %s" %
|
||||
(self.public_ip.ipaddress.ipaddress, lb_method))
|
||||
|
||||
@ -566,7 +566,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
|
||||
#TODO: Add code to check the AppCookie and LbCookie Stickiness policies
|
||||
configs = {"SourceBased": {"tablesize": '100k'}}
|
||||
for lb_method in lb_methods:
|
||||
for method, params in configs.items():
|
||||
for method, params in list(configs.items()):
|
||||
self.debug("Creating load balancing rule on IP %s & algo %s" %
|
||||
(self.public_ip.ipaddress.ipaddress, lb_method))
|
||||
|
||||
@ -632,7 +632,7 @@ class TestHAProxyStickyness(cloudstackTestCase):
|
||||
configs = {"SourceBased": {"tablesize": '100k'}}
|
||||
|
||||
for lb_method in lb_methods:
|
||||
for method, params in configs.items():
|
||||
for method, params in list(configs.items()):
|
||||
self.debug("Setting up environment - acquire public IP")
|
||||
public_ip = self.acquire_Public_Ip()
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from __builtin__ import False
|
||||
""" BVT tests for Hosts Test
|
||||
"""
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from __builtin__ import False
|
||||
""" BVT tests for Hosts Maintenance
|
||||
"""
|
||||
|
||||
@ -198,7 +197,7 @@ class TestHostHA(cloudstackTestCase):
|
||||
"Check if listStoragePools returns a valid response"
|
||||
)
|
||||
for storage_pool in storage_pools:
|
||||
if storage_pool.type == u'NetworkFilesystem':
|
||||
if storage_pool.type == 'NetworkFilesystem':
|
||||
return True
|
||||
|
||||
return False
|
||||
@ -218,7 +217,7 @@ class TestHostHA(cloudstackTestCase):
|
||||
"Check if listStoragePools returns a valid response"
|
||||
)
|
||||
for storage_pool in storage_pools:
|
||||
if storage_pool.type == u'NetworkFilesystem':
|
||||
if storage_pool.type == 'NetworkFilesystem':
|
||||
return False
|
||||
|
||||
return True
|
||||
@ -238,7 +237,7 @@ class TestHostHA(cloudstackTestCase):
|
||||
"Check if listStoragePools returns a valid response"
|
||||
)
|
||||
for storage_pool in storage_pools:
|
||||
if storage_pool.type == u'NetworkFilesystem':
|
||||
if storage_pool.type == 'NetworkFilesystem':
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@ -1156,10 +1156,10 @@ class TestXDCCPInterop(cloudstackTestCase):
|
||||
domainid=self.account.domainid,
|
||||
id=deployVmResponse.id
|
||||
)
|
||||
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
vm = vms[0]
|
||||
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assert_(vm.state == "Running", "VM is not in Running state")
|
||||
self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assertTrue(vm.state == "Running", "VM is not in Running state")
|
||||
return
|
||||
|
||||
@attr(tags=["devcloud", "basic", "advanced"], required_hardware="true")
|
||||
@ -1181,10 +1181,10 @@ class TestXDCCPInterop(cloudstackTestCase):
|
||||
domainid=self.account.domainid,
|
||||
id=deployVmResponse.id
|
||||
)
|
||||
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
self.assertTrue(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
|
||||
vm = vms[0]
|
||||
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assert_(vm.state == "Running", "VM is not in Running state")
|
||||
self.assertTrue(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
|
||||
self.assertTrue(vm.state == "Running", "VM is not in Running state")
|
||||
|
||||
return
|
||||
|
||||
|
||||
@ -22,7 +22,8 @@
|
||||
|
||||
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/FS+-+IP+Range+Reservation+within+a+Network
|
||||
"""
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import validateList, cleanup_resources, verifyRouterState
|
||||
from marvin.lib.base import (Account,
|
||||
Network,
|
||||
@ -762,7 +763,7 @@ class TestUpdateIPReservation(cloudstackTestCase):
|
||||
|
||||
try:
|
||||
virtual_machine_1 = createVirtualMachine(self, network_id=isolated_network.id,
|
||||
ip_address=u"10.1."+random_subnet+".3")
|
||||
ip_address="10.1."+random_subnet+".3")
|
||||
except Exception as e:
|
||||
self.fail("VM creation failed: %s" % e)
|
||||
|
||||
|
||||
@ -30,7 +30,8 @@
|
||||
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
|
||||
@ -89,7 +89,7 @@ class TestLdap(cloudstackTestCase):
|
||||
else:
|
||||
self.delflag = 1
|
||||
self.acctRes = self.apiClient.createAccount(self.acct)
|
||||
self.assertEquals(self.delflag, 1, "LDAP account details are not provided,please check the configuration")
|
||||
self.assertEqual(self.delflag, 1, "LDAP account details are not provided,please check the configuration")
|
||||
return
|
||||
|
||||
def tearDown(self):
|
||||
@ -134,13 +134,13 @@ class TestLdap(cloudstackTestCase):
|
||||
self.services["configurableData"]["ldap_configuration"]["ldapUsername"],
|
||||
self.services["configurableData"]["ldap_configuration"]["ldapPassword"])
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
else:
|
||||
|
||||
self.debug("LDAP Configuration failed with exception")
|
||||
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.ldapconfRes,
|
||||
1,
|
||||
self.reason)
|
||||
@ -250,7 +250,7 @@ class TestLdap(cloudstackTestCase):
|
||||
tn = telnetlib.Telnet(ldapConfiguration['hostname'], ldapConfiguration['port'], timeout=15)
|
||||
if tn is not None:
|
||||
tn.set_debuglevel(1)
|
||||
print tn.msg("Connected to the server")
|
||||
print(tn.msg("Connected to the server"))
|
||||
self.debug("Ldap Server is Up and listening on the port %s" % tn.msg("Connected to the server"))
|
||||
flag = True
|
||||
tn.close()
|
||||
|
||||
@ -143,7 +143,7 @@ def checkLdapConfiguration(cls, ldapConfiguration):
|
||||
timeout=15)
|
||||
if tn is not None:
|
||||
tn.set_debuglevel(1)
|
||||
print tn.msg("Connected to the server")
|
||||
print(tn.msg("Connected to the server"))
|
||||
cls.debug(
|
||||
"Ldap Server is Up and listening on the port %s" %
|
||||
tn.msg("Connected to the server"))
|
||||
@ -251,7 +251,7 @@ class TestLdap(cloudstackTestCase):
|
||||
else:
|
||||
self.delflag1 = 1
|
||||
self.ldaplinkRes = self.apiClient.linkDomainToLdap(self.ldaplink)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.delflag1,
|
||||
1,
|
||||
"Linking LDAP failed,please check the configuration")
|
||||
@ -260,7 +260,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
lsap_user = Account.list(self.api_client,
|
||||
domainid=self.parent_domain.id,
|
||||
@ -328,7 +328,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_03_ldap(self):
|
||||
@ -340,7 +340,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, None, self.reason)
|
||||
self.assertEqual(loginRes, None, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_04_ldap(self):
|
||||
@ -353,7 +353,7 @@ class TestLdap(cloudstackTestCase):
|
||||
"",
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, None, self.reason)
|
||||
self.assertEqual(loginRes, None, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_05_ldap(self):
|
||||
@ -362,7 +362,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, None, self.reason)
|
||||
self.assertEqual(loginRes, None, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_06_ldap(self):
|
||||
@ -395,7 +395,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_07_ldap(self):
|
||||
@ -414,7 +414,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, None, self.reason)
|
||||
self.assertEqual(loginRes, None, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_08_ldap(self):
|
||||
@ -428,7 +428,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
self.domain2 = Domain.create(
|
||||
self.apiclient,
|
||||
@ -465,7 +465,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.delflag2 = 1
|
||||
self.ldaplinkRes2 = self.apiClient.linkDomainToLdap(
|
||||
self.ldaplink2)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.delflag2,
|
||||
1,
|
||||
"Linking LDAP failed,please check the configuration")
|
||||
@ -477,7 +477,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.domain2.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
self.domain3 = Domain.create(
|
||||
self.apiclient,
|
||||
@ -511,7 +511,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.delflag3 = 1
|
||||
self.ldaplinkRes3 = self.apiClient.linkDomainToLdap(
|
||||
self.ldaplink3)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
self.delflag3,
|
||||
1,
|
||||
"Linking LDAP failed,please check the configuration")
|
||||
@ -522,7 +522,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.domain2.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
finally:
|
||||
try:
|
||||
@ -556,7 +556,7 @@ class TestLdap(cloudstackTestCase):
|
||||
self.parent_domain.name,
|
||||
method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, 1, self.reason)
|
||||
self.assertEqual(loginRes, 1, self.reason)
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_10_ldap(self):
|
||||
@ -584,7 +584,7 @@ class TestLdap(cloudstackTestCase):
|
||||
dbChecking[0][2]) == \
|
||||
self.services["configurableData"]["link_ldap_details"]["accounttype"]:
|
||||
db_check = 0
|
||||
self.assertEquals(db_check, 0, "DB check failed")
|
||||
self.assertEqual(db_check, 0, "DB check failed")
|
||||
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_11_ldap(self):
|
||||
@ -593,6 +593,6 @@ class TestLdap(cloudstackTestCase):
|
||||
self,
|
||||
"", "", self.parent_domain.name, method="POST")
|
||||
self.debug(loginRes)
|
||||
self.assertEquals(loginRes, None, self.reason)
|
||||
self.assertEqual(loginRes, None, self.reason)
|
||||
|
||||
|
||||
|
||||
@ -147,4 +147,4 @@ class TestDeployVM(cloudstackTestCase):
|
||||
cleanup_resources(self.apiclient, self.cleanup)
|
||||
except Exception as e:
|
||||
self.debug("Warning! Exception in tearDown: %s" % e)
|
||||
return
|
||||
return
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (cleanup_resources)
|
||||
from marvin.lib.base import (Pod, Cluster, Capacities)
|
||||
from marvin.cloudstackAPI import (updateConfiguration)
|
||||
|
||||
@ -16,25 +16,26 @@
|
||||
# under the License.
|
||||
""" P1 tests for memory resource limits
|
||||
"""
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
Resources,
|
||||
Domain
|
||||
)
|
||||
from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
wait_for_cleanup,
|
||||
findSuitableHostForMigration,
|
||||
get_resource_type
|
||||
)
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
Resources,
|
||||
Domain
|
||||
)
|
||||
from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
wait_for_cleanup,
|
||||
findSuitableHostForMigration,
|
||||
get_resource_type
|
||||
)
|
||||
from marvin.lib.utils import cleanup_resources
|
||||
from marvin.codes import ERROR_NO_HOST_FOR_MIGRATION
|
||||
|
||||
|
||||
class Services:
|
||||
"""Test memory resource limit services
|
||||
@ -42,50 +43,51 @@ class Services:
|
||||
|
||||
def __init__(self):
|
||||
self.services = {
|
||||
"account": {
|
||||
"email": "test@test.com",
|
||||
"firstname": "Test",
|
||||
"lastname": "User",
|
||||
"username": "resource",
|
||||
# Random characters are appended for unique
|
||||
# username
|
||||
"password": "password",
|
||||
},
|
||||
"service_offering": {
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 2048, # In MBs
|
||||
},
|
||||
"virtual_machine": {
|
||||
"displayname": "TestVM",
|
||||
"username": "root",
|
||||
"password": "password",
|
||||
"ssh_port": 22,
|
||||
"hypervisor": 'KVM',
|
||||
"privateport": 22,
|
||||
"publicport": 22,
|
||||
"protocol": 'TCP',
|
||||
},
|
||||
"network": {
|
||||
"name": "Test Network",
|
||||
"displaytext": "Test Network",
|
||||
"netmask": '255.255.255.0'
|
||||
},
|
||||
"project": {
|
||||
"name": "Project",
|
||||
"displaytext": "Test project",
|
||||
},
|
||||
"domain": {
|
||||
"name": "Domain",
|
||||
},
|
||||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
# Networking mode: Advanced, Basic
|
||||
}
|
||||
"account": {
|
||||
"email": "test@test.com",
|
||||
"firstname": "Test",
|
||||
"lastname": "User",
|
||||
"username": "resource",
|
||||
# Random characters are appended for unique
|
||||
# username
|
||||
"password": "password",
|
||||
},
|
||||
"service_offering": {
|
||||
"name": "Tiny Instance",
|
||||
"displaytext": "Tiny Instance",
|
||||
"cpunumber": 1,
|
||||
"cpuspeed": 100, # in MHz
|
||||
"memory": 2048, # In MBs
|
||||
},
|
||||
"virtual_machine": {
|
||||
"displayname": "TestVM",
|
||||
"username": "root",
|
||||
"password": "password",
|
||||
"ssh_port": 22,
|
||||
"hypervisor": 'KVM',
|
||||
"privateport": 22,
|
||||
"publicport": 22,
|
||||
"protocol": 'TCP',
|
||||
},
|
||||
"network": {
|
||||
"name": "Test Network",
|
||||
"displaytext": "Test Network",
|
||||
"netmask": '255.255.255.0'
|
||||
},
|
||||
"project": {
|
||||
"name": "Project",
|
||||
"displaytext": "Test project",
|
||||
},
|
||||
"domain": {
|
||||
"name": "Domain",
|
||||
},
|
||||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
# Networking mode: Advanced, Basic
|
||||
}
|
||||
|
||||
|
||||
class TestMemoryLimits(cloudstackTestCase):
|
||||
|
||||
@ -102,17 +104,17 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
cls.services["mode"] = cls.zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
|
||||
cls._cleanup = [cls.service_offering, ]
|
||||
return
|
||||
@ -130,13 +132,13 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
self.apiclient = self.testClient.getApiClient()
|
||||
self.dbclient = self.testClient.getDbConnection()
|
||||
self.account = Account.create(
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True
|
||||
)
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True
|
||||
)
|
||||
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
self.service_offering.name)
|
||||
self.service_offering.name)
|
||||
self.vm = self.createInstance(service_off=self.service_offering)
|
||||
|
||||
self.cleanup = [self.account, ]
|
||||
@ -153,20 +155,20 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
def createInstance(self, service_off, networks=None, api_client=None):
|
||||
"""Creates an instance in account"""
|
||||
self.debug("Deploying an instance in account: %s" %
|
||||
self.account.name)
|
||||
self.account.name)
|
||||
|
||||
if api_client is None:
|
||||
api_client = self.apiclient
|
||||
api_client = self.apiclient
|
||||
|
||||
try:
|
||||
vm = VirtualMachine.create(
|
||||
api_client,
|
||||
self.services["virtual_machine"],
|
||||
templateid=self.template.id,
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkids=networks,
|
||||
serviceofferingid=service_off.id)
|
||||
api_client,
|
||||
self.services["virtual_machine"],
|
||||
templateid=self.template.id,
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkids=networks,
|
||||
serviceofferingid=service_off.id)
|
||||
vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
|
||||
self.assertIsInstance(vms,
|
||||
list,
|
||||
@ -177,7 +179,7 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("Failed to deploy an instance: %s" % e)
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
|
||||
def test_01_stop_start_instance(self):
|
||||
"""Test Deploy VM with specified RAM & verify the usage"""
|
||||
|
||||
@ -229,7 +231,7 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
"Resource count should be same after stopping the instance")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="true")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="true")
|
||||
def test_02_migrate_instance(self):
|
||||
"""Test Deploy VM with specified RAM & verify the usage"""
|
||||
|
||||
@ -273,7 +275,7 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
"Resource count should be same after stopping the instance")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
|
||||
def test_03_delete_instance(self):
|
||||
"""Test Deploy VM with specified GB RAM & verify the usage"""
|
||||
|
||||
@ -300,8 +302,8 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("Failed to delete instance: %s" % e)
|
||||
|
||||
# Wait for expunge interval to cleanup Memory
|
||||
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
|
||||
# Wait for expunge interval to cleanup Memory
|
||||
wait_for_cleanup(self.apiclient, ["expunge.delay", "expunge.interval"])
|
||||
|
||||
account_list = Account.list(self.apiclient, id=self.account.id)
|
||||
self.assertIsInstance(account_list,
|
||||
@ -309,10 +311,10 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
"List Accounts should return a valid response"
|
||||
)
|
||||
resource_count_after_delete = account_list[0].memorytotal
|
||||
self.assertEqual(resource_count_after_delete, 0 , "Resource count for %s should be 0" % get_resource_type(resource_id=9))#RAM
|
||||
self.assertEqual(resource_count_after_delete, 0, "Resource count for %s should be 0" % get_resource_type(resource_id=9)) # RAM
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
|
||||
def test_04_deploy_multiple_vm(self):
|
||||
"""Test Deploy multiple VM with specified RAM & verify the usage"""
|
||||
|
||||
@ -335,7 +337,7 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
"Resource count should match with the expected resource count")
|
||||
|
||||
self.debug("Creating two instances with service offering: %s" %
|
||||
self.service_offering.name)
|
||||
self.service_offering.name)
|
||||
vm_1 = self.createInstance(service_off=self.service_offering)
|
||||
self.createInstance(service_off=self.service_offering)
|
||||
|
||||
@ -346,7 +348,7 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
)
|
||||
resource_count_new = account_list[0].memorytotal
|
||||
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"]) * 3 #Total 3 VMs
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"]) * 3 # Total 3 VMs
|
||||
|
||||
self.assertEqual(resource_count_new, expected_resource_count,
|
||||
"Resource count should match with the expected resource count")
|
||||
@ -370,6 +372,7 @@ class TestMemoryLimits(cloudstackTestCase):
|
||||
"Resource count should match with the expected resource count")
|
||||
return
|
||||
|
||||
|
||||
class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -384,17 +387,17 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
cls.services["mode"] = cls.zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
cls.api_client,
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
|
||||
cls._cleanup = [cls.service_offering, ]
|
||||
return
|
||||
@ -426,20 +429,20 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
def createInstance(self, service_off, networks=None, api_client=None):
|
||||
"""Creates an instance in account"""
|
||||
self.debug("Deploying an instance in account: %s" %
|
||||
self.account.name)
|
||||
self.account.name)
|
||||
|
||||
if api_client is None:
|
||||
api_client = self.apiclient
|
||||
api_client = self.apiclient
|
||||
|
||||
try:
|
||||
vm = VirtualMachine.create(
|
||||
api_client,
|
||||
self.services["virtual_machine"],
|
||||
templateid=self.template.id,
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkids=networks,
|
||||
serviceofferingid=service_off.id)
|
||||
api_client,
|
||||
self.services["virtual_machine"],
|
||||
templateid=self.template.id,
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkids=networks,
|
||||
serviceofferingid=service_off.id)
|
||||
vms = VirtualMachine.list(api_client, id=vm.id, listall=True)
|
||||
self.assertIsInstance(vms,
|
||||
list,
|
||||
@ -458,11 +461,11 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
parentdomainid=self.domain.id)
|
||||
|
||||
self.child_do_admin_1 = Account.create(
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True,
|
||||
domainid=self.child_domain_1.id
|
||||
)
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True,
|
||||
domainid=self.child_domain_1.id
|
||||
)
|
||||
# Cleanup the resources created at end of test
|
||||
self.cleanup.append(self.child_do_admin_1)
|
||||
self.cleanup.append(self.child_domain_1)
|
||||
@ -470,21 +473,21 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
self.debug("Creating a domain under: %s" % self.domain.name)
|
||||
|
||||
self.child_domain_2 = Domain.create(self.apiclient,
|
||||
services=self.services["domain"],
|
||||
parentdomainid=self.domain.id)
|
||||
services=self.services["domain"],
|
||||
parentdomainid=self.domain.id)
|
||||
|
||||
self.child_do_admin_2 = Account.create(
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True,
|
||||
domainid=self.child_domain_2.id)
|
||||
self.apiclient,
|
||||
self.services["account"],
|
||||
admin=True,
|
||||
domainid=self.child_domain_2.id)
|
||||
# Cleanup the resources created at end of test
|
||||
self.cleanup.append(self.child_do_admin_2)
|
||||
self.cleanup.append(self.child_domain_2)
|
||||
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
|
||||
def test_01_stop_start_instance(self):
|
||||
"""Test Deploy VM with 5 GB memory & verify the usage"""
|
||||
|
||||
@ -499,16 +502,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
api_client = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
self.service_offering.name)
|
||||
self.service_offering.name)
|
||||
vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
|
||||
|
||||
account_list = Account.list(self.apiclient, id=self.account.id)
|
||||
@ -521,7 +524,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"])
|
||||
|
||||
self.assertEqual(resource_count, expected_resource_count,
|
||||
"Initial resource count should match with the expected resource count")
|
||||
"Initial resource count should match with the expected resource count")
|
||||
|
||||
self.debug("Stopping instance: %s" % vm.name)
|
||||
try:
|
||||
@ -537,7 +540,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
resource_count_after_stop = account_list[0].memorytotal
|
||||
|
||||
self.assertEqual(resource_count, resource_count_after_stop,
|
||||
"Resource count should be same after stopping the instance")
|
||||
"Resource count should be same after stopping the instance")
|
||||
|
||||
self.debug("Starting instance: %s" % vm.name)
|
||||
try:
|
||||
@ -553,10 +556,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
resource_count_after_start = account_list[0].memorytotal
|
||||
|
||||
self.assertEqual(resource_count_after_stop, resource_count_after_start,
|
||||
"Resource count should be same after starting the instance")
|
||||
"Resource count should be same after starting the instance")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="true")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="true")
|
||||
def test_02_migrate_instance(self):
|
||||
"""Test Deploy VM with specified memory & verify the usage"""
|
||||
|
||||
@ -574,16 +577,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
api_client = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
self.service_offering.name)
|
||||
self.service_offering.name)
|
||||
vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
|
||||
|
||||
account_list = Account.list(self.apiclient, id=self.account.id)
|
||||
@ -596,13 +599,13 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"])
|
||||
|
||||
self.assertEqual(resource_count, expected_resource_count,
|
||||
"Initial resource count should with the expected resource count")
|
||||
"Initial resource count should with the expected resource count")
|
||||
|
||||
host = findSuitableHostForMigration(self.apiclient, vm.id)
|
||||
if host is None:
|
||||
self.skipTest(ERROR_NO_HOST_FOR_MIGRATION)
|
||||
self.debug("Migrating instance: %s to host: %s" %
|
||||
(vm.name, host.name))
|
||||
(vm.name, host.name))
|
||||
try:
|
||||
vm.migrate(self.apiclient, host.id)
|
||||
except Exception as e:
|
||||
@ -616,10 +619,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
resource_count_after_migrate = account_list[0].memorytotal
|
||||
|
||||
self.assertEqual(resource_count, resource_count_after_migrate,
|
||||
"Resource count should be same after starting the instance")
|
||||
"Resource count should be same after starting the instance")
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"], required_hardware="false")
|
||||
@attr(tags=["advanced", "advancedns", "simulator"], required_hardware="false")
|
||||
def test_03_delete_instance(self):
|
||||
"""Test Deploy VM with specified RAM & verify the usage"""
|
||||
|
||||
@ -634,16 +637,16 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
api_client = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
self.service_offering.name)
|
||||
self.service_offering.name)
|
||||
vm = self.createInstance(service_off=self.service_offering, api_client=api_client)
|
||||
|
||||
account_list = Account.list(self.apiclient, id=self.account.id)
|
||||
@ -656,7 +659,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"])
|
||||
|
||||
self.assertEqual(resource_count, expected_resource_count,
|
||||
"Initial resource count should match with the expected resource count")
|
||||
"Initial resource count should match with the expected resource count")
|
||||
|
||||
self.debug("Destroying instance: %s" % vm.name)
|
||||
try:
|
||||
@ -670,14 +673,14 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
"List Accounts should return a valid response"
|
||||
)
|
||||
resource_count = account_list[0].memorytotal
|
||||
self.assertEqual(resource_count, 0 , "Resource count for %s should be 0" % get_resource_type(resource_id=9))#RAM
|
||||
self.assertEqual(resource_count, 0, "Resource count for %s should be 0" % get_resource_type(resource_id=9)) # RAM
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "advancedns","simulator"])
|
||||
@attr(tags=["advanced", "advancedns", "simulator"])
|
||||
@attr(configuration='max.account.memory')
|
||||
def test_04_deploy_multiple_vm(self):
|
||||
"""Test Deploy multiple VM with 2 GB memory & verify the usage"""
|
||||
#keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)
|
||||
# keep the configuration value - max.account.memory = 8192 (maximum 4 instances per account with 2 GB RAM)
|
||||
|
||||
# Validate the following
|
||||
# 1. Create compute offering with 2 GB RAM
|
||||
@ -687,9 +690,9 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
|
||||
self.debug("Creating service offering with 2 GB RAM")
|
||||
self.service_offering = ServiceOffering.create(
|
||||
self.apiclient,
|
||||
self.services["service_offering"]
|
||||
)
|
||||
self.apiclient,
|
||||
self.services["service_offering"]
|
||||
)
|
||||
# Adding to cleanup list after execution
|
||||
self.cleanup.append(self.service_offering)
|
||||
|
||||
@ -698,25 +701,25 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
users = {self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
memory_account_gc = Resources.list(self.apiclient,
|
||||
resourcetype = 9, #Memory
|
||||
account = self.account.name,
|
||||
domainid = self.domain.id
|
||||
)
|
||||
resourcetype=9, # Memory
|
||||
account=self.account.name,
|
||||
domainid=self.domain.id
|
||||
)
|
||||
|
||||
if memory_account_gc[0].max != 8192:
|
||||
self.skipTest("This test case requires configuration value max.account.memory to be 8192")
|
||||
|
||||
api_client = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
api_client = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain)
|
||||
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
self.service_offering.name)
|
||||
self.service_offering.name)
|
||||
vm_1 = self.createInstance(service_off=self.service_offering, api_client=api_client)
|
||||
vm_2 = self.createInstance(service_off=self.service_offering, api_client=api_client)
|
||||
self.createInstance(service_off=self.service_offering, api_client=api_client)
|
||||
@ -733,10 +736,10 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
)
|
||||
resource_count = account_list[0].memorytotal
|
||||
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 #Total 4 vms
|
||||
expected_resource_count = int(self.services["service_offering"]["memory"]) * 4 # Total 4 vms
|
||||
|
||||
self.assertEqual(resource_count, expected_resource_count,
|
||||
"Initial resource count should with the expected resource count")
|
||||
"Initial resource count should with the expected resource count")
|
||||
|
||||
self.debug("Destroying instance: %s" % vm_1.name)
|
||||
try:
|
||||
@ -754,7 +757,7 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
expected_resource_count -= int(self.services["service_offering"]["memory"])
|
||||
|
||||
self.assertEqual(resource_count_after_delete, expected_resource_count,
|
||||
"Resource count should match with the expected resource count")
|
||||
"Resource count should match with the expected resource count")
|
||||
|
||||
host = findSuitableHostForMigration(self.apiclient, vm_2.id)
|
||||
if host is None:
|
||||
@ -775,5 +778,5 @@ class TestDomainMemoryLimitsConfiguration(cloudstackTestCase):
|
||||
|
||||
self.debug(resource_count_after_migrate)
|
||||
self.assertEqual(resource_count_after_delete, resource_count_after_migrate,
|
||||
"Resource count should be same after migrating the instance")
|
||||
"Resource count should be same after migrating the instance")
|
||||
return
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
@ -225,7 +226,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
|
||||
users = { self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -369,7 +370,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
|
||||
users = { self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
@ -430,7 +431,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
|
||||
users = { self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
@ -490,7 +491,7 @@ class TestDomainMemoryLimits(cloudstackTestCase):
|
||||
users = { self.child_domain_1: self.child_do_admin_1,
|
||||
self.child_domain_2: self.child_do_admin_2
|
||||
}
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
self.debug("Creating an instance with service offering: %s" %
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
|
||||
@ -19,7 +19,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.sshClient import SshClient
|
||||
from marvin.lib.utils import (validateList,
|
||||
cleanup_resources,
|
||||
|
||||
@ -1011,7 +1011,7 @@ class TestVPCPortForwarding(cloudstackTestCase):
|
||||
)
|
||||
logger.debug("Created network with ID: %s" % obj_network.id)
|
||||
return obj_network
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
|
||||
|
||||
def deployvm_in_network(self, network, host_id=None):
|
||||
@ -1231,7 +1231,7 @@ class TestVPCStaticNat(cloudstackTestCase):
|
||||
)
|
||||
logger.debug("Created network with ID: %s" % obj_network.id)
|
||||
return obj_network
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
|
||||
|
||||
def deployvm_in_network(self, network, host_id=None):
|
||||
|
||||
@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackAPI import rebootRouter
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (validateList,
|
||||
get_host_credentials,
|
||||
get_process_status,
|
||||
|
||||
@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackAPI import rebootRouter
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (validateList,
|
||||
get_host_credentials,
|
||||
get_process_status,
|
||||
|
||||
@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackAPI import rebootRouter
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (validateList,
|
||||
get_host_credentials,
|
||||
get_process_status,
|
||||
|
||||
@ -21,7 +21,8 @@ Tests of acquiring IPs in multiple subnets for isolated network or vpc
|
||||
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackAPI import rebootRouter
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.utils import (validateList,
|
||||
get_host_credentials,
|
||||
get_process_status,
|
||||
|
||||
@ -785,7 +785,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
issystem = "true"
|
||||
)
|
||||
status = validateList(vr_sys_off_res)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of VR system offering failed"
|
||||
@ -815,17 +815,17 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
||||
id=self.network_offering.id
|
||||
)
|
||||
status = validateList(network_off_res)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
PASS,
|
||||
status[0],
|
||||
"Listing of network offerings failed"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
len(network_off_res),
|
||||
1,
|
||||
"More than one network offerings are created"
|
||||
)
|
||||
self.assertEquals(
|
||||
self.assertEqual(
|
||||
network_off_res[0].serviceofferingid,
|
||||
vr_sys_off.id,
|
||||
"FAIL: Network offering has been created with default system offering"
|
||||
|
||||
@ -176,7 +176,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
||||
vlans = xsplit(vlan,[','])
|
||||
|
||||
for virtualLan in vlans:
|
||||
self.assert_(physicalnetworks[0].vlan.find(virtualLan) != -1, "vlan range %s \
|
||||
self.assertTrue(physicalnetworks[0].vlan.find(virtualLan) != -1, "vlan range %s \
|
||||
is not present in physical network: %s" % (virtualLan, physicalNetworkId))
|
||||
|
||||
return
|
||||
@ -193,7 +193,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
||||
vlan1 = self.existingvlan + "," + self.vlan["partial_range"][0]
|
||||
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan1)
|
||||
|
||||
self.assert_(updatePhysicalNetworkResponse is not None,
|
||||
self.assertTrue(updatePhysicalNetworkResponse is not None,
|
||||
msg="couldn't add non contiguous range in the physical network with vlan %s"%vlan1)
|
||||
|
||||
self.debug("Verifying the VLAN of the updated physical network: %s, It should match with \
|
||||
@ -204,7 +204,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
||||
vlan2 = vlan1 + "," + self.vlan["partial_range"][1]
|
||||
updatePhysicalNetworkResponse2 = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2)
|
||||
|
||||
self.assert_(updatePhysicalNetworkResponse2 is not None,
|
||||
self.assertTrue(updatePhysicalNetworkResponse2 is not None,
|
||||
msg="couldn't add non contiguous range in the physical network with vlan %s"%vlan2)
|
||||
|
||||
self.debug("Verifying the VLAN of the updated physical network: %s, It should match with \
|
||||
@ -252,7 +252,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
||||
vlan2 = vlan1 + "," + self.vlan["full_range"]
|
||||
updatePhysicalNetworkResponse = self.physicalnetwork.update(self.apiClient, id = self.physicalnetworkid, vlan = vlan2)
|
||||
|
||||
self.assert_(updatePhysicalNetworkResponse is not None,
|
||||
self.assertTrue(updatePhysicalNetworkResponse is not None,
|
||||
msg="couldn't extend the physical network with vlan %s"%vlan2)
|
||||
|
||||
extendedvlan = self.existingvlan + "," + self.vlan["full_range"]
|
||||
@ -289,7 +289,7 @@ class TestNonContiguousVLANRanges(cloudstackTestCase):
|
||||
|
||||
vlanranges= physicalnetworks[0].vlan
|
||||
|
||||
self.assert_(vlanranges.find(self.vlan["partial_range"][0]) == -1, "vlan range is not removed")
|
||||
self.assertTrue(vlanranges.find(self.vlan["partial_range"][0]) == -1, "vlan range is not removed")
|
||||
|
||||
return
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -394,7 +394,7 @@ class Overcommit (cloudstackTestCase):
|
||||
"check list cluster response for zone id %s" %
|
||||
self.zone.id)
|
||||
k = len(list_cluster)
|
||||
for id in xrange(k):
|
||||
for id in range(k):
|
||||
Configurations.update(self.apiclient,
|
||||
clusterid=list_cluster[id].id,
|
||||
name="mem.overprovisioning.factor",
|
||||
@ -414,7 +414,7 @@ class Overcommit (cloudstackTestCase):
|
||||
"check list capacity response for zone id %s" %
|
||||
self.zone.id)
|
||||
cpu, mem = capacity_parser(capacity)
|
||||
for id in xrange(k):
|
||||
for id in range(k):
|
||||
Configurations.update(self.apiclient,
|
||||
clusterid=list_cluster[id].id,
|
||||
name="mem.overprovisioning.factor",
|
||||
@ -452,7 +452,7 @@ class Overcommit (cloudstackTestCase):
|
||||
self.assertEqual(mem[2],
|
||||
mem1[2],
|
||||
"check mem capacity % used")
|
||||
for id in xrange(k):
|
||||
for id in range(k):
|
||||
Configurations.update(self.apiclient,
|
||||
clusterid=list_cluster[id].id,
|
||||
name="mem.overprovisioning.factor",
|
||||
|
||||
@ -44,7 +44,8 @@ from marvin.lib.common import (get_domain,
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.codes import PASS, FAIL, FAILED
|
||||
from marvin.sshClient import SshClient
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from ddt import ddt, data
|
||||
import time
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
#from marvin.cloudstackAPI import *
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
validateList)
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (VirtualMachine,
|
||||
Account,
|
||||
Project,
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
"""
|
||||
#Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import deleteVolume
|
||||
from marvin.lib.utils import (cleanup_resources, validateList)
|
||||
from marvin.lib.base import (Project,
|
||||
@ -2026,4 +2027,4 @@ class TestVMSnapshotUsage(cloudstackTestCase):
|
||||
1,
|
||||
"Check VM.SNAPSHOT.DELETE in events table"
|
||||
)
|
||||
return
|
||||
return
|
||||
|
||||
@ -21,7 +21,8 @@ Tests protocol number support for security groups
|
||||
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.cloudstackAPI import authorizeSecurityGroupIngress, revokeSecurityGroupIngress, authorizeSecurityGroupEgress, revokeSecurityGroupEgress
|
||||
from marvin.sshClient import SshClient
|
||||
from marvin.lib.utils import (validateList,
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
@ -366,7 +367,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
||||
|
||||
templatesize = (self.template.size / (1024 ** 3))
|
||||
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -454,7 +455,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
||||
|
||||
templatesize = (self.template.size / (1024 ** 3))
|
||||
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -562,7 +563,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
||||
result[1])
|
||||
users = result[2]
|
||||
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
|
||||
@ -724,7 +725,7 @@ class TestMultipleChildDomain(cloudstackTestCase):
|
||||
self.assertEqual(result[0], PASS, result[1])
|
||||
users = result[2]
|
||||
|
||||
for domain, admin in users.items():
|
||||
for domain, admin in list(users.items()):
|
||||
self.account = admin
|
||||
self.domain = domain
|
||||
try:
|
||||
|
||||
@ -23,31 +23,36 @@
|
||||
|
||||
Feature Specifications: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Limit+Resources+to+domains+and+accounts
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
import unittest
|
||||
|
||||
from ddt import ddt, data
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
from marvin.codes import (
|
||||
PASS,
|
||||
FAIL,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
CHILD_DOMAIN_ADMIN,
|
||||
ROOT_DOMAIN_ADMIN)
|
||||
from marvin.lib.base import (
|
||||
Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
Domain,
|
||||
Volume,
|
||||
DiskOffering)
|
||||
from marvin.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
matchResourceCount,
|
||||
createSnapshotFromVirtualMachineVolume,
|
||||
isVmExpunged,
|
||||
find_storage_pool_type)
|
||||
Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
Domain,
|
||||
Volume,
|
||||
DiskOffering)
|
||||
from marvin.lib.common import (
|
||||
get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
matchResourceCount,
|
||||
createSnapshotFromVirtualMachineVolume,
|
||||
isVmExpunged,
|
||||
find_storage_pool_type)
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
validateList)
|
||||
from marvin.codes import (PASS,
|
||||
FAIL,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
CHILD_DOMAIN_ADMIN,
|
||||
ROOT_DOMAIN_ADMIN)
|
||||
from ddt import ddt, data
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
|
||||
|
||||
@ddt
|
||||
class TestVolumeLimits(cloudstackTestCase):
|
||||
@ -55,7 +60,7 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cloudstackTestClient = super(TestVolumeLimits,
|
||||
cls).getClsTestClient()
|
||||
cls).getClsTestClient()
|
||||
cls.api_client = cloudstackTestClient.getApiClient()
|
||||
cls.hypervisor = cloudstackTestClient.getHypervisorInfo()
|
||||
# Fill services from the external config file
|
||||
@ -72,10 +77,10 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
return
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
cls.services["ostype"]
|
||||
)
|
||||
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
cls.services["virtual_machine"]["template"] = cls.template.id
|
||||
@ -108,8 +113,8 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
try:
|
||||
self.services["disk_offering"]["disksize"] = 2
|
||||
self.disk_offering = DiskOffering.create(self.apiclient, self.services["disk_offering"])
|
||||
self.assertNotEqual(self.disk_offering, None,\
|
||||
"Disk offering is None")
|
||||
self.assertNotEqual(self.disk_offering, None, \
|
||||
"Disk offering is None")
|
||||
self.cleanup.append(self.disk_offering)
|
||||
except Exception as e:
|
||||
self.tearDown()
|
||||
@ -131,19 +136,19 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
try:
|
||||
if accountType == CHILD_DOMAIN_ADMIN:
|
||||
self.domain = Domain.create(self.apiclient,
|
||||
services=self.services["domain"],
|
||||
parentdomainid=self.domain.id)
|
||||
services=self.services["domain"],
|
||||
parentdomainid=self.domain.id)
|
||||
|
||||
self.account = Account.create(self.apiclient, self.services["account"],
|
||||
domainid=self.domain.id, admin=True)
|
||||
domainid=self.domain.id, admin=True)
|
||||
self.cleanup.append(self.account)
|
||||
if accountType == CHILD_DOMAIN_ADMIN:
|
||||
self.cleanup.append(self.domain)
|
||||
|
||||
self.virtualMachine = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
|
||||
accountid=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=self.disk_offering.id,
|
||||
serviceofferingid=self.service_offering.id)
|
||||
accountid=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=self.disk_offering.id,
|
||||
serviceofferingid=self.service_offering.id)
|
||||
|
||||
accounts = Account.list(self.apiclient, id=self.account.id)
|
||||
|
||||
@ -156,7 +161,7 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
return [PASS, None]
|
||||
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic"], required_hardware="false")
|
||||
@attr(tags=["advanced", "basic"], required_hardware="false")
|
||||
def test_stop_start_vm(self, value):
|
||||
"""Test Deploy VM with 5 GB volume & verify the usage
|
||||
|
||||
@ -175,9 +180,9 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("Failed to stop instance: %s" % e)
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
# Starting instance
|
||||
@ -187,15 +192,15 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.fail("Failed to start instance: %s" % e)
|
||||
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
|
||||
@unittest.skip("skip")
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic"], required_hardware="false")
|
||||
@attr(tags=["advanced", "basic"], required_hardware="false")
|
||||
def test_destroy_recover_vm(self, value):
|
||||
"""Test delete and recover instance
|
||||
|
||||
@ -214,9 +219,9 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("Failed to destroy instance: %s" % e)
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
# Recovering instance
|
||||
@ -226,14 +231,14 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.fail("Failed to start instance: %s" % e)
|
||||
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic"], required_hardware="false")
|
||||
@attr(tags=["advanced", "basic"], required_hardware="false")
|
||||
def test_attach_detach_volume(self, value):
|
||||
"""Stop attach and detach volume from VM
|
||||
|
||||
@ -251,9 +256,9 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
apiclient = self.apiclient
|
||||
if value == CHILD_DOMAIN_ADMIN:
|
||||
apiclient = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain
|
||||
)
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain
|
||||
)
|
||||
self.assertNotEqual(apiclient, FAIL, "Failure while getting\
|
||||
api client of account: %s" % self.account.name)
|
||||
|
||||
@ -261,32 +266,32 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.services["disk_offering"]["disksize"] = 4
|
||||
expectedCount = self.initialResourceCount + int(self.services["disk_offering"]["disksize"])
|
||||
disk_offering = DiskOffering.create(self.apiclient,
|
||||
services=self.services["disk_offering"])
|
||||
services=self.services["disk_offering"])
|
||||
|
||||
self.cleanup.append(disk_offering)
|
||||
|
||||
volume = Volume.create(
|
||||
apiclient,self.services["volume"],zoneid=self.zone.id,
|
||||
account=self.account.name,domainid=self.account.domainid,
|
||||
diskofferingid=disk_offering.id)
|
||||
apiclient, self.services["volume"], zoneid=self.zone.id,
|
||||
account=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=disk_offering.id)
|
||||
except Exception as e:
|
||||
self.fail("Failure: %s" % e)
|
||||
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
self.virtualMachine.attach_volume(apiclient, volume=volume)
|
||||
self.virtualMachine.attach_volume(apiclient, volume=volume)
|
||||
except Exception as e:
|
||||
self.fail("Failed while attaching volume to VM: %s" % e)
|
||||
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
@ -295,14 +300,14 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.fail("Failure while detaching volume: %s" % e)
|
||||
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic"], required_hardware="false")
|
||||
@attr(tags=["advanced", "basic"], required_hardware="false")
|
||||
def test_create_multiple_volumes(self, value):
|
||||
"""Test create multiple volumes
|
||||
|
||||
@ -323,33 +328,33 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
apiclient = self.apiclient
|
||||
if value == CHILD_DOMAIN_ADMIN:
|
||||
apiclient = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain
|
||||
)
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain
|
||||
)
|
||||
self.assertNotEqual(apiclient, FAIL, "Failure while getting\
|
||||
api client of account %s" % self.account.name)
|
||||
|
||||
try:
|
||||
self.services["disk_offering"]["disksize"] = 5
|
||||
disk_offering_5_GB = DiskOffering.create(self.apiclient,
|
||||
services=self.services["disk_offering"])
|
||||
services=self.services["disk_offering"])
|
||||
self.cleanup.append(disk_offering_5_GB)
|
||||
|
||||
self.services["disk_offering"]["disksize"] = 10
|
||||
disk_offering_10_GB = DiskOffering.create(self.apiclient,
|
||||
services=self.services["disk_offering"])
|
||||
services=self.services["disk_offering"])
|
||||
|
||||
self.cleanup.append(disk_offering_10_GB)
|
||||
|
||||
volume_1 = Volume.create(
|
||||
apiclient,self.services["volume"],zoneid=self.zone.id,
|
||||
account=self.account.name,domainid=self.account.domainid,
|
||||
diskofferingid=disk_offering_5_GB.id)
|
||||
apiclient, self.services["volume"], zoneid=self.zone.id,
|
||||
account=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=disk_offering_5_GB.id)
|
||||
|
||||
volume_2 = Volume.create(
|
||||
apiclient,self.services["volume"],zoneid=self.zone.id,
|
||||
account=self.account.name,domainid=self.account.domainid,
|
||||
diskofferingid=disk_offering_10_GB.id)
|
||||
apiclient, self.services["volume"], zoneid=self.zone.id,
|
||||
account=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=disk_offering_10_GB.id)
|
||||
|
||||
self.debug("Attaching volume %s to vm %s" % (volume_1.name, self.virtualMachine.name))
|
||||
self.virtualMachine.attach_volume(apiclient, volume=volume_1)
|
||||
@ -359,11 +364,11 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("Failure: %s" % e)
|
||||
|
||||
expectedCount = self.initialResourceCount + 15 # (5 + 10)
|
||||
expectedCount = self.initialResourceCount + 15 # (5 + 10)
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
@ -373,11 +378,11 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
except Exception as e:
|
||||
self.fail("Failure while volume operation: %s" % e)
|
||||
|
||||
expectedCount -= 5 #After deleting first volume
|
||||
expectedCount -= 5 # After deleting first volume
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
@ -389,14 +394,14 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
|
||||
expectedCount -= 10
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic"], required_hardware="false")
|
||||
@attr(tags=["advanced", "basic"], required_hardware="false")
|
||||
def test_deploy_multiple_vm(self, value):
|
||||
"""Test Deploy multiple VMs with & verify the usage
|
||||
# Validate the following
|
||||
@ -411,32 +416,32 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
self.virtualMachine_2 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
|
||||
accountid=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=self.disk_offering.id,
|
||||
serviceofferingid=self.service_offering.id)
|
||||
accountid=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=self.disk_offering.id,
|
||||
serviceofferingid=self.service_offering.id)
|
||||
|
||||
expectedCount = (self.initialResourceCount * 2) #Total 2 vms
|
||||
expectedCount = (self.initialResourceCount * 2) # Total 2 vms
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
self.virtualMachine_3 = VirtualMachine.create(self.api_client, self.services["virtual_machine"],
|
||||
accountid=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=self.disk_offering.id,
|
||||
serviceofferingid=self.service_offering.id)
|
||||
accountid=self.account.name, domainid=self.account.domainid,
|
||||
diskofferingid=self.disk_offering.id,
|
||||
serviceofferingid=self.service_offering.id)
|
||||
|
||||
expectedCount = (self.initialResourceCount * 3) #Total 3 vms
|
||||
expectedCount = (self.initialResourceCount * 3) # Total 3 vms
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
self.debug("Destroying instance: %s" % self.virtualMachine_2.name)
|
||||
try:
|
||||
self.virtualMachine_2.delete(self.apiclient)
|
||||
self.virtualMachine_2.delete(self.apiclient)
|
||||
except Exception as e:
|
||||
self.fail("Failed to delete instance: %s" % e)
|
||||
|
||||
@ -445,14 +450,14 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
|
||||
expectedCount -= (self.template.size / (1024 ** 3))
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
return
|
||||
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic","selfservice"])
|
||||
@attr(tags=["advanced", "basic", "selfservice"])
|
||||
def test_assign_vm_different_account(self, value):
|
||||
"""Test assign Vm to different account
|
||||
# Validate the following
|
||||
@ -468,44 +473,44 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
|
||||
try:
|
||||
account_2 = Account.create(self.apiclient, self.services["account"],
|
||||
domainid=self.domain.id, admin=True)
|
||||
domainid=self.domain.id, admin=True)
|
||||
self.cleanup.insert(0, account_2)
|
||||
except Exception as e:
|
||||
self.fail("Failed to create account: %s" % e)
|
||||
|
||||
expectedCount = self.initialResourceCount
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
self.virtualMachine.stop(self.apiclient)
|
||||
self.virtualMachine.assign_virtual_machine(self.apiclient,
|
||||
account_2.name ,account_2.domainid)
|
||||
self.virtualMachine.assign_virtual_machine(self.apiclient,
|
||||
account_2.name, account_2.domainid)
|
||||
except Exception as e:
|
||||
self.fail("Failed to assign virtual machine to account %s: %s" %
|
||||
(account_2.name,e))
|
||||
(account_2.name, e))
|
||||
|
||||
# Checking resource count for account 2
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=account_2.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=account_2.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
expectedCount = 0
|
||||
# Checking resource count for original account
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
return
|
||||
|
||||
@data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN)
|
||||
@attr(tags=["advanced","basic"], required_hardware="true")
|
||||
@attr(tags=["advanced", "basic"], required_hardware="true")
|
||||
def test_create_template_snapshot(self, value):
|
||||
"""Test create snapshot and templates from volume
|
||||
|
||||
@ -526,9 +531,9 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
apiclient = self.apiclient
|
||||
if value == CHILD_DOMAIN_ADMIN:
|
||||
apiclient = self.testClient.getUserApiClient(
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain
|
||||
)
|
||||
UserName=self.account.name,
|
||||
DomainName=self.account.domain
|
||||
)
|
||||
self.assertNotEqual(apiclient, FAIL, "Failure while getting api\
|
||||
client of account: %s" % self.account.name)
|
||||
|
||||
@ -538,9 +543,9 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.fail("Failed to stop instance: %s" % e)
|
||||
expectedCount = self.initialResourceCount
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
self.debug("Creating snapshot from ROOT volume: %s" % self.virtualMachine.name)
|
||||
@ -549,18 +554,18 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
snapshot = response[1]
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
self.services["volume"]["size"] = self.services["disk_offering"]["disksize"]
|
||||
volume = Volume.create_from_snapshot(apiclient,
|
||||
snapshot_id=snapshot.id,
|
||||
services=self.services["volume"],
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid)
|
||||
snapshot_id=snapshot.id,
|
||||
services=self.services["volume"],
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid)
|
||||
|
||||
self.debug("Attaching the volume to vm: %s" % self.virtualMachine.name)
|
||||
self.virtualMachine.attach_volume(apiclient, volume)
|
||||
@ -569,9 +574,9 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
|
||||
expectedCount += int(self.services["volume"]["size"])
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
|
||||
try:
|
||||
@ -587,8 +592,8 @@ class TestVolumeLimits(cloudstackTestCase):
|
||||
|
||||
expectedCount -= int(self.services["volume"]["size"])
|
||||
response = matchResourceCount(
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.apiclient, expectedCount,
|
||||
RESOURCE_PRIMARY_STORAGE,
|
||||
accountid=self.account.id)
|
||||
self.assertEqual(response[0], PASS, response[1])
|
||||
return
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
|
||||
@ -25,7 +25,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
"""
|
||||
# Import Local Modules
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.lib.base import (Account,
|
||||
ServiceOffering,
|
||||
VirtualMachine,
|
||||
|
||||
@ -32,7 +32,8 @@ from marvin.lib.common import (get_domain,
|
||||
from marvin.lib.utils import (cleanup_resources,
|
||||
random_gen,
|
||||
validateList)
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||
import unittest
|
||||
from marvin.codes import PASS, RUNNING
|
||||
|
||||
#Import System modules
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user