Remove variables for vpnservice
[integration/test.git] / csit / suites / sfc / Full_Deploy / 015__sfc_rendered_service_paths_logical.robot
1 *** Settings ***
2 Documentation       Test suite for SFC Rendered Service Paths. Logical SFF
3
4 Library             SSHLibrary
5 Library             Collections
6 Library             OperatingSystem
7 Library             RequestsLibrary
8 Resource            ../../../libraries/SFC/SfcKeywords.robot
9 Resource            ../../../variables/sfc/Variables.robot
10 Resource            ../../../libraries/Utils.robot
11 Resource            ../../../libraries/TemplatedRequests.robot
12
13 Suite Setup         Init Suite
14 Suite Teardown      Delete All Elements
15
16
17 *** Variables ***
18 ${VERSION_DIR}                      master
19 ${TEST_DIR}                         ${CURDIR}/../../../variables/sfc/${VERSION_DIR}
20 ${SERVICE_FUNCTIONS_FILE}           ${TEST_DIR}/service-functions-logicalsff.json
21 ${SERVICE_FORWARDERS_FILE}          ${TEST_DIR}/service-function-forwarders-logicallsff.json
22 ${SERVICE_CHAINS_FILE}              ${TEST_DIR}/service-function-chains-logicalsff.json
23 ${SERVICE_FUNCTION_PATHS_FILE}      ${TEST_DIR}/service-function-paths-logicalsff.json
24 ${CREATE_RSP1_INPUT}
25 ...                                 {"input":{"name": "RSP1","parent-service-function-path": "SFP1","symmetric": "true"}}
26 ${CREATE_RSP2_INPUT}
27 ...                                 {"input":{"name": "RSP2","parent-service-function-path": "SFP2","symmetric": "true"}}
28 ${CREATE_RSP_FAILURE_INPUT}
29 ...                                 {"input":{"name": "RSP1","parent-service-function-path": "SFP3","symmetric": "true"}}
30 ${DELETE_RSP1_INPUT}                {"input":{"name":"RSP1"}}
31 ${DELETE_RSP1_REVERSE_INPUT}        {"input":{"name":"RSP1-Reverse"}}
32 ${DELETE_RSP2_INPUT}                {"input":{"name":"RSP2"}}
33 @{SF_NAMES}                         "name":"firewall-1"    "name":"dpi-1"
34
35
36 *** Test Cases ***
37 Basic Environment Setup Tests
38     [Documentation]    Prepare Basic Test Environment. Logical SFF
39     Utils.Add Elements To URI From File    ${SERVICE_FORWARDERS_URI}    ${SERVICE_FORWARDERS_FILE}
40     Utils.Add Elements To URI From File    ${SERVICE_FUNCTIONS_URI}    ${SERVICE_FUNCTIONS_FILE}
41     BuiltIn.Wait Until Keyword Succeeds    60s    2s    SfcKeywords.Check Service Function Types Added    ${SF_NAMES}
42     Utils.Add Elements To URI From File    ${SERVICE_CHAINS_URI}    ${SERVICE_CHAINS_FILE}
43     SfcKeywords.Create Sfp And Wait For Rsp Creation    ${SERVICE_FUNCTION_PATHS_FILE}
44
45 Get Rendered Service Path By Name
46     [Documentation]    Get Rendered Service Path By Name Through RESTConf APIs. Logical SFF
47     # The RSP should be symetric, so 2 should be created for the SFP
48     ${rsp_name} =    SfcKeywords.Get Rendered Service Path Name    ${SFP_NAME}
49     Utils.Get URI And Verify    ${OPERATIONAL_RSP_URI}/${rsp_name}
50     ${rsp_name_rev} =    SfcKeywords.Get Rendered Service Path Name    ${SFP_NAME}
51     Utils.Get URI And Verify    ${OPERATIONAL_RSP_URI}/${rsp_name_rev}
52     ${elements} =    Create List
53     ...    "parent-service-function-path":"${SFP_NAME}"
54     ...    "hop-number":0
55     ...    "service-index":255
56     ...    "hop-number":1
57     ...    "service-index":254
58     Utils.Check For Elements At URI    ${OPERATIONAL_RSPS_URI}    ${elements}
59
60 Delete one Rendered Service Path By Name
61     [Documentation]    Delete One Rendered Service Path By Name Through RESTConf APIs. Logical SFF
62     # First verify that the RSPs exist
63     ${rsp_name} =    SfcKeywords.Get Rendered Service Path Name    ${SFP_NAME}
64     Utils.Get URI And Verify    ${OPERATIONAL_RSP_URI}/${rsp_name}
65     ${rsp_name_rev} =    SfcKeywords.Get Rendered Service Path Name    ${SFP_NAME}    True
66     Utils.Get URI And Verify    ${OPERATIONAL_RSP_URI}/${rsp_name_rev}
67     # Delete the SFP, which will delete the RSPs
68     SfcKeywords.Delete Sfp And Wait For Rsps Deletion    ${SFP_NAME}
69
70 Get Rendered Service Path Hop
71     [Documentation]    Get Rendered Service Path By Name Through RESTConf APIs. Logical SFF
72     # Create the SFP, which will create the RSPs
73     SfcKeywords.Create Sfp And Wait For Rsp Creation    ${SERVICE_FUNCTION_PATHS_FILE}
74     ${rsp_name} =    SfcKeywords.Get Rendered Service Path Name    ${SFP_NAME}
75     ${elements} =    BuiltIn.Create List    "hop-number":0    "service-index":255    "service-function-name":"dpi-1
76     Utils.Check For Elements At URI    ${OPERATIONAL_RSP_URI}/${rsp_name}/rendered-service-path-hop/0/    ${elements}
77     ${elements} =    BuiltIn.Create List
78     ...    "hop-number":1
79     ...    "service-index":254
80     ...    "service-function-name":"firewall-1
81     Utils.Check For Elements At URI    ${OPERATIONAL_RSP_URI}/${rsp_name}/rendered-service-path-hop/1/    ${elements}
82     ${resp} =    RequestsLibrary.Get Request
83     ...    session
84     ...    ${OPERATIONAL_RSP_URI}/${rsp_name}/rendered-service-path-hop/2/
85     BuiltIn.Should Be Equal As Strings    ${resp.status_code}    404
86
87
88 *** Keywords ***
89 Init Suite
90     [Documentation]    Create session and initialize ODL version specific variables
91     RequestsLibrary.Create Session
92     ...    session
93     ...    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
94     ...    auth=${AUTH}
95     ...    headers=${HEADERS}
96     BuiltIn.log    ${ODL_STREAM}
97     BuiltIn.Set Suite Variable    ${SFP_NAME}    SFP1
98     BuiltIn.Set Suite Variable    ${VERSION_DIR}    master
99     BuiltIn.Set Suite Variable
100     ...    ${SERVICE_FUNCTIONS_FILE}
101     ...    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-functions-logicalsff.json
102     BuiltIn.Set Suite Variable
103     ...    ${SERVICE_FORWARDERS_FILE}
104     ...    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-forwarders-logicallsff.json
105     BuiltIn.Set Suite Variable
106     ...    ${SERVICE_CHAINS_FILE}
107     ...    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-chains-logicalsff.json
108     BuiltIn.Set Suite Variable
109     ...    ${SERVICE_FUNCTION_PATHS_FILE}
110     ...    ${CURDIR}/../../../variables/sfc/${VERSION_DIR}/service-function-paths-logicalsff.json
111     BuiltIn.Set Suite Variable    @{SF_NAMES}    "name":"firewall-1"    "name":"dpi-1"
112
113 Delete All Elements
114     [Documentation]    Delete all provisioned elements
115     Utils.Remove All Elements If Exist    ${SERVICE_FUNCTION_PATHS_URI}
116     Utils.Remove All Elements If Exist    ${SERVICE_CHAINS_URI}
117     Utils.Remove All Elements If Exist    ${SERVICE_FORWARDERS_URI}
118     Utils.Remove All Elements If Exist    ${SERVICE_FUNCTIONS_URI}
119     BuiltIn.Wait Until Keyword Succeeds    60s    2s    SfcKeywords.Check Service Function Types Removed    ${SF_NAMES}
120     RequestsLibrary.Delete All Sessions