blob: 2301b989b6394df035e1b523a45f31d9bc77480c [file] [log] [blame]
You Wang0c2b3662018-10-01 16:56:17 -07001# 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 ***
16Documentation Library of functions related to OLT
17Library SSHLibrary
18Library Collections
19Library String
20Library OperatingSystem
21Library RequestsLibrary
22Library utils/utils.py
Zack Williamsc6722d52020-01-13 16:34:33 -070023Library utils/testCaseUtils.py
You Wang0c2b3662018-10-01 16:56:17 -070024Library restApi.py
25
26*** Keywords ***
27Openolt is Up
You Wang88e1d852018-10-05 11:44:19 -070028 [Arguments] ${ip} ${user} ${pass} ${prompt}=~#
You Wang0c2b3662018-10-01 16:56:17 -070029 [Documentation] Verify that openolt process is started and ready to connect to voltha
You Wang88e1d852018-10-05 11:44:19 -070030 Check Remote File Contents True /var/log/openolt.log oper_state: up ${ip} ${user} ${pass} prompt=${prompt}
Suchitra Vemurifa387d32019-02-26 22:44:20 -080031
32OLT 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
43Validate 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}
Kailash7ee66a02019-03-01 13:01:16 -080048
49Get 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 Vemuria21cbe82019-03-06 19:02:26 -080060 testCaseUtils.send_command_to_voltha_cli /tmp voltha_devices.log devices host=${server_ip}
Kailash7ee66a02019-03-01 13:01:16 -080061 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 Vemuria21cbe82019-03-06 19:02:26 -080063 ${voltha_devices_log}= Get Binary File /tmp/voltha_devices.log
64 ${devices_flows}= Get Binary File /tmp/voltha_olt_flows.log
Kailash7ee66a02019-03-01 13:01:16 -080065 ${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 Vemuria21cbe82019-03-06 19:02:26 -080068 Log ${voltha_devices_log}
69 Log ${devices_flows}
Kailash7ee66a02019-03-01 13:01:16 -080070 Log ${device_ports}
71 Log ${logical_devices}
72 Log ${l_device_ports}
73
Suchitra Vemuri6ef45ff2019-09-19 09:08:13 -070074Get ONOS Status
Suchitra Vemuri1d7b0762019-09-18 15:12:31 -070075 [Arguments] ${server_ip}=${None}
Kailash7ee66a02019-03-01 13:01:16 -080076 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 Vemuria21cbe82019-03-06 19:02:26 -080080 testCaseUtils.send_command_to_onos_cli /tmp onos_ports.log ports host=${server_ip}
Kailash7ee66a02019-03-01 13:01:16 -080081 ${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 Vemurifd5bbe92019-05-15 15:14:13 -070084 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 Vemuri50f84312019-11-26 12:53:36 -080090 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 Vemuric254b012019-12-09 13:05:03 -0800100 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 Vemuri7b3f9012019-12-09 20:22:34 -0800102 testCaseUtils.send_command_to_onos_cli /tmp onos_links.log links host=${server_ip}
103 ${onos_links} Get Binary File /tmp/onos_links.log
Kailash7ee66a02019-03-01 13:01:16 -0800104 Log ${onos_apps}
105 Log ${onos_devices}
106 Log ${onos_ports}
107 Log ${onos_flows}
Suchitra Vemurifd5bbe92019-05-15 15:14:13 -0700108 Log ${onos_meters}
Suchitra Vemuri50f84312019-11-26 12:53:36 -0800109 Log ${onos_aaa_users}
Suchitra Vemurifd5bbe92019-05-15 15:14:13 -0700110 Log ${onos_volt_prog_subscribers}
111 Log ${onos_volt_prog_meters}
Suchitra Vemuri50f84312019-11-26 12:53:36 -0800112 Log ${onos_volt_bp_meters}
Suchitra Vemuric254b012019-12-09 13:05:03 -0800113 Log ${onos_hosts}
Suchitra Vemuri50f84312019-11-26 12:53:36 -0800114 Log ${onos_dhcpl2}
115 Log ${onos_netcfg}
116 Log ${onos_groups}
Suchitra Vemuri7b3f9012019-12-09 20:22:34 -0800117 Log ${onos_links}