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