Upgrade RF syntax for v3.2 compatibility
[integration/test.git] / csit / suites / openflowplugin / Inventory_Scalability_OF10 / 010__restconf_inventory.robot
1 *** Settings ***
2 Documentation     Test suite for RESTCONF inventory
3 Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${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 Request    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 Request    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     END
51
52 Check Every Nodes Stats
53     [Arguments]    ${numnodes}
54     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
55         ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:${IND}
56         Log    ${resp.content}
57         Should Be Equal As Strings    ${resp.status_code}    200
58         Should Contain    ${resp.content}    flow-capable-node-connector-statistics
59         Should Contain    ${resp.content}    flow-table-statistics
60     END
61
62 Check Every Nodes Nodeconnector
63     [Arguments]    ${numnodes}
64     FOR    ${IND}    IN RANGE    2    ${numnodes+1}
65         ${resp}    RequestsLibrary.Get Request    session    ${REST_CONTEXT}/node/openflow:${IND}
66         Log    ${resp.content}
67         Should Be Equal As Strings    ${resp.status_code}    200
68         Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.content}
69     END
70
71 Check conn loop
72     [Arguments]    ${arg}    ${outerind}    ${content}
73     FOR    ${var}    IN RANGE    1    ${arg+1}
74         Should Contain    ${content}    openflow:${outerind}:${var}
75     END