Step 1: Move vm scripts to the right place
[integration/test.git] / csit / suites / openflowplugin / Inventory_Scalability_OF13 / 040__statistics_manager.robot
1 *** Settings ***
2 Documentation     Test suite for Statistics Manager
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTPORT}    auth=${AUTH}    headers=${HEADERS}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           RequestsLibrary
7 Library           ../../../libraries/Common.py
8 Library           ../../../libraries/Topologynew.py
9 Variables         ../../../variables/Variables.py
10 Resource          ../../../libraries/Utils.robot
11
12 *** Variables ***
13 ${nodeprefix}     openflow:
14 ${key}            portStatistics
15 ${REST_CONTEXT}    /controller/nb/v2/statistics
16
17 *** Test Cases ***
18 get port stats
19     [Documentation]    Show port stats and validate result
20     [Tags]    adsal
21     ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})    1
22     @{node_list}    Create Nodes List    ${topo_nodes}
23     Wait Until Keyword Succeeds    70s    2s    Check For Elements At URI    ${REST_CONTEXT}/${CONTAINER}/port    ${node_list}
24
25 get flow stats
26     [Documentation]    Show flow stats and validate result
27     [Tags]    adsal
28     ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})
29     @{node_list}    Create Nodes List    ${topo_nodes}
30     Wait Until Keyword Succeeds    70s    2s    Check For Elements At URI    ${REST_CONTEXT}/${CONTAINER}/flow    ${node_list}
31
32 get table stats
33     [Documentation]    Show flow stats and validate result
34     [Tags]    adsal
35     ${topo_nodes}    Get Nodes From Tree Topo    (${TOPO_TREE_DEPTH},${TOPO_TREE_FANOUT})
36     @{node_list}    Create Nodes List    ${topo_nodes}
37     Wait Until Keyword Succeeds    70s    2s    Check For Elements At URI    ${REST_CONTEXT}/${CONTAINER}/table    ${node_list}
38
39 *** Keywords ***
40 Check For Correct Number Of Nodes At URI
41     [Arguments]    ${uri}    ${topo_nodes}
42     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/${uri}
43     Log    ${resp.content}
44     Should Be Equal As Strings    ${resp.status_code}    200
45     Should Contain X Times    ${resp.content}    "00:00:00:00:00:00:00:01"    ${TOPO_TREE_FANOUT+2}
46     : FOR    ${ITEM}    IN    @{topo_nodes}
47     \    ${IND}    Get From Dictionary    ${ITEM}    id
48     \    Should Contain X Times    ${resp.content}    "${IND}"    ${TOPO_TREE_FANOUT+3}
49
50 Check For All Nodes At URI
51     [Arguments]    ${uri}    ${topo_nodes}
52     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/${CONTAINER}/${uri}
53     Log    ${resp.content}
54     Should Be Equal As Strings    ${resp.status_code}    200
55     : FOR    ${ITEM}    IN    @{topo_nodes}
56     \    ${IND}    Get From Dictionary    ${ITEM}    id
57     \    Should Contain    ${resp.content}    "${IND}"
58
59 Create Nodes List
60     [Arguments]    ${topo_dict}
61     ##init list
62     @{node_list}=    Create List
63     : FOR    ${ITEM}    IN    @{topo_dict}
64     \    ${IND}    Get From Dictionary    ${ITEM}    id
65     \    Append To List    ${node_list}    ${IND}
66     [Return]    @{node_list}