Enable python3 fort the test suite
Enable the suite to be used with python3 and added enough documentation to README that are required for this support. Note: only version 3.5.2 tested Change-Id: I07490dad2d4c49658c269b2732fefffd8e412654 Signed-off-by: Jose Perez Carranza <jose.perez.carranza@intel.com>
This commit is contained in:
parent
b6d076779b
commit
6fa0b7985a
@ -157,7 +157,7 @@ def string_to_dict(string_table):
|
|||||||
# in unicode format, so we need the following
|
# in unicode format, so we need the following
|
||||||
# 1. converting string_table variable from unicode to ascii code
|
# 1. converting string_table variable from unicode to ascii code
|
||||||
# 2. split in a list with line breaks
|
# 2. split in a list with line breaks
|
||||||
line_breaks_list = string_table['stdout'].encode('utf-8').split('\n')
|
line_breaks_list = string_table['stdout'].split('\n')
|
||||||
|
|
||||||
robot_dictionary = {}
|
robot_dictionary = {}
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ def grub_checker(iso, mode, grub_option, grub_cmd):
|
|||||||
regex = '-e "label [0-9]" -e "label [A-Z][0-9]" -e append'
|
regex = '-e "label [0-9]" -e "label [A-Z][0-9]" -e append'
|
||||||
grub_extracted_lines = bash.run_command('grep {} {}'.format(
|
grub_extracted_lines = bash.run_command('grep {} {}'.format(
|
||||||
regex, grub))
|
regex, grub))
|
||||||
grub_option_list = grub_extracted_lines[1].split('\n')
|
grub_option_list = grub_extracted_lines[1].decode('utf-8').split('\n')
|
||||||
|
|
||||||
key_dict = []
|
key_dict = []
|
||||||
values_dict = []
|
values_dict = []
|
||||||
|
@ -138,7 +138,7 @@ class Installer(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
for stdout in self.child:
|
for stdout in self.child:
|
||||||
cmd_stdout.append(stdout.strip())
|
cmd_stdout.append(stdout.strip().decode('utf-8'))
|
||||||
except pexpect.exceptions.TIMEOUT:
|
except pexpect.exceptions.TIMEOUT:
|
||||||
LOG.info('custom timeout reached')
|
LOG.info('custom timeout reached')
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class PxeServer(object):
|
|||||||
for service in services:
|
for service in services:
|
||||||
active_service = bash('sudo systemctl is-active {}'
|
active_service = bash('sudo systemctl is-active {}'
|
||||||
.format(service))
|
.format(service))
|
||||||
if 'active' in active_service.stdout:
|
if 'active'.encode('utf-8') in active_service.stdout:
|
||||||
LOG.info('%s service is active', service)
|
LOG.info('%s service is active', service)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@ -246,9 +246,12 @@ class Node(object):
|
|||||||
|
|
||||||
LOG.info('Booting %s To PXE', self.name)
|
LOG.info('Booting %s To PXE', self.name)
|
||||||
LOG.info('Node %s : Setting PXE as first boot option', self.name)
|
LOG.info('Node %s : Setting PXE as first boot option', self.name)
|
||||||
set_pxe = bash('ipmitool -I lanplus -H %s -U %s -P %s '
|
set_pxe = bash('ipmitool -I lanplus -H {node_bmc_ip} '
|
||||||
'chassis bootdev pxe', self.bmc_ip, self.bmc_user,
|
'-U {node_bmc_user} -P {node_bmc_pswd} '
|
||||||
self.bmc_pswd)
|
'chassis bootdev pxe'.format(
|
||||||
|
node_bmc_ip=self.bmc_ip,
|
||||||
|
node_bmc_user=self.bmc_user,
|
||||||
|
node_bmc_pswd=self.bmc_pswd))
|
||||||
if set_pxe.stderr:
|
if set_pxe.stderr:
|
||||||
LOG.info(set_pxe.stderr)
|
LOG.info(set_pxe.stderr)
|
||||||
|
|
||||||
|
@ -25,8 +25,7 @@ be ready soon.
|
|||||||
Suite is based on Robot Framework and Python, please follow below instructions
|
Suite is based on Robot Framework and Python, please follow below instructions
|
||||||
to properly use the suite.
|
to properly use the suite.
|
||||||
|
|
||||||
***NOTE***: Currently the suite is designed to run on Pyhton 2.7 environment,
|
Suite should be executed with Python3 (tested with 3.5.2)
|
||||||
migration to Python 3.5 is undergoing and will be ready soon.
|
|
||||||
|
|
||||||
__ https://docs.starlingx.io/deploy_install_guides/index.html
|
__ https://docs.starlingx.io/deploy_install_guides/index.html
|
||||||
|
|
||||||
@ -168,6 +167,7 @@ Make sure you have python **virtualenv** package installed in your host machine.
|
|||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
$ sudo apt install python-pip
|
$ sudo apt install python-pip
|
||||||
|
$ sudo apt-get install python3-dev
|
||||||
$ sudo pip install virtualenv
|
$ sudo pip install virtualenv
|
||||||
|
|
||||||
You can manage your virtual environments for the two options explained below:
|
You can manage your virtual environments for the two options explained below:
|
||||||
@ -227,7 +227,7 @@ you can follow below steps:
|
|||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
$ virtualenv my-venv
|
$ virtualenv -p python3 my-venv
|
||||||
$ source my-venv/bin/activate
|
$ source my-venv/bin/activate
|
||||||
|
|
||||||
Install the project requirements on virtual environment.
|
Install the project requirements on virtual environment.
|
||||||
|
@ -27,7 +27,7 @@ def delete_network_interfaces():
|
|||||||
# becoming in root
|
# becoming in root
|
||||||
elevate(graphical=False)
|
elevate(graphical=False)
|
||||||
|
|
||||||
ifdata = Ifcfg(subprocess.check_output(['ifconfig', '-a']))
|
ifdata = Ifcfg(subprocess.check_output(['ifconfig', '-a']).decode('utf-8'))
|
||||||
|
|
||||||
# Destroy NAT network if exist
|
# Destroy NAT network if exist
|
||||||
try:
|
try:
|
||||||
@ -75,7 +75,7 @@ def configure_network_interfaces():
|
|||||||
|
|
||||||
for net in networks:
|
for net in networks:
|
||||||
eval_cmd = bash('sudo ifconfig {} up'.format(net))
|
eval_cmd = bash('sudo ifconfig {} up'.format(net))
|
||||||
if 'ERROR' in eval_cmd.stderr:
|
if 'ERROR'.encode('utf-8') in eval_cmd.stderr:
|
||||||
LOG.error(eval_cmd.stderr)
|
LOG.error(eval_cmd.stderr)
|
||||||
raise EnvironmentError(eval_cmd.stderr)
|
raise EnvironmentError(eval_cmd.stderr)
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ def configure_network_interfaces():
|
|||||||
'MASQUERADE')
|
'MASQUERADE')
|
||||||
|
|
||||||
eval_cmd = bash(iptables)
|
eval_cmd = bash(iptables)
|
||||||
if 'ERROR' in eval_cmd.stderr:
|
if 'ERROR'.encode('utf-8') in eval_cmd.stderr:
|
||||||
LOG.error(eval_cmd.stderr)
|
LOG.error(eval_cmd.stderr)
|
||||||
raise EnvironmentError(eval_cmd.stderr)
|
raise EnvironmentError(eval_cmd.stderr)
|
||||||
|
|
||||||
|
@ -117,21 +117,21 @@ def clean_qemu_environment():
|
|||||||
|
|
||||||
for vm in vms:
|
for vm in vms:
|
||||||
# check if the current image is running to shutting down
|
# check if the current image is running to shutting down
|
||||||
cmd = ebash('sudo virsh domstate {}'.format(vm))
|
cmd = ebash('sudo virsh domstate {}'.format(vm.decode('utf-8')))
|
||||||
stdout = cmd.stdout.strip()
|
stdout = cmd.stdout.strip().decode('utf-8')
|
||||||
stderr = cmd.stderr.strip()
|
stderr = cmd.stderr.strip().decode('utf-8')
|
||||||
|
|
||||||
if stdout == 'running' and 'failed to get domain' not in stderr:
|
if stdout == 'running' and 'failed to get domain' not in stderr:
|
||||||
# the vm is running
|
# the vm is running
|
||||||
ebash('sudo virsh destroy {}'.format(vm))
|
ebash('sudo virsh destroy {}'.format(vm.decode('utf-8')))
|
||||||
|
|
||||||
# removing controller/compute from Virtual Machine Manager
|
# removing controller/compute from Virtual Machine Manager
|
||||||
ebash(
|
ebash(
|
||||||
'sudo virsh undefine {} --remove-all-storage --snapshots-metadata'
|
'sudo virsh undefine {} --remove-all-storage --snapshots-metadata'
|
||||||
.format(vm))
|
.format(vm.decode('utf-8')))
|
||||||
|
|
||||||
for partition in partitions:
|
for partition in partitions:
|
||||||
ebash('sudo rm {}/{}'.format(images_path, partition))
|
ebash('sudo rm {}/{}'.format(images_path, partition.decode('utf-8')))
|
||||||
|
|
||||||
|
|
||||||
def qemu_configuration_files():
|
def qemu_configuration_files():
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
watchdog
|
watchdog
|
||||||
robotframework==3.1.1
|
robotframework==3.1.1
|
||||||
robotframework-debuglibrary
|
|
||||||
robotframework-seleniumlibrary
|
robotframework-seleniumlibrary
|
||||||
robotframework-sshlibrary
|
robotframework-sshlibrary
|
||||||
pexpect
|
pexpect
|
||||||
@ -9,6 +8,6 @@ netifaces
|
|||||||
bash
|
bash
|
||||||
elevate
|
elevate
|
||||||
ifparser
|
ifparser
|
||||||
pynetlinux
|
git+https://github.com/rlisagor/pynetlinux.git@master#egg=pynetlinux
|
||||||
kmodpy
|
kmodpy
|
||||||
psutil
|
psutil
|
||||||
|
@ -3,7 +3,8 @@ hacking
|
|||||||
flake8-import-order
|
flake8-import-order
|
||||||
mock
|
mock
|
||||||
coverage
|
coverage
|
||||||
pylint
|
pylint==2.3.0
|
||||||
pep8-naming
|
pep8-naming
|
||||||
ipdb
|
ipdb
|
||||||
ipython
|
ipython
|
||||||
|
mccabe==0.5.3
|
||||||
|
Loading…
Reference in New Issue
Block a user