Ubuntu | f45d1aa | 2020-02-06 07:01:44 +0000 | [diff] [blame^] | 1 | # Copyright 2018 Open Networking Foundation |
mc | cd7e950 | 2019-12-16 22:04:13 +0000 | [diff] [blame] | 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | *** Settings *** |
Ubuntu | f45d1aa | 2020-02-06 07:01:44 +0000 | [diff] [blame^] | 16 | Documentation Provide the function to perform funtional tests for the Redfish device-management project |
| 17 | Suite Setup Get IP AND PORT |
mc | cd7e950 | 2019-12-16 22:04:13 +0000 | [diff] [blame] | 18 | Library Process |
| 19 | Library OperatingSystem |
Ubuntu | f45d1aa | 2020-02-06 07:01:44 +0000 | [diff] [blame^] | 20 | Library BuiltIn |
| 21 | Library String |
| 22 | Library Collections |
| 23 | |
| 24 | *** Variables *** |
| 25 | @{ADDR_LIST} 192.168.4.26:8888 192.168.4.27:8888 |
mc | cd7e950 | 2019-12-16 22:04:13 +0000 | [diff] [blame] | 26 | |
| 27 | *** Test Cases *** |
Ubuntu | f45d1aa | 2020-02-06 07:01:44 +0000 | [diff] [blame^] | 28 | Add Device to Monitor |
| 29 | [Documentation] This test case excercises the API, SendDeviceList, which registers Redfish devices to monitor. |
| 30 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' -e 's/ip2/${IP2}/g' -e 's/port2/${PORT2}/g' tests/add_device_to_monitor.expected |
| 31 | ${OUTPUT}= Run Process tests/add_device_to_monitor.tc ${IP1} ${PORT1} ${IP2} ${PORT2} |
mc | cd7e950 | 2019-12-16 22:04:13 +0000 | [diff] [blame] | 32 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 33 | |
Ubuntu | f45d1aa | 2020-02-06 07:01:44 +0000 | [diff] [blame^] | 34 | Clear Subscribed Events |
| 35 | [Documentation] This test case excercises the API, ClearCurrentEventList, which clears all Redfish evets currently subscribed to. |
| 36 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/clear_all_subscribed_events.expected |
| 37 | ${OUTPUT}= Run Process tests/clear_all_subscribed_events.tc ${IP1} ${PORT1} |
| 38 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 39 | |
| 40 | Configure Data Polling Interval |
| 41 | [Documentation] This test case excercises the API, SetFrequency, which configures the interval of data polling. |
| 42 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/configure_data_polling_interval.expected |
| 43 | ${OUTPUT}= Run Process tests/configure_data_polling_interval.tc ${IP1} ${PORT1} |
| 44 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 45 | |
| 46 | Delete Monitored Device |
| 47 | [Documentation] This test case excercises the API, DeleteDeviceList, which deletes Redfish devices being monitored. |
| 48 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' -e 's/ip2/${IP2}/g' -e 's/port2/${PORT2}/g' tests/delete_monitored_device.expected |
| 49 | ${OUTPUT}= Run Process tests/delete_monitored_device.tc ${IP1} ${PORT1} ${IP2} ${PORT2} |
| 50 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 51 | |
| 52 | List Devices monitored |
| 53 | [Documentation] This test case excercises the API, GetCurrentDevices, which lists all Redfish devices being monitored. |
| 54 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' -e 's/ip2/${IP2}/g' -e 's/port2/${PORT2}/g' tests/list_device_monitored.expected |
| 55 | ${OUTPUT}= Run Process tests/list_device_monitored.tc ${IP1} ${PORT1} ${IP2} ${PORT2} |
| 56 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 57 | |
| 58 | List Subscribed Events |
| 59 | [Documentation] This test case excercises the API, GetCurrentEventList, which lists all Redfish evets currently subscribed to. |
| 60 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/list_subscribed_events.expected |
| 61 | ${OUTPUT}= Run Process tests/list_subscribed_events.tc ${IP1} ${PORT1} |
| 62 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 63 | |
| 64 | List Supported Events |
| 65 | [Documentation] This test case excercises the API, GetEventList, which lists all supported Redfish events. |
| 66 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/list_supported_events.expected |
| 67 | ${OUTPUT}= Run Process tests/list_supported_events.tc ${IP1} ${PORT1} |
| 68 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 69 | |
| 70 | Subscribe Events |
| 71 | [Documentation] This test case excercises the API, SubscribeGivenEvents, which subscribes to the specified events. |
| 72 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/subscribe_events.expected |
| 73 | ${OUTPUT}= Run Process tests/subscribe_events.tc ${IP1} ${PORT1} |
| 74 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 75 | |
| 76 | Unsubscribe Events |
| 77 | [Documentation] This test case excercises the API, UnsubscribeGivenEvents, which unsubscribes to the specified events. |
| 78 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/unsubscribe_events.expected |
| 79 | ${OUTPUT}= Run Process tests/unsubscribe_events.tc ${IP1} ${PORT1} |
| 80 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 81 | |
| 82 | Validate IP |
| 83 | [Documentation] This test case validates the format of IP, whcih is expected to be in the form of <ip>:<port>. |
| 84 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/validate_ip.expected |
| 85 | ${OUTPUT}= Run Process tests/validate_ip.tc ${IP1} ${PORT1} |
| 86 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 87 | |
| 88 | *** Keywords *** |
| 89 | Get IP AND PORT |
| 90 | Sort List ${ADDR_LIST} |
| 91 | ${I1}= Fetch From LEFT ${ADDR_LIST}[0] : |
| 92 | Set Suite Variable ${IP1} ${I1} |
| 93 | ${P1}= Fetch From Right ${ADDR_LIST}[0] : |
| 94 | Set Suite Variable ${PORT1} ${P1} |
| 95 | ${I2}= Fetch From LEFT ${ADDR_LIST}[1] : |
| 96 | Set Suite Variable ${IP2} ${I2} |
| 97 | ${P2}= Fetch From Right ${ADDR_LIST}[1] : |
| 98 | Set Suite Variable ${PORT2} ${P2} |