Add O2 IMS compliance automation test scripts.
[it/test.git] / test_scripts / O2IMS_Compliance_Test / o2ims_compliance / ssh_helper.robot
1 *** Settings ***
2
3 Library                SSHLibrary
4 Variables              ${EXECDIR}${/}test_configs.yaml
5
6 *** Variables ***
7 ${HOST}                ${ocloud.ssh.host}
8 ${PORT}                ${ocloud.ssh.port}
9 ${USERNAME}            ${ocloud.ssh.username}
10 ${PASSWORD}            ${ocloud.ssh.password}
11 ${OPENRC}              ${ocloud.ssh.openrc}
12
13 ${DD_TEST_ASSERT_CMD}     "dd if=/dev/zero of=/home/sysadmin/fullfill-8G.zeros bs=512M count=15"
14 ${DD_TEST_CLEAR_CMD}        "[ -e '/home/sysadmin/fullfill-8G.zeros' ] && rm /home/sysadmin/fullfill-8G.zeros "
15 ${VERIFY_ALARM_ASSERTED}  "fm alarm-list"
16
17 *** Keywords ***
18 Open Connection And Log In
19     Open Connection                  ${HOST}             port=${PORT}
20     Login                            ${USERNAME}         ${PASSWORD}
21
22 Execute Command With Sudo
23     [Documentation]               Execute Command With Sudo and always return stderr and rc
24     [Arguments]                   ${cmd}
25     ${stdout}  ${stderr}  ${rc}=  Execute Command               ${cmd}  sudo=True  sudo_password=${PASSWORD}  return_stderr=True  return_rc=True
26     log                           rc = ${rc}   level=DEBUG
27     Should Be Equal               ${rc} 0
28     RETURN                        ${stdout}  ${stderr}  ${rc}
29
30 Assert Alarm With Disk Usage
31     [Documentation]               Set up conditions to assert disk usage StarlingX Alarm
32     ${stdout}  ${stderr}  ${rc}=  Execute Command    ${DD_TEST_ASSERT_CMD}  return_stderr=True  return_rc=True
33     log                           rc = ${rc}   level=DEBUG
34     Should Be Equal               ${rc} 0
35     RETURN                        ${stdout}  ${stderr}  ${rc}
36
37 Clear Alarm With Disk Usage
38     [Documentation]               Tear down conditions to clear disk usage StarlingX Alarm
39     ${stdout}  ${stderr}  ${rc}=  Execute Command    ${DD_TEST_CLEAR_CMD}  return_stderr=True  return_rc=True
40     log                           rc = ${rc}   level=DEBUG
41 #     Should Be Equal               ${rc}  0
42     RETURN                        ${stdout}  ${stderr}  ${rc}