From 4d93fe98c3b9ad51882b65b4679ffa3cd768649a Mon Sep 17 00:00:00 2001 From: Juha Kosonen Date: Mon, 14 Oct 2019 16:27:56 +0300 Subject: [PATCH] Add Redfish Robot test Validate common use cases by running Redfish Usecase Checkers suite via Redfish Test Framework. JIRA: VAL-67 Change-Id: Ibfec4f6a70dd4dfd62fc0ceb9a871509b53a0745 Signed-off-by: Juha Kosonen --- docker/hardware/Dockerfile | 14 +++++++- docker/hardware/pip-requirements.txt | 1 + tests/hardware/redfish/redfish.resource | 59 +++++++++++++++++++++++++++++++++ tests/hardware/redfish/redfish.robot | 27 +++++++++++++++ tests/variables.yaml | 7 ++++ 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 tests/hardware/redfish/redfish.resource create mode 100644 tests/hardware/redfish/redfish.robot diff --git a/docker/hardware/Dockerfile b/docker/hardware/Dockerfile index 5b25e76..a21cb64 100644 --- a/docker/hardware/Dockerfile +++ b/docker/hardware/Dockerfile @@ -27,7 +27,8 @@ RUN apk --no-cache add --update \ libffi \ libffi-dev \ make \ - openssl-dev + openssl-dev \ + wget # Build binaries WORKDIR /wheels @@ -35,10 +36,17 @@ RUN pip3 install wheel RUN pip3 wheel -r /wheels/requirements/pip-requirements.txt RUN git clone https://gerrit.akraino.org/r/validation /opt/akraino/validation +RUN wget -qO- https://github.com/DMTF/Redfish-Test-Framework/archive/master.zip | \ + unzip -qd /opt/akraino - +RUN wget -qO- https://github.com/DMTF/Redfish-Usecase-Checkers/archive/master.zip | \ + unzip -qd /opt/akraino - + # Copy binaries in the final contaier and install robot framework FROM python:3.6-alpine3.9 COPY --from=build /wheels /wheels COPY --from=build /opt/akraino/validation /opt/akraino/validation +COPY --from=build /opt/akraino/Redfish-Test-Framework-master /opt/akraino/Redfish-Test-Framework +COPY --from=build /opt/akraino/Redfish-Usecase-Checkers-master /opt/akraino/Redfish-Usecase-Checkers RUN pip3 install -r /wheels/requirements/pip-requirements.txt \ -f /wheels && \ @@ -48,6 +56,10 @@ RUN pip3 install -r /wheels/requirements/pip-requirements.txt \ # Install blueval dependencies RUN pip install -r /opt/akraino/validation/bluval/requirements.txt +# Install Redfish dependencies +RUN pip install html-testRunner \ + -r /opt/akraino/Redfish-Usecase-Checkers/requirements.txt + # Install curl RUN apk --no-cache add --update \ curl diff --git a/docker/hardware/pip-requirements.txt b/docker/hardware/pip-requirements.txt index 6139a45..18b264c 100644 --- a/docker/hardware/pip-requirements.txt +++ b/docker/hardware/pip-requirements.txt @@ -1,4 +1,5 @@ robotframework robotframework-httplibrary +robotframework-jsonlibrary robotframework-requests robotframework-sshlibrary diff --git a/tests/hardware/redfish/redfish.resource b/tests/hardware/redfish/redfish.resource new file mode 100644 index 0000000..433f9db --- /dev/null +++ b/tests/hardware/redfish/redfish.resource @@ -0,0 +1,59 @@ +############################################################################## +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you maynot use this file except in compliance with the License. # +# # +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +############################################################################## + + +*** Settings *** +Library JSONLibrary +Library OperatingSystem +Library Process + + +*** Variables *** +${REPORTDIR} ${LOG_PATH}/${SUITE_NAME.replace(' ','_')} +${REDFISHDIR} ${TEMPDIR}/Redfish + + +*** Keywords *** +Update Config File + ${conf}= Load JSON From File ${REDFISHDIR}/framework_conf.json + ${conf}= Update Value To Json ${conf} $.password ${BMC_PASSWORD} + ${conf}= Convert JSON To String ${conf} + Create File ${REDFISHDIR}/framework_conf.json ${conf} + +Run Suite Against Target Node + [Arguments] ${ip} + ${result}= Run Process python test_framework.py + ... --directory ${REDFISHDIR} + ... --rhost ${ip} + ... --user ${BMC_USER} + ... --interpreter python + ... --secure Always + ... cwd=${REDFISHDIR} + Copy Files ${REDFISHDIR}/reports/output-*/results*.json ${REPORTDIR}/${ip} + Copy Files ${REDFISHDIR}/output-*/*.html ${REPORTDIR}/${ip} + Should Be Equal As Integers ${result.rc} 0 + Should Not Contain ${result.stderr} FAILED${\n} (Failures= + +Run Usecase Checkers Suite + FOR ${ip} IN @{BMC_IP} + Copy Directory /opt/akraino/Redfish-Test-Framework ${REDFISHDIR} + Copy Directory /opt/akraino/Redfish-Usecase-Checkers ${REDFISHDIR}/Redfish-Usecase-Checkers + Create Directory ${REDFISHDIR}/reports + Update Config File + Run Suite Against Target Node ${ip} + Remove Directory ${REDFISHDIR} recursive=True + END diff --git a/tests/hardware/redfish/redfish.robot b/tests/hardware/redfish/redfish.robot new file mode 100644 index 0000000..0ff6f31 --- /dev/null +++ b/tests/hardware/redfish/redfish.robot @@ -0,0 +1,27 @@ +############################################################################## +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you maynot use this file except in compliance with the License. # +# # +# You may obtain a copy of the License at # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +############################################################################## + + +*** Settings *** +Documentation Redfish Test Framework is a tool and a model for organizing +... and running a set of Redfish interoperability test +Resource redfish.resource + + +*** Test Cases *** +Validate Common Use Cases + Run Usecase Checkers Suite diff --git a/tests/variables.yaml b/tests/variables.yaml index 11e8779..1da77ef 100644 --- a/tests/variables.yaml +++ b/tests/variables.yaml @@ -49,6 +49,13 @@ bootseq: boot_input # boot status biosver: bios_version # host bios version firmware: firmware_version # host firmware +### Input variables for Redfish test +bmc_ip: # bmc address list + - 192.168.10.10 + - 192.168.10.11 +bmc_user: admin # username +bmc_password: Password#0 # password + ### Input variables for containerized ceph test nodename: targetnode # target node to test ceph -- 2.16.6