Migrate Get Requests invocations(libraries)
[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}     /rests/data/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 On Session
29     ...    session
30     ...    url=${REST_CONTEXT}/node=openflow%3A1?content=nonconfig
31     ...    expected_status=200
32     Log    ${resp.content}
33     Wait Until Keyword Succeeds    30s    2s    Check conn loop    ${TOPO_TREE_FANOUT}    1    ${resp.content}
34
35 Get nodeconnector for a node
36     [Documentation]    Get the inventory for a node
37     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
38     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
39     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
40     Wait Until Keyword Succeeds    30s    2s    Check Every Nodes Nodeconnector    ${numnodes}
41
42 Get Stats for a node
43     [Documentation]    Get the stats for a node
44     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
45     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
46     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
47     Wait Until Keyword Succeeds    120s    2s    Check Every Nodes Stats    ${numnodes}
48
49
50 *** Keywords ***
51 Check Every Nodes
52     [Arguments]    ${numnodes}
53     ${resp}    RequestsLibrary.GET On Session
54     ...    session
55     ...    url=${REST_CONTEXT}?content=nonconfig
56     ...    expected_status=200
57     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
58         Should Contain    ${resp.content}    openflow:${IND}
59     END
60
61 Check Every Nodes Stats
62     [Arguments]    ${numnodes}
63     FOR    ${IND}    IN RANGE    1    ${numnodes+1}
64         ${resp}    RequestsLibrary.GET On Session
65         ...    session
66         ...    url=${REST_CONTEXT}/node=openflow%3A${IND}?content=nonconfig
67         ...    expected_status=200
68         Log    ${resp.content}
69         Should Contain    ${resp.content}    flow-capable-node-connector-statistics
70         Should Contain    ${resp.content}    flow-table-statistics
71     END
72
73 Check Every Nodes Nodeconnector
74     [Arguments]    ${numnodes}
75     FOR    ${IND}    IN RANGE    2    ${numnodes+1}
76         ${resp}    RequestsLibrary.GET On Session
77         ...    session
78         ...    url=${REST_CONTEXT}/node=openflow%3A${IND}?content=nonconfig
79         ...    expected_status=200
80         Log    ${resp.content}
81         Check conn loop    ${TOPO_TREE_FANOUT+1}    ${IND}    ${resp.content}
82     END
83
84 Check conn loop
85     [Arguments]    ${arg}    ${outerind}    ${content}
86     FOR    ${var}    IN RANGE    1    ${arg+1}
87         Should Contain    ${content}    openflow:${outerind}:${var}
88     END