Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 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 Library of functions related to OLT |
| 17 | Library SSHLibrary |
| 18 | Library Collections |
| 19 | Library String |
| 20 | Library OperatingSystem |
| 21 | Library RequestsLibrary |
| 22 | Library CORDRobot |
| 23 | |
| 24 | *** Keywords *** |
| 25 | Openolt is Up |
| 26 | [Documentation] Verify that openolt process is started and ready to connect to voltha |
| 27 | [Arguments] ${ip} ${user} ${pass} ${prompt}=~# |
| 28 | Check Remote File Contents True |
| 29 | ... /var/log/openolt.log oper_state: up |
| 30 | ... ${ip} ${user} ${pass} prompt=${prompt} |
| 31 | |
| 32 | OLT Status Check |
| 33 | [Documentation] Returns "operational_status" and "admin_status" of a particular |
| 34 | ... OLT device from "olt device list" |
| 35 | [Arguments] ${olt_device} |
| 36 | ${json_result}= CORDRobot.ApiGet VOLT_DEVICE |
| 37 | Log ${json_result} |
| 38 | ${json_result_list}= Get From dictionary ${json_result} items |
| 39 | ${getJsonDict}= CORDRobot.getDictFromListOfDict |
| 40 | ... ${json_result_list} host ${olt_device} |
| 41 | ${operational_status}= Get From Dictionary ${getJsonDict} oper_status |
| 42 | ${admin_status}= Get From Dictionary ${getJsonDict} admin_state |
| 43 | [Return] ${operational_status} ${admin_status} |
| 44 | |
| 45 | Validate OLT States |
| 46 | [Documentation] Check that OLT has the expected 'operational_status' and 'admin_status' |
| 47 | [Arguments] ${expected_op_status} ${expected_admin_status} ${olt_device} |
| 48 | ${operational_status} ${admin_status} OLT Status Check ${olt_device} |
| 49 | Should Be Equal ${operational_status} ${expected_op_status} |
| 50 | Should Be Equal ${admin_status} ${expected_admin_status} |
| 51 | |
| 52 | Get VOLTHA Status |
| 53 | [Documentation] Obtain and log output of VOLTHA diagnostic commands |
| 54 | ${resp}= CORD Get ${VOLT_DEVICE} |
| 55 | ${jsondata}= To Json ${resp.content} |
| 56 | Log ${jsondata} |
| 57 | ${length}= Get Length ${jsondata['items']} |
| 58 | FOR ${INDEX} IN RANGE 0 ${length} |
| 59 | ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 60 | ${olt_device_id}= Get From Dictionary ${value} device_id |
| 61 | ${logical_device_id}= Get From Dictionary ${value} of_id |
| 62 | END |
| 63 | Set Suite Variable ${olt_device_id} |
| 64 | Set Suite Variable ${logical_device_id} |
| 65 | CORDRobot.write_log_of_voltha_cli_comand /tmp |
| 66 | ... voltha_devices.log devices |
| 67 | ... host=${server_ip} |
| 68 | CORDRobot.write_log_of_voltha_cli_comand /tmp |
| 69 | ... logical_devices.log logical_device ${logical_device_id} |
| 70 | ... voltha_logical_ports.log ports |
| 71 | ... voltha_logical_flows.log flow |
| 72 | ... host=${server_ip} |
| 73 | CORDRobot.write_log_of_voltha_cli_comand /tmp |
| 74 | ... devices.log device ${olt_device_id} |
| 75 | ... voltha_olt_ports.log ports |
| 76 | ... voltha_olt_flows.log flows |
| 77 | ... host=${server_ip} |
| 78 | ${voltha_devices_log}= Get Binary File /tmp/voltha_devices.log |
| 79 | ${devices_flows}= Get Binary File /tmp/voltha_olt_flows.log |
| 80 | ${device_ports}= Get Binary File /tmp/voltha_olt_ports.log |
| 81 | ${logical_devices}= Get Binary File /tmp/voltha_logical_flows.log |
| 82 | ${l_device_ports}= Get Binary File /tmp/voltha_logical_ports.log |
| 83 | Log ${voltha_devices_log} |
| 84 | Log ${devices_flows} |
| 85 | Log ${device_ports} |
| 86 | Log ${logical_devices} |
| 87 | Log ${l_device_ports} |