1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property. #
3 # Copyright (c) 2019 Nokia. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you maynot use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ##############################################################################
21 Library OperatingSystem
28 ${REPORTDIR} ${LOG_PATH}${/}${SUITE_NAME.replace(' ','_')}
29 ${SRCDIR} ./docker-bench-security
30 ${DESTDIR} /tmp/docker-bench-security
31 ${NODEDIR} /tmp/docker-bench-security-run
32 ${SSH_OPTS} -o StrictHostKeyChecking=no
36 Open Connection And Log In
37 Open Connection ${HOST}
38 Login With Public Key ${USERNAME} ${SSH_KEYFILE}
40 Download Docker Bench Software
41 Remove Docker Bench Software
43 ... https://github.com/docker/docker-bench-security.git ${SRCDIR}
45 Upload Test Software To Nodes
46 Put Directory ${SRCDIR} ${DESTDIR} recursive=True
48 Copy Test Software To All Nodes
50 Run Test Software On Nodes
51 :FOR ${node} IN @{nodes}
52 \ Execute Command ssh ${SSH_OPTS} ${node} "cd ${NODEDIR}; sudo ./docker-bench-security.sh -b -l bench.log"
53 \ Execute Command scp ${SSH_OPTS} ${node}:${NODEDIR}/bench.log ${DESTDIR}/docker-bench-${node}.log
54 \ Execute Command scp ${SSH_OPTS} ${node}:${NODEDIR}/bench.log.json ${DESTDIR}/docker-bench-${node}.json
55 \ SSHLibrary.Get File ${DESTDIR}/docker-bench-${node}.log ${REPORTDIR}/
56 \ SSHLibrary.Get File ${DESTDIR}/docker-bench-${node}.json ${REPORTDIR}/
59 ${stdout}= Execute Command
60 ... kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address'}
61 @{nodes}= Split String ${stdout}
62 Set Test Variable @{nodes}
64 Copy Test Software To All Nodes
65 :FOR ${node} IN @{nodes}
66 \ Execute Command ssh ${SSH_OPTS} ${node} "mkdir -p ${NODEDIR}"
67 \ Execute Command scp ${SSH_OPTS} -rp ${DESTDIR}/. ${node}:${NODEDIR}
69 Remove Docker Bench Software
70 Remove Directory ${SRCDIR} recursive=True
72 Remove Test Software From Nodes
73 :FOR ${node} IN @{nodes}
74 \ Execute Command ssh ${SSH_OPTS} ${node} "rm -rf ${NODEDIR}"
75 Execute Command rm -rf ${DESTDIR}