blob: e507dcba78389365cb0a8f3522d6b87340f09c19 [file] [log] [blame]
wejs060bc422018-05-25 13:58:11 +02001*** Settings ***
wejs060bc422018-05-25 13:58:11 +02002Library RequestsLibrary
Mariusz Wagnercfd26b92018-06-13 14:30:27 +02003Library Process
4Library resources/PrhLibrary.py
wejs060bc422018-05-25 13:58:11 +02005
6*** Variables ***
Mariusz Wagner4a6ece42018-06-05 15:54:27 +02007${DMAAP_SIM_URL} http://${DMAAP_SIMULATOR}
8${AAI_SIM_URL} http://${AAI_SIMULATOR}
9${PRH_URL} http://${PRH}
wejs060bc422018-05-25 13:58:11 +020010
11*** Test Cases ***
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020012Getting and Consuming Positive Scenario
13 [Documentation] Get message from new topic and consume it - positive scenarios
14 [Tags] PRH
15 [Setup] Start prh
16 [Template] Run Getting and Consuming
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020017 {"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}}}
18 {"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}}}
19 {"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}}}
20 {"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}}}
21 [Teardown] Stop prh
wejs060bc422018-05-25 13:58:11 +020022
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020023Missing IPv4 and IPv6
24 [Documentation] Test get event from DMaaP without IPv4 and IPv6
25 [Tags] PRH no_IPv4 no_IPv6
26 [Setup] Start prh
Mariusz Wagnera2a6c982018-06-14 15:53:56 +020027 Missing IP {"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":"", "pnfVendorName":"Nokia", "pnfModelNumber":"AJ02", "pnfFamily":"BBU", "pnfType":"AirScale", "otherFieldsVersion":1, "pnfOamIpv4Address":"", "pnfSoftwareVersion":"v4.5.0.1", "pnfSerialNumber":"QTFCOC540002E", "pnfManufactureDate":1516406400}}}
28 [Teardown] Stop prh
29
30Wrong AAI record
31 [Documentation] Wrong or missing record in AAI
32 [Tags] PRH AAI
33 [Setup] Start prh
34 Wrong AAI record {"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}}}
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020035 [Teardown] Stop prh
36
wejs060bc422018-05-25 13:58:11 +020037*** Keywords ***
Mariusz Wagnera2a6c982018-06-14 15:53:56 +020038Wrong AAI record
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020039 [Arguments] ${event_in_dmaap}
40 [Timeout] 1m
41 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
42 Set get event in DMAAP ${event_in_dmaap} ${headers}
Mariusz Wagnera2a6c982018-06-14 15:53:56 +020043 Set pnfs name in AAI wrong_aai_record
44 ${check}= check for log org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException: Incorrect response code for continuation of tasks workflow
45 Should Be Equal As Strings ${check} True
46
47Missing IP
48 [Arguments] ${event_in_dmaap}
49 [Timeout] 1m
50 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
51 Set get event in DMAAP ${event_in_dmaap} ${headers}
52 ${check}= check for log org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: IPV4 and IPV6 are empty
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020053 Should Be Equal As Strings ${check} True
54
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020055Run Getting and Consuming
56 [Arguments] ${posted_event_to_dmaap} ${pnfs_name} ${event_in_dmaap}
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020057 [Timeout] 1m
wejs060bc422018-05-25 13:58:11 +020058 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020059 Set pnfs name in AAI ${pnfs_name}
60 Set get event in DMAAP ${event_in_dmaap} ${headers}
61 : FOR ${Index} IN RANGE 1 30
62 \ Create Session prh_ready ${DMAAP_SIM_URL}
63 \ ${resp}= Get Request prh_ready /events/pnfReady headers=${headers}
64 \ Exit For Loop If '${resp.text}' == '${posted_event_to_dmaap}'
65 \ Sleep 1s
66 Should Be Equal ${resp.text} ${posted_event_to_dmaap}
wejs060bc422018-05-25 13:58:11 +020067
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020068Start prh
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020069 [Timeout] 1m
wejs060bc422018-05-25 13:58:11 +020070 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020071 Create Session prh_start ${PRH_URL}
72 ${resp}= Get Request prh_start /start headers=${headers}
73 Should Be Equal ${resp.text} "PRH Service has been started!"
74
75Stop prh
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020076 [Timeout] 1m
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020077 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
78 Create Session prh_stop ${PRH_URL}
79 ${resp}= Get Request prh_stop /stopPrh headers=${headers}
80 Should Be Equal ${resp.text} "PRH Service has already been stopped!"
81
82Set pnfs name in AAI
83 [Arguments] ${pnfs_name}
84 [Timeout] 1 minute
85 ${headers}= Create Dictionary Accept=application/json Content-Type=text/html
86 Create Session set_pnfs_in_aai ${AAI_SIM_URL}
87 ${resp}= Put Request set_pnfs_in_aai /set_pnfs headers=${headers} data=${pnfs_name}
88 Should Be Equal As Strings ${resp.status_code} 200
89 Log To Console ${resp.text}
90
91Set get event in DMAAP
92 [Arguments] ${event_in_dmaap} ${headers}
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020093 [Timeout] 1m
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020094 Create Session set_get_event ${DMAAP_SIM_URL}
95 ${resp}= Put Request set_get_event /set_get_event headers=${headers} data=${event_in_dmaap}
96 Should Be Equal As Strings ${resp.status_code} 200
97 Log To Console ${resp.text}