4d13a6bfad2a35ebb6bc0b1c74fede53dd41a1a6
[integration/csit.git] / tests / dcaegen2-collectors-hv-ves / testcases / authorization.robot
1 # ============LICENSE_START=======================================================
2 # csit-dcaegen2-collectors-hv-ves
3 # ================================================================================
4 # Copyright (C) 2018 NOKIA
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #      http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18
19 *** Settings ***
20 Library       DcaeAppSimulatorLibrary
21
22 Resource      resources/common-keywords.robot
23
24 Suite Setup       Client Authorization Suite Setup
25 Suite Teardown    VES-HV Collector Suite Teardown
26 Test Teardown     VES-HV Collector Test Shutdown
27
28 *** Keywords ***
29 Client Authorization Suite Setup
30     Log   Started Suite: VES-HV Client Authorization
31     ${XNF_PORTS_LIST}=    Create List    7000
32     ${XNF_WITH_INVALID_CERTIFICATES}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
33     ...                                               should_use_valid_certs=${false}
34     Set Suite Variable   ${XNF_WITH_INVALID_CERTIFICATES}
35     ${XNF_PORTS_LIST}=    Create List    7001
36     ${XNF_WITHOUT_SSL}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
37     ...                                               should_disable_ssl=${true}
38     Set Suite Variable   ${XNF_WITHOUT_SSL}
39     ${XNF_PORTS_LIST}=    Create List    7002
40     ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
41     ...                                                                                should_disable_ssl=${true}
42     ...                                                                                should_connect_to_unencrypted_hv_ves=${true}
43     Set Suite Variable   ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}
44     Log   Suite setup finished
45
46 *** Test Cases ***
47 Authorization
48     [Documentation]   VES-HV Collector should not authorize XNF with invalid certificate and not route any message
49     ...               to topics
50
51     Send Messages From xNF Simulators   ${XNF_WITH_INVALID_CERTIFICATES}   ${XNF_VALID_MESSAGES_REQUEST}
52
53     Wait until keyword succeeds   60 sec   5 sec
54     ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}
55
56 Unencrypted connection from client
57     [Documentation]   VES-HV Collector should not authorize XNF trying to connect through unencrypted connection
58
59     Send Messages From xNF Simulators   ${XNF_WITHOUT_SSL}   ${XNF_VALID_MESSAGES_REQUEST}
60
61     Wait until keyword succeeds   60 sec   5 sec
62     ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}
63
64 Unencrypted connection on both ends
65     [Documentation]   When run without SSL turned on, VES-HV Collector should route all valid messages
66     ...               from xNF trying to connect through unencrypted connection
67
68     Send Messages From xNF Simulators   ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}   ${XNF_VALID_MESSAGES_REQUEST}
69
70     Wait until keyword succeeds   60 sec   5 sec
71     ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_5000}
72
73
74 *** Variables ***
75 ${HV_VES_SCENARIOS}                            %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
76
77 ${XNF_VALID_MESSAGES_REQUEST}                  ${HV_VES_SCENARIOS}/authorization/xnf-valid-messages-request.json
78
79 ${AMOUNT_0}                                    0
80 ${AMOUNT_5000}                                 5000