Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / libraries / ODLTools.robot
1 *** Settings ***
2 Documentation     Robot wrapper around ODLTools.
3 Library           OperatingSystem
4 Resource          ../variables/Variables.robot
5
6 *** Keywords ***
7 Version
8     [Documentation]    Get the odltools version
9     ${cmd} =    BuiltIn.Set Variable    odltools -V
10     ${rc}    ${output} =    OperatingSystem.Run And Return Rc And Output    ${cmd}
11     BuiltIn.Log    rc: ${rc}, output: ${output}
12     BuiltIn.Should Be True    '${rc}' == '0'
13     [Return]    ${output}
14
15 Get EOS
16     [Arguments]    ${node_ip}=${ODL_SYSTEM_IP}    ${port}=${RESTCONFPORT}    ${test_name}=${SUITE_NAME}.${TEST_NAME}
17     [Documentation]    Get the various ODL entity ownership information
18     ${dstdir} =    Get Path    ${test_name}
19     ${cmd} =    BuiltIn.Set Variable    odltools netvirt show eos -i ${node_ip} -t ${port} -u ${ODL_RESTCONF_USER} -w ${ODL_RESTCONF_PASSWORD} --path ${dstdir}
20     ${rc}    ${output} =    OperatingSystem.Run And Return Rc And Output    ${cmd}
21     BuiltIn.Log    rc: ${rc}, output: ${output}
22     BuiltIn.Should Be True    '${rc}' == '0'
23     [Return]    ${output}
24
25 Get Cluster Info
26     [Arguments]    ${port}=${RESTCONFPORT}
27     [Documentation]    Get ODL Cluster related information like transaction counts, commit rates, etc.
28     FOR    ${i}    IN RANGE    ${NUM_ODL_SYSTEM}
29         ${cmd} =    BuiltIn.Set Variable    odltools netvirt show cluster-info -i ${ODL_SYSTEM_${i+1}_IP} -t ${port} -u ${ODL_RESTCONF_USER} -w ${ODL_RESTCONF_PASSWORD}
30         ${output} =    OperatingSystem.Run    ${cmd}
31         BuiltIn.Log    output: ${output}
32     END
33
34 Analyze Tunnels
35     [Arguments]    ${node_ip}=${ODL_SYSTEM_IP}    ${port}=${RESTCONFPORT}    ${test_name}=${SUITE_NAME}.${TEST_NAME}
36     [Documentation]    Analyze Tunnel Mesh creation for any errors and log results
37     ${dstdir} =    Get Path    ${test_name}
38     ${cmd} =    BuiltIn.Set Variable    odltools netvirt analyze tunnels -i ${node_ip} -t ${port} -u ${ODL_RESTCONF_USER} -w ${ODL_RESTCONF_PASSWORD} --path ${dstdir}
39     ${rc}    ${output} =    OperatingSystem.Run And Return Rc And Output    ${cmd}
40     BuiltIn.Log    rc: ${rc}, output: ${output}
41     BuiltIn.Should Be True    '${rc}' == '0'
42     [Return]    ${output}
43
44 Get All
45     [Arguments]    ${node_ip}=${ODL_SYSTEM_IP}    ${port}=${RESTCONFPORT}    ${test_name}=${SUITE_NAME}.${TEST_NAME}
46     [Documentation]    Get all results provided by ODLTools
47     ODLTools.Get Cluster Info
48     BuiltIn.run Keyword And Ignore Error    ODLTools.Get EOS    ${node_ip}    test_name=${test_name}
49     BuiltIn.run Keyword And Ignore Error    ODLTools.Analyze Tunnels    ${node_ip}    test_name=${test_name}
50
51 Get Path
52     [Arguments]    ${test_name}=${SUITE_NAME}.${TEST_NAME}
53     [Documentation]    Get odltools path for a given test case
54     ${tmpdir} =    BuiltIn.Evaluate    """${test_name}""".replace(" ","_").replace("/","_").replace(".","_").replace("(","_").replace(")","_")
55     [Return]    /tmp/${tmpdir}