Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / openflowplugin / MD_SAL_NSF_OF13 / 020_restconf_topology.robot
index 9e4d8cd31572670b34c4dc0d8329f6bc90b7500a..b6334ed9b29c8edb5caa067927927d0cf07914cf 100644 (file)
@@ -1,22 +1,32 @@
 *** Settings ***
-Documentation     Test suite for RESTCONF Topology
-Suite Setup       Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
-Suite Teardown    Delete All Sessions
-Library           Collections
-Library           RequestsLibrary
-Library           ../../../libraries/Common.py
-Variables         ../../../variables/Variables.py
-Resource          ../../../libraries/Utils.robot
+Documentation       Test suite for RESTCONF Topology
+
+Library             Collections
+Library             RequestsLibrary
+Library             ../../../libraries/Common.py
+Variables           ../../../variables/Variables.py
+Resource            ../../../variables/openflowplugin/Variables.robot
+Resource            ../../../libraries/Utils.robot
+
+Suite Setup         Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+Suite Teardown      Delete All Sessions
+
 
 *** Variables ***
-@{node_list}      openflow:1    openflow:2    openflow:3
+@{node_list}    openflow:1    openflow:2    openflow:3
+
 
 *** Test Cases ***
 Get RESTCONF Topology
     [Documentation]    Get RESTCONF Topology and validate the result.
-    Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${node_list}
-    ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_TOPO_API}
-    Log    ${resp.content}
+    Wait Until Keyword Succeeds
+    ...    10s
+    ...    2s
+    ...    Check For Elements At URI
+    ...    ${RFC8040_OPERATIONAL_TOPO_API}
+    ...    ${node_list}
+    ${resp}    RequestsLibrary.GET On Session    session    url=${RFC8040_OPERATIONAL_TOPO_API}
+    Log    ${resp.text}
 
 List all the links
     [Documentation]    List all the links in the topology.
@@ -50,10 +60,10 @@ Link Down
     # shot in the dark.    maybe the "link s1 s2 down" really didn't take the link(s) down?
     # hopefully this output below will show that.
     Write    sh ovs-vsctl find Interface name="s1-eth1"
-    ${output}=    Read Until    mininet>
+    ${output}    Read Until    mininet>
     Log    ${output}
     Write    sh ovs-vsctl find Interface name="s1-eth2"
-    ${output}=    Read Until    mininet>
+    ${output}    Read Until    mininet>
     Log    ${output}
 
 Link Up
@@ -68,27 +78,36 @@ Remove Port
     [Tags]    exclude
     Write    sh ovs-vsctl del-port s2 s2-eth2
     Read Until    mininet>
-    @{list}    Create List    openflow:2:2
-    Wait Until Keyword Succeeds    10s    2s    Check For Elements Not At URI    ${OPERATIONAL_TOPO_API}    ${list}
+    @{list}    Create List    openflow%3A2%3A2
+    Wait Until Keyword Succeeds
+    ...    10s
+    ...    2s
+    ...    Check For Elements Not At URI
+    ...    ${RFC8040_OPERATIONAL_TOPO_API}
+    ...    ${list}
 
 Add Port
     [Documentation]    Add port s2-eth2, new id 5
     [Tags]    exclude
     Write    sh ovs-vsctl add-port s2 s2-eth2
     Read Until    mininet>
-    @{list}    Create List    openflow:2:5
-    Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${OPERATIONAL_TOPO_API}    ${list}
+    @{list}    Create List    openflow%3A2%3A5
+    Wait Until Keyword Succeeds    10s    2s    Check For Elements At URI    ${RFC8040_OPERATIONAL_TOPO_API}    ${list}
+
 
 *** Keywords ***
 Verify Links
     [Arguments]    ${expected_links}
-    ${resp}    RequestsLibrary.Get Request    session    ${OPERATIONAL_TOPO_API}/topology/flow:1
-    Log    ${resp.content}
-    Should Be Equal As Strings    ${resp.status_code}    200
-    ${result}    To JSON    ${resp.content}
+    ${resp}    RequestsLibrary.GET On Session
+    ...    session
+    ...    url=${RFC8040_OPERATIONAL_TOPO_FLOW1_API}
+    ...    expected_status=200
+    Log    ${resp.text}
+    ${result}    Utils.Json Parse From String    ${resp.text}
     Log    ${result}
-    ${content}    Get From Dictionary    ${result}    topology
+    ${content}    Get From Dictionary    ${result}    network-topology:topology
     ${topology}    Get From List    ${content}    0
-    ${link}    Get From Dictionary    ${topology}    link
-    Sort List    ${link}
-    Lists Should be Equal    ${link}    ${expected_links}
+    ${links}    Get From Dictionary    ${topology}    link
+    FOR    ${expected_link}    IN    @{expected_links}
+        Should Contain    ${links}    ${expected_link}
+    END