Allow 409 code when DS is empty 21/89921/3
authorLuis Gomez <ecelgp@gmail.com>
Sat, 23 May 2020 01:07:22 +0000 (18:07 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Sun, 24 May 2020 21:40:24 +0000 (21:40 +0000)
Change-Id: Ib4fc3a58fadc147623091daae8f99b5604e430e2
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
csit/libraries/FlowLib.robot
csit/libraries/LISPFlowMapping.robot
csit/libraries/TemplatedRequests.robot
csit/libraries/Utils.robot
csit/suites/lispflowmapping/msmr/020_RPC_CRUD.robot
csit/suites/netconf/notifications/notifications_basic.robot

index 143b06f46d3235a8040b2cb8a19e4f655c1eb44e..2108da9a7cf232a28f858b16206a4785c1c8edb4 100644 (file)
@@ -310,7 +310,7 @@ Remove Group From Controller And Verify
     Log    ${resp.content}
     Should Be Equal As Strings    ${resp.status_code}    200
     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_NODES_API}/node/${node_id}/group/${group_id}
-    Builtin.Return_From_Keyword_If    ${resp.status_code} == 404
+    Builtin.Return_From_Keyword_If    ${resp.status_code} == 404 or ${resp.status_code} == 409
     Builtin.Log    ${resp.text}
     Builtin.Fail    The request failed with code ${resp.status_code}
 
@@ -321,7 +321,7 @@ Remove Flow From Controller And Verify
     Log    ${resp.content}
     Should Be Equal As Strings    ${resp.status_code}    200
     ${resp}    RequestsLibrary.Get Request    session    ${CONFIG_NODES_API}/node/${node_id}/table/${table_id}/flow/${flow_id}
-    Builtin.Return_From_Keyword_If    ${resp.status_code} == 404
+    Builtin.Return_From_Keyword_If    ${resp.status_code} == 404 or ${resp.status_code} == 409
     Builtin.Log    ${resp.text}
     Builtin.Fail    The request failed with code ${resp.status_code}
 
index c12a02e4d1bb5f5d1b83e3a2a91e1711f3acb145..1eee8412b95350b8c14c0ca0a917dbf00b15f21b 100644 (file)
@@ -54,11 +54,11 @@ Get Elp Hop
 
 Check Key Removal
     [Arguments]    ${json}
-    Post Log Check    ${LFM_RPC_API}:get-key    ${json}    status_codes=${DELETED_STATUS_CODE}
+    Post Log Check    ${LFM_RPC_API}:get-key    ${json}    status_codes=${DELETED_STATUS_CODES}
 
 Check Mapping Removal
     [Arguments]    ${json}
-    Post Log Check    ${LFM_RPC_API}:get-mapping    ${json}    status_codes=${DELETED_STATUS_CODE}
+    Post Log Check    ${LFM_RPC_API}:get-mapping    ${json}    status_codes=${DELETED_STATUS_CODES}
 
 Get Mapping JSON
     [Arguments]    ${eid}    ${rloc}
index 052080703a9f0e3fce314dac8be706ef6fa5b6d8..6f044edd3b94ce8fcb95cb15c07d94c288e36b02 100644 (file)
@@ -120,7 +120,7 @@ Resource          ${CURDIR}/../variables/Variables.robot
 @{ALLOWED_DELETE_STATUS_CODES}    ${200}    ${201}    ${204}    ${404}    # List of integers, not strings. Used by DELETE if the resource may be not present.
 @{ALLOWED_STATUS_CODES}    ${200}    ${201}    ${204}    # List of integers, not strings. Used by both PUT and DELETE (if the resource should have been present).
 @{DATA_VALIDATION_ERROR}    ${400}    # For testing mildly negative scenarios where ODL reports user error.
-@{DELETED_STATUS_CODE}    ${404}    # List of integers, not strings. Used by DELETE if the resource may be not present.
+@{DELETED_STATUS_CODES}    ${404}    ${409}    # List of integers, not strings. Used by DELETE if the resource may be not present.
 # TODO: Add option for delete to require 404.
 @{INTERNAL_SERVER_ERROR}    ${500}    # Only for testing severely negative scenarios where ODL cannot recover.
 @{KEYS_WITH_BITS}    op    # the default list with keys to be sorted when norm_json libray is used
index f69693427124d391060012b9a38ad02f7d8286cc..34d711750a80feff0f1516c287a4480b1dd1dcad 100644 (file)
@@ -128,7 +128,7 @@ Check For Elements Not At URI
     ${resp}    RequestsLibrary.Get Request    ${session}    ${uri}
     BuiltIn.Run Keyword If    "${pretty_print_json}" == "True"    Log Content    ${resp.content}
     ...    ELSE    BuiltIn.Log    ${resp.content}
-    BuiltIn.Run Keyword If    "${check_for_null}" == "True"    Builtin.Return From Keyword If    ${resp.status_code} == 404
+    BuiltIn.Run Keyword If    "${check_for_null}" == "True"    Builtin.Return From Keyword If    ${resp.status_code} == 404 or ${resp.status_code} == 409
     Should Be Equal As Strings    ${resp.status_code}    200
     FOR    ${i}    IN    @{elements}
         Should Not Contain    ${resp.content}    ${i}
@@ -318,13 +318,13 @@ Remove All Elements At URI And Verify
     ${resp}    RequestsLibrary.Delete Request    ${session}    ${uri}
     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
     ${resp}    RequestsLibrary.Get Request    ${session}    ${uri}
-    Should Be Equal As Strings    ${resp.status_code}    404
+    Should Contain    ${DELETED_STATUS_CODES}    ${resp.status_code}
 
 Remove All Elements If Exist
     [Arguments]    ${uri}    ${session}=session
     [Documentation]    Delete all elements from an URI if the configuration was not empty
     ${resp}    RequestsLibrary.Get Request    ${session}    ${uri}
-    Run Keyword If    '${resp.status_code}'!='404'    Remove All Elements At URI    ${uri}    ${session}
+    Run Keyword If    '${resp.status_code}'!='404' and '${resp.status_code}'!='409'    Remove All Elements At URI    ${uri}    ${session}
 
 Add Elements To URI From File
     [Arguments]    ${dest_uri}    ${data_file}    ${headers}=${headers}    ${session}=session
@@ -345,7 +345,7 @@ Add Elements To URI And Verify
     ${resp}    RequestsLibrary.Put Request    ${session}    ${dest_uri}    ${data}    headers=${headers}
     Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
     ${resp}    RequestsLibrary.Get Request    ${session}    ${dest_uri}
-    Should Not Be Equal    ${resp.status_code}    404
+    Should Not Contain    ${DELETED_STATUS_CODES}    ${resp.status_code}
 
 Add Elements To URI From File And Check Validation Error
     [Arguments]    ${dest_uri}    ${data_file}    ${headers}=${headers}    ${session}=session
@@ -385,18 +385,18 @@ Get Data From URI
     ...    Issues a GET request for ${uri} in ${session} using headers from
     ...    ${headers}. If the request returns a HTTP error, fails. Otherwise
     ...    returns the data obtained by the request.
-    ${response}=    RequestsLibrary.Get Request    ${session}    ${uri}    ${headers}
-    Builtin.Return_From_Keyword_If    ${response.status_code} == 200    ${response.text}
-    Builtin.Log    ${response.text}
-    Builtin.Fail    The request failed with code ${response.status_code}
+    ${resp}=    RequestsLibrary.Get Request    ${session}    ${uri}    ${headers}
+    Builtin.Return_From_Keyword_If    ${resp.status_code} == 200    ${resp.text}
+    Builtin.Log    ${resp.text}
+    Builtin.Fail    The request failed with code ${resp.status_code}
 
 Get URI And Verify
     [Arguments]    ${uri}    ${session}=session    ${headers}=${NONE}
     [Documentation]    Issue a GET request and verify a successfull HTTP return.
     ...    Issues a GET request for ${uri} in ${session} using headers from ${headers}.
-    ${response} =    RequestsLibrary.Get Request    ${session}    ${uri}    ${headers}
-    Builtin.Log    ${response.status_code}
-    Should Contain    ${ALLOWED_STATUS_CODES}    ${response.status_code}
+    ${resp} =    RequestsLibrary.Get Request    ${session}    ${uri}    ${headers}
+    Builtin.Log    ${resp.status_code}
+    Should Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
 
 No Content From URI
     [Arguments]    ${session}    ${uri}    ${headers}=${NONE}
@@ -404,10 +404,10 @@ No Content From URI
     ...    Issues a GET request for ${uri} in ${session} using headers from
     ...    ${headers}. If the request returns a HTTP error, fails. Otherwise
     ...    returns the data obtained by the request.
-    ${response}=    RequestsLibrary.Get Request    ${session}    ${uri}    ${headers}
-    Builtin.Return_From_Keyword_If    ${response.status_code} == 404
-    Builtin.Log    ${response.text}
-    Builtin.Fail    The request failed with code ${response.status_code}
+    ${resp}=    RequestsLibrary.Get Request    ${session}    ${uri}    ${headers}
+    Builtin.Return_From_Keyword_If    ${resp.status_code} == 404 or ${resp.status_code} == 409
+    Builtin.Log    ${resp.text}
+    Builtin.Fail    The request failed with code ${resp.status_code}
 
 Get Index From List Of Dictionaries
     [Arguments]    ${dictionary_list}    ${key}    ${value}
index 907764fae009eb77161341000409d00b6da851ad..daa09b2552da554daa957571b503de2848ee8427 100644 (file)
@@ -23,7 +23,7 @@ Create Key
 Attempt To Read Non-Existing Key
     [Documentation]    Try to read a non-existing key for an IPv4 EID
     ${get_key}=    Get LispAddress JSON And Wrap input    ipv4:192.0.2.255/32
-    Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    status_codes=${DELETED_STATUS_CODE}
+    Post Log Check    ${LFM_RPC_API}:get-key    ${get_key}    status_codes=${DELETED_STATUS_CODES}
 
 Read Key
     [Documentation]    Read an existing key for an IPv4 EID
@@ -35,7 +35,7 @@ Update Key
     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
     ${authkey_json}=    Get MappingAuthkey JSON    key_string=updated-password
     ${update_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
-    Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    status_codes=${ALLOWED_STATUS_CODES}
+    Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    status_codes=${ALLOWED_STATUS_CODESS}
 
 Read Updated Key
     [Documentation]    Read the key updated in the previous test
@@ -57,7 +57,7 @@ Attempt To Update Non-Existing Key
     ${eid_json}=    Get LispAddress JSON    ipv4:192.0.2.1/32
     ${authkey_json}=    Get MappingAuthkey JSON    key_string=updated-password
     ${update_key}=    Merge And Wrap input    ${eid_json}    ${authkey_json}
-    Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    status_codes=${DELETED_STATUS_CODE}
+    Post Log Check    ${LFM_RPC_API}:update-key    ${update_key}    status_codes=${DELETED_STATUS_CODES}
 
 Create Mapping
     [Documentation]    Create a mapping for an IPv4 EID
index be32bf32cfc0e405b6059cebceed2cea72692417..914192dba231465073fe1c9ebe40bc8a8d214de0 100644 (file)
@@ -59,7 +59,7 @@ Clean_Config
     [Documentation]    Make sure config inventory is empty.
     [Tags]    critical
     ${uri} =    Restconf.Generate URI    opendaylight-inventory:nodes    config
-    TemplatedRequests.Delete_From_Uri    uri=${uri}    additional_allowed_status_codes=${DELETED_STATUS_CODE}
+    TemplatedRequests.Delete_From_Uri    uri=${uri}    additional_allowed_status_codes=${DELETED_STATUS_CODES}
     # TODO: Rework also other test cases to use TemplatedRequests.
 
 Create_Subscribtion