blob: 19eebc6a4d78a027db1532ebff65f65fbadcc08f [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
23Library restApi.py
24
25*** Keywords ***
26Openolt is Up
You Wang88e1d852018-10-05 11:44:19 -070027 [Arguments] ${ip} ${user} ${pass} ${prompt}=~#
You Wang0c2b3662018-10-01 16:56:17 -070028 [Documentation] Verify that openolt process is started and ready to connect to voltha
You Wang88e1d852018-10-05 11:44:19 -070029 Check Remote File Contents True /var/log/openolt.log oper_state: up ${ip} ${user} ${pass} prompt=${prompt}
Suchitra Vemurifa387d32019-02-26 22:44:20 -080030
31OLT 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
42Validate 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}
Kailash7ee66a02019-03-01 13:01:16 -080047
48Get 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 Vemuria21cbe82019-03-06 19:02:26 -080059 testCaseUtils.send_command_to_voltha_cli /tmp voltha_devices.log devices host=${server_ip}
Kailash7ee66a02019-03-01 13:01:16 -080060 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 Vemuria21cbe82019-03-06 19:02:26 -080062 ${voltha_devices_log}= Get Binary File /tmp/voltha_devices.log
63 ${devices_flows}= Get Binary File /tmp/voltha_olt_flows.log
Kailash7ee66a02019-03-01 13:01:16 -080064 ${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 Vemuria21cbe82019-03-06 19:02:26 -080067 Log ${voltha_devices_log}
68 Log ${devices_flows}
Kailash7ee66a02019-03-01 13:01:16 -080069 Log ${device_ports}
70 Log ${logical_devices}
71 Log ${l_device_ports}
72
73Get 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 Vemuria21cbe82019-03-06 19:02:26 -080078 testCaseUtils.send_command_to_onos_cli /tmp onos_ports.log ports host=${server_ip}
Kailash7ee66a02019-03-01 13:01:16 -080079 ${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}