X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=tests%2Fos%2Fvuls%2Fvuls.robot;h=3b3a9015d4e6161faa10026a528765b37731dceb;hb=cbea59029a35dbdc4a37a400c6abcb7421b0df5b;hp=6ddc2836be593afecfad42ee47b5ae87616894e3;hpb=b88c6c799d8885d8ed5e4326b3d366df44453154;p=validation.git diff --git a/tests/os/vuls/vuls.robot b/tests/os/vuls/vuls.robot index 6ddc283..3b3a901 100644 --- a/tests/os/vuls/vuls.robot +++ b/tests/os/vuls/vuls.robot @@ -19,10 +19,8 @@ Library SSHLibrary Library OperatingSystem Library BuiltIn -Library Process - -*** Variables *** -${LOG_PATH} /opt/akraino/validation/tests/os/vuls +Suite Setup Open Connection And Log In +Suite Teardown Close All Connections *** Test Cases *** Run Vuls test @@ -32,21 +30,35 @@ Run Vuls test Set Environment Variable LC_ALL en_US.UTF-8 Set Environment Variable LANG en_US.UTF-8 - ${rc} = Run And Return Rc install -D /opt/akraino/validation/tests/os/vuls/config /root/.ssh/ + ${rc} = Run And Return Rc install -D ${CURDIR}/config /root/.ssh/ Should Be Equal As Integers ${rc} 0 - ${rc} = Run And Return Rc sed -i 's/HOST/${HOST}/g' config.toml + ${rc} = Run And Return Rc sed -i -e 's/HOST/${HOST}/g' -e 's/USERNAME/${USERNAME}/g' ${CURDIR}/config.toml Should Be Equal As Integers ${rc} 0 - ${rc} = Run And Return Rc sed -i 's/USERNAME/${USERNAME}/g' config.toml + ${rc} = Run And Return Rc tar xvzf ${CURDIR}/db.tar.gz -C ${CURDIR} Should Be Equal As Integers ${rc} 0 - ${rc} = Run And Return Rc tar xvzf db.tar.gz -C /opt/akraino/validation/tests/os/vuls/ + ${os} = SSHLibrary.Execute Command source /etc/os-release && echo $ID + + ${rc} = Run And Return Rc vuls scan -config ${CURDIR}/config.toml -ssh-config Should Be Equal As Integers ${rc} 0 - - ${rc} = Run And Return Rc vuls scan -config config.toml -ssh-config + + Run Keyword IF '${os}' == 'ubuntu' Run vuls for ubuntu ELSE IF '${os}' == 'centos' Run vuls for centos ELSE FAIL Distro '${os}' not supported + +*** Keywords *** +Run vuls for ubuntu + ${os_version} = SSHLibrary.Execute Command source /etc/os-release && echo $VERSION_ID | cut -d '.' -f1 + + ${rc} ${output} = Run And Return Rc And Output vuls report -config ${CURDIR}/config.toml -cvedb-sqlite3-path=${CURDIR}/cve.sqlite3 -ovaldb-sqlite3-path=${CURDIR}/oval_ubuntu_${os_version}.sqlite3 Should Be Equal As Integers ${rc} 0 + Append To File ${LOG_PATH}/vuls.log ${output}${\n} - ${rc} ${output} = Run And Return Rc And Output vuls report +Run vuls for centos + ${rc} ${output} = Run And Return Rc And Output vuls report -config ${CURDIR}/config.toml -cvedb-sqlite3-path=${CURDIR}/cve.sqlite3 -ovaldb-sqlite3-path=${CURDIR}/oval_centos.sqlite3 -gostdb-sqlite3-path=${CURDIR}/gost_centos.sqlite3 Should Be Equal As Integers ${rc} 0 Append To File ${LOG_PATH}/vuls.log ${output}${\n} + +Open Connection And Log In + Open Connection ${HOST} + Login With Public Key ${USERNAME} ${SSH_KEYFILE} \ No newline at end of file