Step 2: Move test folder to root
[integration/test.git] / csit / suites / sfc / Clustering_Datastore / 020_simple_clustering.robot
1 *** Settings ***
2 Documentation     Test suite for GBP Tenants, Operates functions from Restconf APIs.
3 Library           RequestsLibrary
4 Suite Teardown    Delete All Sessions
5 Library           SSHLibrary
6 Library           Collections
7 Library           OperatingSystem
8 Variables         ../../../variables/Variables.py
9 Resource          ../../../libraries/Utils.robot
10
11 *** Variables ***
12 ${SFC_API}    /restconf/config/service-function:service-functions
13 ${SFC_FUNCTIONS_FILE}    ${CURDIR}/../../../variables/sfc/service-functions.json
14
15
16 *** Test Cases ***
17 Add Service Functions To One Node
18     [Documentation]    Add service functions from JSON file
19     Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
20     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
21     Add Elements To URI From File    ${SFC__API}    ${SFC_FUNCTIONS_FILE}
22     ${resp}    RequestsLibrary.Get    session    ${SFC_API}
23     Should Be Equal As Strings    ${resp.status_code}    200
24     ${result}    To JSON    ${resp.content}
25     Lists Should be Equal    ${result}    ${jsonbody}
26
27 Read Service Functions From Other Node
28     Create Session    session    http://${CONTROLLER1}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
29     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
30     ${resp}    RequestsLibrary.Get    session    ${SFC_API}
31     Should Be Equal As Strings    ${resp.status_code}   200
32     ${result}    To JSON    ${resp.content}
33     Lists Should be Equal    ${result}    ${jsonbody}
34
35 *** Keywords ***
36 Read JSON From File
37     [Arguments]    ${filepath}
38     ${body}    OperatingSystem.Get File    ${filepath}
39     ${jsonbody}    To Json    ${body}
40     [Return]    ${jsonbody}