X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FMdsalLowlevel.robot;h=9dcaaa74e07013e92114e54a8a3a6130e1983c43;hb=2054a254a8608303b4f69aa5181285686cab5c6e;hp=7f5e1807fd437198dde0d2281b0f60c5af3d8355;hpb=e2eaf44e0d7eec7ca60ddaa272ca9918ba4fa7f9;p=integration%2Ftest.git diff --git a/csit/libraries/MdsalLowlevel.robot b/csit/libraries/MdsalLowlevel.robot index 7f5e1807fd..9dcaaa74e0 100644 --- a/csit/libraries/MdsalLowlevel.robot +++ b/csit/libraries/MdsalLowlevel.robot @@ -24,6 +24,8 @@ ${REGISTER_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/register_constant ${REGISTER_FLAPPING_SINGLETON_DIR} ${LOWLEVEL_RPC_DIR}/register_flapping_singleton ${REGISTER_SINGLETON_CONSTANT_DIR} ${LOWLEVEL_RPC_DIR}/register_singleton_constant ${REMOVE_PREFIX_SHARD_DIR} ${LOWLEVEL_RPC_DIR}/remove_prefix_shard +${SHUTDOWN_SHARD_REPLICA_DIR} ${LOWLEVEL_RPC_DIR}/shutdown_shard_replica +${SHUTDOWN_PREFIX_SHARD_REPLICA_DIR} ${LOWLEVEL_RPC_DIR}/shutdown_prefix_shard_replica ${START_PUBLISH_NOTIFICATIONS_DIR} ${LOWLEVEL_RPC_DIR}/start_publish_notifications ${SUBSCRIBE_DDTL_DIR} ${LOWLEVEL_RPC_DIR}/subscribe_ddtl ${SUBSCRIBE_DTCL_DIR} ${LOWLEVEL_RPC_DIR}/subscribe_dtcl @@ -135,8 +137,9 @@ Create_Prefix_Shard [Documentation] Create prefix based shard. ${replicas} is a list of cluster node indexes, taken e.g. from ClusterManagement.List_Indices_Or_All. ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} ${replicas_str} BuiltIn.Set_Variable ${EMPTY} - : FOR ${replica} IN @{replicas} - \ ${replicas_str} BuiltIn.Set_Variable ${replicas_str}member-${replica} + FOR ${replica} IN @{replicas} + ${replicas_str} BuiltIn.Set_Variable ${replicas_str}member-${replica} + END &{mapping} BuiltIn.Create_Dictionary PREFIX=${prefix} REPLICAS=${replicas_str} ${text} = TemplatedRequests.Post_As_Xml_Templated ${CREATE_PREFIX_SHARD_DIR} mapping=${mapping} session=${session} @@ -162,13 +165,17 @@ Subscribe_Dtcl Unsubscribe_Dtcl [Arguments] ${member_index} - [Documentation] Unsubscribe a listener from the data changes. Invoke unsubscribe-dtcl rpc. + [Documentation] Invoke unsubscribe-dtcl rpc, return copy-matches field as boolean. ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DTCL_DIR} session=${session} - ${xml} = XML.Parse_Xml ${text} - ${matches} = XML.Get_Element_Text ${xml} xpath=copy-matches - ${matches} = BuiltIn.Convert_To_Boolean ${matches} - BuiltIn.Return_From_Keyword ${matches} + BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Matches ${text} + +Unsubscribe_Dtcl_No_Tx + [Arguments] ${member_index} + [Documentation] Unsubscribe a listener from the data changes. Expect success no notifications received. Return boolean status. + ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} + ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DTCL_DIR} session=${session} additional_allowed_status_codes=${INTERNAL_SERVER_ERROR} + BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Maybe_No_Tx ${text} Subscribe_Ddtl [Arguments] ${member_index} @@ -178,14 +185,37 @@ Subscribe_Ddtl Unsubscribe_Ddtl [Arguments] ${member_index} - [Documentation] Unsubscribe DOMDataTreeListener from listening to the data changes. + [Documentation] Invoke unsubscribe-ddtl rpc, return copy-matches field as boolean. ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DDTL_DIR} session=${session} + BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Matches ${text} + +Unsubscribe_Ddtl_No_Tx + [Arguments] ${member_index} + [Documentation] Unsubscribe a listener from the data changes. Expect success no notifications received. Return boolean status. + ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} + ${text} = TemplatedRequests.Post_As_Xml_Templated ${UNSUBSCRIBE_DDTL_DIR} session=${session} additional_allowed_status_codes=${INTERNAL_SERVER_ERROR} + BuiltIn.Run_Keyword_And_Return MdsalLowLevel__Parse_Maybe_No_Tx ${text} + +MdsalLowLevel__Parse_Matches + [Arguments] ${text} + [Documentation] Interpret the \${text} as XML response to an unsubscribe call and return copy-matches as boolean. ${xml} = XML.Parse_Xml ${text} ${matches} = XML.Get_Element_Text ${xml} xpath=copy-matches ${matches} = BuiltIn.Convert_To_Boolean ${matches} BuiltIn.Return_From_Keyword ${matches} +MdsalLowLevel__Parse_Maybe_No_Tx + [Arguments] ${text} + [Documentation] Attempt to parse the \${text} as successful unsubscribe. If that fails, extract the error message and expect no notifications. + ${status} ${message} = BuiltIn.Run_Keyword_And_Ignore_Error MdsalLowLevel__Parse_Matches ${text} + BuiltIn.Return_From_Keyword_If "${status}" == "PASS" ${message} + ${xml} = XML.Parse_Xml ${text} + ${message} = XML.Get_Element_Text ${xml} xpath=error/error-message + ${status} ${message} = BuiltIn.Run_Keyword_And_Ignore_Error BuiltIn.Should_Contain ${message} listener has not received + BuiltIn.Return_From_Keyword_If "${status}" == "PASS" ${TRUE} + [Return] ${FALSE} + Start_Publish_Notifications [Arguments] ${member_index} ${gid} ${seconds} ${notif_per_sec} [Documentation] Start publishing notifications by invoking publish-notifications rpc. @@ -245,3 +275,17 @@ Unregister_Bound_Constant ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} &{mapping} BuiltIn.Create_Dictionary CONTEXT=${context} TemplatedRequests.Post_As_Xml_Templated ${UNREGISTER_BOUND_CONSTANT_DIR} mapping=${mapping} session=${session} + +Shutdown_Shard_Replica + [Arguments] ${member_index} ${shard_name} + [Documentation] Invoke shutdown-shard-replica rpc. + ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} + &{mapping} BuiltIn.Create_Dictionary SHARD_NAME=${shard_name} + TemplatedRequests.Post_As_Xml_Templated ${SHUTDOWN_SHARD_REPLICA_DIR} mapping=${mapping} session=${session} + +Shutdown_Prefix_Shard_Replica + [Arguments] ${member_index} ${shard_prefix} + [Documentation] Invoke shutdown-prefix-shard-replica rpc. + ${session} = ClusterManagement.Resolve_Http_Session_For_Member member_index=${member_index} + &{mapping} BuiltIn.Create_Dictionary PREFIX=${shard_prefix} + TemplatedRequests.Post_As_Xml_Templated ${SHUTDOWN_PREFIX_SHARD_REPLICA_DIR} mapping=${mapping} session=${session}