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 |
Zack Williams | c6722d5 | 2020-01-13 16:34:33 -0700 | [diff] [blame] | 23 | Library utils/testCaseUtils.py |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 24 | Library restApi.py |
| 25 | |
| 26 | *** Keywords *** |
| 27 | Openolt is Up |
You Wang | 88e1d85 | 2018-10-05 11:44:19 -0700 | [diff] [blame] | 28 | [Arguments] ${ip} ${user} ${pass} ${prompt}=~# |
You Wang | 0c2b366 | 2018-10-01 16:56:17 -0700 | [diff] [blame] | 29 | [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] | 30 | 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] | 31 | |
| 32 | OLT Status Check |
| 33 | [Arguments] ${olt_device} |
| 34 | [Documentation] Returns "operational_status" and "admin_status" of a particular OLT device from "olt device list" |
| 35 | ${json_result}= restApi.ApiGet VOLT_DEVICE |
| 36 | Log ${json_result} |
| 37 | ${json_result_list}= Get From dictionary ${json_result} items |
| 38 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} host ${olt_device} |
| 39 | ${operational_status}= Get From Dictionary ${getJsonDict} oper_status |
| 40 | ${admin_status}= Get From Dictionary ${getJsonDict} admin_state |
| 41 | [Return] ${operational_status} ${admin_status} |
| 42 | |
| 43 | Validate OLT States |
| 44 | [Arguments] ${expected_op_status} ${expected_admin_status} ${olt_device} |
| 45 | ${operational_status} ${admin_status} OLT Status Check ${olt_device} |
| 46 | Should Be Equal ${operational_status} ${expected_op_status} |
| 47 | Should Be Equal ${admin_status} ${expected_admin_status} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 48 | |
| 49 | Get VOLTHA Status |
| 50 | ${resp}= CORD Get ${VOLT_DEVICE} |
| 51 | ${jsondata}= To Json ${resp.content} |
| 52 | Log ${jsondata} |
| 53 | ${length}= Get Length ${jsondata['items']} |
| 54 | : FOR ${INDEX} IN RANGE 0 ${length} |
| 55 | \ ${value}= Get From List ${jsondata['items']} ${INDEX} |
| 56 | \ ${olt_device_id}= Get From Dictionary ${value} device_id |
| 57 | \ ${logical_device_id}= Get From Dictionary ${value} of_id |
| 58 | Set Suite Variable ${olt_device_id} |
| 59 | Set Suite Variable ${logical_device_id} |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 60 | 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] | 61 | 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} |
| 62 | 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] | 63 | ${voltha_devices_log}= Get Binary File /tmp/voltha_devices.log |
| 64 | ${devices_flows}= Get Binary File /tmp/voltha_olt_flows.log |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 65 | ${device_ports}= Get Binary File /tmp/voltha_olt_ports.log |
| 66 | ${logical_devices}= Get Binary File /tmp/voltha_logical_flows.log |
| 67 | ${l_device_ports}= Get Binary File /tmp/voltha_logical_ports.log |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 68 | Log ${voltha_devices_log} |
| 69 | Log ${devices_flows} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 70 | Log ${device_ports} |
| 71 | Log ${logical_devices} |
| 72 | Log ${l_device_ports} |
| 73 | |
Suchitra Vemuri | 6ef45ff | 2019-09-19 09:08:13 -0700 | [diff] [blame] | 74 | Get ONOS Status |
Suchitra Vemuri | 1d7b076 | 2019-09-18 15:12:31 -0700 | [diff] [blame] | 75 | [Arguments] ${server_ip}=${None} |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 76 | testCaseUtils.send_command_to_onos_cli /tmp onos_apps.log apps -a -s host=${server_ip} |
| 77 | ${onos_apps} Get Binary File /tmp/onos_apps.log |
| 78 | testCaseUtils.send_command_to_onos_cli /tmp onos_devices.log devices host=${server_ip} |
| 79 | ${onos_devices} Get Binary File /tmp/onos_devices.log |
Suchitra Vemuri | a21cbe8 | 2019-03-06 19:02:26 -0800 | [diff] [blame] | 80 | 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] | 81 | ${onos_ports} Get Binary File /tmp/onos_ports.log |
| 82 | testCaseUtils.send_command_to_onos_cli /tmp onos_flows.log flows -s host=${server_ip} |
| 83 | ${onos_flows} Get Binary File /tmp/onos_flows.log |
Suchitra Vemuri | fd5bbe9 | 2019-05-15 15:14:13 -0700 | [diff] [blame] | 84 | testCaseUtils.send_command_to_onos_cli /tmp onos_meters.log meters host=${server_ip} |
| 85 | ${onos_meters} Get Binary File /tmp/onos_meters.log |
| 86 | testCaseUtils.send_command_to_onos_cli /tmp onos_volt_prog_subscribers.log volt-programmed-subscribers host=${server_ip} |
| 87 | ${onos_volt_prog_subscribers} Get Binary File /tmp/onos_volt_prog_subscribers.log |
| 88 | testCaseUtils.send_command_to_onos_cli /tmp onos_volt_prog_meters.log volt-programmed-meters host=${server_ip} |
| 89 | ${onos_volt_prog_meters} Get Binary File /tmp/onos_volt_prog_meters.log |
Suchitra Vemuri | 50f8431 | 2019-11-26 12:53:36 -0800 | [diff] [blame] | 90 | testCaseUtils.send_command_to_onos_cli /tmp onos_volt_bp_meters.log volt-bpmeter-mappings host=${server_ip} |
| 91 | ${onos_volt_bp_meters} Get Binary File /tmp/onos_volt_bp_meters.log |
| 92 | testCaseUtils.send_command_to_onos_cli /tmp onos_dhcpl2.log dhcpl2relay-allocations host=${server_ip} |
| 93 | ${onos_dhcpl2} Get Binary File /tmp/onos_dhcpl2.log |
| 94 | testCaseUtils.send_command_to_onos_cli /tmp onos_aaa_users.log aaa-users host=${server_ip} |
| 95 | ${onos_aaa_users} Get Binary File /tmp/onos_aaa_users.log |
| 96 | testCaseUtils.send_command_to_onos_cli /tmp onos_netcfg.log netcfg host=${server_ip} |
| 97 | ${onos_netcfg} Get Binary File /tmp/onos_netcfg.log |
| 98 | testCaseUtils.send_command_to_onos_cli /tmp onos_groups.log groups host=${server_ip} |
| 99 | ${onos_groups} Get Binary File /tmp/onos_groups.log |
Suchitra Vemuri | c254b01 | 2019-12-09 13:05:03 -0800 | [diff] [blame] | 100 | testCaseUtils.send_command_to_onos_cli /tmp onos_hosts.log hosts host=${server_ip} |
| 101 | ${onos_hosts} Get Binary File /tmp/onos_hosts.log |
Suchitra Vemuri | 7b3f901 | 2019-12-09 20:22:34 -0800 | [diff] [blame] | 102 | testCaseUtils.send_command_to_onos_cli /tmp onos_links.log links host=${server_ip} |
| 103 | ${onos_links} Get Binary File /tmp/onos_links.log |
Kailash | 7ee66a0 | 2019-03-01 13:01:16 -0800 | [diff] [blame] | 104 | Log ${onos_apps} |
| 105 | Log ${onos_devices} |
| 106 | Log ${onos_ports} |
| 107 | Log ${onos_flows} |
Suchitra Vemuri | fd5bbe9 | 2019-05-15 15:14:13 -0700 | [diff] [blame] | 108 | Log ${onos_meters} |
Suchitra Vemuri | 50f8431 | 2019-11-26 12:53:36 -0800 | [diff] [blame] | 109 | Log ${onos_aaa_users} |
Suchitra Vemuri | fd5bbe9 | 2019-05-15 15:14:13 -0700 | [diff] [blame] | 110 | Log ${onos_volt_prog_subscribers} |
| 111 | Log ${onos_volt_prog_meters} |
Suchitra Vemuri | 50f8431 | 2019-11-26 12:53:36 -0800 | [diff] [blame] | 112 | Log ${onos_volt_bp_meters} |
Suchitra Vemuri | c254b01 | 2019-12-09 13:05:03 -0800 | [diff] [blame] | 113 | Log ${onos_hosts} |
Suchitra Vemuri | 50f8431 | 2019-11-26 12:53:36 -0800 | [diff] [blame] | 114 | Log ${onos_dhcpl2} |
| 115 | Log ${onos_netcfg} |
| 116 | Log ${onos_groups} |
Suchitra Vemuri | 7b3f901 | 2019-12-09 20:22:34 -0800 | [diff] [blame] | 117 | Log ${onos_links} |