e570e5bdab3deb543fbb9f1e2f60c1d4269cfda9
[integration/test.git] / csit / suites / openflowplugin / Inventory_Scalability_OF13 / 020__restconf_topology.robot
1 *** Settings ***
2 Documentation     Test suite for RESTCONF topology
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           XML
7 Library           RequestsLibrary
8 Library           ../../../libraries/Common.py
9 Variables         ../../../variables/Variables.py
10 Resource          ../../../variables/openflowplugin/Variables.robot
11
12 *** Variables ***
13
14 *** Test Cases ***
15 Get Nodes Count
16     [Documentation]    Checks the number of switches
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    60s    2s    Verify Element Count    ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}    node    ${numnodes}
21
22 Get Links Count
23     [Documentation]    Checks the number of links
24     ${TOPO_TREE_DEPTH}    Convert To Integer    ${TOPO_TREE_DEPTH}
25     ${TOPO_TREE_FANOUT}    Convert To Integer    ${TOPO_TREE_FANOUT}
26     ${numnodes}    Num Of Nodes    ${TOPO_TREE_DEPTH}    ${TOPO_TREE_FANOUT}
27     ${numlinks}    Evaluate    (${numnodes}-1)*2
28     Wait Until Keyword Succeeds    60s    2s    Verify Element Count    ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}    link    ${numlinks}
29
30 *** Keywords ***
31 Verify Element Count
32     [Arguments]    ${URI}    ${xpath_location}    ${expected_count}
33     ${resp}    RequestsLibrary.Get Request    session    ${RFC8040_OPERATIONAL_TOPO_FLOW1_API}    headers=${ACCEPT_XML}
34     Log    ${resp.text}
35     Should Be Equal As Strings    ${resp.status_code}    200
36     ${count}=    Get Element Count    ${resp.text}    xpath=${xpath_location}
37     Should Be Equal As Numbers    ${count}    ${expected_count}