diff options
Diffstat (limited to 'test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot')
-rw-r--r-- | test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot | 91 |
1 files changed, 54 insertions, 37 deletions
diff --git a/test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot b/test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot index ec21b39fb..764a879a3 100644 --- a/test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot +++ b/test/csit/tests/dcaegen2/prh_testcases/prh_tests.robot @@ -1,48 +1,65 @@ *** Settings *** -Library OperatingSystem Library RequestsLibrary -Library requests -Library Collections -Library String *** Variables *** -${PNF_REGISTER_URL} http://${DMAAP_SIMULATOR}/events/unauthenticated.SEC_OTHER_OUTPUT -${PNF_READY_URL} http://${DMAAP_SIMULATOR}/events/pnfReady -${PRH_START_URL} http://${PRH}/start -${PNF_REGISTER_EVENT} %{WORKSPACE}/test/csit/tests/dcaegen2/prh_testcases/resources/events/pnf_register_event.json - +${DMAAP_SIM_URL} http://${DMAAP_SIMULATOR} +${AAI_SIM_URL} http://${AAI_SIMULATOR} +${PRH_URL} http://${PRH} *** Test Cases *** -Run Posting and Consuming - [Documentation] Post message to new topic and consume it - [Timeout] 1 minute - ${req_data}= Get Binary File ${PNF_REGISTER_EVENT} - ${resp}= PostCall ${PNF_REGISTER_URL} ${req_data} - log ${PNF_REGISTER_URL} - log ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - # ${count}= Evaluate $resp.json().get('count') - log 'JSON Response Code:' ${resp} - ${resp}= GetCall ${PRH_START_URL} - log ${PRH_START_URL} - log ${resp.text} - Should Be Equal As Strings ${resp.status_code} 201 - ${resp}= GetCall ${PNF_READY_URL} - log ${PNF_READY_URL} - log ${resp.text} - Should Be Equal As Strings ${resp.status_code} 200 - log 'JSON Response Code:' ${resp} - +Getting and Consuming Positive Scenario + [Documentation] Get message from new topic and consume it - positive scenarios + [Tags] PRH + [Setup] Start prh + [Template] Run Getting and Consuming + [Timeout] + {"pnfName":"NOKQTFCOC540002E","ipv4":"10.16.123.234","ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"} NOKQTFCOC540002E {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002E", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002E-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.234", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002E", "pnfManufactureDate":1516406400}}} + {"pnfName":"NOKQTFCOC540002F","ipv4":"","ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"} NOKQTFCOC540002F {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002F", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002F-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002F", "pnfManufactureDate":1516406400}}} + {"pnfName":"NOKQTFCOC540002G","ipv4":"10.16.123.234","ipv6":""} NOKQTFCOC540002G {"event": {"commonEventHeader": {"sourceId":"QTFCOC540002G", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC540002G-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.234", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002G", "pnfManufactureDate":1516406400}}} + {"pnfName":"ERIQTFCOC5400000","ipv4":"10.16.123.23","ipv6":""} ERIQTFCOC5400000 {"event": {"commonEventHeader": {"sourceId":"QTFCOC5400000", "startEpochMicrosec":1519837825682, "eventId":"QTFCOC5400000-reg", "nfcNamingCode":"5DU", "internalHeaderFields":{"collectorTimeStamp":"Fri, 04 27 2018 09:01:10 GMT"}, "eventType":"pnfRegistration", "priority":"Normal", "version":3, "reportingEntityName":"5GRAN_DU", "sequence":0, "domain":"other", "lastEpochMicrosec":1519837825682, "eventName":"pnfRegistration_5GDU", "sourceName":"5GRAN_DU", "nfNamingCode":"5GRAN"}, "otherFields": {"pnfLastServiceDate":1517206400, "pnfOamIpv6Address":"", "pnfVendorName":"Ericsson", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"10.16.123.23", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC5400000", "pnfManufactureDate":1516406400}}} + [Teardown] Stop prh *** Keywords *** -PostCall - [Arguments] ${url} ${data} +Run Getting and Consuming + [Arguments] ${posted_event_to_dmaap} ${pnfs_name} ${event_in_dmaap} + [Timeout] 1 minutes + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + Set pnfs name in AAI ${pnfs_name} + Set get event in DMAAP ${event_in_dmaap} ${headers} + : FOR ${Index} IN RANGE 1 30 + \ Create Session prh_ready ${DMAAP_SIM_URL} + \ ${resp}= Get Request prh_ready /events/pnfReady headers=${headers} + \ Exit For Loop If '${resp.text}' == '${posted_event_to_dmaap}' + \ Sleep 1s + Should Be Equal ${resp.text} ${posted_event_to_dmaap} + +Start prh + [Timeout] 1 minute ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests - [Return] ${resp} + Create Session prh_start ${PRH_URL} + ${resp}= Get Request prh_start /start headers=${headers} + Should Be Equal ${resp.text} "PRH Service has been started!" -GetCall - [Arguments] ${url} +Stop prh + [Timeout] 1 minute ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Evaluate requests.get('${url}', headers=${headers}, verify=False) requests - [Return] ${resp} + Create Session prh_stop ${PRH_URL} + ${resp}= Get Request prh_stop /stopPrh headers=${headers} + Should Be Equal ${resp.text} "PRH Service has already been stopped!" + +Set pnfs name in AAI + [Arguments] ${pnfs_name} + [Timeout] 1 minute + ${headers}= Create Dictionary Accept=application/json Content-Type=text/html + Create Session set_pnfs_in_aai ${AAI_SIM_URL} + ${resp}= Put Request set_pnfs_in_aai /set_pnfs headers=${headers} data=${pnfs_name} + Should Be Equal As Strings ${resp.status_code} 200 + Log To Console ${resp.text} + +Set get event in DMAAP + [Arguments] ${event_in_dmaap} ${headers} + [Timeout] 1 minute + Create Session set_get_event ${DMAAP_SIM_URL} + ${resp}= Put Request set_get_event /set_get_event headers=${headers} data=${event_in_dmaap} + Should Be Equal As Strings ${resp.status_code} 200 + Log To Console ${resp.text} |