2 Documentation Keywords wrapping controller's odl-mdsal-lowlevel yang model rpcs.
4 ... Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
6 ... This program and the accompanying materials are made available under the
7 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 Resource ${CURDIR}/ClusterManagement.robot
11 Resource ${CURDIR}/TemplatedRequests.robot
14 ${LOWLEVEL_RPC_DIR} ${CURDIR}/../variables/mdsal/lowlevelrpc
15 ${BECOME_PREFIX_LEADER_DIR} ${LOWLEVEL_RPC_DIR}/become_prefix_leader
16 ${CHECK_PUBLISH_NOTIFICATIONS_DIR} ${LOWLEVEL_RPC_DIR}/check_publish_notifications
17 ${CREATE_PREFIX_SHARD_DIR} ${LOWLEVEL_RPC_DIR}/create_prefix_shard
18 ${GET_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/get_constant
19 ${GET_CONTEXTED_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/get_contexted_constant
20 ${GET_SINGLETON_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/get_singleton_constant
21 ${PRODUCE_TRANSACTIONS_DIR} ${LOWLEVEL_RPC_DIR}/produce_transactions
22 ${REGISTER_BOUND_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/register_bound_constant
23 ${REGISTER_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/register_constant
24 ${REGISTER_FLAPPING_SINGLETON_DIR} ${LOWLEVEL_RPC_DIR}/register_flapping_singleton
25 ${REGISTER_SINGLETON_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/register_singleton_constant
26 ${REMOVE_PREFIX_SHARD_DIR} ${LOWLEVEL_RPC_DIR}/remove_prefix_shard
27 ${SHUTDOWN_SHARD_REPLICA_DIR} ${LOWLEVEL_RPC_DIR}/shutdown_shard_replica
28 ${SHUTDOWN_PREFIX_SHARD_REPLICA_DIR} ${LOWLEVEL_RPC_DIR}/shutdown_prefix_shard_replica
29 ${START_PUBLISH_NOTIFICATIONS_DIR} ${LOWLEVEL_RPC_DIR}/start_publish_notifications
30 ${SUBSCRIBE_DDTL_DIR} ${LOWLEVEL_RPC_DIR}/subscribe_ddtl
31 ${SUBSCRIBE_DTCL_DIR} ${LOWLEVEL_RPC_DIR}/subscribe_dtcl
32 ${SUBSCRIBE_YNL_DIR} ${LOWLEVEL_RPC_DIR}/subscribe_ynl
33 ${UNREGISTER_BOUND_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/unregister_bound_constant
34 ${UNREGISTER_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/unregister_constant
35 ${UNREGISTER_FLAPPING_SINGLETON_DIR} ${LOWLEVEL_RPC_DIR}/unregister_flapping_singleton
36 ${UNREGISTER_SINGLETON_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/unregister_singleton_constant
37 ${UNSUBSCRIBE_DDTL_DIR} ${LOWLEVEL_RPC_DIR}/unsubscribe_ddtl
38 ${UNSUBSCRIBE_DTCL_DIR} ${LOWLEVEL_RPC_DIR}/unsubscribe_dtcl
39 ${UNSUBSCRIBE_YNL_DIR} ${LOWLEVEL_RPC_DIR}/unsubscribe_ynl
40 ${WRITE_TRANSACTIONS_DIR} ${LOWLEVEL_RPC_DIR}/write_transactions
44 [Arguments] ${member_index} ${explicit_status_codes}=${NO_STATUS_CODES}
45 [Documentation] Invoke get-constant rpc on the requested member and return the registered constant unless explicit status code is expected.
46 ... The ${explicit_status_codes} is a list of http status codes for which the rpc call is considered as passed and is used for calls with
47 ... expected failures on odl's side, such as calling the rpc on isolated node etc.
48 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
49 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_CONSTANT_DIR} session=${session} explicit_status_codes=${explicit_status_codes}
50 BuiltIn.Return_From_Keyword_If """${explicit_status_codes}""" != """${NO_STATUS_CODES}"""
51 ${xml} = XML.Parse_Xml ${text}
52 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
53 BuiltIn.Return_From_Keyword ${constant}
55 Get_Contexted_Constant
56 [Arguments] ${member_index} ${context}
57 [Documentation] Invoke get-contexted-constant rpc on the requested member and return the registered constant. The argument ${context} is only the string part
58 ... of the whole instance identifier. The ${explicit_status_codes} is a list of http status codes for which the rpc call is considered as passed and is used for
59 ... calls with expected failures on odl's side, such as calling the rpc on isolated node etc.
60 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
61 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context}
62 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_CONTEXTED_CONSTANT_DIR} mapping=${mapping} session=${session}
63 ${xml} = XML.Parse_Xml ${text}
64 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
65 BuiltIn.Return_From_Keyword ${constant}
67 Get_Singleton_Constant
68 [Arguments] ${member_index} ${explicit_status_codes}=${NO_STATUS_CODES}
69 [Documentation] Invoke get-singleton-constant rpc on the requested member and return the registered constant unless explicit status code is
70 ... expected. The ${explicit_status_codes} is a list of http status codes for which the rpc call is considered as passed and is used for calls
71 ... with expected failures on odl's side, such as calling the rpc on isolated node etc.
72 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
73 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_SINGLETON_CONSTANT_DIR} session=${session} explicit_status_codes=${explicit_status_codes}
74 BuiltIn.Return_From_Keyword_If """${explicit_status_codes}""" != """${NO_STATUS_CODES}"""
75 ${xml} = XML.Parse_Xml ${text}
76 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
77 BuiltIn.Return_From_Keyword ${constant}
80 [Arguments] ${member_index} ${constant}
81 [Documentation] Register the get-constant rpc on the requested node with given constant.
82 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
83 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
84 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_CONSTANT_DIR} mapping=${mapping} session=${session}
87 [Arguments] ${member_index}
88 [Documentation] Unregister the get-constant rpc on the given node.
89 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
90 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_CONSTANT_DIR} session=${session}
92 Register_Singleton_Constant
93 [Arguments] ${member_index} ${constant}
94 [Documentation] Register singleton application on given node by invoking register-singleton-constant rpc.
95 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
96 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
97 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_SINGLETON_CONSTANT_DIR} mapping=${mapping} session=${session}
99 Unregister_Singleton_Constant
100 [Arguments] ${member_index}
101 [Documentation] Unregister singleton application on given node by invoking unregister-singleton-constant rpc.
102 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
103 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_SINGLETON_CONSTANT_DIR} session=${session}
105 Register_Flapping_Singleton
106 [Arguments] ${member_index}
107 [Documentation] Activate flapping application on given node by invoking register-flapping-singleton rpc.
108 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
109 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_FLAPPING_SINGLETON_DIR} session=${session}
111 Unregister_Flapping_Singleton
112 [Arguments] ${member_index}
113 [Documentation] Deactivate flapping singleton application by invoking unregister-flapping-singleton rpc.
114 ... Return the successful re-registrations count.
115 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
116 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_FLAPPING_SINGLETON_DIR} session=${session}
117 ${xml} = XML.Parse_Xml ${text}
118 ${count} = XML.Get_Element_Text ${xml} xpath=flap-count
119 BuiltIn.Return_From_Keyword ${count}
122 [Arguments] ${member_index} ${identifier} ${seconds} ${trans_per_sec} ${chained_trans}=${True}
123 [Documentation] Create transactions with given rate for given time for module-based shards.
124 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
125 &{mapping} BuiltIn.Create_Dictionary ID=${identifier} DURATION=${seconds} RATE=${trans_per_sec} CHAINED_FLAG=${chained_trans}
126 TemplatedRequests.Post_As_Xml_Templated ${WRITE_TRANSACTIONS_DIR} mapping=${mapping} session=${session}
129 [Arguments] ${member_index} ${seconds} ${trans_per_sec} ${isolated_trans}=${True}
130 [Documentation] Create transactions with given rate for given time for prefix-based shards.
131 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
132 &{mapping} BuiltIn.Create_Dictionary SECONDS=${seconds} TPS=${trans_per_sec} ISOLATED_TRANSACTIONS=${chained_trans}
133 TemplatedRequests.Post_As_Xml_Templated ${PRODUCE_TRANSACTIONS_DIR} mapping=${mapping} session=${session}
136 [Arguments] ${member_index} ${prefix} ${replicas}
137 [Documentation] Create prefix based shard. ${replicas} is a list of cluster node indexes, taken e.g. from ClusterManagement.List_Indices_Or_All.
138 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
139 ${replicas_str} BuiltIn.Set_Variable ${EMPTY}
140 : FOR ${replica} IN @{replicas}
141 \ ${replicas_str} BuiltIn.Set_Variable ${replicas_str}<replicas>member-${replica}</replicas>
142 &{mapping} BuiltIn.Create_Dictionary PREFIX=${prefix} REPLICAS=${replicas_str}
143 ${text} = TemplatedRequests.Post_As_Xml_Templated ${CREATE_PREFIX_SHARD_DIR} mapping=${mapping} session=${session}
146 [Arguments] ${member_index} ${prefix}
147 [Documentation] Remove prefix based shard.
148 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
149 &{mapping} BuiltIn.Create_Dictionary PREFIX=${prefix}
150 ${text} = TemplatedRequests.Post_As_Xml_Templated ${REMOVE_PREFIX_SHARD_DIR} mapping=${mapping} session=${session}
153 [Arguments] ${member_index} ${shard_name}
154 [Documentation] Given node ask to become a shard leader.
155 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
156 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name} ID=prefix-0
157 ${text} = TemplatedRequests.Post_As_Xml_Templated ${BECOME_PREFIX_LEADER_DIR} mapping=${mapping} session=${session}
160 [Arguments] ${member_index}
161 [Documentation] Subscribe a listener for data changes. Invoke subscribe-dtcl rpc.
162 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
163 TemplatedRequests.Post_As_Xml_Templated ${SUBSCRIBE_DTCL_DIR} session=${session}
166 [Arguments] ${member_index}
167 [Documentation] Invoke unsubscribe-dtcl rpc, return copy-matches field as boolean.
168 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
169 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DTCL_DIR} session=${session}
170 BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Matches ${text}
172 Unsubscribe_Dtcl_No_Tx
173 [Arguments] ${member_index}
174 [Documentation] Unsubscribe a listener from the data changes. Expect success no notifications received. Return boolean status.
175 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
176 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DTCL_DIR} session=${session} additional_allowed_status_codes=${INTERNAL_SERVER_ERROR}
177 BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Maybe_No_Tx ${text}
180 [Arguments] ${member_index}
181 [Documentation] Subscribe DOMDataTreeListener to listen for the data changes.
182 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
183 TemplatedRequests.Post_As_Xml_Templated ${SUBSCRIBE_DDTL_DIR} session=${session}
186 [Arguments] ${member_index}
187 [Documentation] Invoke unsubscribe-ddtl rpc, return copy-matches field as boolean.
188 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
189 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DDTL_DIR} session=${session}
190 BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Matches ${text}
192 Unsubscribe_Ddtl_No_Tx
193 [Arguments] ${member_index}
194 [Documentation] Unsubscribe a listener from the data changes. Expect success no notifications received. Return boolean status.
195 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
196 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DDTL_DIR} session=${session} additional_allowed_status_codes=${INTERNAL_SERVER_ERROR}
197 BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Maybe_No_Tx ${text}
199 MdsalLowLevel__Parse_Matches
201 [Documentation] Interpret the \${text} as XML response to an unsubscribe call and return copy-matches as boolean.
202 ${xml} = XML.Parse_Xml ${text}
203 ${matches} = XML.Get_Element_Text ${xml} xpath=copy-matches
204 ${matches} = BuiltIn.Convert_To_Boolean ${matches}
205 BuiltIn.Return_From_Keyword ${matches}
207 MdsalLowLevel__Parse_Maybe_No_Tx
209 [Documentation] Attempt to parse the \${text} as successful unsubscribe. If that fails, extract the error message and expect no notifications.
210 ${status} ${message} = BuiltIn.Run_Keyword_And_Ignore_Error MdsalLowLevel__Parse_Matches ${text}
211 BuiltIn.Return_From_Keyword_If "${status}" == "PASS" ${message}
212 ${xml} = XML.Parse_Xml ${text}
213 ${message} = XML.Get_Element_Text ${xml} xpath=error/error-message
214 ${status} ${message} = BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Should_Contain ${message} listener has not received
215 BuiltIn.Return_From_Keyword_If "${status}" == "PASS" ${TRUE}
218 Start_Publish_Notifications
219 [Arguments] ${member_index} ${gid} ${seconds} ${notif_per_sec}
220 [Documentation] Start publishing notifications by invoking publish-notifications rpc.
221 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
222 &{mapping} BuiltIn.Create_Dictionary ID=${gid} DURATION=${seconds} RATE=${notif_per_sec}
223 TemplatedRequests.Post_As_Xml_Templated ${START_PUBLISH_NOTIFICATIONS_DIR} mapping=${mapping} session=${session}
225 Check_Publish_Notifications
226 [Arguments] ${member_index} ${gid}
227 [Documentation] Publishing notifications check by invoking check-publish-notifications rpc. Return publising process state details.
228 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
229 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
230 ${text} = TemplatedRequests.Post_As_Xml_Templated ${CHECK_PUBLISH_NOTIFICATIONS_DIR} mapping=${mapping} session=${session}
231 ${xml} = XML.Parse_Xml ${text}
232 ${active} = XML.Get_Element_Text ${xml} xpath=active
233 ${active} = BuiltIn.Convert_To_Boolean ${active}
234 ${status} ${publish_count}= BuiltIn.Run_Keyword_And_Ignore_Error XML.Get_Element_Text ${xml} xpath=publish-count
235 BuiltIn.Run_Keyword_If """${status}""" == """FAIL""" and """${publish_count}""" != """No element matching 'publish-count' found.""" BuiltIn.Fail ${publish_count}
236 ${publish_count} BuiltIn.Set_Variable_If """${status}""" == """FAIL""" ${EMPTY} ${publish_count}
237 ${status} ${last_error}= BuiltIn.Run_Keyword_And_Ignore_Error XML.Get_Element_Text ${xml} xpath=last-error
238 BuiltIn.Run_Keyword_If """${status}""" == """FAIL""" and """${last_error}""" != """No element matching 'last-error' found.""" BuiltIn.Fail ${last_error}
239 ${last_error} BuiltIn.Set_Variable_If """${status}""" == """FAIL""" ${EMPTY} ${last_error}
240 BuiltIn.Return_From_Keyword ${active} ${publish_count} ${last_error}
243 [Arguments] ${member_index} ${gid}
244 [Documentation] Subscribe listener for the notifications with identifier ${gid}.
245 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
246 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
247 TemplatedRequests.Post_As_Xml_Templated ${SUBSCRIBE_YNL_DIR} mapping=${mapping} session=${session}
250 [Arguments] ${member_index} ${gid}
251 [Documentation] Unsubscribe listener for the ${gid} identifier. Return statistics of the publishing process.
252 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
253 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
254 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_YNL_DIR} mapping=${mapping} session=${session}
255 ${xml} = XML.Parse_Xml ${text}
256 ${all_not} = XML.Get_Element_Text ${xml} xpath=all-not
257 ${id_not} = XML.Get_Element_Text ${xml} xpath=id-not
258 ${err_not} = XML.Get_Element_Text ${xml} xpath=err-not
259 ${local_number} = XML.Get_Element_Text ${xml} xpath=local-number
260 BuiltIn.Return_From_Keyword ${all_not} ${id_not} ${err_not} ${local_number}
262 Register_Bound_Constant
263 [Arguments] ${member_index} ${context} ${constant}
264 [Documentation] Invoke register-bound-constant rpc and register get-contexted-constant rpc. The argument ${context} is only the string part
265 ... of the whole instance identifier.
266 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
267 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context} CONSTANT=${constant}
268 ${text} = TemplatedRequests.Post_As_Xml_Templated ${REGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session}
270 Unregister_Bound_Constant
271 [Arguments] ${member_index} ${context}
272 [Documentation] Invoke unregister-bound-constant rpc and unregister get-contexted-constant rpc. The argument ${context} is only the string part
273 ... of the whole instance identifier.
274 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
275 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context}
276 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session}
278 Shutdown_Shard_Replica
279 [Arguments] ${member_index} ${shard_name}
280 [Documentation] Invoke shutdown-shard-replica rpc.
281 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
282 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
283 TemplatedRequests.Post_As_Xml_Templated ${SHUTDOWN_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}
285 Shutdown_Prefix_Shard_Replica
286 [Arguments] ${member_index} ${shard_prefix}
287 [Documentation] Invoke shutdown-prefix-shard-replica rpc.
288 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
289 &{mapping} BuiltIn.Create_Dictionary PREFIX=${shard_prefix}
290 TemplatedRequests.Post_As_Xml_Templated ${SHUTDOWN_PREFIX_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}