From 32e8a73529c058197bb47bd3955871b5cf439bac Mon Sep 17 00:00:00 2001 From: Alexandru Dimofte Date: Wed, 6 May 2020 10:17:58 +0300 Subject: [PATCH] Commited current changes added in Jenkins using sed command in automated robot files Description: Currently the Jenkins groovy scripts are modifying the robot files using sed commands in order to work preperly. That changes are now added in robot files and will removed from Jenkins pipeline scripts. All this delays, sleeps and other commands are needed. Modified the test-requirements.txt file changing some versions for some components, this will fix some issues. Story: 2007623 Task: 39657 Change-Id: Id9c5cb56e30f764302521747d3abdb5637d633c1 Signed-off-by: Alexandru Dimofte --- .../Resources/OpenStack.robot | 80 ++++++++++--------- .../Resources/Provisioning.robot | 11 +-- automated-robot-suite/Resources/Utils.robot | 2 +- automated-robot-suite/test-requirements.txt | 4 +- 4 files changed, 50 insertions(+), 47 deletions(-) diff --git a/automated-robot-suite/Resources/OpenStack.robot b/automated-robot-suite/Resources/OpenStack.robot index f063b7a..6af89dd 100644 --- a/automated-robot-suite/Resources/OpenStack.robot +++ b/automated-robot-suite/Resources/OpenStack.robot @@ -14,7 +14,7 @@ Variables Variables/Global.py *** Keywords *** Run OS Command - [Arguments] ${cmd} ${fail_if_error}=False ${timeout}=${TIMEOUT+20} + [Arguments] ${cmd} ${fail_if_error}=False ${timeout}=${TIMEOUT+170} [Documentation] Keyword to execute exclusively commands for OpenStack as ... it uses the proper token for OS authentication. ${load_os_token} Set Variable export OS_CLOUD=openstack_helm @@ -34,7 +34,7 @@ Create Network ${openstack_cmd} Set Variable openstack network create ${cmd} Catenate ${openstack_cmd} ${network_name} ... ${additional_args} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Create Subnet [Arguments] ${network_name} ${range_ip} @@ -43,7 +43,7 @@ Create Subnet ${openstack_cmd} Set Variable openstack subnet create ${cmd} Catenate ${openstack_cmd} --network ${network_name} ... --subnet-range ${range_ip} ${additional_args} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Create Flavor [Arguments] ${ram} ${vcpus} ${disk} ${name} @@ -72,7 +72,7 @@ Create Volume ${openstack_cmd} Set Variable openstack volume create ${cmd} Catenate ${openstack_cmd} --size ${size} ... --image ${image} ${bootable} ${name} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Wait Until Keyword Succeeds 10 min 10 sec Check Field Value ... volume ${name} status available @@ -81,7 +81,7 @@ Create Snapshot [Documentation] Create Snapshot. Run OS Command ... openstack volume snapshot create --volume ${volume} ${name} - ... True 30 sec + ... True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... volume snapshot ${name} status available @@ -97,7 +97,7 @@ Create Stack ${openstack_cmd} Set Variable openstack server list ${cmd} Catenate SEPARATOR=| ${openstack_cmd} awk '{print$4}' ... grep -v "Name" - &{result} Run OS Command ${cmd} True 30 sec + &{result} Run OS Command ${cmd} True 3 min @{vm_list} Convert Response To List ${result} : FOR ${vm} IN @{vm_list} \ Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -113,7 +113,7 @@ Create Instance ${openstack_cmd} Set Variable openstack server create ${cmd} Catenate ${openstack_cmd} --image ${image} ... --flavor ${flavor} --nic net-id=${net_id} ${vm_name} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -127,7 +127,7 @@ Create Instance From Volume ${openstack_cmd} Set Variable openstack server create ${cmd} Catenate ${openstack_cmd} --volume ${volume} ... --flavor ${flavor} --nic net-id=${net_id} ${vm_name} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -146,7 +146,7 @@ Create Instance From Snapshot ${cmd} Catenate ${openstack_cmd} --flavor ${flavor} ... --image ${image} --nic net-id=${net_id} ... --block-device-mapping vdb=${mapping} ${vm_name} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -162,7 +162,7 @@ Create Instance With Keypair ${cmd} Catenate ${openstack_cmd} --image ${image} ... --flavor ${flavor} --nic net-id=${net_id} ... --key-name ${key_name} ${vm_name} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -182,19 +182,19 @@ Create KeyPair ${openstack_cmd} Set Variable openstack keypair create ${cmd} Catenate ${openstack_cmd} ... --public-key ${key_dir}/${key_name}.pub ${key_name} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Suspend Instance [Arguments] ${vm_name} [Documentation] Suspend the corresponding VM - Run OS Command openstack server suspend ${vm_name} True 30 sec + Run OS Command openstack server suspend ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status SUSPENDED Resume Instance [Arguments] ${vm_name} [Documentation] Resume the corresponding VM - Run OS Command openstack server resume ${vm_name} True 30 sec + Run OS Command openstack server resume ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE @@ -202,7 +202,7 @@ Set Error State Instance [Arguments] ${vm_name} ${value} [Documentation] Set 'Error' value to the corresponding VM Run OS Command openstack server set --state ${value} ${vm_name} - ... True 30 sec + ... True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ERROR @@ -210,52 +210,52 @@ Set Active State Instance [Arguments] ${vm_name} ${value} [Documentation] Set 'Active' value to the corresponding VM Run OS Command openstack server set --state ${value} ${vm_name} - ... True 30 sec + ... True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Pause Instance [Arguments] ${vm_name} [Documentation] Pause an instance. - Run OS Command openstack server pause ${vm_name} True 30 sec + Run OS Command openstack server pause ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status PAUSED Unpause Instance [Arguments] ${vm_name} [Documentation] Unpause an instance. - Run OS Command openstack server unpause ${vm_name} True 30 sec + Run OS Command openstack server unpause ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Stop Instance [Arguments] ${vm_name} [Documentation] Stop an instance. - Run OS Command openstack server stop ${vm_name} True 30 sec + Run OS Command openstack server stop ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status SHUTOFF Start Instance [Arguments] ${vm_name} [Documentation] Start an instance. - Run OS Command openstack server start ${vm_name} True 30 sec + Run OS Command openstack server start ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE Lock Instance [Arguments] ${vm_name} [Documentation] Lock an instance. - Run OS Command openstack server lock ${vm_name} True 30 sec + Run OS Command openstack server lock ${vm_name} True 3 min Unlock Instance [Arguments] ${vm_name} [Documentation] Unlock an instance. - Run OS Command openstack server unlock ${vm_name} True 30 sec + Run OS Command openstack server unlock ${vm_name} True 3 min Reboot Instance [Arguments] ${vm_name} [Documentation] Reboot an instance. - Run OS Command openstack server reboot ${vm_name} True 30 sec + Run OS Command openstack server reboot ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status REBOOT Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -264,7 +264,7 @@ Reboot Instance Rebuild Instance [Arguments] ${vm_name} [Documentation] Rebuild an instance. - Run OS Command openstack server rebuild ${vm_name} True 30 sec + Run OS Command openstack server rebuild ${vm_name} True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status REBUILD Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -274,7 +274,7 @@ Rebuild Instance From Volume [Arguments] ${vm_name} ${image} [Documentation] Rebuild an instance from volume Run OS Command openstack server rebuild --image ${image} ${vm_name} - ... True 30 sec + ... True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status REBUILD Wait Until Keyword Succeeds 5 min 10 sec Check Field Value @@ -284,13 +284,13 @@ Resize Instance [Arguments] ${vm_name} ${flavor} [Documentation] Resize an instance. Run OS Command openstack server resize --flavor ${flavor} ${vm_name} - ... True 30 sec + ... True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status RESIZE Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status VERIFY_RESIZE Run OS Command openstack server resize --confirm ${vm_name} - ... True 30 sec + ... True 3 min Wait Until Keyword Succeeds 5 min 10 sec Check Field Value ... server ${vm_name} status ACTIVE @@ -312,12 +312,12 @@ Evacuate Instances ${openstack_cmd} Set Variable openstack compute service set ${cmd} Catenate ${openstack_cmd} --disable ... --disable-reason test-evacuate ${host} nova-compute - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Wait Until Keyword Succeeds 5 min 10 sec ... Check Compute Service Property ${host} disabled ${cmd1} Catenate ${openstack_cmd} --enable ... ${host} nova-compute - Run OS Command ${cmd1} True 30 sec + Run OS Command ${cmd1} True 3 min Wait Until Keyword Succeeds 5 min 10 sec ... Check Compute Service Property ${host} enabled @@ -326,56 +326,56 @@ Delete Stack [Documentation] Delete an specific stack. ${openstack_cmd} Set Variable openstack stack delete ${cmd} Catenate ${openstack_cmd} ${stack} -y - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete Snapshot [Arguments] ${snapshot} [Documentation] Delete an specific snapshot. ${openstack_cmd} Set Variable openstack volume snapshot delete ${cmd} Catenate ${openstack_cmd} ${snapshot} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete Volume [Arguments] ${volume} [Documentation] Delete an specific volume. ${openstack_cmd} Set Variable openstack volume delete ${cmd} Catenate ${openstack_cmd} ${volume} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete Flavor [Arguments] ${flavor} [Documentation] Delete an specific flavor. ${openstack_cmd} Set Variable openstack flavor delete ${cmd} Catenate ${openstack_cmd} ${flavor} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete Image [Arguments] ${image} [Documentation] Delete an specific image. ${openstack_cmd} Set Variable openstack image delete ${cmd} Catenate ${openstack_cmd} ${image} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete Instance [Arguments] ${vm} [Documentation] Delete an specific instance. ${openstack_cmd} Set Variable openstack server delete ${cmd} Catenate ${openstack_cmd} ${vm} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete Network [Arguments] ${network} [Documentation] Delete an specific network. ${openstack_cmd} Set Variable openstack network delete ${cmd} Catenate ${openstack_cmd} ${network} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete KeyPair [Arguments] ${keypair} [Documentation] Delete an specific keypair. ${openstack_cmd} Set Variable openstack keypair delete ${cmd} Catenate ${openstack_cmd} ${keypair} - Run OS Command ${cmd} True 30 sec + Run OS Command ${cmd} True 3 min Delete All Stacks [Documentation] Get a list of all existing stacks to delete them one @@ -383,7 +383,7 @@ Delete All Stacks ${openstack_cmd} Set Variable openstack stack list ${cmd} Catenate SEPARATOR=| ${openstack_cmd} awk '{print$4}' ... grep -v "Stack" - &{result} Run OS Command ${cmd} True 30 sec + &{result} Run OS Command ${cmd} True 3 min @{stack_list} Convert Response To List ${result} : FOR ${stack} IN @{stack_list} \ Delete Stack ${stack} @@ -394,7 +394,7 @@ Delete All Snapshots ${openstack_cmd} Set Variable openstack volume snapshot list ${cmd} Catenate SEPARATOR=| ${openstack_cmd} awk '{print$4}' ... grep -v "Name" - &{result} Run OS Command ${cmd} True 30 sec + &{result} Run OS Command ${cmd} True 3 min @{snapshot_list} Convert Response To List ${result} : FOR ${snapshot} IN @{snapshot_list} \ Delete Snapshot ${snapshot} @@ -405,7 +405,7 @@ Delete All Volumes ${openstack_cmd} Set Variable openstack volume list ${cmd} Catenate SEPARATOR=| ${openstack_cmd} awk '{print$2}' ... grep -v "ID" - &{result} Run OS Command ${cmd} True 30 sec + &{result} Run OS Command ${cmd} True 3 min @{volume_list} Convert Response To List ${result} : FOR ${volume} IN @{volume_list} \ Delete Volume ${volume} @@ -475,6 +475,8 @@ Openstack Cleanup All Delete All Networks Delete All KeyPairs Run Keyword And Ignore Error Delete All Volumes + Sleep 5 min Delete All Snapshots + Sleep 3 min Delete All Volumes Delete All Stacks diff --git a/automated-robot-suite/Resources/Provisioning.robot b/automated-robot-suite/Resources/Provisioning.robot index 45554fa..faf9dc0 100644 --- a/automated-robot-suite/Resources/Provisioning.robot +++ b/automated-robot-suite/Resources/Provisioning.robot @@ -131,6 +131,7 @@ Unlock Master Controller Wait Until Keyword Fails 20 min 20 sec ${error_expected} ... Run Command whoami Close Connection + Sleep 10 min Wait Until Keyword Succeeds 15 min 30 sec ... Open Master Controller Connection Wait Until Keyword Succeeds 15 min 30 sec @@ -380,10 +381,10 @@ Install Remaining Nodes Baremetal \ ${bmc_ip} Set Variable &{node_data}[bmc_ip] \ ${bmc_user} Set Variable &{node_data}[bmc_user] \ ${pswd} Set Variable &{node_data}[bmc_pswd] - \ ${set_pxe_boot_device} Catenate ipmitool -H ${bmc_ip} + \ ${set_pxe_boot_device} Catenate ipmitool -N 5 -H ${bmc_ip} ... -U ${bmc_user} -P ${pswd} - ... -I lanplus chassis bootparam set bootflag force_pxe - \ ${turn_on_node} Catenate ipmitool -H ${bmc_ip} -U ${bmc_user} + ... -I lanplus chassis bootparam set bootflag pxe options=no-timeout + \ ${turn_on_node} Catenate ipmitool -N 5 -H ${bmc_ip} -U ${bmc_user} ... -P ${pswd} -I lanplus chassis power on \ Run ${set_pxe_boot_device} \ Run ${turn_on_node} @@ -404,7 +405,7 @@ Install Remaining Nodes Baremetal : FOR ${node} IN @{nodes_list} \ &{node_data} Set Variable &{NODES}[${node}] \ ${name} Set Variable &{node_data}[name] - \ Wait Until Keyword Succeeds 20 min 5 sec Check Property Value + \ Wait Until Keyword Succeeds 30 min 5 sec Check Property Value \ ... ${name} install_state completed Get List Of Installation Nodes @@ -437,7 +438,7 @@ Turn Off Installation Nodes \ ${bmc_ip} Set Variable &{node_data}[bmc_ip] \ ${bmc_user} Set Variable &{node_data}[bmc_user] \ ${pswd} Set Variable &{node_data}[bmc_pswd] - \ ${turn_off_node} Catenate ipmitool -H ${bmc_ip} -U ${bmc_user} + \ ${turn_off_node} Catenate ipmitool -N 5 -H ${bmc_ip} -U ${bmc_user} ... -P ${pswd} -I lanplus chassis power off \ Run ${turn_off_node} diff --git a/automated-robot-suite/Resources/Utils.robot b/automated-robot-suite/Resources/Utils.robot index 94ef487..d377dd4 100644 --- a/automated-robot-suite/Resources/Utils.robot +++ b/automated-robot-suite/Resources/Utils.robot @@ -69,7 +69,7 @@ Run Command ... will not fail and will return the stderr. Set Client Configuration timeout=${timeout} prompt=${prompt} &{result} Create Empty Result Dictionary - Read + Read delay=0.5s Write ${cmd} ${output} Read Until Prompt ${output} Remove Prompt Line ${output} diff --git a/automated-robot-suite/test-requirements.txt b/automated-robot-suite/test-requirements.txt index 1a12875..bea18c8 100644 --- a/automated-robot-suite/test-requirements.txt +++ b/automated-robot-suite/test-requirements.txt @@ -1,4 +1,4 @@ -flake8==2.6.2 +flake8==3.6.0 hacking flake8-import-order mock @@ -7,4 +7,4 @@ pylint==2.3.0 pep8-naming ipdb ipython -mccabe==0.5.3 +mccabe==0.6.0