X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=csit%2Flibraries%2FSwitchUtils.robot;h=34b4c46eacbc3756b4351eea6b910f0122b38a2a;hb=0f5cfedbcdcac2227fec58f379d9b518c2c0f793;hp=227a9ea8c22c7e4a6ac88efc861f23a4d8faa6cc;hpb=59e81c38620fa1b61e15771191e35771450b9499;p=integration%2Ftest.git diff --git a/csit/libraries/SwitchUtils.robot b/csit/libraries/SwitchUtils.robot index 227a9ea8c2..34b4c46eac 100644 --- a/csit/libraries/SwitchUtils.robot +++ b/csit/libraries/SwitchUtils.robot @@ -22,25 +22,26 @@ Get Switch Datapath ID Verify Switch In Operational Data Store [Arguments] ${switch} [Documentation] Verifies the existence of the switch.datapath_id in the operational datastore. - ${resp} RequestsLibrary.Get session ${REST_CONTEXT} - Log ${resp.content} - Should Match Regexp ${resp.content} openflow:${switch.datapath_id} + ${resp} RequestsLibrary.Get Request session ${REST_CONTEXT} + Log ${resp.text} + Should Match Regexp ${resp.text} openflow:${switch.datapath_id} Verify Switch Not In Operational Data Store [Arguments] ${switch} [Documentation] Verifies that the given switch.datapath_id is not in the operational datastore. - ${resp} RequestsLibrary.Get session ${REST_CONTEXT} - Log ${resp.content} - Should Not Match Regexp ${resp.content} openflow:${switch.datapath_id} + ${resp} RequestsLibrary.Get Request session ${REST_CONTEXT} + Log ${resp.text} + Should Not Match Regexp ${resp.text} openflow:${switch.datapath_id} Iterate Switch Commands From List [Arguments] ${switch} ${cmd_list} [Documentation] Each string in the @{cmd_list} argument is executed on the switch.connection_index. Configure Connection Index And Prompt Wrapper ${switch} - : FOR ${cmd} IN @{cmd_list} - \ Log ${cmd} - \ Read Wrapper ${switch} - \ Execute Command Wrapper ${switch} ${cmd} + FOR ${cmd} IN @{cmd_list} + Log ${cmd} + Read Wrapper ${switch} + Execute Command Wrapper ${switch} ${cmd} + END Configure OpenFlow [Arguments] ${switch} @@ -63,9 +64,10 @@ Validate Switch Output Log ${tmp} ${output}= Execute Command Wrapper ${switch} ${cmd} Log ${output} - : FOR ${str} IN @{validations} - \ Run Keyword If "${should_exist}" == "true" Should Match Regexp ${output} ${str} - \ Run Keyword If "${should_exist}" == "false" Should Not Match Regexp ${output} ${str} + FOR ${str} IN @{validations} + Run Keyword If "${should_exist}" == "true" Should Match Regexp ${output} ${str} + Run Keyword If "${should_exist}" == "false" Should Not Match Regexp ${output} ${str} + END Enable OpenFlow [Arguments] ${switch} @@ -89,11 +91,11 @@ Open Connection Wrapper ... switch.mgmt_protocol, the connection open will be handled by the right robot ... library (Telnet or SSHLibrary). \ The connection_index is returned. Run Keyword If "${switch.mgmt_protocol}" == "ssh" Call Method ${switch} set_ssh_key ${USER_HOME}/.ssh/${SSH_KEY} - Run Keyword If "${switch.mgmt_protocol}" == "ssh" Call Method ${switch} set_mgmt_user ${MININET_USER} + Run Keyword If "${switch.mgmt_protocol}" == "ssh" Call Method ${switch} set_mgmt_user ${TOOLS_SYSTEM_USER} ${connection_index}= Run Keyword If "${switch.mgmt_protocol}" == "ssh" SSHLibrary.Open Connection ${switch.mgmt_ip} prompt=${switch.mgmt_prompt} timeout=30s Run Keyword If "${switch.mgmt_protocol}" == "ssh" Login With Public Key ${switch.mgmt_user} ${switch.ssh_key} any - ${connection_index}= Run Keyword If "${switch.mgmt_protocol}" == "telnet" Telnet.Open Connection ${switch.mgmt_ip} ELSE Set Variable - ... ${connection_index} + ${connection_index}= Run Keyword If "${switch.mgmt_protocol}" == "telnet" Telnet.Open Connection ${switch.mgmt_ip} + ... ELSE Set Variable ${connection_index} [Return] ${connection_index} Configure Connection Index And Prompt Wrapper @@ -124,8 +126,8 @@ Execute Command Wrapper [Documentation] Wraps the Execute Command keyword so that depending on the switch.mgmt_protocol the right ... library (Telnet or SSHLibrary) is used. ${output}= Run Keyword If "${switch.mgmt_protocol}" == "ssh" SSHLibrary.Execute Command ${cmd} - ${output}= Run Keyword If "${switch.mgmt_protocol}" == "telnet" Telnet.Execute Command ${cmd} ELSE Set Variable - ... ${output} + ${output}= Run Keyword If "${switch.mgmt_protocol}" == "telnet" Telnet.Execute Command ${cmd} + ... ELSE Set Variable ${output} [Return] ${output} Connect To Switch @@ -140,10 +142,11 @@ Connect To Switch ${connection_index}= Open Connection Wrapper ${switch} Call Method ${switch} set_connection_index ${connection_index} Configure Connection Index And Prompt Wrapper ${switch} - : FOR ${cmd} IN @{switch.connection_configs} - \ Write Bare Wrapper ${switch} ${cmd} - \ Sleep 1 - \ Read Wrapper ${switch} + FOR ${cmd} IN @{switch.connection_configs} + Write Bare Wrapper ${switch} ${cmd} + Sleep 1 + Read Wrapper ${switch} + END Cleanup Switch [Arguments] ${switch} @@ -158,10 +161,11 @@ Initialize Switch ... and a reconnect to the switch is made. Connect To Switch ${switch} Configure Connection Index And Prompt Wrapper ${switch} - : FOR ${cmd} IN @{switch.initialization_cmds} - \ Write Bare Wrapper ${switch} ${cmd} - \ Sleep 1 - \ Run Keyword And Ignore Error Read Wrapper ${switch} + FOR ${cmd} IN @{switch.initialization_cmds} + Write Bare Wrapper ${switch} ${cmd} + Sleep 1 + Run Keyword And Ignore Error Read Wrapper ${switch} + END Run Keyword If "${switch.initialization_type}" == "reboot" Wait For Switch Reboot ${switch} Run Keyword If "${switch.initialization_type}" == "reboot" Connect To Switch ${switch}