2 Documentation Keywords wrapping controller's odl-mdsal-lowlevel yang model rpcs.
4 ... This is just an initial skeleton implementation, calls are debugged. Multiple
5 ... changes will follow as suites will be implemented.
6 ... This suite should be preferably merged before any suite to avoid conflicting
7 ... situations while suites will be implementing.
9 ... Copyright (c) 2017 Cisco Systems, Inc. and others. All rights reserved.
11 ... This program and the accompanying materials are made available under the
12 ... terms of the Eclipse Public License v1.0 which accompanies this distribution,
13 ... and is available at http://www.eclipse.org/legal/epl-v10.html
15 Resource ${CURDIR}/ClusterManagement.robot
16 Resource ${CURDIR}/TemplatedRequests.robot
19 ${RPC_DIR} ${CURDIR}/../variables/mdsal/lowlevelrpc
20 ${ADD_SHARD_REPLICA_DIR} ${RPC_DIR}/add_shard_replica
21 ${BECOME_MODULE_LEADER_DIR} ${RPC_DIR}/become_module_leader
22 ${BECOME_PREFIX_LEADER_DIR} ${RPC_DIR}/become_prefix_leader
23 ${CHECK_PUBLISH_NOTIFICATIONS_DIR} ${RPC_DIR}/check_publish_notifications
24 ${DECONFIGURE_ID_INTS_SHARD_DIR} ${RPC_DIR}/deconfigure_id_ints_shard
25 ${GET_CONSTANT_DIR} ${RPC_DIR}/get_constant
26 ${GET_CONTEXTED_CONSTANT_DIR} ${RPC_DIR}/get_contexted_constant
27 ${GET_SINGLETON_CONSTANT_DIR} ${RPC_DIR}/get_singleton_constant
28 ${IS_CLIENT_ABORTED_DIR} ${RPC_DIR}/is_client_aborted
29 ${PRODUCE_TRANSACTIONS_DIR} ${RPC_DIR}/produce_transactions
30 ${REGISTER_BOUND_CONSTANT_DIR} ${RPC_DIR}/register_bound_constant
31 ${REGISTER_CONSTANT_DIR} ${RPC_DIR}/register_constant
32 ${REGISTER_DEFAULT_CONSTANT_DIR} ${RPC_DIR}/register_default_constant
33 ${REGISTER_FLAPPING_SINGLETON_DIR} ${RPC_DIR}/register_flapping_singleton
34 ${REGISTER_SINGLETON_CONSTANT_DIR} ${RPC_DIR}/register_singleton_constant
35 ${REMOVE_SHARD_REPLICA_DIR} ${RPC_DIR}/remove_shard_replica
36 ${START_PUBLISH_NOTIFICATIONS_DIR} ${RPC_DIR}/start_publish_notifications
37 ${SUBSCRIBE_DDTL_DIR} ${RPC_DIR}/subscribe_ddtl
38 ${SUBSCRIBE_DTCL_DIR} ${RPC_DIR}/subscribe_dtcl
39 ${SUBSCRIBE_YNL_DIR} ${RPC_DIR}/subscribe_ynl
40 ${UNREGISTER_BOUND_CONSTANT_DIR} ${RPC_DIR}/unregister_bound_constant
41 ${UNREGISTER_CONSTANT_DIR} ${RPC_DIR}/unregister_constant
42 ${UNREGISTER_DEFAULT_CONSTANT_DIR} ${RPC_DIR}/unregister_default_constant
43 ${UNREGISTER_FLAPPING_SINGLETON_DIR} ${RPC_DIR}/unregister_flapping_singleton
44 ${UNREGISTER_SINGLETON_CONSTANT_DIR} ${RPC_DIR}/unregister_singleton_constant
45 ${UNSUBSCRIBE_DDTL_DIR} ${RPC_DIR}/unsubscribe_ddtl
46 ${UNSUBSCRIBE_DTCL_DIR} ${RPC_DIR}/unsubscribe_dtcl
47 ${UNSUBSCRIBE_YNL_DIR} ${RPC_DIR}/unsubscribe_ynl
48 ${WRITE_TRANSACTIONS_DIR} ${RPC_DIR}/write_transactions
52 [Arguments] ${member_index} ${explicit_status_codes}=${NO_STATUS_CODES}
53 [Documentation] Invoke get-constant rpc on the requested member and return the registered constant. The ${explicit_status_codes} is a list
54 ... of http status codes for which the rpc call is considered as passed and is used for calls with expected failures on odl's side, such as
55 ... calling the rpc on isolated node etc.
56 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
57 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_CONSTANT_DIR} session=${session} explicit_status_codes=${explicit_status_codes}
58 ${xml} = XML.Parse_Xml ${text}
59 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
60 BuiltIn.Return_From_Keyword ${constant}
62 Get_Contexted_Constant
63 [Arguments] ${member_index} ${context}
64 [Documentation] Invoke get-contexted-constant rpc on the requested member and return the registered constant. The argument ${context} is only the string part
65 ... 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
66 ... calls with expected failures on odl's side, such as calling the rpc on isolated node etc.
67 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
68 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context}
69 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_CONTEXTED_CONSTANT_DIR} mapping=${mapping} session=${session}
70 ${xml} = XML.Parse_Xml ${text}
71 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
72 BuiltIn.Return_From_Keyword ${constant}
74 Get_Singleton_Constant
75 [Arguments] ${member_index}
76 [Documentation] TODO: more desctiptive comment than: Invoke get-singleton-constant rpc.
77 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
78 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${GET_SINGLETON_CONSTANT_DIR} base_name=location extension=uri
79 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
80 BuiltIn.Fail TODO: to format output data
81 BuiltIn.Return_From_Keyword ${formatted_output}
84 [Arguments] ${member_index} ${constant}
85 [Documentation] Register the get-constant rpc on the requested node with given constant.
86 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
87 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
88 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_CONSTANT_DIR} mapping=${mapping} session=${session}
91 [Arguments] ${member_index}
92 [Documentation] Unregister the get-constant rpc on the given node.
93 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
94 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_CONSTANT_DIR} session=${session}
96 Register_Singleton_Constant
97 [Arguments] ${member_index} ${constant}
98 [Documentation] TODO: more desctiptive comment than: Invoke register-singleton-constant rpc.
99 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
100 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
101 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_SINGLETON_CONSTANT_DIR} mapping=${mapping} session=${session}
103 Unregister_Singleton_Constant
104 [Arguments] ${member_index}
105 [Documentation] TODO: more desctiptive comment than: Invoke unregister-singleton-constant rpc.
106 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
107 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${UNREGISTER_SINGLETON_CONSTANT_DIR} base_name=location extension=uri
108 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
110 Register_Flapping_Singleton
111 [Arguments] ${member_index}
112 [Documentation] TODO: more desctiptive comment than: Invoke register-flapping-singleton rpc.
113 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
114 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${REGISTER_FLAPPING_SINGLETON_DIR} base_name=location extension=uri
115 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
117 Unregister_Flapping_Singleton
118 [Arguments] ${member_index}
119 [Documentation] TODO: more desctiptive comment than: Invoke unregister-flapping-singleton rpc.
120 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
121 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${UNREGISTER_FLAPPING_SINGLETON_DIR} base_name=location extension=uri
122 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
125 [Arguments] ${member_index} ${seconds} ${trans_per_sec} ${chained_trans}=${True}
126 [Documentation] TODO: more desctiptive comment than: Invoke write-transactions rpc.
127 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
128 &{mapping} BuiltIn.Create_Dictionary SECONDS=${seconds} TPS=${trans_per_sec} CHAINED_TRANSACTIONS=${chained_trans}
129 TemplatedRequests.Post_As_Xml_Templated ${WRITE_TRANSACTIONS_DIR} mapping=${mapping} session=${session}
132 [Arguments] ${member_index} ${seconds} ${trans_per_sec} ${isolated_trans}=${True}
133 [Documentation] TODO: more desctiptive comment than: Invoke produce-transactions rpc.
134 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
135 &{mapping} BuiltIn.Create_Dictionary SECONDS=${seconds} TPS=${trans_per_sec} ISOLATED_TRANSACTIONS=${chained_trans}
136 TemplatedRequests.Post_As_Xml_Templated ${PRODUCE_TRANSACTIONS_DIR} mapping=${mapping} session=${session}
139 [Arguments] ${member_index} ${shard_name}
140 [Documentation] TODO: more desctiptive comment than: Invoke become-prefix-leader rpc.
141 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
142 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
143 ${text} = TemplatedRequests.Post_As_Xml_Templated ${BECOME_PREFIX_LEADER_DIR} mapping=${mapping} session=${session}
146 [Arguments] ${member_index} ${shard_name}
147 [Documentation] TODO: more desctiptive comment than: Invoke become-module-leader rpc.
148 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
149 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
150 ${text} = TemplatedRequests.Post_As_Xml_Templated ${BECOME_MODULE_LEADER_DIR} mapping=${mapping} session=${session}
153 [Arguments] ${member_index} ${shard_name}
154 [Documentation] TODO: more desctiptive comment than: Invoke remove-shard-replica rpc.
155 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
156 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
157 TemplatedRequests.Post_As_Xml_Templated ${REMOVE_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}
160 [Arguments] ${member_index} ${shard_name}
161 [Documentation] TODO: more desctiptive comment than: Invoke add-shard-replica rpc.
162 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
163 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
164 TemplatedRequests.Post_As_Xml_Templated ${ADD_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}
166 Deconfigure_Id_Ints_Shard
167 [Arguments] ${member_index}
168 [Documentation] TODO: more desctiptive comment than: Invoke deconfigure-id-ints-shard rpc.
169 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
170 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${DECONFIGURE_ID_INTS_SHARD_DIR} base_name=location extension=uri
171 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
174 [Arguments] ${member_index}
175 [Documentation] TODO: more desctiptive comment than: Invoke is-client-aborted rpc.
176 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
177 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${IS_CLIENT_ABORTED_SHARD_DIR} base_name=location extension=uri
178 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
181 [Arguments] ${member_index}
182 [Documentation] TODO: more desctiptive comment than: Invoke subscribe-dtcl rpc.
183 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
184 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${SUBSCRIBE_DTCL_DIR} base_name=location extension=uri
185 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
188 [Arguments] ${member_index}
189 [Documentation] TODO: more desctiptive comment than: Invoke unsubscribe-dtcl rpc.
190 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
191 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${UNSUBSCRIBE_DTCL_DIR} base_name=location extension=uri
192 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
195 [Arguments] ${member_index}
196 [Documentation] TODO: more desctiptive comment than: Invoke subscribe-ddtl rpc.
197 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
198 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${SUBSCRIBE_DDTL_DIR} base_name=location extension=uri
199 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
202 [Arguments] ${member_index}
203 [Documentation] TODO: more desctiptive comment than: Invoke unsubscribe-ddtl rpc.
204 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
205 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${UNSUBSCRIBE_DDTL_DIR} base_name=location extension=uri
206 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
208 Start_Publish_Notifications
209 [Arguments] ${member_index} ${gid} ${seconds} ${notif_per_sec}
210 [Documentation] Start publishing notifications by invoking publish-notifications rpc.
211 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
212 &{mapping} BuiltIn.Create_Dictionary ID=${gid} DURATION=${seconds} RATE=${notif_per_sec}
213 TemplatedRequests.Post_As_Xml_Templated ${START_PUBLISH_NOTIFICATIONS_DIR} mapping=${mapping} session=${session}
215 Check_Publish_Notifications
216 [Arguments] ${member_index} ${gid}
217 [Documentation] Publishing notifications check by invoking check-publish-notifications rpc. Return publising process state details.
218 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
219 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
220 ${text} = TemplatedRequests.Post_As_Xml_Templated ${CHECK_PUBLISH_NOTIFICATIONS_DIR} mapping=${mapping} session=${session}
221 ${xml} = XML.Parse_Xml ${text}
222 ${active} = XML.Get_Element_Text ${xml} xpath=active
223 ${active} = BuiltIn.Convert_To_Boolean ${active}
224 ${status} ${publish_count}= BuiltIn.Run_Keyword_And_Ignore_Error XML.Get_Element_Text ${xml} xpath=publish-count
225 BuiltIn.Run_Keyword_If """${status}""" == """FAIL""" and """${publish_count}""" != """No element matching 'publish-count' found.""" BuiltIn.Fail ${publish_count}
226 ${publish_count} BuiltIn.Set_Variable_If """${status}""" == """FAIL""" ${EMPTY} ${publish_count}
227 ${status} ${last_error}= BuiltIn.Run_Keyword_And_Ignore_Error XML.Get_Element_Text ${xml} xpath=last-error
228 BuiltIn.Run_Keyword_If """${status}""" == """FAIL""" and """${last_error}""" != """No element matching 'last-error' found.""" BuiltIn.Fail ${last_error}
229 ${last_error} BuiltIn.Set_Variable_If """${status}""" == """FAIL""" ${EMPTY} ${last_error}
230 BuiltIn.Return_From_Keyword ${active} ${publish_count} ${last_error}
233 [Arguments] ${member_index} ${gid}
234 [Documentation] Subscribe listener for the notifications with identifier ${gid}.
235 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
236 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
237 TemplatedRequests.Post_As_Xml_Templated ${SUBSCRIBE_YNL_DIR} mapping=${mapping} session=${session}
240 [Arguments] ${member_index} ${gid}
241 [Documentation] Unsubscribe listener for the ${gid} identifier. Return statistics of the publishing process.
242 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
243 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
244 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_YNL_DIR} mapping=${mapping} session=${session}
245 ${xml} = XML.Parse_Xml ${text}
246 ${all_not} = XML.Get_Element_Text ${xml} xpath=all-not
247 ${id_not} = XML.Get_Element_Text ${xml} xpath=id-not
248 ${err_not} = XML.Get_Element_Text ${xml} xpath=err-not
249 ${local_number} = XML.Get_Element_Text ${xml} xpath=local-number
250 BuiltIn.Return_From_Keyword ${all_not} ${id_not} ${err_not} ${local_number}
252 Register_Bound_Constant
253 [Arguments] ${member_index} ${context} ${constant}
254 [Documentation] Invoke register-bound-constant rpc and register get-contexted-constant rpc. The argument ${context} is only the string part
255 ... of the whole instance identifier.
256 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
257 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context} CONSTANT=${constant}
258 ${text} = TemplatedRequests.Post_As_Xml_Templated ${REGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session}
260 Unregister_Bound_Constant
261 [Arguments] ${member_index} ${context}
262 [Documentation] Invoke unregister-bound-constant rpc and unregister get-contexted-constant rpc. The argument ${context} is only the string part
263 ... of the whole instance identifier.
264 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
265 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context}
266 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session}
268 Register_Default_Constant
269 [Arguments] ${member_index} ${constant}
270 [Documentation] TODO: more desctiptive comment than: Invoke register-default-constant rpc.
271 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
272 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
273 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_DEFAULT_CONSTANT_DIR} mapping=${mapping} session=${session}
275 Unregister_Default_Constant
276 [Arguments] ${member_index}
277 [Documentation] TODO: more desctiptive comment than: Invoke unregister-default-constant rpc.
278 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
279 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_DEFAULT_CONSTANT_DIR} session=${session}