fix ovsdb clustering failures
[integration/test.git] / csit / libraries / ClusterKeywords.robot
index 011ce420fa1b44e9030ae89e62cb9c1db5c4908c..4f9cab6c5843e895b520ba0f81985e0be8fc7e24 100644 (file)
@@ -121,11 +121,22 @@ Check Item Occurrence At URI In Cluster
 
 Put And Check At URI In Cluster
     [Arguments]    ${controller_index_list}    ${controller_index}    ${uri}    ${body}
-    [Documentation]    Send a PUT with the supplied ${uri} and ${body} (json string) to a ${controller_index}
-    ...    and check the data is replicated in all instances in ${controller_index_list}.
+    [Documentation]    Wrapper keyword for "Create Data And Check At URI In Cluster" using PUT
+    Create Data And Check At URI In Cluster    ${controller_index_list}    ${controller_index}    ${uri}    ${body}    PUT
+
+Post And Check At URI In Cluster
+    [Arguments]    ${controller_index_list}    ${controller_index}    ${uri}    ${body}
+    [Documentation]    Wrapper keyword for "Create Data And Check At URI In Cluster" using POST
+    Create Data And Check At URI In Cluster    ${controller_index_list}    ${controller_index}    ${uri}    ${body}    POST
+
+Create Data And Check At URI In Cluster
+    [Arguments]    ${controller_index_list}    ${controller_index}    ${uri}    ${body}    ${create_method}=PUT
+    [Documentation]    Send a ${create_method} REST call with the supplied ${uri} and ${body} (json string) to a
+    ...    ${controller_index} and check the data is replicated in all instances in ${controller_index_list}.
     ${expected_body}=    Hsf Json    ${body}
     Log    ${body}
-    ${resp}    RequestsLibrary.Put Request    controller${controller_index}    ${uri}    data=${body}    headers=${HEADERS_YANG_JSON}
+    ${resp}    Run Keyword If    "${create_method}" == "POST"    RequestsLibrary.Post Request    controller${controller_index}    ${uri}    data=${body}    headers=${HEADERS}
+    ...    ELSE    RequestsLibrary.Put Request    controller${controller_index}    ${uri}    data=${body}    headers=${HEADERS_YANG_JSON}
     Log    ${resp.content}
     Log    ${resp.status_code}
     ${status_code}=    Convert To String    ${resp.status_code}