Update Robot Framework format - step 14
[integration/test.git] / csit / suites / sfc / SFC_Basic / 080__sfc_simple_clustering.robot
1 *** Settings ***
2 Documentation       Test suite for SFC Service Functions, Operates functions from Restconf APIs.
3
4 Library             RequestsLibrary
5 Library             SSHLibrary
6 Library             Collections
7 Library             OperatingSystem
8 Resource            ../../../variables/sfc/Variables.robot
9 Resource            ../../../libraries/Utils.robot
10
11 Suite Setup         Init Suite
12 Suite Teardown      Delete All Sessions
13
14
15 *** Variables ***
16 ${SFC_API}      /restconf/config/service-function:service-functions
17
18
19 *** Test Cases ***
20 Add Service Functions To First Node
21     [Documentation]    Add service functions from JSON file
22     Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
23     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
24     Add Elements To URI From File    ${SFC_API}    ${SFC_FUNCTIONS_FILE}    ${HEADERS_YANG_JSON}
25     ${resp}    RequestsLibrary.Get Request    session    ${SFC_API}
26     Should Be Equal As Strings    ${resp.status_code}    200
27     ${result}    To JSON    ${resp.content}
28     Lists Should be Equal    ${result}    ${jsonbody}
29
30 Read Service Functions From Second Node
31     Create Session    session    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
32     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
33     ${resp}    RequestsLibrary.Get Request    session    ${SFC_API}
34     Should Be Equal As Strings    ${resp.status_code}    200
35     ${result}    To JSON    ${resp.content}
36     Lists Should be Equal    ${result}    ${jsonbody}
37
38 Read Service Functions From Third Node
39     Create Session    session    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}
40     ${jsonbody}    Read JSON From File    ${SFC_FUNCTIONS_FILE}
41     ${resp}    RequestsLibrary.Get Request    session    ${SFC_API}
42     Should Be Equal As Strings    ${resp.status_code}    200
43     ${result}    To JSON    ${resp.content}
44     Lists Should be Equal    ${result}    ${jsonbody}
45
46
47 *** Keywords ***
48 Read JSON From File
49     [Arguments]    ${filepath}
50     ${body}    OperatingSystem.Get File    ${filepath}
51     ${jsonbody}    To Json    ${body}
52     RETURN    ${jsonbody}
53
54 Init Suite
55     [Documentation]    Initialize ODL version specific variables
56     log    ${ODL_STREAM}
57     Set Suite Variable    ${VERSION_DIR}    master
58     Set Suite Variable
59     ...    ${SFC_FUNCTIONS_FILE}
60     ...    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions.json