X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FCompareStream.robot;h=ee04dae78273f99b182c8e39ab2a9acb4e6cd862;hb=94651ca9711d8eb316721775561e815830bc6c7e;hp=f759463f7ae2464cef4591bad758b74cfa4abb9b;hpb=cd59d927d1e06f3df310acff55d11805f4cde2ff;p=integration%2Ftest.git diff --git a/csit/libraries/CompareStream.robot b/csit/libraries/CompareStream.robot index f759463f7a..ee04dae782 100644 --- a/csit/libraries/CompareStream.robot +++ b/csit/libraries/CompareStream.robot @@ -8,7 +8,7 @@ Library Collections Library String *** Variables *** -&{Stream_dict} carbon=${6} nitrogen=${7} oxygen=${8} fluorine=${9} +&{Stream_dict} carbon=${6} nitrogen=${7} oxygen=${8} fluorine=${9} neon=${10} sodium=${11} magnesium=${12} *** Keywords *** Set_Variable_If_At_Least @@ -47,6 +47,23 @@ Set_Variable_If_At_Least_Fluorine ... return ${value_if_false} otherwise. BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Least fluorine ${value_if_true} ${value_if_false} +Set_Variable_If_At_Least_Neon + [Arguments] ${value_if_true} ${value_if_false} + [Documentation] Compare neon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least neon, + ... return ${value_if_false} otherwise. + BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Least neon ${value_if_true} ${value_if_false} + +Set_Variable_If_At_Least_Sodium + [Arguments] ${value_if_true} ${value_if_false} + [Documentation] Compare neon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least sodium, + ... return ${value_if_false} otherwise. + BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Least sodium ${value_if_true} ${value_if_false} + +Set_Variable_If_At_Least_Magnesium + [Arguments] ${value_if_true} ${value_if_false} + [Documentation] Compare magnesium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is atleast magnesium, return ${value_if_false} otherwise. + BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Least magnesium ${value_if_true} ${value_if_false} + Set_Variable_If_At_Most_Carbon [Arguments] ${value_if_true} ${value_if_false} [Documentation] Compare carbon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most carbon, @@ -71,6 +88,24 @@ Set_Variable_If_At_Most_Fluorine ... return ${value_if_false} otherwise. BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Most fluorine ${value_if_true} ${value_if_false} +Set_Variable_If_At_Most_Neon + [Arguments] ${value_if_true} ${value_if_false} + [Documentation] Compare neon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most neon, + ... return ${value_if_false} otherwise. + BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Most neon ${value_if_true} ${value_if_false} + +Set_Variable_If_At_Most_Sodium + [Arguments] ${value_if_true} ${value_if_false} + [Documentation] Compare neon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most sodium, + ... return ${value_if_false} otherwise. + BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Most sodium ${value_if_true} ${value_if_false} + +Set_Variable_If_At_Most_Magnesium + [Arguments] ${value_if_true} ${value_if_false} + [Documentation] Compare magnesium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most magnesium, + ... return ${value_if_false} otherwise. + BuiltIn.Run_Keyword_And_Return Set_Variable_If_At_Most magnesium ${value_if_true} ${value_if_false} + CompareStream__Convert_Input [Arguments] @{arguments} [Documentation] Splits arguments into args and kwargs is used in Run_Keyword_If_At_Least_Else and Run_Keyword_If_At_Most_Else. @@ -81,15 +116,16 @@ CompareStream__Convert_Input ... are not supported. ${args} BuiltIn.Create_List ${kwargs} BuiltIn.Create_Dictionary - : FOR ${arg} IN @{arguments} - \ ${arg} BuiltIn.Convert_To_String ${arg} - \ ${removed} String.Remove_String ${arg} \n ${Space} \t - \ ... \r - \ ${splitted} BuiltIn.Run_Keyword_If "${removed[0]}" == "<" BuiltIn.Create List ${arg} - \ ... ELSE String.Split_String ${arg} separator== max_split=1 - \ ${len} BuiltIn.Get_Length ${splitted} - \ Run Keyword If ${len}==1 Collections.Append_To_List ${args} @{splitted}[0] - \ ... ELSE Collections.Set_To_Dictionary ${kwargs} @{splitted} + FOR ${arg} IN @{arguments} + ${arg} BuiltIn.Convert_To_String ${arg} + ${removed} String.Remove_String ${arg} \n ${Space} \t + ... \r + ${splitted} BuiltIn.Run_Keyword_If "${removed[0]}" == "<" BuiltIn.Create List ${arg} + ... ELSE String.Split_String ${arg} separator== max_split=1 + ${len} BuiltIn.Get_Length ${splitted} + Run Keyword If ${len}==1 Collections.Append_To_List ${args} @{splitted}[0] + ... ELSE Collections.Set_To_Dictionary ${kwargs} @{splitted} + END BuiltIn.Return_From_Keyword ${args} ${kwargs} Run_Keyword_If_At_Least @@ -144,6 +180,20 @@ Run_Keyword_If_Equals ... run ${kw_name} @{varargs} &{kwargs} and return its value. BuiltIn.Run_Keyword_And_Return_If &{Stream_dict}[${ODL_STREAM}] == &{Stream_dict}[${stream}] ${kw_name} @{varargs} &{kwargs} +Run_Keyword_If_Equals_Else + [Arguments] ${stream} @{varargs} + [Documentation] Compare ${stream} to ${ODL_STREAM} and in case ${ODL_STREAM} equals ${stream}, + ... run keyword defined before ELSE statement otherwise run keyword defined after ELSE statement and return its value. + ${position} Collections.Get_Index_From_List ${varargs} \ELSE + BuiltIn.Run_Keyword_If "${position}" == "-1" BuiltIn.Fail Missing else statement in defined expresion + ${varargs_if} Collections.Get_Slice_From_List ${varargs} 0 ${position} + ${varargs_else} Collections.Get_Slice_From_List ${varargs} ${position+1} + ${args_if} ${kwargs_if} CompareStream__Convert_Input @{varargs_if} + ${args_else} ${kwargs_else} CompareStream__Convert_Input @{varargs_else} + ${resp} BuiltIn.Run_Keyword_If &{Stream_dict}[${ODL_STREAM}] == &{Stream_dict}[${stream}] @{args_if} &{kwargs_if} + ... ELSE @{args_else} &{kwargs_else} + [Return] ${resp} + Run_Keyword_If_Less_Than [Arguments] ${lower_bound} ${kw_name} @{varargs} &{kwargs} [Documentation] Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is less than ${lower_bound}, @@ -174,6 +224,24 @@ Run_Keyword_If_At_Least_Fluorine ... run ${kw_name} @{varargs} &{kwargs} and return its value. BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Least fluorine ${kw_name} @{varargs} &{kwargs} +Run_Keyword_If_At_Least_Neon + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare neon to ${ODL_STREAM} and in case ${ODL_STREAM} is at least neon, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Least neon ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_At_Least_Sodium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare sodium to ${ODL_STREAM} and in case ${ODL_STREAM} is at least sodium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Least sodium ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_At_Least_Magnesium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare magnesium to ${ODL_STREAM} and in case ${ODL_STREAM} is at least magnesium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Least magnesium ${kw_name} @{varargs} &{kwargs} + Run_Keyword_If_At_Most_Carbon [Arguments] ${kw_name} @{varargs} &{kwargs} [Documentation] Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is at most carbon, @@ -198,6 +266,24 @@ Run_Keyword_If_At_Most_Fluorine ... run ${kw_name} @{varargs} &{kwargs} and return its value. BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Most fluorine ${kw_name} @{varargs} &{kwargs} +Run_Keyword_If_At_Most_Neon + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare neon to ${ODL_STREAM} and in case ${ODL_STREAM} is at most neon, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Most neon ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_At_Most_Sodium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare sodium to ${ODL_STREAM} and in case ${ODL_STREAM} is at most sodium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Most sodium ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_At_Most_Magnesium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare magnesium to ${ODL_STREAM} and in case ${ODL_STREAM} is at most magnesium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_At_Most magnesium ${kw_name} @{varargs} &{kwargs} + Run_Keyword_If_More_Than_Carbon [Arguments] ${kw_name} @{varargs} &{kwargs} [Documentation] Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is more than carbon, @@ -222,6 +308,24 @@ Run_Keyword_If_More_Than_Fluorine ... run ${kw_name} @{varargs} &{kwargs} and return its value. BuiltIn.Run_Keyword_And_Return Run_Keyword_If_More_Than fluorine ${kw_name} @{varargs} &{kwargs} +Run_Keyword_If_More_Than_Neon + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare neon to ${ODL_STREAM} and in case ${ODL_STREAM} is more than neon, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_More_Than neon ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_More_Than_Sodium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare sodium to ${ODL_STREAM} and in case ${ODL_STREAM} is more than sodium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_More_Than sodium ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_More_Than_Magnesium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare magnesium to ${ODL_STREAM} and in case ${ODL_STREAM} is more than magnesium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_More_Than magnesium ${kw_name} @{varargs} &{kwargs} + Run_Keyword_If_Less_Than_Carbon [Arguments] ${kw_name} @{varargs} &{kwargs} [Documentation] Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is less than carbon, @@ -245,3 +349,21 @@ Run_Keyword_If_Less_Than_Fluorine [Documentation] Compare fluorine to ${ODL_STREAM} and in case ${ODL_STREAM} is less than fluorine, ... run ${kw_name} @{varargs} &{kwargs} and return its value. BuiltIn.Run_Keyword_And_Return Run_Keyword_If_Less_Than fluorine ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_Less_Than_Neon + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare neon to ${ODL_STREAM} and in case ${ODL_STREAM} is less than neon, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_Less_Than neon ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_Less_Than_Sodium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare sodium to ${ODL_STREAM} and in case ${ODL_STREAM} is less than sodium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_Less_Than sodium ${kw_name} @{varargs} &{kwargs} + +Run_Keyword_If_Less_Than_Magnesium + [Arguments] ${kw_name} @{varargs} &{kwargs} + [Documentation] Compare magnesium to ${ODL_STREAM} and in case ${ODL_STREAM} is less than magnesium, + ... run ${kw_name} @{varargs} &{kwargs} and return its value. + BuiltIn.Run_Keyword_And_Return Run_Keyword_If_Less_Than magnesium ${kw_name} @{varargs} &{kwargs}