Remove ODL_STREAM from VtnCoKeywords.robot 14/50614/5
authorPeter Gubka <pgubka@cisco.com>
Wed, 18 Jan 2017 12:17:37 +0000 (13:17 +0100)
committerVratko Polák <vrpolak@cisco.com>
Fri, 20 Jan 2017 11:41:18 +0000 (11:41 +0000)
Contains also an additional kw in CompareStream to run kw for a certain stream

Change-Id: I92f70902cdb706c88a80e3e5d3105aa5e22a3239
Signed-off-by: Peter Gubka <pgubka@cisco.com>
csit/libraries/CompareStream.robot
csit/libraries/VtnCoKeywords.robot

index c85b40171eb6d86ed244530d466c9f30cb2b4f8f..f9a6cb4c6d4bc8670c5b6aced06ede64be3975c9 100644 (file)
@@ -124,6 +124,12 @@ Run_Keyword_If_More_Than
     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
     BuiltIn.Run_Keyword_And_Return_If    &{Stream_dict}[${ODL_STREAM}] > &{Stream_dict}[${lower_bound}]    ${kw_name}    @{varargs}    &{kwargs}
 
+Run_Keyword_If_Equals
+    [Arguments]    ${stream}    ${kw_name}    @{varargs}    &{kwargs}
+    [Documentation]    Compare ${stream} to ${ODL_STREAM} and in case ${ODL_STREAM} equals ${stream},
+    ...    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_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},
index e7d4bd0ec85bf69ee4745510f1af8e387e3430f8..9aed1b937ee1e21dc51627ca8e897923ed6d3e0e 100644 (file)
@@ -8,6 +8,7 @@ Library           SSHLibrary
 Library           Collections
 Library           XML
 Variables         ../variables/Variables.py
+Resource          ./CompareStream.robot
 Resource          ./Utils.robot
 Resource          ./MininetKeywords.robot
 
@@ -43,7 +44,7 @@ Start SuiteVtnCo
     SSHLibrary.Execute Command    sudo chown jenkins /usr/local/vtn
     SSHLibrary.Execute Command    sudo yum install -q -y http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-2.noarch.rpm
     SSHLibrary.Execute Command    sudo yum install -q -y postgresql93-libs postgresql93 postgresql93-server postgresql93-contrib postgresql93-odbc-09.03.0400
-    Run Keyword If    '${ODL_STREAM}' == 'boron' or '${ODL_STREAM}' == 'carbon'    Download VtnCo Distribution
+    CompareStream.Run_Keyword_If_At_Least_Else    boron    Download VtnCo Distribution
     ...    ELSE    SSHLibrary.Execute Command    tar -C/ -jxvf ${WORKSPACE}/${BUNDLEFOLDER}/externalapps/${vtn_dist}*-bin.tar.bz2
     SSHLibrary.Execute Command    /usr/local/vtn/sbin/db_setup
     SSHLibrary.Execute Command    /usr/local/vtn/bin/vtn_start
@@ -58,13 +59,14 @@ Start SuiteVtnCo
     SSHLibrary.Execute Command    exit
 
 Download VtnCo Distribution
-    Run Keyword If    '${ODL_STREAM}' == 'boron'    SSHLibrary.Execute Command    wget "${nexus_path}/${boron}/maven-metadata.xml"
-    ...    ELSE IF    '${ODL_STREAM}' == 'carbon'    SSHLibrary.Execute Command    wget "${nexus_path}/${carbon}/maven-metadata.xml"
-    Run Keyword If    '${ODL_STREAM}' == 'boron' or '${ODL_STREAM}' == 'carbon'    SSHLibrary.Get_file    maven-metadata.xml
+    # TODO: https://trello.com/c/fDiIUFMv/431-remove-hardcoded-versions-of-vtn-coordinator-in-libraries-vtncokeywords-robot
+    CompareStream.Run_Keyword_If_Equals    boron    SSHLibrary.Execute Command    wget "${nexus_path}/${boron}/maven-metadata.xml"
+    CompareStream.Run_Keyword_If_Equals    carbon    SSHLibrary.Execute Command    wget "${nexus_path}/${carbon}/maven-metadata.xml"
+    CompareStream.Run_Keyword_If_At_Least_Boron    SSHLibrary.Get_file    maven-metadata.xml
     ${time_stamp}=    XML.Get Element Text    maven-metadata.xml    xpath=.//snapshot/timestamp
     ${build_number}=    XML.Get Element Text    maven-metadata.xml    xpath=.//snapshot/buildNumber
-    Run Keyword If    '${ODL_STREAM}' == 'boron'    SSHLibrary.Execute Command    wget '${nexus_path}/${boron}/${vtn_dist}-6.3.2-${time_stamp}-${build_number}-bin.tar.bz2'
-    ...    ELSE IF    '${ODL_STREAM}' == 'carbon'    SSHLibrary.Execute Command    wget '${nexus_path}/${carbon}/${vtn_dist}-6.4.0-${time_stamp}-${build_number}-bin.tar.bz2'
+    CompareStream.Run_Keyword_If_Equals    boron    SSHLibrary.Execute Command    wget '${nexus_path}/${boron}/${vtn_dist}-6.3.2-${time_stamp}-${build_number}-bin.tar.bz2'
+    CompareStream.Run_Keyword_If_Equals    carbon    SSHLibrary.Execute Command    wget '${nexus_path}/${carbon}/${vtn_dist}-6.4.0-${time_stamp}-${build_number}-bin.tar.bz2'
     SSHLibrary.Execute Command    tar -C/ -jxvf ${vtn_dist}*-bin.tar.bz2
 
 Stop SuiteVtnCo