243b1fad185c7dee1ec6a6d700790d8885bba49c
[integration/test.git] / csit / suites / groupbasedpolicy / GBPSFC / 6-node / demo-asymmetric-chain / 010_set_odl.robot
1 *** Settings ***
2 Documentation     Test suite for setting up infrastructure for demo-asymmetric-chain
3 Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS_YANG_JSON}
4 Suite Teardown    Delete All Sessions
5 Library           RequestsLibrary
6 Library           OperatingSystem
7 Variables         ../../../../../variables/Variables.py
8 Resource          ../../../../../libraries/Utils.robot
9 Resource          ../Variables.robot
10 Resource          ../../../../../libraries/GBP/OpenFlowUtils.robot
11
12 *** Test Cases ***
13 Put Service Functions
14     [Documentation]    Register Service Functions to ODL
15     ${json_to_edit}    OperatingSystem.Get File    ${SF_FILE}
16     ${edited_json}    Replace String    ${json_to_edit}    _SF1    ${GBPSFC3}
17     ${edited_json}    Replace String    ${edited_json}    _SF2    ${GBPSFC5}
18     ${resp}    RequestsLibrary.Put Request    session    ${SF_PATH}    ${edited_json}    ${HEADERS_YANG_JSON}
19     Should Be Equal As Strings    ${resp.status_code}    200
20
21 Put Service Function Forwarders
22     [Documentation]    Register Service Function Forwarders to ODL
23     ${json_to_edit}    OperatingSystem.Get File    ${SFF_FILE}
24     ${edited_json}    Replace String    ${json_to_edit}    _SFF1    ${GBPSFC2}
25     ${edited_json}    Replace String    ${edited_json}    _SFF2    ${GBPSFC4}
26     ${resp}    RequestsLibrary.Put Request    session    ${SFF_PATH}    ${edited_json}    ${HEADERS_YANG_JSON}
27     Should Be Equal As Strings    ${resp.status_code}    200
28
29 Wait For Manager and Switch Connected on GBPSFC2
30     [Documentation]    Making sure that manager is connected for further processing.
31     SSHLibrary.Open Connection    ${GBPSFC2}
32     Utils.Flexible Mininet Login
33     Wait Until Keyword Succeeds    2min    3s    Manager and Switch Connected    sw_name=sw2
34     SSHLibrary.Close Connection
35
36 Wait For Manager and Switch Connected on GBPSFC4
37     [Documentation]    Making sure that manager is connected for further processing.
38     SSHLibrary.Open Connection    ${GBPSFC4}
39     Utils.Flexible Mininet Login
40     Wait Until Keyword Succeeds    2min    3s    Manager and Switch Connected    sw_name=sw4
41     SSHLibrary.Close Connection
42
43 Put Service Function Chains
44     [Documentation]    Register Service Function Chains to ODL
45     Add Elements To URI From File    ${SFC_PATH}    ${SFC_ASYMM_FILE}    ${HEADERS_YANG_JSON}
46
47 Put Service Function Paths
48     [Documentation]    Register Service Function Paths to ODL
49     Add Elements To URI From File    ${SFP_PATH}    ${SFP_ASYMM_FILE}    ${HEADERS_YANG_JSON}
50
51 Put Tunnels
52     [Documentation]    Send tunnel augmentation to ODL
53     ${json_to_edit}    OperatingSystem.Get File    ${TUNNELS_FILE}
54     ${edited_json}    Replace String    ${json_to_edit}    _CLASSIFIER1    ${GBPSFC1}
55     ${edited_json}    Replace String    ${edited_json}    _CLASSIFIER2    ${GBPSFC6}
56     ${resp}    RequestsLibrary.Put Request    session    ${TUNNELS_PATH}    ${edited_json}    ${HEADERS_YANG_JSON}
57     Should Be Equal As Strings    ${resp.status_code}    200
58
59 Put Tenant
60     [Documentation]    Send Tenant Data to ODL
61     Add Elements To URI From File    ${TENANT_PATH}    ${TENANT_ASYMM_FILE}    ${HEADERS_YANG_JSON}
62
63 Register Endpoints
64     [Documentation]    Endpoints registration
65     @{endpoint_files} =    OperatingSystem.List Files In Directory    ${ENDPOINTS_ASYMM_DIR}    vethl*.*json    absolute
66     : FOR    ${endpoint_file}    IN    @{endpoint_files}
67     \    Post Elements To URI From File    ${ENDPOINT_REG_PATH}    ${endpoint_file}    ${HEADERS_YANG_JSON}