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