blob: 07ea3b7b2351bdad6f8159a61433a8455874eb41 [file] [log] [blame]
rajendrajaiswal9b723a82019-11-25 12:18:51 +00001*** Settings ***
2Documentation 5G Bulk PM Usecase functionality
3
4Library RequestsLibrary
5Library OperatingSystem
6Library Collections
7Library String
8Library DateTime
9Library SSHLibrary
10Library JSONLibrary
11Library Process
12Library ONAPLibrary.JSON
13Library ONAPLibrary.Utilities
mrichommea7172172020-05-15 14:42:12 +020014Resource ../../resources/usecases/5gbulkpm_interface.robot
15Resource ../../resources/mr_interface.robot
16Resource ../../resources/dr_interface.robot
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020017Suite Setup Send File Ready Event to VES Collector test
rajendrajaiswal9b723a82019-11-25 12:18:51 +000018Suite Teardown Usecase Teardown
19
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010020
21
rajendrajaiswal9b723a82019-11-25 12:18:51 +000022*** Variables ***
23${INVENTORY_ENDPOINT} /dcae-service-types
rajendrajaiswal9b723a82019-11-25 12:18:51 +000024${XNF_SFTP_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/k8s-sftp.yaml
25${BLUEPRINT_TEMPLATE_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/blueprintTemplate.json
26${FTP_FILE_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/pmfiles/A20181002.0000-1000-0015-1000_5G.xml.gz
27${DEPLOYMENT_ENDPOINT} dcae-deployments
28${MR_TOPIC_CHECK_PATH} /topics
29${DR_SUB_CHECK_PATH} /internal/prov
30${MR_TOPIC_URL_PATH} /events/org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS/CG1/C1
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020031${MR_TOPIC_URL_PATH_FOR_POST} /events/org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS
rajendrajaiswal9b723a82019-11-25 12:18:51 +000032${DMAAP_BC_MR_CLIENT_PATH} /webapi/mr_clients
33${DMAAP_BC_MR_CLUSTER_PATH} /webapi/mr_clusters
34${PMMAPPER_HEALTH_CHECK_PATH} /healthcheck
35${JSON_DATA_FILE} ${EXECDIR}/robot/assets/usecases/5gbulkpm/Notification.json
36${VES_LISTENER_PATH} /eventListener/v7
37${PMMAPPER_SUB_ROLE_DATA} ${EXECDIR}/robot/assets/usecases/5gbulkpm/sub.json
38${PMMAPPER_MR_CLUSTER_DATA} ${EXECDIR}/robot/assets/usecases/5gbulkpm/mr_clusters.json
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020039${NEXUS3} ${GLOBAL_INJECTED_NEXUS_DOCKER_REPO}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010040${SET_KNOWN_HOSTS_FILE_PATH} kubectl set env deployment/$(kubectl get deployment -n onap | grep datafile | awk '{print $1}') KNOWN_HOSTS_FILE_PATH=/home/datafile/.ssh/known_hosts -n onap
41${CHECK_ENV_SET} kubectl set env pod/$(kubectl get pod -n onap | grep datafile | awk '{print $1}') --list -n onap
42${GET_RSA_KEY} kubectl exec $(kubectl get pod -n onap | grep sftpserver | awk '{print $1}') -n onap -- ssh-keyscan -t rsa sftpserver > /tmp/known_hosts
43${COPY_RSA_KEY} kubectl cp /tmp/known_hosts $(kubectl get pod -n onap | grep datafile | awk '{print $1}'):/home/datafile/.ssh/known_hosts -n onap
44${CHECK_DFC_LOGS} kubectl logs $(kubectl get pod -n onap | grep datafile | awk '{print $1}') -n onap --tail=4
45${EXPECTED_PRINT} StrictHostKeyChecking is enabled but environment variable KNOWN_HOSTS_FILE_PATH is not set or points to not existing file
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020046
rajendrajaiswal9b723a82019-11-25 12:18:51 +000047*** Test Cases ***
48
49Deploying Data File Collector
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010050 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
rajendrajaiswal9b723a82019-11-25 12:18:51 +000051 ${headers}= Create Dictionary content-type=application/json
52 ${session}= Create Session dfc ${INVENTORY_SERVER}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010053 ${resp}= Get Request dfc ${INVENTORY_ENDPOINT}?typeName=k8s-datafile headers=${headers}
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020054 ${json}= Set Variable ${resp.json()}
55 ${serviceTypeId-Dfc} Set Variable ${json['items'][0]['typeId']}
56 ${image} Get Regexp Matches ${json['items'][0]['blueprintTemplate']} nexus3(.)*?(?=\\")
57 ${image} Replace String ${image}[0] nexus3.onap.org:10001 ${NEXUS3}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000058 Set Global Variable ${serviceTypeId-Dfc}
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020059 ${deployment_data}= Set Variable {"serviceTypeId": "${serviceTypeId-Dfc}", "inputs": {"tag_version": "${image}"}}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000060 ${session}= Create Session deployment-dfc ${DEPLOYMENT_SERVER}
61 ${resp}= Put Request deployment-dfc /${DEPLOYMENT_ENDPOINT}/datafile data=${deployment_data} headers=${headers}
62 ${operationLink} Set Variable ${resp.json().get('links').get('status')}
63 ${operationId} Fetch From Right ${operationLink} /
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020064 Wait Until Keyword Succeeds 5 minute 20 sec Deployment Status ${DEPLOYMENT_SERVER} ${DEPLOYMENT_ENDPOINT} datafile ${operationId}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000065
66Deploying 3GPP PM Mapper
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010067 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
rajendrajaiswal9b723a82019-11-25 12:18:51 +000068 ${clusterdata}= OperatingSystem.Get File ${PMMAPPER_MR_CLUSTER_DATA}
69 ${headers}= Create Dictionary content-type=application/json
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020070 ${session}= Create Session dmaapbc ${DMAAP_BC_SERVER}
71 ${resp}= Post Request dmaapbc ${DMAAP_BC_MR_CLUSTER_PATH} data=${clusterdata} headers=${headers}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000072 ${session}= Create Session pmmapper ${INVENTORY_SERVER}
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020073 ${resp}= Get Request pmmapper ${INVENTORY_ENDPOINT}?typeName=k8s-pm-mapper headers=${headers}
74 ${json}= Set Variable ${resp.json()}
75 ${serviceTypeId-Pmmapper} Set Variable ${json['items'][0]['typeId']}
76 ${image} Get Regexp Matches ${json['items'][0]['blueprintTemplate']} nexus3(.)*?(?=\')
77 ${image} Replace String ${image}[0] nexus3.onap.org:10001 ${NEXUS3}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000078 Set Global Variable ${serviceTypeId-Pmmapper}
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020079 ${deployment_data}= Set Variable {"inputs":{"client_password": "${GLOBAL_DCAE_PASSWORD}", "tag_version": "${image}"},"serviceTypeId": "${serviceTypeId-Pmmapper}"}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000080 ${session}= Create Session deployment-pmmapper ${DEPLOYMENT_SERVER}
81 ${resp}= Put Request deployment-pmmapper /${DEPLOYMENT_ENDPOINT}/pmmapper data=${deployment_data} headers=${headers}
82 ${operationLink} Set Variable ${resp.json().get('links').get('status')}
83 ${operationId} Fetch From Right ${operationLink} /
mrichommea7172172020-05-15 14:42:12 +020084 Wait Until Keyword Succeeds 6 minute 10 sec Deployment Status ${DEPLOYMENT_SERVER} ${DEPLOYMENT_ENDPOINT} pmmapper ${operationId}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000085
86Deploying SFTP Server As xNF
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010087 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
rajendrajaiswal9b723a82019-11-25 12:18:51 +000088 ${blueprint}= OperatingSystem.Get File ${XNF_SFTP_BLUEPRINT_PATH}
89 ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE_PATH}
90 ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint}
91 ${templatejson}= Update Value To Json ${templatejson} typeName sftpserver
92 ${json_data} Convert JSON To String ${templatejson}
93 ${headers}= Create Dictionary content-type=application/json
94 ${session}= Create Session sftp ${INVENTORY_SERVER}
95 ${resp}= Post Request sftp ${INVENTORY_ENDPOINT} data=${json_data} headers=${headers}
96 ${serviceTypeId-Sftp}= Set Variable ${resp.json().get('typeId')}
97 Set Global Variable ${serviceTypeId-Sftp}
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020098 ${deployment_data}= Set Variable {"serviceTypeId": "${serviceTypeId-Sftp}" }
rajendrajaiswal9b723a82019-11-25 12:18:51 +000099 ${session}= Create Session deployment-sftpserver ${DEPLOYMENT_SERVER}
100 ${resp}= Put Request deployment-sftpserver /${DEPLOYMENT_ENDPOINT}/sftpserver data=${deployment_data} headers=${headers}
101 ${operationLink}= Set Variable ${resp.json().get('links').get('status')}
102 ${operationId} Fetch From Right ${operationLink} /
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +0200103 Wait Until Keyword Succeeds 2 minute 5 sec Deployment Status ${DEPLOYMENT_SERVER} ${DEPLOYMENT_ENDPOINT} sftpserver ${operationId}
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000104
105
106Checking PERFORMANCE_MEASUREMENTS Topic In Message Router
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100107 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000108 ${headers}= Create Dictionary content-type=application/json
109 ${subdata}= OperatingSystem.Get File ${PMMAPPER_SUB_ROLE_DATA}
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +0200110 ${session}= Create Session dmaapbc ${DMAAP_BC_SERVER}
111 ${resp}= Post Request dmaapbc ${DMAAP_BC_MR_CLIENT_PATH} data=${subdata} headers=${headers}
112 Wait Until Keyword Succeeds 5 minute 5 sec Topic Validate success
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000113 ${resp}= Run MR Get Request ${MR_TOPIC_CHECK_PATH}
114 Should Be Equal As Strings ${resp.status_code} 200
115 ${topics}= Set Variable ${resp.json().get('topics')}
116 List Should Contain Value ${topics} org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +0200117 ${resp}= Run MR Auth Get Request ${MR_TOPIC_URL_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000118 Should Be Equal As Strings ${resp.status_code} 200
119
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100120Upload PM Files to xNF SFTP Server After Services Deployed
121 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
122 Upload PM Files to xNF SFTP Server ${FTP_FILE_PATH}
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000123 Set Global Variable ${epoch}
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000124
125DR Bulk PM Feed Check
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100126 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000127 ${resp}= Run DR Get Request ${DR_SUB_CHECK_PATH}
128 Should Contain ${resp.text} bulk_pm_feed
129
130DR PM Mapper Subscriber Check
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100131 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000132 ${resp}= Run DR Get Request ${DR_SUB_CHECK_PATH}
133 Should Contain ${resp.text} https://dcae-pm-mapper:8443/delivery
134
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100135Sending File Ready Event to VES Collector After Services Deployed
136 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
137 Send File Ready Event to VES Collector ${epoch}
rajendrajaiswal9b723a82019-11-25 12:18:51 +0000138
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100139Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic After Services Deployed
140 [Tags] 5gbulkpm 5gbulkpm_checking_sftp_rsa_key
mrichomme5b52b592020-05-25 16:42:26 +0200141 Wait Until Keyword Succeeds 5 minute 5 sec xNF PM File Validate perf3gpp_RnNode-Ericsson_pmMeasResult
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +0100142
143Setting Known_Hosts Environment Set
144 [Tags] 5gbulkpm_checking_sftp_rsa_key
145 ${rc}= Run and Return RC ${SET_KNOWN_HOSTS_FILE_PATH}
146 Should Be Equal As Integers ${rc} 0
147 Wait Until Keyword Succeeds 5 min 10s Check Known Hosts In Env ${CHECK_ENV_SET}
148 ${rc}= Run and Return RC ${GET_RSA_KEY}
149 Should Be Equal As Integers ${rc} 0
150 ${rc}= Run and Return RC ${COPY_RSA_KEY}
151 Should Be Equal As Integers ${rc} 0
152
153Uploading PM Files to xNF SFTP Server After Known_Host Set
154 [Tags] 5gbulkpm_checking_sftp_rsa_key
155 Upload PM Files to xNF SFTP Server ${FTP_FILE_PATH}
156 Set Global Variable ${epoch}
157
158Sending File Ready Event to VES Collector After Known_Host Set
159 [Tags] 5gbulkpm_checking_sftp_rsa_key
160 Send File Ready Event to VES Collector ${epoch}
161
162Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic After Known_Host Set
163 [Tags] 5gbulkpm_checking_sftp_rsa_key
164 Wait Until Keyword Succeeds 5 minute 5 sec xNF PM File Validate perf3gpp_RnNode-Ericsson_pmMeasResult
165
166Checking DFC Logs After Known_Hosts Set
167 [Tags] 5gbulkpm_checking_sftp_rsa_key
168 ${dfc_logs}= Run Given Command On DFC Container ${CHECK_DFC_LOGS}
169 Should Not Contain ${dfc_logs} ${EXPECTED_PRINT}
170
171Changing RSA Key Known_Hosts
172 [Tags] 5gbulkpm_checking_sftp_rsa_key
173 ${get_known_hosts_file}= OperatingSystem.Get File /tmp/known_hosts
174 ${change_rsa_key}= Replace String ${get_known_hosts_file} A a
175 Create File /tmp/known_hosts ${change_rsa_key}
176 ${rc}= Run and Return RC ${COPY_RSA_KEY}
177 Should Be Equal As Integers ${rc} 0
178
179Uploading PM Files to xNF SFTP Server After RSA Key Change
180 [Tags] 5gbulkpm_checking_sftp_rsa_key
181 Upload PM Files to xNF SFTP Server ${FTP_FILE_PATH}
182 Set Global Variable ${epoch}
183
184Sending File Ready Event to VES Collector After RSA Key Change
185 [Tags] 5gbulkpm_checking_sftp_rsa_key
186 Send File Ready Event to VES Collector ${epoch}
187
188Checking DFC Logs After RSA Key Change
189 [Tags] 5gbulkpm_checking_sftp_rsa_key
190 Wait Until Keyword Succeeds 5 sec 30 sec Check Given Print In DFC LOG ${CHECK_DFC_LOGS}