rajendrajaiswal | 9b723a8 | 2019-11-25 12:18:51 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 5G Bulk PM Usecase functionality |
| 3 | |
| 4 | Library RequestsLibrary |
| 5 | Library OperatingSystem |
| 6 | Library Collections |
| 7 | Library String |
| 8 | Library DateTime |
| 9 | Library SSHLibrary |
| 10 | Library JSONLibrary |
| 11 | Library Process |
| 12 | Library ONAPLibrary.JSON |
| 13 | Library ONAPLibrary.Utilities |
| 14 | Resource ../resources/usecases/5gbulkpm_interface.robot |
| 15 | Resource ../resources/mr_interface.robot |
| 16 | Resource ../resources/dr_interface.robot |
| 17 | Suite Teardown Usecase Teardown |
| 18 | |
| 19 | *** Variables *** |
| 20 | ${INVENTORY_ENDPOINT} /dcae-service-types |
| 21 | ${DFC_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm//k8s-datafile.yaml |
| 22 | ${PMMAPPER_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm//k8s-pm-mapper.yaml |
| 23 | ${XNF_SFTP_BLUEPRINT_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/k8s-sftp.yaml |
| 24 | ${BLUEPRINT_TEMPLATE_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/blueprintTemplate.json |
| 25 | ${FTP_FILE_PATH} ${EXECDIR}/robot/assets/usecases/5gbulkpm/pmfiles/A20181002.0000-1000-0015-1000_5G.xml.gz |
| 26 | ${DEPLOYMENT_ENDPOINT} dcae-deployments |
| 27 | ${MR_TOPIC_CHECK_PATH} /topics |
| 28 | ${DR_SUB_CHECK_PATH} /internal/prov |
| 29 | ${MR_TOPIC_URL_PATH} /events/org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS/CG1/C1 |
| 30 | ${DMAAP_BC_MR_CLIENT_PATH} /webapi/mr_clients |
| 31 | ${DMAAP_BC_MR_CLUSTER_PATH} /webapi/mr_clusters |
| 32 | ${PMMAPPER_HEALTH_CHECK_PATH} /healthcheck |
| 33 | ${JSON_DATA_FILE} ${EXECDIR}/robot/assets/usecases/5gbulkpm/Notification.json |
| 34 | ${VES_LISTENER_PATH} /eventListener/v7 |
| 35 | ${PMMAPPER_SUB_ROLE_DATA} ${EXECDIR}/robot/assets/usecases/5gbulkpm/sub.json |
| 36 | ${PMMAPPER_MR_CLUSTER_DATA} ${EXECDIR}/robot/assets/usecases/5gbulkpm/mr_clusters.json |
| 37 | |
| 38 | *** Test Cases *** |
| 39 | |
| 40 | Deploying Data File Collector |
| 41 | [Tags] 5gbulkpm |
| 42 | ${blueprint}= OperatingSystem.Get File ${DFC_BLUEPRINT_PATH} |
| 43 | ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE_PATH} |
| 44 | ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint} |
| 45 | ${templatejson}= Update Value To Json ${templatejson} typeName datafile |
| 46 | ${json_data} Convert JSON To String ${templatejson} |
| 47 | ${headers}= Create Dictionary content-type=application/json |
| 48 | ${session}= Create Session dfc ${INVENTORY_SERVER} |
| 49 | ${resp}= Post Request dfc ${INVENTORY_ENDPOINT} data=${json_data} headers=${headers} |
| 50 | ${serviceTypeId-Dfc} Set Variable ${resp.json().get('typeId')} |
| 51 | Set Global Variable ${serviceTypeId-Dfc} |
| 52 | ${deployment_data}= Set Variable {"serviceTypeId": "${serviceTypeId-Dfc}"} |
| 53 | ${session}= Create Session deployment-dfc ${DEPLOYMENT_SERVER} |
| 54 | ${resp}= Put Request deployment-dfc /${DEPLOYMENT_ENDPOINT}/datafile data=${deployment_data} headers=${headers} |
| 55 | ${operationLink} Set Variable ${resp.json().get('links').get('status')} |
| 56 | ${operationId} Fetch From Right ${operationLink} / |
| 57 | Wait Until Keyword Succeeds 3 minute 20 sec Deployment Status ${DEPLOYMENT_SERVER} ${DEPLOYMENT_ENDPOINT} datafile ${operationId} |
| 58 | |
| 59 | Deploying 3GPP PM Mapper |
| 60 | [Tags] 5gbulkpm |
| 61 | ${clusterdata}= OperatingSystem.Get File ${PMMAPPER_MR_CLUSTER_DATA} |
| 62 | ${headers}= Create Dictionary content-type=application/json |
| 63 | ${session}= Create Session dmaapbc ${DMAAP_BC_SERVER} |
| 64 | ${resp}= Post Request dmaapbc ${DMAAP_BC_MR_CLUSTER_PATH} data=${clusterdata} headers=${headers} |
| 65 | ${blueprint}= OperatingSystem.Get File ${PMMAPPER_BLUEPRINT_PATH} |
| 66 | ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE_PATH} |
| 67 | ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint} |
| 68 | ${templatejson}= Update Value To Json ${templatejson} typeName pmmapper |
| 69 | ${json_data} Convert JSON To String ${templatejson} |
| 70 | ${session}= Create Session pmmapper ${INVENTORY_SERVER} |
| 71 | ${resp}= Post Request pmmapper ${INVENTORY_ENDPOINT} data=${json_data} headers=${headers} |
| 72 | ${serviceTypeId-Pmmapper} Set Variable ${resp.json().get('typeId')} |
| 73 | Set Global Variable ${serviceTypeId-Pmmapper} |
| 74 | ${deployment_data}= Set Variable {"inputs":{"client_password": "${GLOBAL_DCAE_PASSWORD}"},"serviceTypeId": "${serviceTypeId-Pmmapper}"} |
| 75 | ${session}= Create Session deployment-pmmapper ${DEPLOYMENT_SERVER} |
| 76 | ${resp}= Put Request deployment-pmmapper /${DEPLOYMENT_ENDPOINT}/pmmapper data=${deployment_data} headers=${headers} |
| 77 | ${operationLink} Set Variable ${resp.json().get('links').get('status')} |
| 78 | ${operationId} Fetch From Right ${operationLink} / |
| 79 | Wait Until Keyword Succeeds 2 minute 10 sec Deployment Status ${DEPLOYMENT_SERVER} ${DEPLOYMENT_ENDPOINT} pmmapper ${operationId} |
| 80 | |
| 81 | Deploying SFTP Server As xNF |
| 82 | [Tags] 5gbulkpm |
| 83 | ${blueprint}= OperatingSystem.Get File ${XNF_SFTP_BLUEPRINT_PATH} |
| 84 | ${templatejson}= Load JSON From File ${BLUEPRINT_TEMPLATE_PATH} |
| 85 | ${templatejson}= Update Value To Json ${templatejson} blueprintTemplate ${blueprint} |
| 86 | ${templatejson}= Update Value To Json ${templatejson} typeName sftpserver |
| 87 | ${json_data} Convert JSON To String ${templatejson} |
| 88 | ${headers}= Create Dictionary content-type=application/json |
| 89 | ${session}= Create Session sftp ${INVENTORY_SERVER} |
| 90 | ${resp}= Post Request sftp ${INVENTORY_ENDPOINT} data=${json_data} headers=${headers} |
| 91 | ${serviceTypeId-Sftp}= Set Variable ${resp.json().get('typeId')} |
| 92 | Set Global Variable ${serviceTypeId-Sftp} |
| 93 | ${deployment_data}= Set Variable {"serviceTypeId": "${serviceTypeId-Sftp}"} |
| 94 | ${session}= Create Session deployment-sftpserver ${DEPLOYMENT_SERVER} |
| 95 | ${resp}= Put Request deployment-sftpserver /${DEPLOYMENT_ENDPOINT}/sftpserver data=${deployment_data} headers=${headers} |
| 96 | ${operationLink}= Set Variable ${resp.json().get('links').get('status')} |
| 97 | ${operationId} Fetch From Right ${operationLink} / |
| 98 | Wait Until Keyword Succeeds 1 minute 5 sec Deployment Status ${DEPLOYMENT_SERVER} ${DEPLOYMENT_ENDPOINT} sftpserver ${operationId} |
| 99 | |
| 100 | |
| 101 | Checking PERFORMANCE_MEASUREMENTS Topic In Message Router |
| 102 | [Tags] 5gbulkpm |
| 103 | ${headers}= Create Dictionary content-type=application/json |
| 104 | ${subdata}= OperatingSystem.Get File ${PMMAPPER_SUB_ROLE_DATA} |
| 105 | ${session}= Create Session dmaapbc ${DMAAP_BC_SERVER} |
| 106 | ${resp}= Post Request dmaapbc ${DMAAP_BC_MR_CLIENT_PATH} data=${subdata} headers=${headers} |
| 107 | ${resp}= Run MR Get Request ${MR_TOPIC_CHECK_PATH} |
| 108 | Should Be Equal As Strings ${resp.status_code} 200 |
| 109 | ${topics}= Set Variable ${resp.json().get('topics')} |
| 110 | List Should Contain Value ${topics} org.onap.dmaap.mr.PERFORMANCE_MEASUREMENTS |
| 111 | ${resp}= Run MR Auth Get Request ${MR_TOPIC_URL_PATH} ${GLOBAL_DCAE_USERNAME} ${GLOBAL_DCAE_PASSWORD} |
| 112 | Should Be Equal As Strings ${resp.status_code} 200 |
| 113 | |
| 114 | Upload PM Files to xNF SFTP Server |
| 115 | [Tags] 5gbulkpm |
| 116 | Open Connection sftpserver |
| 117 | Login bulkpm bulkpm |
| 118 | ${epoch}= Get Current Date result_format=epoch |
| 119 | Set Global Variable ${epoch} |
| 120 | Put File ${FTP_FILE_PATH} upload/A${epoch}.xml.gz |
| 121 | |
| 122 | DR Bulk PM Feed Check |
| 123 | [Tags] 5gbulkpm |
| 124 | ${resp}= Run DR Get Request ${DR_SUB_CHECK_PATH} |
| 125 | Should Contain ${resp.text} bulk_pm_feed |
| 126 | |
| 127 | DR PM Mapper Subscriber Check |
| 128 | [Tags] 5gbulkpm |
| 129 | ${resp}= Run DR Get Request ${DR_SUB_CHECK_PATH} |
| 130 | Should Contain ${resp.text} https://dcae-pm-mapper:8443/delivery |
| 131 | |
| 132 | Sending File Ready Event to VES Collector |
| 133 | [Tags] 5gbulkpm |
| 134 | ${headers}= Create Dictionary content-type=application/json |
| 135 | ${fileready}= OperatingSystem.Get File ${JSON_DATA_FILE} |
| 136 | ${session}= Create Session ves ${VES_HEALTH_CHECK_PATH} |
| 137 | ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${fileready} headers=${headers} |
| 138 | Should Be Equal As Strings ${resp.status_code} 202 |
| 139 | ${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"}}]}}} |
| 140 | ${resp}= Post Request ves ${VES_LISTENER_PATH} data=${VES_FILE_READY_NOTIFICATION} headers=${headers} |
| 141 | Should Be Equal As Strings ${resp.status_code} 202 |
| 142 | |
| 143 | Verifying 3GPP Perf VES Content On PERFORMANCE_MEASUREMENTS Topic |
| 144 | [Tags] 5gbulkpm |
| 145 | Wait Until Keyword Succeeds 1 minute 5 sec xNF PM File Validate perf3gpp_RnNode-Ericsson_pmMeasResult |