Super patch to stabilize our suites
[integration/test.git] / test / csit / libraries / Utils.txt
1 *** Settings ***
2 Library           SSHLibrary
3
4 *** Variables ***
5 ${start}          sudo mn --controller=remote,ip=${CONTROLLER} --topo tree,1 --switch ovsk,protocols=OpenFlow13
6
7 *** Keywords ***
8 Start Suite
9     [Documentation]    Basic setup/cleanup work that can be done safely before any system
10     ...    is run.
11     Log    Start the test on the base edition
12     Open Connection    ${MININET}    prompt=>    timeout=30s
13     Login With Public Key    ${MININET_USER}    ${USER_HOME}/.ssh/id_rsa    any
14     Write    sudo ovs-vsctl set-manager ptcp:6644
15     Write    sudo mn -c
16     Read Until    >
17     Write    ${start}
18     Read Until    mininet>
19     Sleep   6
20
21 Stop Suite
22     [Documentation]    Cleanup/Shutdown work that should be done at the completion of all
23     ...    tests
24     Log    Stop the test on the base edition
25     Read
26     Write    exit
27     Read Until    >
28     Close Connection
29
30 Ensure All Nodes Are In Response
31     [Arguments]    ${URI}    ${node_list}
32     [Documentation]    A GET is made to the supplied ${URI} and every item in the ${node_list}
33     ...    is verified to exist in the repsonse. This keyword currently implies that it's node
34     ...    specific but any list of strings can be given in ${node_list}. Refactoring of this
35     ...    to make it more generic should be done. (see keyword "Check For Elements At URI")
36     : FOR    ${node}    IN    @{node_list}
37     \    ${resp}    Get    session    ${URI}
38     \    Should Be Equal As Strings    ${resp.status_code}    200
39     \    Should Contain    ${resp.content}    ${node}
40
41 Check Nodes Stats
42     [Arguments]    ${node}
43     [Documentation]    A GET on the /node/${node} API is made and specific flow stat
44     ...    strings are checked for existence.
45     ${resp}    Get    session    ${REST_CONTEXT}/node/${node}
46     Should Be Equal As Strings    ${resp.status_code}    200
47     Should Contain    ${resp.content}    flow-capable-node-connector-statistics
48     Should Contain    ${resp.content}    flow-table-statistics
49
50 Check That Port Count Is Ok
51     [Arguments]    ${node}    ${count}
52     [Documentation]    A GET on the /port API is made and the specified port ${count} is
53     ...    verified. A more generic Keyword "Check For Specific Number Of Elements At URI"
54     ...    also does this work and further consolidation should be done.
55     ${resp}    Get    session    ${REST_CONTEXT}/${CONTAINER}/port
56     Log    ${resp.content}
57     Should Be Equal As Strings    ${resp.status_code}    200
58     Should Contain X Times    ${resp.content}    ${node}    ${count}
59
60 Check For Specific Number Of Elements At URI
61     [Arguments]    ${uri}    ${element}    ${expected_count}
62     [Documentation]    A GET is made to the specified ${URI} and the specific count of a
63     ...    given element is done (as supplied by ${element} and ${expected_count})
64     ${resp}    Get    session    ${uri}
65     Log    ${resp.content}
66     Should Be Equal As Strings    ${resp.status_code}    200
67     Should Contain X Times    ${resp.content}    ${element}    ${expected_count}
68
69 Check For Elements At URI
70     [Arguments]    ${uri}    ${elements}
71     [Documentation]    A GET is made at the supplied ${URI} and every item in the list of
72     ...    ${elements} is verified to exist in the response
73     ${resp}    Get    session    ${uri}
74     Log    ${resp.content}
75     Should Be Equal As Strings    ${resp.status_code}    200
76     : FOR    ${i}    IN    @{elements}
77     \    Should Contain    ${resp.content}    ${i}
78
79 Check For Elements Not At URI
80     [Arguments]    ${uri}    ${elements}
81     [Documentation]    A GET is made at the supplied ${URI} and every item in the list of
82     ...    ${elements} is verified to NOT exist in the response
83     ${resp}    Get    session    ${uri}
84     Log    ${resp.content}
85     Should Be Equal As Strings    ${resp.status_code}    200
86     : FOR    ${i}    IN    @{elements}
87     \    Should Not Contain    ${resp.content}    ${i}