Moved calls to "RequestLibrary.<action> Request" in suites/sfc/
[integration/test.git] / csit / suites / sfc / Clustering_Datastore / 020_simple_clustering.robot
index b40e253529ddd5c2e6065ec67b030b2906a7bb04..f64a3182caf73d9042bc03b3e8fb1b58ca008a97 100644 (file)
@@ -1,5 +1,6 @@
 *** Settings ***
-Documentation     Test suite for GBP Tenants, Operates functions from Restconf APIs.
+Documentation     Test suite for SFC Service Functions, Operates functions from Restconf APIs.
+Suite Setup       Init Variables
 Suite Teardown    Delete All Sessions
 Library           RequestsLibrary
 Library           SSHLibrary
@@ -8,25 +9,29 @@ Library           OperatingSystem
 Variables         ../../../variables/Variables.py
 Resource          ../../../libraries/Utils.robot
 
-*** Variables ***
-${SFC_API}        /restconf/config/service-function:service-functions
-${SFC_FUNCTIONS_FILE}    ${CURDIR}/../../../variables/sfc/service-functions.json
-
 *** Test Cases ***
-Add Service Functions To One Node
+Add Service Functions To First Node
     [Documentation]    Add service functions from JSON file
-    Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
-    Add Elements To URI From File    ${SFC__API}    ${SFC_FUNCTIONS_FILE}
-    ${resp}    RequestsLibrary.Get    session    ${SFC_API}
+    Add Elements To URI From File    ${SFC_API}    ${SFC_FUNCTIONS_FILE}    ${HEADERS_YANG_JSON}
+    ${resp}    RequestsLibrary.Get Request    session    ${SFC_API}
     Should Be Equal As Strings    ${resp.status_code}    200
     ${result}    To JSON    ${resp.content}
     Lists Should be Equal    ${result}    ${jsonbody}
 
-Read Service Functions From Other Node
-    Create Session    session    http://${CONTROLLER1}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+Read Service Functions From Second Node
+    Create Session    session    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
-    ${resp}    RequestsLibrary.Get    session    ${SFC_API}
+    ${resp}    RequestsLibrary.Get Request    session    ${SFC_API}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    ${result}    To JSON    ${resp.content}
+    Lists Should be Equal    ${result}    ${jsonbody}
+
+Read Service Functions From Third Node
+    Create Session    session    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
+    ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
+    ${resp}    RequestsLibrary.Get Request    session    ${SFC_API}
     Should Be Equal As Strings    ${resp.status_code}    200
     ${result}    To JSON    ${resp.content}
     Lists Should be Equal    ${result}    ${jsonbody}
@@ -37,3 +42,19 @@ Read JSON From File
     ${body}    OperatingSystem.Get File    ${filepath}
     ${jsonbody}    To Json    ${body}
     [Return]    ${jsonbody}
+
+Init Variables
+    [Documentation]    Initialize ODL version specific variables
+    log    ${ODL_VERSION}
+    Run Keyword If    '${ODL_VERSION}' == 'stable-lithium'    Init Variables Lithium
+    ...    ELSE    Init Variables Master
+
+Init Variables Master
+    [Documentation]    Sets variables specific to latest(master) version
+    Set Suite Variable    ${SFC_API}    /restconf/config/service-function:service-functions
+    Set Suite Variable    ${SFC_FUNCTIONS_FILE} ${CURDIR}/../../../variables/sfc/master/service-functions.json
+
+Init Variables Lithium
+    [Documentation]    Sets variables specific to Lithium version
+    Set Suite Variable    ${SFC_API}    /restconf/config/service-function:service-functions
+    Set Suite Variable    ${SFC_FUNCTIONS_FILE} ${CURDIR}/../../../variables/sfc/lithium/service-functions.json