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 unless explicit status code is expected.
54 ... 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
55 ... expected failures on odl's side, such as 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 BuiltIn.Return_From_Keyword_If """${explicit_status_codes}""" != """${NO_STATUS_CODES}"""
59 ${xml} = XML.Parse_Xml ${text}
60 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
61 BuiltIn.Return_From_Keyword ${constant}
63 Get_Contexted_Constant
64 [Arguments] ${member_index} ${context}
65 [Documentation] Invoke get-contexted-constant rpc on the requested member and return the registered constant. The argument ${context} is only the string part
66 ... 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
67 ... calls with expected failures on odl's side, such as calling the rpc on isolated node etc.
68 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
69 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context}
70 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_CONTEXTED_CONSTANT_DIR} mapping=${mapping} session=${session}
71 ${xml} = XML.Parse_Xml ${text}
72 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
73 BuiltIn.Return_From_Keyword ${constant}
75 Get_Singleton_Constant
76 [Arguments] ${member_index} ${explicit_status_codes}=${NO_STATUS_CODES}
77 [Documentation] Invoke get-singleton-constant rpc on the requested member and return the registered constant unless explicit status code is
78 ... 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
79 ... with expected failures on odl's side, such as calling the rpc on isolated node etc.
80 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
81 ${text} = TemplatedRequests.Post_As_Xml_Templated ${GET_SINGLETON_CONSTANT_DIR} session=${session} explicit_status_codes=${explicit_status_codes}
82 BuiltIn.Return_From_Keyword_If """${explicit_status_codes}""" != """${NO_STATUS_CODES}"""
83 ${xml} = XML.Parse_Xml ${text}
84 ${constant} = XML.Get_Element_Text ${xml} xpath=constant
85 BuiltIn.Return_From_Keyword ${constant}
88 [Arguments] ${member_index} ${constant}
89 [Documentation] Register the get-constant rpc on the requested node with given constant.
90 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
91 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
92 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_CONSTANT_DIR} mapping=${mapping} session=${session}
95 [Arguments] ${member_index}
96 [Documentation] Unregister the get-constant rpc on the given node.
97 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
98 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_CONSTANT_DIR} session=${session}
100 Register_Singleton_Constant
101 [Arguments] ${member_index} ${constant}
102 [Documentation] TODO: more desctiptive comment than: Invoke register-singleton-constant rpc.
103 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
104 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
105 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_SINGLETON_CONSTANT_DIR} mapping=${mapping} session=${session}
107 Unregister_Singleton_Constant
108 [Arguments] ${member_index}
109 [Documentation] TODO: more desctiptive comment than: Invoke unregister-singleton-constant rpc.
110 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
111 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_SINGLETON_CONSTANT_DIR} session=${session}
113 Register_Flapping_Singleton
114 [Arguments] ${member_index}
115 [Documentation] TODO: more desctiptive comment than: Invoke register-flapping-singleton rpc.
116 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
117 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_FLAPPING_SINGLETON_DIR} session=${session}
119 Unregister_Flapping_Singleton
120 [Arguments] ${member_index}
121 [Documentation] TODO: more desctiptive comment than: Invoke unregister-flapping-singleton rpc.
122 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
123 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_FLAPPING_SINGLETON_DIR} session=${session}
124 ${xml} = XML.Parse_Xml ${text}
125 ${count} = XML.Get_Element_Text ${xml} xpath=flap-count
126 BuiltIn.Return_From_Keyword ${count}
129 [Arguments] ${member_index} ${seconds} ${trans_per_sec} ${chained_trans}=${True}
130 [Documentation] TODO: more desctiptive comment than: Invoke write-transactions rpc.
131 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
132 &{mapping} BuiltIn.Create_Dictionary SECONDS=${seconds} TPS=${trans_per_sec} CHAINED_TRANSACTIONS=${chained_trans}
133 TemplatedRequests.Post_As_Xml_Templated ${WRITE_TRANSACTIONS_DIR} mapping=${mapping} session=${session}
136 [Arguments] ${member_index} ${seconds} ${trans_per_sec} ${isolated_trans}=${True}
137 [Documentation] TODO: more desctiptive comment than: Invoke produce-transactions rpc.
138 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
139 &{mapping} BuiltIn.Create_Dictionary SECONDS=${seconds} TPS=${trans_per_sec} ISOLATED_TRANSACTIONS=${chained_trans}
140 TemplatedRequests.Post_As_Xml_Templated ${PRODUCE_TRANSACTIONS_DIR} mapping=${mapping} session=${session}
143 [Arguments] ${member_index} ${shard_name}
144 [Documentation] TODO: more desctiptive comment than: Invoke become-prefix-leader rpc.
145 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
146 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
147 ${text} = TemplatedRequests.Post_As_Xml_Templated ${BECOME_PREFIX_LEADER_DIR} mapping=${mapping} session=${session}
150 [Arguments] ${member_index} ${shard_name}
151 [Documentation] TODO: more desctiptive comment than: Invoke become-module-leader rpc.
152 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
153 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
154 ${text} = TemplatedRequests.Post_As_Xml_Templated ${BECOME_MODULE_LEADER_DIR} mapping=${mapping} session=${session}
157 [Arguments] ${member_index} ${shard_name}
158 [Documentation] TODO: more desctiptive comment than: Invoke remove-shard-replica rpc.
159 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
160 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
161 TemplatedRequests.Post_As_Xml_Templated ${REMOVE_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}
164 [Arguments] ${member_index} ${shard_name}
165 [Documentation] TODO: more desctiptive comment than: Invoke add-shard-replica rpc.
166 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
167 &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name}
168 TemplatedRequests.Post_As_Xml_Templated ${ADD_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}
170 Deconfigure_Id_Ints_Shard
171 [Arguments] ${member_index}
172 [Documentation] TODO: more desctiptive comment than: Invoke deconfigure-id-ints-shard rpc.
173 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
174 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${DECONFIGURE_ID_INTS_SHARD_DIR} base_name=location extension=uri
175 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
178 [Arguments] ${member_index}
179 [Documentation] TODO: more desctiptive comment than: Invoke is-client-aborted rpc.
180 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
181 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${IS_CLIENT_ABORTED_SHARD_DIR} base_name=location extension=uri
182 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
185 [Arguments] ${member_index}
186 [Documentation] TODO: more desctiptive comment than: Invoke subscribe-dtcl rpc.
187 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
188 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${SUBSCRIBE_DTCL_DIR} base_name=location extension=uri
189 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
192 [Arguments] ${member_index}
193 [Documentation] TODO: more desctiptive comment than: Invoke unsubscribe-dtcl rpc.
194 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
195 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${UNSUBSCRIBE_DTCL_DIR} base_name=location extension=uri
196 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
199 [Arguments] ${member_index}
200 [Documentation] TODO: more desctiptive comment than: Invoke subscribe-ddtl rpc.
201 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
202 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${SUBSCRIBE_DDTL_DIR} base_name=location extension=uri
203 TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
206 [Arguments] ${member_index}
207 [Documentation] TODO: more desctiptive comment than: Invoke unsubscribe-ddtl rpc.
208 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
209 ${uri} = TemplatedRequests.Resolve_Text_From_Template_Folder folder=${UNSUBSCRIBE_DDTL_DIR} base_name=location extension=uri
210 ${text} = TemplatedRequests.Post_To_Uri uri=${uri} data=${EMPTY} accept=${ACCEPT_JSON} content_type=${HEADERS_YANG_JSON} session=${session}
212 Start_Publish_Notifications
213 [Arguments] ${member_index} ${gid} ${seconds} ${notif_per_sec}
214 [Documentation] Start publishing notifications by invoking publish-notifications rpc.
215 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
216 &{mapping} BuiltIn.Create_Dictionary ID=${gid} DURATION=${seconds} RATE=${notif_per_sec}
217 TemplatedRequests.Post_As_Xml_Templated ${START_PUBLISH_NOTIFICATIONS_DIR} mapping=${mapping} session=${session}
219 Check_Publish_Notifications
220 [Arguments] ${member_index} ${gid}
221 [Documentation] Publishing notifications check by invoking check-publish-notifications rpc. Return publising process state details.
222 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
223 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
224 ${text} = TemplatedRequests.Post_As_Xml_Templated ${CHECK_PUBLISH_NOTIFICATIONS_DIR} mapping=${mapping} session=${session}
225 ${xml} = XML.Parse_Xml ${text}
226 ${active} = XML.Get_Element_Text ${xml} xpath=active
227 ${active} = BuiltIn.Convert_To_Boolean ${active}
228 ${status} ${publish_count}= BuiltIn.Run_Keyword_And_Ignore_Error XML.Get_Element_Text ${xml} xpath=publish-count
229 BuiltIn.Run_Keyword_If """${status}""" == """FAIL""" and """${publish_count}""" != """No element matching 'publish-count' found.""" BuiltIn.Fail ${publish_count}
230 ${publish_count} BuiltIn.Set_Variable_If """${status}""" == """FAIL""" ${EMPTY} ${publish_count}
231 ${status} ${last_error}= BuiltIn.Run_Keyword_And_Ignore_Error XML.Get_Element_Text ${xml} xpath=last-error
232 BuiltIn.Run_Keyword_If """${status}""" == """FAIL""" and """${last_error}""" != """No element matching 'last-error' found.""" BuiltIn.Fail ${last_error}
233 ${last_error} BuiltIn.Set_Variable_If """${status}""" == """FAIL""" ${EMPTY} ${last_error}
234 BuiltIn.Return_From_Keyword ${active} ${publish_count} ${last_error}
237 [Arguments] ${member_index} ${gid}
238 [Documentation] Subscribe listener for the notifications with identifier ${gid}.
239 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
240 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
241 TemplatedRequests.Post_As_Xml_Templated ${SUBSCRIBE_YNL_DIR} mapping=${mapping} session=${session}
244 [Arguments] ${member_index} ${gid}
245 [Documentation] Unsubscribe listener for the ${gid} identifier. Return statistics of the publishing process.
246 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
247 &{mapping} BuiltIn.Create_Dictionary ID=${gid}
248 ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_YNL_DIR} mapping=${mapping} session=${session}
249 ${xml} = XML.Parse_Xml ${text}
250 ${all_not} = XML.Get_Element_Text ${xml} xpath=all-not
251 ${id_not} = XML.Get_Element_Text ${xml} xpath=id-not
252 ${err_not} = XML.Get_Element_Text ${xml} xpath=err-not
253 ${local_number} = XML.Get_Element_Text ${xml} xpath=local-number
254 BuiltIn.Return_From_Keyword ${all_not} ${id_not} ${err_not} ${local_number}
256 Register_Bound_Constant
257 [Arguments] ${member_index} ${context} ${constant}
258 [Documentation] Invoke register-bound-constant rpc and register get-contexted-constant rpc. The argument ${context} is only the string part
259 ... of the whole instance identifier.
260 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
261 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context} CONSTANT=${constant}
262 ${text} = TemplatedRequests.Post_As_Xml_Templated ${REGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session}
264 Unregister_Bound_Constant
265 [Arguments] ${member_index} ${context}
266 [Documentation] Invoke unregister-bound-constant rpc and unregister get-contexted-constant rpc. The argument ${context} is only the string part
267 ... of the whole instance identifier.
268 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
269 &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context}
270 TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session}
272 Register_Default_Constant
273 [Arguments] ${member_index} ${constant}
274 [Documentation] TODO: more desctiptive comment than: Invoke register-default-constant rpc.
275 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
276 &{mapping} BuiltIn.Create_Dictionary CONSTANT=${constant}
277 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_DEFAULT_CONSTANT_DIR} mapping=${mapping} session=${session}
279 Unregister_Default_Constant
280 [Arguments] ${member_index}
281 [Documentation] TODO: more desctiptive comment than: Invoke unregister-default-constant rpc.
282 ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index}
283 TemplatedRequests.Post_As_Xml_Templated ${REGISTER_DEFAULT_CONSTANT_DIR} session=${session}