61818742708155b74d062adf448acf14255c83c4
[integration/test.git] / csit / suites / sfc / Clustering_Datastore / 020_simple_clustering.robot
1 *** Settings ***
2 Documentation     Test suite for SFC Service Functions, Operates functions from Restconf APIs.
3 Suite Teardown    Delete All Sessions
4 Library           RequestsLibrary
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 *** Test Cases ***
16 Add Service Functions To First Node
17     [Documentation]    Add service functions from JSON file
18     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
19     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
20     Add Elements To URI From File    ${SFC_API}    ${SFC_FUNCTIONS_FILE}    ${HEADERS_YANG_JSON}
21     ${resp}    RequestsLibrary.Get    session    ${SFC_API}
22     Should Be Equal As Strings    ${resp.status_code}    200
23     ${result}    To JSON    ${resp.content}
24     Lists Should be Equal    ${result}    ${jsonbody}
25
26 Read Service Functions From Second Node
27     Create Session    session    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
28     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
29     ${resp}    RequestsLibrary.Get    session    ${SFC_API}
30     Should Be Equal As Strings    ${resp.status_code}    200
31     ${result}    To JSON    ${resp.content}
32     Lists Should be Equal    ${result}    ${jsonbody}
33
34 Read Service Functions From Third Node
35     Create Session    session    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
36     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
37     ${resp}    RequestsLibrary.Get    session    ${SFC_API}
38     Should Be Equal As Strings    ${resp.status_code}    200
39     ${result}    To JSON    ${resp.content}
40     Lists Should be Equal    ${result}    ${jsonbody}
41
42 *** Keywords ***
43 Read JSON From File
44     [Arguments]    ${filepath}
45     ${body}    OperatingSystem.Get File    ${filepath}
46     ${jsonbody}    To Json    ${body}
47     [Return]    ${jsonbody}