Joey Armstrong | 9fadcbe | 2024-01-17 19:00:37 -0500 | [diff] [blame] | 1 | #Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Ubuntu | 32b4b41 | 2020-02-04 23:01:45 +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 *** |
| 16 | Documentation Provide the function to perform funtional tests for the Redfish device-management project |
| 17 | Suite Setup Get IP AND PORT |
| 18 | Library Process |
| 19 | Library OperatingSystem |
| 20 | Library BuiltIn |
| 21 | Library String |
| 22 | Library Collections |
| 23 | Variables ../../variables/variables.robot |
| 24 | |
| 25 | *** Test Cases *** |
| 26 | Clear Subscribed Events |
| 27 | [Documentation] This test case excercises the API, ClearCurrentEventList, which clears all Redfish evets |
| 28 | ... currently subscribed to. |
| 29 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' |
| 30 | ... tests/clear_all_subscribed_events.expected |
| 31 | ${OUTPUT}= Run Process tests/clear_all_subscribed_events.tc ${IP1} ${PORT1} |
| 32 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 33 | |
| 34 | Configure Data Polling Interval |
| 35 | [Documentation] This test case excercises the API, SetFrequency, which configures the interval of data polling. |
| 36 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' |
| 37 | ... tests/configure_data_polling_interval.expected |
| 38 | ${OUTPUT}= Run Process tests/configure_data_polling_interval.tc ${IP1} ${PORT1} |
| 39 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 40 | |
| 41 | List Subscribed Events |
| 42 | [Documentation] This test case excercises the API, GetCurrentEventList, which lists all Redfish evets currently |
| 43 | ... subscribed to. |
| 44 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' |
| 45 | ... tests/list_subscribed_events.expected |
| 46 | ${OUTPUT}= Run Process tests/list_subscribed_events.tc ${IP1} ${PORT1} |
| 47 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 48 | |
| 49 | List Supported Events |
| 50 | [Documentation] This test case excercises the API, GetEventList, which lists all supported Redfish events. |
| 51 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' |
| 52 | ... tests/list_supported_events.expected |
| 53 | ${OUTPUT}= Run Process tests/list_supported_events.tc ${IP1} ${PORT1} |
| 54 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 55 | |
| 56 | Subscribe Events |
| 57 | [Documentation] This test case excercises the API, SubscribeGivenEvents, which subscribes to the specified |
| 58 | ... events. |
| 59 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' |
| 60 | ... tests/subscribe_events.expected |
| 61 | ${OUTPUT}= Run Process tests/subscribe_events.tc ${IP1} ${PORT1} |
| 62 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 63 | |
| 64 | Unsubscribe Events |
| 65 | [Documentation] This test case excercises the API, UnsubscribeGivenEvents, which unsubscribes to the specified |
| 66 | ... events. |
| 67 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' |
| 68 | ... tests/unsubscribe_events.expected |
| 69 | ${OUTPUT}= Run Process tests/unsubscribe_events.tc ${IP1} ${PORT1} |
| 70 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 71 | |
| 72 | Validate IP |
| 73 | [Documentation] This test case validates the format of IP, whcih is expected to be in the form of <ip>:<port>. |
| 74 | ${EXPECTED}= RUN sed -e '/^\\/\\//d' -e 's/ip1/${IP1}/g' -e 's/port1/${PORT1}/g' tests/validate_ip.expected |
| 75 | ${OUTPUT}= Run Process tests/validate_ip.tc ${IP1} ${PORT1} |
| 76 | Should Be Equal ${EXPECTED} ${OUTPUT.stdout} |
| 77 | |
| 78 | *** Keywords *** |
| 79 | Setup Suite |
| 80 | [Documentation] Set up the test suite |
| 81 | Common Test Suite Setup |
| 82 | |
| 83 | Get IP AND PORT |
| 84 | [Documentation] Obtain the ip and port of Redfish devices from ONF voltha-system-tests |
| 85 | @{ADDR_LIST} ${olt_ip}:${OLT_PORT} |
| 86 | Sort List ${ADDR_LIST} |
| 87 | ${I1}= Fetch From LEFT ${ADDR_LIST}[0] : |
| 88 | Set Suite Variable ${IP1} ${I1} |
| 89 | ${P1}= Fetch From Right ${ADDR_LIST}[0] : |
| 90 | Set Suite Variable ${PORT1} ${P1} |