blob: 0655e53e21ea136be473d05b980020fd0deccf51 [file] [log] [blame]
rajendrajaiswal9b723a82019-11-25 12:18:51 +00001*** Settings ***
2Documentation The main interface for interacting with 5G Bulkpm.
3Library RequestsLibrary
4Library OperatingSystem
5Library String
6
7*** Variables ***
8${INVENTORY_SERVER} ${GLOBAL_INVENTORY_SERVER_PROTOCOL}://${GLOBAL_INVENTORY_SERVER_NAME}:${GLOBAL_INVENTORY_SERVER_PORT}
9${DEPLOYMENT_SERVER} ${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PROTOCOL}://${GLOBAL_DEPLOYMENT_HANDLER_SERVER_NAME}:${GLOBAL_DEPLOYMENT_HANDLER_SERVER_PORT}
10${DR_ENDPOINT} ${GLOBAL_DMAAP_DR_PROV_SERVER_PROTOCOL}://${GLOBAL_INJECTED_DMAAP_DR_PROV_IP_ADDR}:${GLOBAL_DMAAP_DR_PROV_SERVER_PORT}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000011${DMAAP_BC_SERVER} ${GLOBAL_BC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_BC_IP_ADDR}:${GLOBAL_BC_HTTPS_SERVER_PORT}
Krzysztof Kuzmicki52a02b22020-04-08 12:02:05 +020012${VES_HEALTH_CHECK_PATH} ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT}
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020013${MR_PUBLISH_TEMPLATE} mr/mr_publish.jinja
rajendrajaiswal9b723a82019-11-25 12:18:51 +000014
15*** Keywords ***
16Undeploy Service
17 [Arguments] ${server} ${endpoint}
18 ${session}= Create Session deployment ${server}
19 ${resp}= Delete Request deployment ${endpoint}
20 [Return] ${resp}
21
22Deployment Status
23 [Arguments] ${server} ${endpoint} ${deployment} ${operationId}
24 ${session}= Create Session deployment-status ${server}
25 ${resp}= Get Request deployment-status /${endpoint}/${deployment}/operation/${operationId}
26 ${status} Set Variable ${resp.json().get('status')}
27 Should Be Equal As Strings ${status} succeeded
28
29xNF PM File Validate
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000030 [Arguments] ${value}
31 ${resp}= Run MR Auth Get Request ${MR_TOPIC_URL_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
32 Should Contain ${resp.text} ${value}
rajendrajaiswal9b723a82019-11-25 12:18:51 +000033
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020034Topic Validate
35 [Arguments] ${value}
36 ${timestamp}= Get Current Date
37 ${dict}= Create Dictionary timestamp=${timestamp}
38 Templating.Create Environment mr ${GLOBAL_TEMPLATE_FOLDER}
39 ${data}= Templating.Apply Template mr ${MR_PUBLISH_TEMPLATE} ${dict}
40 ${resp}= Run MR Auth Post Request (User And Pass) ${MR_TOPIC_URL_PATH_FOR_POST} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD} ${data}
41 Should Be Equal As Strings ${resp.status_code} 200
42 ${resp}= Run MR Auth Get Request ${MR_TOPIC_URL_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD}
43 Should Contain ${resp.text} ${value}
44
45
rajendrajaiswal9b723a82019-11-25 12:18:51 +000046Usecase Teardown
47 Undeploy Service ${DEPLOYMENT_SERVER} /${DEPLOYMENT_ENDPOINT}/pmmapper
rajendrajaiswal9b723a82019-11-25 12:18:51 +000048 Undeploy Service ${DEPLOYMENT_SERVER} /${DEPLOYMENT_ENDPOINT}/sftpserver
49 Undeploy Service ${INVENTORY_SERVER} ${INVENTORY_ENDPOINT}/${serviceTypeId-Sftp}
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020050 Undeploy Service ${DEPLOYMENT_SERVER} /${DEPLOYMENT_ENDPOINT}/datafile
51
52
53Send File Ready Event to VES Collector
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000054 [Arguments] ${epoch}
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020055 ${headers}= Create Dictionary content-type=application/json
56 ${fileready}= OperatingSystem.Get File ${JSON_DATA_FILE}
57 ${auth}= Create List ${GLOBAL_DCAE_VES_USERNAME} ${GLOBAL_DCAE_VES_PASSWORD}
58 ${session}= Create Session ves ${VES_HEALTH_CHECK_PATH} auth=${auth}
59 ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${fileready} headers=${headers}
60 Should Be Equal As Strings ${resp.status_code} 202
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000061 ${VES_FILE_READY_NOTIFICATION} Set Variable {"event":{"commonEventHeader":{"version":"4.0.1","vesEventListenerVersion":"7.0.1","domain":"notification","eventName":"Noti_RnNode-Ericsson_FileReady","eventId":"FileReady_1797490e-10ae-4d48-9ea7-3d7d790b25e1","lastEpochMicrosec":8745745764578,"priority":"Normal","reportingEntityName":"otenb5309","sequence":0,"sourceName":"oteNB5309","startEpochMicrosec":8745745764578,"timeZoneOffset":"UTC+05.30"},"notificationFields":{"changeIdentifier":"PM_MEAS_FILES","changeType":"FileReady","notificationFieldsVersion":"2.0","arrayOfNamedHashMap":[{"name":"A${epoch}.xml.gz","hashMap":{"location":"sftp://bulkpm:bulkpm@sftpserver:22/upload/A${epoch}.xml.gz","compression":"gzip","fileFormatType":"org.3GPP.32.435#measCollec","fileFormatVersion":"V10"}}]}}}
Krzysztof Kuzmickiae8615f2020-05-29 12:35:06 +020062 ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${VES_FILE_READY_NOTIFICATION} headers=${headers}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010063 Should Be Equal As Strings ${resp.status_code} 202
64
65Upload PM Files to xNF SFTP Server
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000066 [Arguments] ${ftp_file_path}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010067 Open Connection sftpserver
68 Login bulkpm bulkpm
69 ${epoch}= Get Current Date result_format=epoch
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000070 Set Global Variable ${epoch}
71 Put File ${ftp_file_path} upload/A${epoch}.xml.gz
72 [Return] ${epoch}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010073
74Check Given Print In DFC Log
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000075 [Arguments] ${CHECK_DFC_LOGS}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010076 ${dfc_logs}= Run Given Command On DFC Container ${CHECK_DFC_LOGS}
77 Should Contain ${dfc_logs} HostKey has been changed
78
79Run Given Command On DFC Container
80 [Arguments] ${user_command}
81 ${run_command} = Run And Return Rc And Output ${user_command}
82 ${command_output} = Set Variable ${run_command[1]}
83 ${regexp_matches} = Get Regexp Matches ${command_output} .*(\\s|\\[)+(.+-datafile-collector).* 2
84 ${dfc_container_name} = Set Variable ${regexp_matches[0]}
85 ${new_command} = Set Variable ${user_command} ${dfc_container_name}
86 ${command_output} = Run And Return Rc And Output ${new_command}
87 Should Be Equal As Integers ${command_output[0]} 0
88 ${log} = Set Variable ${command_output[1]}
89 [Return] ${log}
90
91Check Known Hosts In Env
92 [Arguments] ${CHECK_KNOWN_HOSTS}
93 ${check} = Run And Return Rc And Output ${CHECK_KNOWN_HOSTS}
94 Should Be Equal As Integers ${check[0]} 0
95 ${env} = Set Variable ${check[1]}
96 ${string_matches} = Get Lines Containing String ${env} KNOWN_HOSTS_FILE_PATH=/home/datafile/.ssh/known_host case_insensitive=True
Krzysztof Kuzmickic8617d42021-01-19 10:34:03 +000097 ${output} = Should Not Be Empty ${string_matches}
Katarzyna Wasiel7ebd4b32020-12-02 13:39:45 +010098 [Return] ${output}