Tidied new changes
[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}
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
11 *** Variables ***
12 ${GBP_TENANT_ID}    f5c7d344-d1c7-4208-8531-2c2693657e12
13 ${TENANT_PATH}    /restconf/config/policy:tenants/tenant/${GBP_TENANT_ID}
14 ${TENANT_FILE}    ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/tenants.json
15 ${TUNNELS_PATH}    /restconf/config/opendaylight-inventory:nodes
16 ${TUNNELS_FILE}    ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/tunnels.json
17 ${ENDPOINTS_PATH}    /restconf/operations/endpoint:register-endpoint
18 ${SF_PATH}        /restconf/config/service-function:service-functions
19 ${SF_FILE}        ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_functions.json
20 ${SFF_PATH}       /restconf/config/service-function-forwarder:service-function-forwarders
21 ${SFF_FILE}       ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_function_forwarders.json
22 ${SFC_PATH}       /restconf/config/service-function-chain:service-function-chains
23 ${SFC_FILE}       ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_function_chains.json
24 ${SFP_PATH}       /restconf/config/service-function-path:service-function-paths
25 ${SFP_FILE}       ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/service_function_paths.json
26 ${h35_2_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_2.json
27 ${h35_3_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_3.json
28 ${h35_4_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_4.json
29 ${h35_5_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h35_5.json
30 ${h36_2_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_2.json
31 ${h36_3_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_3.json
32 ${h36_4_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_4.json
33 ${h36_5_FILE}     ${CURDIR}/../../../../../variables/gbp/demo-asymmetric-chain/vethl-h36_5.json
34 @{ENDPOINT_FILES}    ${h35_2_FILE}    ${h35_3_FILE}    ${h35_4_FILE}    ${h35_5_FILE}    ${h36_2_FILE}    ${h36_3_FILE}    ${h36_4_FILE}
35 ...               ${h36_5_FILE}
36
37 *** Test Cases ***
38 Put Service Functions
39     [Documentation]    Register Service Functions to ODL
40     ${json_to_edit}    OperatingSystem.Get File    ${SF_FILE}
41     ${edited_json}    Replace String    ${json_to_edit}    _SF1    ${GBPSFC3}
42     ${edited_json}    Replace String    ${edited_json}    _SF2    ${GBPSFC5}
43     ${resp}    RequestsLibrary.Put    session    ${SF_PATH}    ${edited_json}    ${HEADERS}
44     Should Be Equal As Strings    ${resp.status_code}    200
45
46 Put Service Function Forwarders
47     [Documentation]    Register Service Function Forwarders to ODL
48     ${json_to_edit}    OperatingSystem.Get File    ${SFF_FILE}
49     ${edited_json}    Replace String    ${json_to_edit}    _SFF1    ${GBPSFC2}
50     ${edited_json}    Replace String    ${edited_json}    _SFF2    ${GBPSFC4}
51     ${resp}    RequestsLibrary.Put    session    ${SFF_PATH}    ${edited_json}    ${HEADERS}
52     Should Be Equal As Strings    ${resp.status_code}    200
53
54 Put Service Function Chains
55     [Documentation]    Register Service Function Chains to ODL
56     Add Elements To URI From File    ${SFC_PATH}    ${SFC_FILE}
57
58 Put Service Function Paths
59     [Documentation]    Register Service Function Paths to ODL
60     Add Elements To URI From File    ${SFP_PATH}    ${SFP_FILE}
61
62 Put Tunnels
63     [Documentation]    Send tunnel augmentation to ODL
64     ${json_to_edit}    OperatingSystem.Get File    ${TUNNELS_FILE}
65     ${edited_json}    Replace String    ${json_to_edit}    _CLASSIFIER1    ${GBPSFC1}
66     ${edited_json}    Replace String    ${edited_json}    _CLASSIFIER2    ${GBPSFC6}
67     ${resp}    RequestsLibrary.Put    session    ${TUNNELS_PATH}    ${edited_json}    ${HEADERS}
68     Should Be Equal As Strings    ${resp.status_code}    200
69
70 Put Tenant
71     [Documentation]    Send Tenant Data to ODL
72     Add Elements To URI From File    ${TENANT_PATH}    ${TENANT_FILE}
73
74 Register Endpoints
75     [Documentation]    Endpoints registration
76     : FOR    ${endpoint_file}    IN    @{ENDPOINT_FILES}
77     \    Post Elements To URI From File    ${ENDPOINTS_PATH}    ${endpoint_file}