Add HTTPS to collect files from xNFs
[integration/csit.git] / tests / dcaegen2-collectors-datafile / testsuites / Strict-Host-Checking-suite / StrictHostChecking.robot
1 *** Settings ***
2 Library        OperatingSystem
3 Library        RequestsLibrary
4 Library        Process
5
6 Resource    ../../resources/common-keywords.robot
7
8 Test Teardown
9
10 *** Variables ***
11 ${CONSUL_UPL_APP}                   /usr/bin/curl -v http://127.0.0.1:8500/v1/kv/dfc_app0?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary @${SIMGROUP_ROOT}/consul/c12_feed2_PM_MEAS.json
12 ${CONSUL_UPL_APP_INSECURE_SFTP}     /usr/bin/curl -v http://127.0.0.1:8500/v1/kv/dfc_app0?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary @${SIMGROUP_ROOT}/consul/c12_feed2_PM_MEAS_no_strict_host_key_checking.json
13 ${CONSUL_GET_APP}                   /usr/bin/curl -v http://127.0.0.1:8500/v1/kv/dfc_app0?raw
14 ${CBS_GET_MERGED_CONFIG}            /usr/bin/curl -v http://127.0.0.1:10000/service_component_all/dfc_app0
15
16 *** Test Cases ***
17
18 ######### Single file, SFTP, various SFTP Strict host key checking settings
19
20 Verify single event with SFTP file, when host known and strict host key checking enabled. From event poll to published file
21     [TAGS]                          DFC_STRICT_HOST_KEY_CHECKING_1
22     [Documentation]                 Verify single event with SFTP file, when host known and strict host key checking enabled. From event poll to published file.
23     [Setup]  Setup Strict Host Key Checking Test  ${CONSUL_UPL_APP}  all_hosts_keys
24
25     Wait Until Keyword Succeeds     1 minute      10 sec    MR Sim Emitted Files Equal          1                       #Verify 1 file emitted from MR sim
26     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Query Not Published Equal    1                       #Verify 1 query response for not published files
27     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Published Files Equal        1                       #Verify 1 file published to DR sim
28     DR Redir Sim Downloaded Volume Equal          1 000 000                                                             #Verify 1 000 000 bytes published file data in DR redir sim
29
30     [Teardown]                      Test Teardown
31
32 Verify single event with SFTP file, when host unknown and strict host key checking disabled. From event poll to published file
33     [TAGS]                          DFC_STRICT_HOST_KEY_CHECKING_2
34     [Documentation]                 Verify single event with SFTP file, when host unknown and strict host key checking disabled. From event poll to published file.
35     [Setup]  Setup Strict Host Key Checking Test  ${CONSUL_UPL_APP_INSECURE_SFTP}  known_hosts_empty
36
37     Wait Until Keyword Succeeds     1 minute      10 sec    MR Sim Emitted Files Equal          1                       #Verify 1 file emitted from MR sim
38     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Query Not Published Equal    1                       #Verify 1 query response for not published files
39     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Published Files Equal        1                       #Verify 1 file published to DR sim
40     DR Redir Sim Downloaded Volume Equal          1 000 000                                                             #Verify 1 000 000 bytes published file data in DR redir sim
41
42     [Teardown]                      Test Teardown
43
44 Verify single event with SFTP file, when no known hosts file and strict host key checking enabled. From event poll to published file
45     [TAGS]                          DFC_STRICT_HOST_KEY_CHECKING_3
46     [Documentation]                 Verify single event with SFTP file, when host unknown and strict host key checking enabled. File not published.
47     [Setup]  Setup Strict Host Key Checking Test  ${CONSUL_UPL_APP}  no_known_hosts_file
48
49     Wait Until Keyword Succeeds     1 minute      10 sec    MR Sim Emitted Files Equal          1                       #Verify 1 file emitted from MR sim
50     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Query Not Published Equal    1                       #Verify 1 query response for not published files
51     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Published Files Equal        1                       #Verify 1 file published to DR sim
52     DR Redir Sim Downloaded Volume Equal          1 000 000                                                             #Verify 1 000 000 bytes published file data in DR redir sim
53
54     [Teardown]                      Test Teardown
55
56
57
58 Verify single event with SFTP file, when host unknown and strict host key checking enabled. File not published
59     [TAGS]                          DFC_STRICT_HOST_KEY_CHECKING_4
60     [Documentation]                 Verify single event with SFTP file, when host unknown and strict host key checking enabled. File not published.
61     [Setup]  Setup Strict Host Key Checking Test  ${CONSUL_UPL_APP}  known_hosts_empty
62     Wait Until Keyword Succeeds     1 minute      10 sec    MR Sim Emitted Files Equal          1                       #Verify 1 file emitted from MR sim
63     Wait Until Keyword Succeeds     1 minute      10 sec    DR Sim Query Not Published Equal    1                       #Verify 1 query response for not published files
64     Sleep                           60
65     DR Sim Published Files Equal    0                                                                                   #Verify no file was published to DR sim
66     [Teardown]                      Test Teardown
67
68 *** Keywords ***
69
70 Setup Strict Host Key Checking Test
71     [Documentation]                 Sets up strict host key checking test with single 1MB file
72     [Arguments]                     ${consul_config_request}  ${known_hosts_file}
73     Set Environment Variable        MR_TC                   --tc100
74     Set Environment Variable        DR_TC                   --tc normal
75     Set Environment Variable        DR_REDIR_TC             --tc normal
76     Set Environment Variable        MR_GROUPS               OpenDcae-c12:PM_MEAS_FILES
77     Set Environment Variable        MR_FILE_PREFIX_MAPPING  PM_MEAS_FILES:A
78     Set Environment Variable        DR_REDIR_FEEDS          2:A
79     Set Environment Variable        FTP_FILE_PREFIXES       A
80     Set Environment Variable        HTTP_FILE_PREFIXES      A
81     Set Environment Variable        NUM_FTPFILES            1
82     Set Environment Variable        NUM_HTTPFILES           1
83     Set Environment Variable        NUM_PNFS                1
84     Set Environment Variable        FILE_SIZE               1MB
85     Set Environment Variable        FTP_TYPE                SFTP
86     Set Environment Variable        HTTP_TYPE               HTTP
87     Set Environment Variable        NUM_FTP_SERVERS         1
88     Set Environment Variable        NUM_HTTP_SERVERS        1
89     Set Environment Variable        DR_FEEDS                2:A
90     Set Environment Variable        DR_REDIR_SIM            drsim_redir
91     Set Environment Variable        SFTP_SIMS               sftp-server0:22
92     Set Environment Variable        FTPES_SIMS              ftpes-server-vsftpd0:21
93     Set Environment Variable        HTTP_SIMS               http-https-server0:80
94     Set Environment Variable        HTTPS_SIMS              http-https-server0:443
95     Set Environment Variable        HTTPS_SIMS_NO_AUTH      http-https-server0:8080
96
97     ${cli_cmd_output}=              Run Process     ./simulators-start.sh    cwd=${SIMGROUP_ROOT}
98     Log To Console                  Simulator-start:
99     Log To Console                  ${cli_cmd_output.stdout} ${cli_cmd_output.stderr}
100     MR Sim Emitted Files Equal      0                                                                                   #Verify 0 file emitted from MR sim
101     DR Sim Published Files Equal    0                                                                                   #Verify 0 file published to DR sim
102
103     ${cli_cmd_output}=              Run Process                     ${consul_config_request}    shell=yes
104     Log To Console                  Consul APP write:
105     Log To Console                  ${cli_cmd_output.stdout} ${cli_cmd_output.stderr}
106
107     ${cli_cmd_output}=              Run Process                     ${CONSUL_GET_APP}           shell=yes
108     Log To Console                  Consul APP read:
109     Log To Console                  ${cli_cmd_output.stdout} ${cli_cmd_output.stderr}
110
111     ${cli_cmd_output}=              Run Process                     ${CBS_GET_MERGED_CONFIG}    shell=yes
112     Log To Console                  CBS merged configuration:
113     Log To Console                  ${cli_cmd_output.stdout} ${cli_cmd_output.stderr}
114
115     Sleep                           10
116
117     ${cli_cmd_output}=              Run Process                    ${DFC_ROOT}/dfc-start.sh    cwd=${DFC_ROOT}    env:KNOWN_HOSTS=${known_hosts_file}    env:SIMGROUP_ROOT=${SIMGROUP_ROOT}
118     Log To Console                  Dfc-start:
119     Log To Console                  ${cli_cmd_output.stdout} ${cli_cmd_output.stderr}