Migrate 'Get Request' (bgpcep) 50/111150/4
authorSangwook Ha <sangwook.ha@verizon.com>
Mon, 1 Apr 2024 04:02:19 +0000 (21:02 -0700)
committerSangwook Ha <sangwook.ha@verizon.com>
Fri, 5 Apr 2024 17:49:37 +0000 (10:49 -0700)
There are a couple places in bgpcep test suites where deprecated
'Get Request' RequestsLibrary keyword is used. Replace it with
'GET On Session'.

Also, use 'anything' instead of 'any' and do not remove 'alias=' for
the session argument to make them more consistent across all the test
suites.

JIRA: INTTEST-141
Change-Id: Id8bf71a5477cdfb5d6181016a614bbc8f7dfc083
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
csit/libraries/BgpOperations.robot
csit/libraries/ExaBgpLib.robot
csit/libraries/GoBgpLib.robot
csit/libraries/PcepOperations.robot
csit/libraries/PrefixCounting.robot
csit/libraries/TemplatedRequests.robot
csit/libraries/Utils.robot
csit/suites/bgpcep/bgpflowspec/010_bgp_flowspec.robot
csit/suites/bgpcep/bgpfunct/020_bgp_functional_multipath.robot
csit/suites/bgpcep/bgpfunct/030_bgp_functional_evpn.robot
csit/suites/bgpcep/bgpfunct/090_bgp_functional_rt_constrain_validation.robot

index 1a9591cb10096c57c2d5301fc008f5625bd2e40d..ad3d40e6407cc91c5f8abc0637bad7b4493433db 100644 (file)
@@ -273,7 +273,7 @@ AddNeighbor To BGP Configuration On ODL
 Get BGP Configuration On ODL
     [Documentation]    Get bgp configuration
     [Arguments]    ${odl_session}
-    ${resp} =    RequestsLibrary.GET On Session    alias=${odl_session}    url=${CONFIG_API}/ebgp:bgp/
+    ${resp} =    RequestsLibrary.GET On Session    ${odl_session}    url=${CONFIG_API}/ebgp:bgp/
     Log    ${resp.text}
     RETURN    ${resp.text}
 
@@ -281,7 +281,7 @@ Delete BGP Configuration On ODL
     [Documentation]    Delete BGP
     [Arguments]    ${odl_session}
     ${resp} =    RequestsLibrary.DELETE On Session
-    ...    alias=${odl_session}
+    ...    ${odl_session}
     ...    url=${CONFIG_API}/ebgp:bgp/
     ...    expected_status=200
     Log    ${resp.text}
@@ -314,7 +314,7 @@ Check_Example_Bgp_Rib_Content
     [Documentation]    Check the example-bgp-rib content for string
     [Arguments]    ${session}    ${substr}    ${error_message}=${JSONKEYSTR} not found, but expected.
     ${response} =    RequestsLibrary.GET On Session
-    ...    alias=${session}
+    ...    ${session}
     ...    url=${REST_API}/${BGP_RIB_URI}?content=nonconfig
     BuiltIn.Log    ${response.status_code}
     BuiltIn.Log    ${response.text}
@@ -324,7 +324,7 @@ Check_Example_Bgp_Rib_Does_Not_Contain
     [Documentation]    Check the example-bgp-rib does not contain the string
     [Arguments]    ${session}    ${substr}    ${error_message}=${JSONKEYSTR} found, but not expected.
     ${response} =    RequestsLibrary.GET On Session
-    ...    alias=${session}
+    ...    ${session}
     ...    url=${REST_API}/${BGP_RIB_URI}?content=nonconfig
     BuiltIn.Log    ${response.status_code}
     BuiltIn.Log    ${response.text}
@@ -334,7 +334,7 @@ Check_Example_IPv4_Topology_Content
     [Documentation]    Check the example-ipv4-topology content for string
     [Arguments]    ${session}    ${string_to_check}=${EMPTY}
     ${response} =    RequestsLibrary.GET On Session
-    ...    alias=${session}
+    ...    ${session}
     ...    url=${REST_API}/${BGP_TOPOLOGY_URI}?content=nonconfig
     BuiltIn.Log    ${response.status_code}
     BuiltIn.Log    ${response.text}
@@ -344,7 +344,7 @@ Check_Example_IPv4_Topology_Does_Not_Contain
     [Documentation]    Check the example-ipv4-topology does not contain the string
     [Arguments]    ${session}    ${string_to_check}
     ${response} =    RequestsLibrary.GET On Session
-    ...    alias=${session}
+    ...    ${session}
     ...    url=${REST_API}/${BGP_TOPOLOGY_URI}?content=nonconfig
     BuiltIn.Log    ${response.status_code}
     BuiltIn.Log    ${response.text}
index b1bf48c12deafef81af090ac6418afa1545a1807..2c47b308101d9eb3ce08e635a5c62e5d45efcff1 100644 (file)
@@ -77,8 +77,9 @@ Verify_ExaBgps_Connection
     ${peer_check_url}=    BuiltIn.Set_Variable    ${REST_API}/bgp-rib:bgp-rib/rib=example-bgp-rib/peer=bgp:%2F%2F
     ${exp_status_code}=    BuiltIn.Set_Variable_If    ${connected}    ${200}    ${404}
     ${rsp}=    RequestsLibrary.GET On Session
-    ...    alias=${session}
+    ...    ${session}
     ...    url=${peer_check_url}${exabgp_ip}?content=nonconfig
+    ...    expected_status=anything
     BuiltIn.Log    ${rsp.content}
     BuiltIn.Should_Be_Equal_As_Numbers    ${exp_status_code}    ${rsp.status_code}
 
index 986f3079f1d86f3d6c40e85feb7f1ef36d72fc5e..e2d931ed3c80e0de463af94365e224d2ed965927 100644 (file)
@@ -75,8 +75,8 @@ Verify_GoBgps_Connection
     ...    ${ALLOWED_STATUS_CODES}
     ...    ${DELETED_STATUS_CODES}
     ${rsp}=    RequestsLibrary.GET On Session
-    ...    alias=${session}
+    ...    ${session}
     ...    url=${peer_check_url}${gobgp_ip}?content=nonconfig
-    ...    expected_status=any
+    ...    expected_status=anything
     BuiltIn.Log    ${rsp.content}
     BuiltIn.Should_Be_Equal_As_Numbers    ${exp_status_code}    ${rsp.status_code}
index 1a37c05948809726872be675a1f010d02b2a87fb..4dae800afd6f94e03c51fe39b9acc41bbdf9abfe 100644 (file)
@@ -24,7 +24,7 @@ ${PCEP_VAR_FOLDER}      ${CURDIR}/../variables/tcpmd5user
 Setup_Pcep_Operations
     [Documentation]    Creates Requests session to be used by subsequent keywords.
     RequestsLibrary.Create_Session
-    ...    alias=pcep_session
+    ...    pcep_session
     ...    url=http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
     ...    headers=${HEADERS_XML}
     ...    auth=${AUTH}
@@ -59,10 +59,10 @@ Operate_Xml_Lsp_Return_Json
     [Arguments]    ${uri_part}    ${xml_data}
     ${uri_path}=    BuiltIn.Set_Variable    /rests/operations/${uri_part}
     ${response}=    RequestsLibrary.POST On Session
-    ...    alias=pcep_session
+    ...    pcep_session
     ...    url=${uri_path}
     ...    data=${xml_data}
-    ...    expected_status=any
+    ...    expected_status=anything
     Log    ${xml_data}
     Should Contain    ${ALLOWED_STATUS_CODES}    ${response.status_code}
     RETURN    ${response.text}
index 2d410d29814d222ce5224a8299ef62d275051c5d..9465e41925e8e268f348fd0b43f241dbb28a2d7f 100644 (file)
@@ -38,7 +38,7 @@ Get_Ipv4_Topology
     ${response} =    RequestsLibrary.GET On Session
     ...    ${session}
     ...    url=${PC_NW_TOPOLOGY}=${topology}?content=nonconfig
-    ...    expected_status=any
+    ...    expected_status=anything
     IF    ${response.status_code} != 200
         Fail    Get on ${topology} returned status code ${response.status_code} with message: ${response.text}
     END
index ea7a795e6dd03812f621968faebdcddd0f79b773..73fc5ab08ac71a41180d16672dac2bc30e22d342 100644 (file)
@@ -151,7 +151,7 @@ Create_Default_Session
     ...    This Keyword is in this Resource only so that user do not need to call RequestsLibrary directly.
     [Arguments]    ${url}=http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    ${auth}=${AUTH}    ${timeout}=${DEFAULT_TIMEOUT_HTTP}    ${max_retries}=0
     RequestsLibrary.Create_Session
-    ...    alias=default
+    ...    default
     ...    url=${url}
     ...    auth=${auth}
     ...    timeout=${timeout}
index ddcc2f7f98c7a0d67e473aa32cf2cb7d28d71631..17077d466caa6c10a471b7f0a5d0a631a42732d5 100644 (file)
@@ -469,7 +469,11 @@ No Content From URI
     ...    ${headers}. If the request returns a HTTP error, fails. Otherwise
     ...    returns the data obtained by the request.
     [Arguments]    ${session}    ${uri}    ${headers}=${NONE}
-    ${resp}=    RequestsLibrary.Get On Session    ${session}    url=${uri}    expected_status=any    headers=${headers}
+    ${resp}=    RequestsLibrary.Get On Session
+    ...    ${session}
+    ...    url=${uri}
+    ...    headers=${headers}
+    ...    expected_status=anything
     IF    ${resp.status_code} == 404 or ${resp.status_code} == 409    RETURN
     Builtin.Log    ${resp.text}
     Builtin.Fail    The request failed with code ${resp.status_code}
index 52d267b2e242493677d91f24d1ba08244503fc62..ef3930ab6becc0424a2133747f397aa89f03bdc3 100644 (file)
@@ -129,7 +129,7 @@ Verify_Flowspec_Data
 
 Normalize_And_Compare
     [Documentation]    Verify empty flowspec data
-    ${rsp}    RequestsLibrary.Get_Request    ${CONFIG_SESSION}    ${FLOWSPEC_URL}
+    ${rsp}    RequestsLibrary.GET On Session    ${CONFIG_SESSION}    url=${FLOWSPEC_URL}
     TemplatedRequests.Normalize_Jsons_With_Bits_And_Compare
     ...    ${EXP0}
     ...    ${rsp.content}
index 5fc04cb164c73433db39b27a44bfddbbcc597bb3..3691d790e8d9d22e450040eea02e36a197eb5ab2 100644 (file)
@@ -197,7 +197,7 @@ Store_Rib_Configuration
 
 Log_Loc_Rib_Operational
     ${rsp}    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=/rests/data/bgp-rib:bgp-rib/rib=example-bgp-rib/loc-rib?content=nonconfig
     BuiltIn.Log    ${rsp.content}
 
index 3f5eb2c47ff3664c87995cb6c9fba8afcf577fa0..efac5aad93295650cace17dc362e73b5acc1268d 100644 (file)
@@ -321,14 +321,14 @@ Odl_To_Play_Template
     BuiltIn.Log    ${withdraw_hex}
     BgpRpcClient.play_clean
     ${resp} =    RequestsLibrary.POST On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_CONF_URL}
     ...    data=${data_xml}
     ...    headers=${HEADERS_XML}
     ...    expected_status=201
     BuiltIn.Log    ${resp.content}
     ${resp} =    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_CONF_URL}?content=config
     ...    headers=${HEADERS_XML}
     BuiltIn.Log    ${resp.content}
@@ -363,12 +363,12 @@ Play_To_Odl_Template
 
 Verify_Test_Preconditions
     ${resp} =    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_CONF_URL}?content=config
-    ...    expected_status=any
+    ...    expected_status=anything
     BuiltIn.Should_Contain    ${DELETED_STATUS_CODES}    ${resp.status_code}
     ${resp} =    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_FAMILY_LOC_RIB}
     ...    headers=${HEADERS}
     TemplatedRequests.Normalize_Jsons_And_Compare    ${EMPTY_ROUTES}    ${resp.content}
@@ -376,22 +376,22 @@ Verify_Test_Preconditions
 Remove_Configured_Routes
     [Documentation]    Removes the route if present. First GET is for debug purposes.
     ${resp} =    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_LOC_RIB}
     ...    headers=${HEADERS}
-    ...    expected_status=any
+    ...    expected_status=anything
     BuiltIn.Log    ${resp.content}
     BuiltIn.Should_Contain    ${ALLOWED_DELETE_STATUS_CODES}    ${resp.status_code}
     ${resp} =    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_CONF_URL}?content=config
     ...    headers=${HEADERS}
-    ...    expected_status=any
+    ...    expected_status=anything
     BuiltIn.Log    ${resp.content}
     BuiltIn.Should_Contain    ${ALLOWED_DELETE_STATUS_CODES}    ${resp.status_code}
     IF    ${resp.status_code} in ${DELETED_STATUS_CODES}    RETURN
     ${resp} =    RequestsLibrary.DELETE On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_CONF_URL}
     ...    expected_status=204
 
@@ -405,10 +405,10 @@ Get_Update_Content
     [Documentation]    Gets received data from odl's peer
     [Arguments]    ${expected_status_codes}
     ${resp} =    RequestsLibrary.GET On Session
-    ...    alias=${CONFIG_SESSION}
+    ...    ${CONFIG_SESSION}
     ...    url=${EVPN_LOC_RIB}
     ...    headers=${HEADERS_XML}
-    ...    expected_status=any
+    ...    expected_status=anything
     BuiltIn.Log    ${resp.content}
     BuiltIn.Should_Contain    ${expected_status_codes}    ${resp.status_code}
     ${update} =    BgpRpcClient.play_get
@@ -418,6 +418,6 @@ Get_Update_Content
 Loc_Rib_Presence
     [Documentation]    Verifies if loc-rib contains expected data
     [Arguments]    ${exp_content}
-    ${resp} =    RequestsLibrary.GET On Session    alias=${CONFIG_SESSION}    url=${EVPN_LOC_RIB}    headers=${HEADERS}
+    ${resp} =    RequestsLibrary.GET On Session    ${CONFIG_SESSION}    url=${EVPN_LOC_RIB}    headers=${HEADERS}
     BuiltIn.Log_Many    ${exp_content}    ${resp.content}
     TemplatedRequests.Normalize_Jsons_And_Compare    ${exp_content}    ${resp.content}
index 9b5f00dd4061e2820b6dbaa0e37badb7cdee989a..72697ec7db1ec56cb9f23e0ba65da3e76f688874 100644 (file)
@@ -285,7 +285,7 @@ Verify_Reported_Data
     [Arguments]    ${url}    ${exprspfile}
     ${expresponse} =    OperatingSystem.Get File    ${exprspfile}
     BuiltIn.Log    expected_response: ${expresponse}
-    ${rsp} =    RequestsLibrary.Get_Request    ${CONFIG_SESSION}    ${url}
+    ${rsp} =    RequestsLibrary.GET On Session    ${CONFIG_SESSION}    url=${url}
     BuiltIn.Log    actual_response: ${rsp}
     BuiltIn.Log    actual_response_content: ${rsp.content}
     TemplatedRequests.Normalize_Jsons_And_Compare    ${expresponse}    ${rsp.content}