Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / openflowplugin / Inventory_Scalability_OF13 / 020__restconf_topology.robot
1 *** Settings ***
2 Documentation       Test suite for RESTCONF topology
3
4 Library             Collections
5 Library             XML
6 Library             RequestsLibrary
7 Library             ../../../libraries/Common.py
8 Variables           ../../../variables/Variables.py
9 Resource            ../../../variables/openflowplugin/Variables.robot
10
11 Suite Setup         Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_XML}
12 Suite Teardown      Delete All Sessions
13
14
15 *** Test Cases ***
16 Get Nodes Count
17     [Documentation]    Checks the number of switches
18     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
19     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
20     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
21     Wait Until Keyword Succeeds
22     ...    60s
23     ...    2s
24     ...    Verify Element Count
25     ...    ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
26     ...    node
27     ...    ${numnodes}
28
29 Get Links Count
30     [Documentation]    Checks the number of links
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     ${numlinks}    Evaluate    (${numnodes}-1)*2
35     Wait Until Keyword Succeeds
36     ...    60s
37     ...    2s
38     ...    Verify Element Count
39     ...    ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
40     ...    link
41     ...    ${numlinks}
42
43
44 *** Keywords ***
45 Verify Element Count
46     [Arguments]    ${URI}    ${xpath_location}    ${expected_count}
47     ${resp}    RequestsLibrary.GET On Session
48     ...    session
49     ...    url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
50     ...    headers=${ACCEPT_XML}
51     ...    expected_status=200
52     Log    ${resp.text}
53     ${count}    Get Element Count    ${resp.text}    xpath=${xpath_location}
54     Should Be Equal As Numbers    ${count}    ${expected_count}