aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot
blob: 4d13a6bfad2a35ebb6bc0b1c74fede53dd41a1a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# ============LICENSE_START=======================================================
# csit-dcaegen2-collectors-hv-ves
# ================================================================================
# Copyright (C) 2018 NOKIA
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================

*** Settings ***
Library       DcaeAppSimulatorLibrary

Resource      resources/common-keywords.robot

Suite Setup       Client Authorization Suite Setup
Suite Teardown    VES-HV Collector Suite Teardown
Test Teardown     VES-HV Collector Test Shutdown

*** Keywords ***
Client Authorization Suite Setup
    Log   Started Suite: VES-HV Client Authorization
    ${XNF_PORTS_LIST}=    Create List    7000
    ${XNF_WITH_INVALID_CERTIFICATES}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
    ...                                               should_use_valid_certs=${false}
    Set Suite Variable   ${XNF_WITH_INVALID_CERTIFICATES}
    ${XNF_PORTS_LIST}=    Create List    7001
    ${XNF_WITHOUT_SSL}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
    ...                                               should_disable_ssl=${true}
    Set Suite Variable   ${XNF_WITHOUT_SSL}
    ${XNF_PORTS_LIST}=    Create List    7002
    ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}=   Configure xNF Simulators    ${XNF_PORTS_LIST}
    ...                                                                                should_disable_ssl=${true}
    ...                                                                                should_connect_to_unencrypted_hv_ves=${true}
    Set Suite Variable   ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}
    Log   Suite setup finished

*** Test Cases ***
Authorization
    [Documentation]   VES-HV Collector should not authorize XNF with invalid certificate and not route any message
    ...               to topics

    Send Messages From xNF Simulators   ${XNF_WITH_INVALID_CERTIFICATES}   ${XNF_VALID_MESSAGES_REQUEST}

    Wait until keyword succeeds   60 sec   5 sec
    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}

Unencrypted connection from client
    [Documentation]   VES-HV Collector should not authorize XNF trying to connect through unencrypted connection

    Send Messages From xNF Simulators   ${XNF_WITHOUT_SSL}   ${XNF_VALID_MESSAGES_REQUEST}

    Wait until keyword succeeds   60 sec   5 sec
    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}

Unencrypted connection on both ends
    [Documentation]   When run without SSL turned on, VES-HV Collector should route all valid messages
    ...               from xNF trying to connect through unencrypted connection

    Send Messages From xNF Simulators   ${XNF_WITHOUT_SSL_CONNECTING_TO_UNENCRYPTED_HV_VES}   ${XNF_VALID_MESSAGES_REQUEST}

    Wait until keyword succeeds   60 sec   5 sec
    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_5000}


*** Variables ***
${HV_VES_SCENARIOS}                            %{WORKSPACE}/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios

${XNF_VALID_MESSAGES_REQUEST}                  ${HV_VES_SCENARIOS}/authorization/xnf-valid-messages-request.json

${AMOUNT_0}                                    0
${AMOUNT_5000}                                 5000