rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation The main interface for interacting with 5G Bulkpm. |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library 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} |
rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 11 | ${DMAAP_BC_SERVER} ${GLOBAL_BC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_BC_IP_ADDR}:${GLOBAL_BC_HTTPS_SERVER_PORT} |
Krzysztof Kuzmicki | 52a02b2 | 2020-04-08 12:02:05 +0200 | [diff] [blame] | 12 | ${VES_HEALTH_CHECK_PATH} ${GLOBAL_DCAE_VES_HTTPS_PROTOCOL}://${GLOBAL_INJECTED_DCAE_VES_HOST}:${GLOBAL_DCAE_VES_HTTPS_SERVER_PORT} |
Krzysztof Kuzmicki | ae8615f | 2020-05-29 12:35:06 +0200 | [diff] [blame] | 13 | ${MR_PUBLISH_TEMPLATE} mr/mr_publish.jinja |
rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 14 | |
| 15 | *** Keywords *** |
| 16 | Undeploy Service |
| 17 | [Arguments] ${server} ${endpoint} |
| 18 | ${session}= Create Session deployment ${server} |
| 19 | ${resp}= Delete Request deployment ${endpoint} |
| 20 | [Return] ${resp} |
| 21 | |
| 22 | Deployment 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 | |
| 29 | xNF PM File Validate |
Krzysztof Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 30 | [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} |
rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 33 | |
Krzysztof Kuzmicki | ae8615f | 2020-05-29 12:35:06 +0200 | [diff] [blame] | 34 | Topic 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 | |
rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 46 | Usecase Teardown |
| 47 | Undeploy Service ${DEPLOYMENT_SERVER} /${DEPLOYMENT_ENDPOINT}/pmmapper |
rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 48 | Undeploy Service ${DEPLOYMENT_SERVER} /${DEPLOYMENT_ENDPOINT}/sftpserver |
| 49 | Undeploy Service ${INVENTORY_SERVER} ${INVENTORY_ENDPOINT}/${serviceTypeId-Sftp} |
Krzysztof Kuzmicki | ae8615f | 2020-05-29 12:35:06 +0200 | [diff] [blame] | 50 | Undeploy Service ${DEPLOYMENT_SERVER} /${DEPLOYMENT_ENDPOINT}/datafile |
| 51 | |
| 52 | |
| 53 | Send File Ready Event to VES Collector |
Krzysztof Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 54 | [Arguments] ${epoch} |
Krzysztof Kuzmicki | ae8615f | 2020-05-29 12:35:06 +0200 | [diff] [blame] | 55 | ${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 Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 61 | ${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 Kuzmicki | ae8615f | 2020-05-29 12:35:06 +0200 | [diff] [blame] | 62 | ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${VES_FILE_READY_NOTIFICATION} headers=${headers} |
Katarzyna Wasiel | 7ebd4b3 | 2020-12-02 13:39:45 +0100 | [diff] [blame] | 63 | Should Be Equal As Strings ${resp.status_code} 202 |
| 64 | |
| 65 | Upload PM Files to xNF SFTP Server |
Krzysztof Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 66 | [Arguments] ${ftp_file_path} |
Katarzyna Wasiel | 7ebd4b3 | 2020-12-02 13:39:45 +0100 | [diff] [blame] | 67 | Open Connection sftpserver |
| 68 | Login bulkpm bulkpm |
| 69 | ${epoch}= Get Current Date result_format=epoch |
Krzysztof Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 70 | Set Global Variable ${epoch} |
| 71 | Put File ${ftp_file_path} upload/A${epoch}.xml.gz |
| 72 | [Return] ${epoch} |
Katarzyna Wasiel | 7ebd4b3 | 2020-12-02 13:39:45 +0100 | [diff] [blame] | 73 | |
| 74 | Check Given Print In DFC Log |
Krzysztof Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 75 | [Arguments] ${CHECK_DFC_LOGS} |
Katarzyna Wasiel | 7ebd4b3 | 2020-12-02 13:39:45 +0100 | [diff] [blame] | 76 | ${dfc_logs}= Run Given Command On DFC Container ${CHECK_DFC_LOGS} |
| 77 | Should Contain ${dfc_logs} HostKey has been changed |
| 78 | |
| 79 | Run 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 | |
| 91 | Check 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 Kuzmicki | c8617d4 | 2021-01-19 10:34:03 +0000 | [diff] [blame^] | 97 | ${output} = Should Not Be Empty ${string_matches} |
Katarzyna Wasiel | 7ebd4b3 | 2020-12-02 13:39:45 +0100 | [diff] [blame] | 98 | [Return] ${output} |