blob: cd7abb9f9cc7ebad520843d128d8fca3d34c5823 [file] [log] [blame]
Zack Williams821c5022020-01-15 15:11:46 -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# onos common functions
15
16*** Settings ***
17Documentation Library for ONOS Functions
18Library SSHLibrary
19
20*** Keywords ***
21Execute ONOS CLI Command
Matteo Scandolo44ef9be2021-05-20 10:41:41 -070022 [Documentation] *DEPRECATED* Use "Execute ONOS CLI Command on open connection" instead. Establishes an ssh connection to ONOS contoller and executes a command
Zack Williams821c5022020-01-15 15:11:46 -070023 [Arguments] ${host} ${port} ${cmd} ${user}=karaf ${pass}=karaf
24 ${conn_id}= SSHLibrary.Open Connection ${host} port=${port} timeout=300s
25 SSHLibrary.Login ${user} ${pass}
26 @{result_values} SSHLibrary.Execute Command ${cmd} return_rc=True
27 ... return_stderr=True return_stdout=True
28 ${output} Set Variable @{result_values}[0]
29 Log ${output}
30 Should Be Empty @{result_values}[1]
31 Should Be Equal As Integers @{result_values}[2] 0
32 SSHLibrary.Close Connection
33 [Return] ${output}
34
35Validate XConnect in ONOS
36 [Documentation] Check if Fabric Crossconnnect matches exists value
37 [Arguments] ${server_ip} ${stag} ${exists}=True ${port}=30120
38 # FIXME: use Robot-based JSON manipulation, shorten line
39 ${rc}= Run And Return RC
40 ... http -a karaf:karaf GET http://${server_ip}:${port}/onos/segmentrouting/xconnect|jq -r '.xconnects[].vlanId'|grep ${stag}
41 Run Keyword If '${exists}' == 'True'
42 ... Should Be Equal As Integers ${rc} 0
43 ... ELSE
44 ... Should Be Equal As Integers ${rc} 1
45
46Get ONOS Status
47 [Documentation] Obtain and log output of ONOS diagnostic commands
48 [Arguments] ${server_ip}=${None} ${server_port}=30115
49 CORDRobot.write_log_of_onos_cli_command /tmp
50 ... onos_apps.log apps -a -s
51 ... host=${server_ip} port=${server_port}
52 ${onos_apps} Get Binary File /tmp/onos_apps.log
53 CORDRobot.write_log_of_onos_cli_command /tmp
54 ... onos_devices.log devices
55 ... host=${server_ip} port=${server_port}
56 ${onos_devices} Get Binary File /tmp/onos_devices.log
57 CORDRobot.write_log_of_onos_cli_command /tmp
58 ... onos_ports.log ports
59 ... host=${server_ip} port=${server_port}
60 ${onos_ports} Get Binary File /tmp/onos_ports.log
61 CORDRobot.write_log_of_onos_cli_command /tmp
62 ... onos_flows.log flows -s
63 ... host=${server_ip} port=${server_port}
64 ${onos_flows} Get Binary File /tmp/onos_flows.log
65 CORDRobot.write_log_of_onos_cli_command /tmp
66 ... onos_meters.log meters
67 ... host=${server_ip} port=${server_port}
68 ${onos_meters} Get Binary File /tmp/onos_meters.log
69 CORDRobot.write_log_of_onos_cli_command /tmp
70 ... onos_volt_prog_subscribers.log volt-programmed-subscribers
71 ... host=${server_ip} port=${server_port}
72 ${onos_volt_prog_subscribers} Get Binary File /tmp/onos_volt_prog_subscribers.log
73 CORDRobot.write_log_of_onos_cli_command /tmp
74 ... onos_volt_prog_meters.log volt-programmed-meters
75 ... host=${server_ip} port=${server_port}
76 ${onos_volt_prog_meters} Get Binary File /tmp/onos_volt_prog_meters.log
77 CORDRobot.write_log_of_onos_cli_command /tmp
78 ... onos_volt_bp_meters.log volt-bpmeter-mappings
79 ... host=${server_ip} port=${server_port}
80 ${onos_volt_bp_meters} Get Binary File /tmp/onos_volt_bp_meters.log
81 CORDRobot.write_log_of_onos_cli_command /tmp
82 ... onos_dhcpl2.log dhcpl2relay-allocations
83 ... host=${server_ip} port=${server_port}
84 ${onos_dhcpl2} Get Binary File /tmp/onos_dhcpl2.log
85 CORDRobot.write_log_of_onos_cli_command /tmp
86 ... onos_aaa_users.log aaa-users
87 ... host=${server_ip} port=${server_port}
88 ${onos_aaa_users} Get Binary File /tmp/onos_aaa_users.log
89 CORDRobot.write_log_of_onos_cli_command /tmp
90 ... onos_netcfg.log netcfg
91 ... host=${server_ip} port=${server_port}
92 ${onos_netcfg} Get Binary File /tmp/onos_netcfg.log
93 CORDRobot.write_log_of_onos_cli_command /tmp
94 ... onos_groups.log groups
95 ... host=${server_ip} port=${server_port}
96 ${onos_groups} Get Binary File /tmp/onos_groups.log
97 CORDRobot.write_log_of_onos_cli_command /tmp
98 ... onos_hosts.log hosts
99 ... host=${server_ip} port=${server_port}
100 ${onos_hosts} Get Binary File /tmp/onos_hosts.log
101 CORDRobot.write_log_of_onos_cli_command /tmp
102 ... onos_links.log links
103 ... host=${server_ip} port=${server_port}
104 ${onos_links} Get Binary File /tmp/onos_links.log
Suchitra Vemuri12bac502020-09-02 14:57:29 -0700105 CORDRobot.write_log_of_onos_cli_command /tmp
106 ... onos_roles.log roles
107 ... host=${server_ip} port=${server_port}
108 ${onos_roles} Get Binary File /tmp/onos_roles.log
109 CORDRobot.write_log_of_onos_cli_command /tmp
110 ... onos_dhcpl2relay_stats.log dhcpl2relay-stats
111 ... host=${server_ip} port=${server_port}
112 ${onos_dhcpl2relay_stats} Get Binary File /tmp/onos_dhcpl2relay_stats.log
113 CORDRobot.write_log_of_onos_cli_command /tmp
114 ... onos_aaa_stats.log aaa-statistics
115 ... host=${server_ip} port=${server_port}
116 ${onos_aaa_stats} Get Binary File /tmp/onos_aaa_stats.log
Andrea Campanella46007d52021-03-09 12:58:57 +0100117 CORDRobot.write_log_of_onos_cli_command /tmp
118 ... onos_cfg_settings.log cfg get
119 ... host=${server_ip} port=${server_port}
120 ${onos_cfg_settings} Get Binary File /tmp/onos_cfg_settings.log
Suchitra Vemurieaccb592020-07-15 17:53:48 -0700121 CORDRobot.write_log_of_onos_cli_command /tmp
122 ... onos_xc.log sr-xconnect
123 ... host=${server_ip} port=${server_port}
124 ${onos_xc} Get Binary File /tmp/onos_xc.log
Andrea Campanellaa7e53422021-10-07 10:04:52 +0200125 CORDRobot.write_log_of_onos_cli_command /tmp
126 ... onos_instances.log nodes
127 ... host=${server_ip} port=${server_port}
128 ${onos_instances} Get Binary File /tmp/onos_instances.log
129 CORDRobot.write_log_of_onos_cli_command /tmp
130 ... onos_masters.log masters
131 ... host=${server_ip} port=${server_port}
132 ${onos_masters} Get Binary File /tmp/onos_masters.log
Zack Williams821c5022020-01-15 15:11:46 -0700133 Log ${onos_apps}
134 Log ${onos_devices}
Suchitra Vemurieaccb592020-07-15 17:53:48 -0700135 Log ${onos_xc}
Zack Williams821c5022020-01-15 15:11:46 -0700136 Log ${onos_ports}
137 Log ${onos_flows}
138 Log ${onos_meters}
139 Log ${onos_aaa_users}
140 Log ${onos_volt_prog_subscribers}
141 Log ${onos_volt_prog_meters}
142 Log ${onos_volt_bp_meters}
143 Log ${onos_hosts}
144 Log ${onos_dhcpl2}
145 Log ${onos_netcfg}
146 Log ${onos_groups}
147 Log ${onos_links}
Suchitra Vemuri12bac502020-09-02 14:57:29 -0700148 Log ${onos_roles}
149 Log ${onos_dhcpl2relay_stats}
150 Log ${onos_aaa_stats}
Andrea Campanella46007d52021-03-09 12:58:57 +0100151 Log ${onos_cfg_settings}
Andrea Campanellaa7e53422021-10-07 10:04:52 +0200152 Log ${onos_instances}
153 Log ${onos_masters}