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