From 02dd570f7544c8cd6eb17bda775de9bccc89f923 Mon Sep 17 00:00:00 2001 From: Yaroslav Lastivka Date: Wed, 27 Mar 2024 16:35:50 +0200 Subject: [PATCH] Migrate Get Requests invocations(libraries) The 'Get Request' RequestsLibrary keyword has been deprecated. 'Get Request' has been replaced by 'GET On Session'. JIRA: INTTEST-141 Change-Id: I2128046b5a97126ad33927b099f605fc92715e81 Signed-off-by: Yaroslav Lastivka --- csit/libraries/DIDMKeywords.robot | 3 +-- csit/libraries/DatastoreCRUD.robot | 2 +- csit/libraries/OVSDB.robot | 2 +- csit/libraries/SxpBindingOriginsLib.robot | 4 ++-- csit/libraries/SxpClusterLib.robot | 9 ++++---- csit/libraries/SxpLib.robot | 12 +++++----- csit/libraries/TopoprocessingKeywords.robot | 3 +-- csit/libraries/VtnMaKeywords.robot | 25 +++++++++++---------- 8 files changed, 29 insertions(+), 31 deletions(-) diff --git a/csit/libraries/DIDMKeywords.robot b/csit/libraries/DIDMKeywords.robot index 9905ee117a..f61c1784c3 100644 --- a/csit/libraries/DIDMKeywords.robot +++ b/csit/libraries/DIDMKeywords.robot @@ -12,8 +12,7 @@ Resource ../variables/openflowplugin/Variables.robot *** Keywords *** Check DIDM Registered With Device [Documentation] Check for DIDM registered with the device - ${resp}= RequestsLibrary.Get Request session ${RFC8040_OPERATIONAL_NODES_API} - Should Be Equal As Strings ${resp.status_code} 200 + ${resp}= RequestsLibrary.GET On Session session ${RFC8040_OPERATIONAL_NODES_API} expected_status=200 Log ${resp.text} Should Contain ${resp.text} didm RETURN ${resp.text} diff --git a/csit/libraries/DatastoreCRUD.robot b/csit/libraries/DatastoreCRUD.robot index dd591fe3e8..558f92ff39 100644 --- a/csit/libraries/DatastoreCRUD.robot +++ b/csit/libraries/DatastoreCRUD.robot @@ -34,7 +34,7 @@ Read Records ... http://${controller_ip}:${RESTCONFPORT}${CONFIG_API} ... headers=${HEADERS} ... auth=${AUTH} - ${resp}= RequestsLibrary.Get Request session ${node} + ${resp}= RequestsLibrary.GET On Session session ${node} RETURN ${resp.json()} Update Records diff --git a/csit/libraries/OVSDB.robot b/csit/libraries/OVSDB.robot index a50a4aacf3..166ce964f0 100644 --- a/csit/libraries/OVSDB.robot +++ b/csit/libraries/OVSDB.robot @@ -293,7 +293,7 @@ Log Config And Operational Topology Config and Operational Topology Should Be Empty [Documentation] This will check that only the expected output is there for both operational and config ... topology data stores. Empty probably means that only ovsdb:1 is there. - ${config_resp} = RequestsLibrary.GET On Session session url=${RFC8040_CONFIG_TOPO_API} + ${config_resp} = RequestsLibrary.GET On Session session url=${RFC8040_CONFIG_TOPO_API} ${operational_resp} = RequestsLibrary.GET On Session session url=${RFC8040_OPERATIONAL_TOPO_API} BuiltIn.Should Contain ${config_resp.text} {"topology-id":"ovsdb:1"} BuiltIn.Should Contain ${operational_resp.text} {"topology-id":"ovsdb:1"} diff --git a/csit/libraries/SxpBindingOriginsLib.robot b/csit/libraries/SxpBindingOriginsLib.robot index b41da8071d..b09e8c8ff4 100644 --- a/csit/libraries/SxpBindingOriginsLib.robot +++ b/csit/libraries/SxpBindingOriginsLib.robot @@ -28,8 +28,8 @@ Revert To Default Binding Origins Configuration Get Binding Origins [Documentation] Gets all binding origins via RPC from configuration [Arguments] ${session}=session - ${resp} = RequestsLibrary.Get Request ${session} /restconf/config/sxp-config:binding-origins - BuiltIn.Should Be Equal As Strings ${resp.status_code} 200 + ${resp} = RequestsLibrary.GET On Session ${session} /restconf/config/sxp-config:binding-origins + ... expected_status=200 RETURN ${resp} Add Binding Origin diff --git a/csit/libraries/SxpClusterLib.robot b/csit/libraries/SxpClusterLib.robot index dec6a0f8b1..99fd137ae7 100644 --- a/csit/libraries/SxpClusterLib.robot +++ b/csit/libraries/SxpClusterLib.robot @@ -129,10 +129,9 @@ Clean SXP Cluster Check Cluster Node Started [Documentation] Verify that SxpNode has data written to Operational datastore and Node is running on one of cluster nodes [Arguments] ${node} ${port}=64999 ${ip}=${node} - ${resp} = RequestsLibrary.Get Request + ${resp} = RequestsLibrary.GET On Session ... ${CONTROLLER_SESSION} - ... /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/ - BuiltIn.Should Be Equal As Strings ${resp.status_code} 200 + ... /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/ expected_status=200 ${started} = BuiltIn.Set Variable ${False} FOR ${i} IN RANGE ${NUM_ODL_SYSTEM} ${rc} = Utils.Run Command On Remote System @@ -148,10 +147,10 @@ Check Cluster Node Started Check Cluster Node Stopped [Documentation] Verify that SxpNode has data removed from Operational datastore and Node is stopped [Arguments] ${node} ${port}=64999 ${ip}=${node} - ${resp} = RequestsLibrary.Get Request + ${resp} = RequestsLibrary.GET On Session ... ${CONTROLLER_SESSION} ... /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/ - BuiltIn.Should Be Equal As Strings ${resp.status_code} 404 + ... expected_status=404 ${stopped} = BuiltIn.Set Variable ${False} FOR ${i} IN RANGE ${NUM_ODL_SYSTEM} ${rc} = Utils.Run Command On Remote System diff --git a/csit/libraries/SxpLib.robot b/csit/libraries/SxpLib.robot index 7ee57de389..7a3a431029 100644 --- a/csit/libraries/SxpLib.robot +++ b/csit/libraries/SxpLib.robot @@ -362,20 +362,20 @@ Setup SXP Environment Check Node Started [Documentation] Verify that SxpNode has data writen to Operational datastore and is running [Arguments] ${node} ${port}=64999 ${system}=${node} ${session}=session ${ip}=${node} - ${resp} = RequestsLibrary.Get Request + ${resp} = RequestsLibrary.GET On Session ... ${session} ... /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/ - BuiltIn.Should Be Equal As Strings ${resp.status_code} 200 + ... expected_status=200 ${rc} = Get Node Running Status ${node} ${port} ${system} ${session} ${ip} BuiltIn.Should Be Equal As Strings ${rc} 0 Check Node Stopped [Documentation] Verify that SxpNode has data removed from Operational datastore and is not running [Arguments] ${node} ${port}=64999 ${system}=${node} ${session}=session ${ip}=${node} - ${resp} = RequestsLibrary.Get Request + ${resp} = RequestsLibrary.GET On Session ... ${session} ... /restconf/operational/network-topology:network-topology/topology/sxp/node/${node}/ - BuiltIn.Should Be Equal As Strings ${resp.status_code} 404 + ... expected_status=404 ${rc} = Get Node Running Status ${node} ${port} ${system} ${session} ${ip} BuiltIn.Should Be Equal As Strings ${rc} 1 @@ -403,7 +403,7 @@ Clean SXP Environment Get Routing Configuration From Controller [Documentation] Get Routing configuration from config DS [Arguments] ${session} - ${resp} = RequestsLibrary.Get Request + ${resp} = RequestsLibrary.GET On Session ... ${session} ... /restconf/config/sxp-cluster-route:sxp-cluster-route/ ... headers=${ACCEPT_XML} @@ -424,7 +424,7 @@ Put Routing Configuration To Controller Clean Routing Configuration To Controller [Documentation] Delete Routing configuration from Config DS [Arguments] ${session} - ${resp} = RequestsLibrary.Get Request + ${resp} = RequestsLibrary.GET On Session ... ${session} ... /restconf/config/sxp-cluster-route:sxp-cluster-route/ ... headers=${ACCEPT_XML} diff --git a/csit/libraries/TopoprocessingKeywords.robot b/csit/libraries/TopoprocessingKeywords.robot index 6f60263945..b6ddab7094 100644 --- a/csit/libraries/TopoprocessingKeywords.robot +++ b/csit/libraries/TopoprocessingKeywords.robot @@ -35,8 +35,7 @@ Basic Request Put Basic Request Get [Documentation] Send a simple HTTP GET request to a given URL [Arguments] ${overlay_topology_url} - ${resp} Get Request session ${OPERATIONAL_API}/${overlay_topology_url} - Should Be Equal As Strings ${resp.status_code} 200 + ${resp} Get On Session session ${OPERATIONAL_API}/${overlay_topology_url} expected_status=200 RETURN ${resp} Send Basic Delete Request diff --git a/csit/libraries/VtnMaKeywords.robot b/csit/libraries/VtnMaKeywords.robot index 03b5020d40..e299f33560 100644 --- a/csit/libraries/VtnMaKeywords.robot +++ b/csit/libraries/VtnMaKeywords.robot @@ -101,16 +101,14 @@ Stop SuiteVtnMaTest Fetch vtn list [Documentation] Check if VTN Manager is up. - ${resp}= RequestsLibrary.Get Request session restconf/operational/vtn:vtns - Should Be Equal As Strings ${resp.status_code} 200 + ${resp}= RequestsLibrary.GET On Session session restconf/operational/vtn:vtns expected_status=200 Fetch vtn switch inventory [Documentation] Check if Switch is detected. [Arguments] ${sw_name} - ${resp}= RequestsLibrary.Get Request + ${resp}= RequestsLibrary.GET On Session ... session - ... restconf/operational/vtn-inventory:vtn-nodes/vtn-node/${sw_name} - Should Be Equal As Strings ${resp.status_code} 200 + ... restconf/operational/vtn-inventory:vtn-nodes/vtn-node/${sw_name} expected_status=200 Collect Debug Info [Documentation] Check if Switch is detected. @@ -243,7 +241,7 @@ Add a pathmap Get a pathmap [Documentation] Get a pathmap for a vtn. - ${resp}= RequestsLibrary.Get Request session restconf/operational/vtn-path-map:global-path-maps + ${resp}= RequestsLibrary.GET On Session session restconf/operational/vtn-path-map:global-path-maps FOR ${pathElement} IN @{PATHMAP_ATTR} should Contain ${resp.text} ${pathElement} END @@ -260,7 +258,7 @@ Add a pathpolicy Get a pathpolicy [Documentation] Get a pathpolicy for a vtn. [Arguments] ${pathpolicy_id} - ${resp}= RequestsLibrary.Get Request + ${resp}= RequestsLibrary.GET On Session ... session ... restconf/operational/vtn-path-policy:vtn-path-policies/vtn-path-policy/${pathpolicy_id} FOR ${pathpolicyElement} IN @{PATHPOLICY_ATTR} @@ -349,10 +347,10 @@ Start vlan_topo Get flow [Documentation] Get data flow. [Arguments] ${vtn_name} - ${resp}= RequestsLibrary.Get Request + ${resp}= RequestsLibrary.GET On Session ... session ... restconf/operational/vtn-flow-impl:vtn-flows/vtn-flow-table/${vtn_name} - Should Be Equal As Strings ${resp.status_code} 200 + ... expected_status=200 Remove a portmap [Documentation] Remove a portmap for a interface of a vbridge @@ -519,16 +517,19 @@ Add a flowcondition Get flowconditions [Documentation] Retrieve the list of flowconditions created - ${resp}= RequestsLibrary.Get Request session restconf/operational/vtn-flow-condition:vtn-flow-conditions - Should Be Equal As Strings ${resp.status_code} 200 + ${resp}= RequestsLibrary.Get On Session + ... session + ... restconf/operational/vtn-flow-condition:vtn-flow-conditions + ... expected_status=200 Get flowcondition [Documentation] Retrieve the flowcondition by name and to check the removed flowcondition we added "retrieve" argument to differentiate the status code, ... since after removing flowcondition name the status will be different compare to status code when the flowcondition name is present. [Arguments] ${flowcond_name} ${retrieve} - ${resp}= RequestsLibrary.Get Request + ${resp}= RequestsLibrary.GET On Session ... session ... restconf/operational/vtn-flow-condition:vtn-flow-conditions/vtn-flow-condition/${flowcond_name} + ... expected_status=anything IF '${retrieve}' == 'retrieve' Should Be Equal As Strings ${resp.status_code} 200 ELSE -- 2.36.6