Step 1: Move vm scripts to the right place
[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://${CONTROLLER}:${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
11 *** Variables ***
12 ${REST_CONTEXT}    /restconf/operational/network-topology:network-topology/topology/flow:1
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    ${REST_CONTEXT}    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    ${REST_CONTEXT}    link    ${numlinks}
29
30 *** Keywords ***
31 Verify Element Count
32     [Arguments]    ${URI}    ${xpath_location}    ${expected_count}
33     ${resp}    RequestsLibrary.Get    session    ${REST_CONTEXT}    headers=${ACCEPT_XML}
34     Log    ${resp.content}
35     Should Be Equal As Strings    ${resp.status_code}    200
36     ${count}=    Get Element Count    ${resp.content}    xpath=${xpath_location}
37     Should Be Equal As Numbers    ${count}    ${expected_count}