You Wang | 0c2b366 | 2018-10-01 16:56:17 -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 utils/utils.py |
| 23 | Library restApi.py |
| 24 | |
| 25 | *** Keywords *** |
| 26 | Openolt is Up |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 27 | [Arguments] ${ip} ${user} ${pass} ${prompt}=~# |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 28 | [Documentation] Verify that openolt process is started and ready to connect to voltha |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 29 | Check Remote File Contents True /var/log/openolt.log oper_state: up ${ip} ${user} ${pass} prompt=${prompt} |
Suchitra Vemuri | fa387d3 | 2019-02-26 22:44:20 -0800 | [diff] [blame] | 30 | |
| 31 | OLT Status Check |
| 32 | [Arguments] ${olt_device} |
| 33 | [Documentation] Returns "operational_status" and "admin_status" of a particular OLT device from "olt device list" |
| 34 | ${json_result}= restApi.ApiGet VOLT_DEVICE |
| 35 | Log ${json_result} |
| 36 | ${json_result_list}= Get From dictionary ${json_result} items |
| 37 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} host ${olt_device} |
| 38 | ${operational_status}= Get From Dictionary ${getJsonDict} oper_status |
| 39 | ${admin_status}= Get From Dictionary ${getJsonDict} admin_state |
| 40 | [Return] ${operational_status} ${admin_status} |
| 41 | |
| 42 | Validate OLT States |
| 43 | [Arguments] ${expected_op_status} ${expected_admin_status} ${olt_device} |
| 44 | ${operational_status} ${admin_status} OLT Status Check ${olt_device} |
| 45 | Should Be Equal ${operational_status} ${expected_op_status} |
| 46 | Should Be Equal ${admin_status} ${expected_admin_status} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 47 | |
| 48 | Get VOLTHA Status |
| 49 | ${resp}= CORD Get ${VOLT_DEVICE} |
| 50 | ${jsondata}= To Json ${resp.content} |
| 51 | Log ${jsondata} |
| 52 | ${length}= Get Length ${jsondata['items']} |
| 53 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 54 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 55 | \ ${olt_device_id}= Get From Dictionary ${value} device_id |
| 56 | \ ${logical_device_id}= Get From Dictionary ${value} of_id |
| 57 | Set Suite Variable ${olt_device_id} |
| 58 | Set Suite Variable ${logical_device_id} |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 59 | testCaseUtils.send_command_to_voltha_cli /tmp voltha_devices.log devices host=${server_ip} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 60 | testCaseUtils.send_command_to_voltha_cli /tmp logical_devices.log logical_device ${logical_device_id} voltha_logical_ports.log ports voltha_logical_flows.log flow host=${server_ip} |
| 61 | testCaseUtils.send_command_to_voltha_cli /tmp devices.log device ${olt_device_id} voltha_olt_ports.log ports voltha_olt_flows.log flows host=${server_ip} |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 62 | ${voltha_devices_log}= Get Binary File /tmp/voltha_devices.log |
| 63 | ${devices_flows}= Get Binary File /tmp/voltha_olt_flows.log |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 64 | ${device_ports}= Get Binary File /tmp/voltha_olt_ports.log |
| 65 | ${logical_devices}= Get Binary File /tmp/voltha_logical_flows.log |
| 66 | ${l_device_ports}= Get Binary File /tmp/voltha_logical_ports.log |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 67 | Log ${voltha_devices_log} |
| 68 | Log ${devices_flows} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 69 | Log ${device_ports} |
| 70 | Log ${logical_devices} |
| 71 | Log ${l_device_ports} |
| 72 | |
| 73 | Get ONOS Status |
| 74 | testCaseUtils.send_command_to_onos_cli /tmp onos_apps.log apps -a -s host=${server_ip} |
| 75 | ${onos_apps} Get Binary File /tmp/onos_apps.log |
| 76 | testCaseUtils.send_command_to_onos_cli /tmp onos_devices.log devices host=${server_ip} |
| 77 | ${onos_devices} Get Binary File /tmp/onos_devices.log |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 78 | testCaseUtils.send_command_to_onos_cli /tmp onos_ports.log ports host=${server_ip} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 79 | ${onos_ports} Get Binary File /tmp/onos_ports.log |
| 80 | testCaseUtils.send_command_to_onos_cli /tmp onos_flows.log flows -s host=${server_ip} |
| 81 | ${onos_flows} Get Binary File /tmp/onos_flows.log |
| 82 | Log ${onos_apps} |
| 83 | Log ${onos_devices} |
| 84 | Log ${onos_ports} |
| 85 | Log ${onos_flows} |