Step 2: Move test folder to root
[integration/test.git] / csit / suites / openflowplugin / Inventory_Scalability_OF13 / 010__restconf_inventory.robot
1 *** Settings ***
2 Documentation     Test suite for RESTCONF inventory
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
4 Suite Teardown    Delete All Sessions
5 Library           Collections
6 Library           RequestsLibrary
7 Library           ../../../libraries/Common.py
8 Variables         ../../../variables/Variables.py
9
10 *** Variables ***
11 ${REST_CONTEXT}    /restconf/operational/opendaylight-inventory:nodes
12
13 *** Test Cases ***
14 Get list of nodes
15     [Documentation]    Get the inventory
16     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
17     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
18     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
19     Wait Until Keyword Succeeds    30s    2s    Check Every Nodes    ${numnodes}
20
21 Get nodeconnector for the root node
22     [Documentation]    Get the inventory for the root node
23     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
24     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/node/openflow:1
25     Log    ${resp.content}
26     Should Be Equal As Strings    ${resp.status_code}    200
27     Wait Until Keyword Succeeds    30s    2s    Check conn loop    ${TOPO_TREE_FANOUT}    1    ${resp.content}
28
29 Get nodeconnector for a node
30     [Documentation]    Get the inventory for a node
31     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
32     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
33     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
34     Wait Until Keyword Succeeds    30s    2s    Check Every Nodes Nodeconnector    ${numnodes}
35
36 Get Stats for a node
37     [Documentation]    Get the stats for a node
38     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
39     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
40     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
41     Wait Until Keyword Succeeds    120s    2s    Check Every Nodes Stats    ${numnodes}
42
43 *** Keywords ***
44 Check Every Nodes
45     [Arguments]    ${numnodes}
46     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}
47     Should Be Equal As Strings    ${resp.status_code}    200
48     : FOR    ${IND}    IN RANGE    1    ${numnodes+1}
49     \    Should Contain    ${resp.content}    openflow:${IND}
50
51 Check Every Nodes Stats
52     [Arguments]    ${numnodes}
53     : FOR    ${IND}    IN RANGE    1    ${numnodes+1}
54     \    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/node/openflow:${IND}
55     \    Log    ${resp.content}
56     \    Should Be Equal As Strings    ${resp.status_code}    200
57     \    Should Contain    ${resp.content}    flow-capable-node-connector-statistics
58     \    Should Contain    ${resp.content}    flow-table-statistics
59
60 Check Every Nodes Nodeconnector
61     [Arguments]    ${numnodes}
62     : FOR    ${IND}    IN RANGE    2    ${numnodes+1}
63     \    ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}/node/openflow:${IND}
64     \    Log    ${resp.content}
65     \    Should Be Equal As Strings    ${resp.status_code}    200
66     \    Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.content}
67
68 Check conn loop
69     [Arguments]    ${arg}    ${outerind}    ${content}
70     : FOR    ${var}    IN RANGE    1    ${arg+1}
71     \    Should Contain    ${content}    openflow:${outerind}:${var}