Changing Execute Command by Write/Read as the first does not work after karaf upgrade
[integration/test.git] / test / csit / libraries / KarafKeywords.txt
1 *** Settings ***
2 Library           SSHLibrary
3 Library           OperatingSystem
4
5 *** Variables ***
6 ${karaf_shell_port}     8101
7 ${karaf_prompt}         opendaylight-user
8 ${karaf_user}           karaf
9 ${karaf_password}       karaf
10
11 *** Keywords ***
12 Check Karaf Log File Does Not Have Messages
13     [Arguments]     ${ip}   ${message}  ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
14     ${output}=  Run Command On Remote System    ${ip}   grep ${message} ${log_file}
15     Should Not Contain  ${output}   ${message}
16
17 Verify Feature Is Installed
18     [Documentation]     Will Succeed if the given ${feature_name} is found in the output of "feature:list -i"
19     [Arguments]     ${feature_name}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}
20     ${output}=  Issue Command On Karaf Console  feature:list -i | grep ${feature_name}     ${controller}   ${karaf_port}
21     Should Contain  ${output}   ${feature_name}
22     [Return]    ${output}
23
24 Verify Feature Is Not Installed
25     [Documentation]     Will Succeed if the given ${feature_name} is NOT found in the output of "feature:list -i"
26     [Arguments]     ${feature_name}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}
27     ${output}=  Issue Command On Karaf Console  feature:list -i | grep ${feature_name}     ${controller}   ${karaf_port}
28     Should Not Contain  ${output}   ${feature_name}
29     [Return]    ${output}
30
31 Issue Command On Karaf Console
32     [Documentation]     Will execute the given ${cmd} by ssh'ing to the karaf console running on ${CONTROLLER}
33     [Arguments]     ${cmd}     ${controller}=${CONTROLLER}     ${karaf_port}=${karaf_shell_port}
34     Open Connection    ${controller}    port=${karaf_port}  prompt=${karaf_prompt}
35     Login    ${karaf_user}    ${karaf_password}
36     Write    ${cmd}
37     ${output}    Read Until    ${karaf_prompt}
38     Close Connection
39     Log     ${output}
40     [Return]    ${output}