blob: d0649a332c0dcaf9bca2bfc86ff4f876174cc4e0 [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}
Matteo Scandolo50fa7362021-12-01 12:06:01 -080080 CORDRobot.write_log_of_onos_cli_command /tmp
81 ... onos_volt_port_status.log volt-port-status
82 ... host=${server_ip} port=${server_port}
83 ${onos_volt_port_status} Get Binary File /tmp/onos_volt_port_status.log
Zack Williams821c5022020-01-15 15:11:46 -070084 ${onos_volt_bp_meters} Get Binary File /tmp/onos_volt_bp_meters.log
85 CORDRobot.write_log_of_onos_cli_command /tmp
86 ... onos_dhcpl2.log dhcpl2relay-allocations
87 ... host=${server_ip} port=${server_port}
88 ${onos_dhcpl2} Get Binary File /tmp/onos_dhcpl2.log
89 CORDRobot.write_log_of_onos_cli_command /tmp
90 ... onos_aaa_users.log aaa-users
91 ... host=${server_ip} port=${server_port}
92 ${onos_aaa_users} Get Binary File /tmp/onos_aaa_users.log
93 CORDRobot.write_log_of_onos_cli_command /tmp
94 ... onos_netcfg.log netcfg
95 ... host=${server_ip} port=${server_port}
96 ${onos_netcfg} Get Binary File /tmp/onos_netcfg.log
97 CORDRobot.write_log_of_onos_cli_command /tmp
98 ... onos_groups.log groups
99 ... host=${server_ip} port=${server_port}
100 ${onos_groups} Get Binary File /tmp/onos_groups.log
101 CORDRobot.write_log_of_onos_cli_command /tmp
102 ... onos_hosts.log hosts
103 ... host=${server_ip} port=${server_port}
104 ${onos_hosts} Get Binary File /tmp/onos_hosts.log
105 CORDRobot.write_log_of_onos_cli_command /tmp
106 ... onos_links.log links
107 ... host=${server_ip} port=${server_port}
108 ${onos_links} Get Binary File /tmp/onos_links.log
Suchitra Vemuri12bac502020-09-02 14:57:29 -0700109 CORDRobot.write_log_of_onos_cli_command /tmp
110 ... onos_roles.log roles
111 ... host=${server_ip} port=${server_port}
112 ${onos_roles} Get Binary File /tmp/onos_roles.log
113 CORDRobot.write_log_of_onos_cli_command /tmp
114 ... onos_dhcpl2relay_stats.log dhcpl2relay-stats
115 ... host=${server_ip} port=${server_port}
116 ${onos_dhcpl2relay_stats} Get Binary File /tmp/onos_dhcpl2relay_stats.log
117 CORDRobot.write_log_of_onos_cli_command /tmp
118 ... onos_aaa_stats.log aaa-statistics
119 ... host=${server_ip} port=${server_port}
120 ${onos_aaa_stats} Get Binary File /tmp/onos_aaa_stats.log
Andrea Campanella46007d52021-03-09 12:58:57 +0100121 CORDRobot.write_log_of_onos_cli_command /tmp
122 ... onos_cfg_settings.log cfg get
123 ... host=${server_ip} port=${server_port}
124 ${onos_cfg_settings} Get Binary File /tmp/onos_cfg_settings.log
Suchitra Vemurieaccb592020-07-15 17:53:48 -0700125 CORDRobot.write_log_of_onos_cli_command /tmp
126 ... onos_xc.log sr-xconnect
127 ... host=${server_ip} port=${server_port}
128 ${onos_xc} Get Binary File /tmp/onos_xc.log
Andrea Campanellaa7e53422021-10-07 10:04:52 +0200129 CORDRobot.write_log_of_onos_cli_command /tmp
130 ... onos_instances.log nodes
131 ... host=${server_ip} port=${server_port}
132 ${onos_instances} Get Binary File /tmp/onos_instances.log
133 CORDRobot.write_log_of_onos_cli_command /tmp
134 ... onos_masters.log masters
135 ... host=${server_ip} port=${server_port}
136 ${onos_masters} Get Binary File /tmp/onos_masters.log
Andrea Campanella3837cde2022-03-11 14:49:35 +0100137 CORDRobot.write_log_of_onos_cli_command /tmp
138 ... onos_mac_learner_mappings.log mac-learner-get-mapping
139 ... host=${server_ip} port=${server_port}
140 ${onos_mac_learner_mappings} Get Binary File /tmp/onos_mac_learner_mappings.log
Zack Williams821c5022020-01-15 15:11:46 -0700141 Log ${onos_apps}
142 Log ${onos_devices}
Suchitra Vemurieaccb592020-07-15 17:53:48 -0700143 Log ${onos_xc}
Zack Williams821c5022020-01-15 15:11:46 -0700144 Log ${onos_ports}
145 Log ${onos_flows}
146 Log ${onos_meters}
147 Log ${onos_aaa_users}
148 Log ${onos_volt_prog_subscribers}
Matteo Scandolo50fa7362021-12-01 12:06:01 -0800149 Log ${onos_volt_port_status}
Zack Williams821c5022020-01-15 15:11:46 -0700150 Log ${onos_volt_prog_meters}
151 Log ${onos_volt_bp_meters}
152 Log ${onos_hosts}
153 Log ${onos_dhcpl2}
154 Log ${onos_netcfg}
155 Log ${onos_groups}
156 Log ${onos_links}
Suchitra Vemuri12bac502020-09-02 14:57:29 -0700157 Log ${onos_roles}
158 Log ${onos_dhcpl2relay_stats}
159 Log ${onos_aaa_stats}
Andrea Campanella46007d52021-03-09 12:58:57 +0100160 Log ${onos_cfg_settings}
Andrea Campanellaa7e53422021-10-07 10:04:52 +0200161 Log ${onos_instances}
162 Log ${onos_masters}
Andrea Campanella3837cde2022-03-11 14:49:35 +0100163 Log ${onos_mac_learner_mappings}