summaryrefslogtreecommitdiffstats
path: root/test/csit/tests/dcaegen2
diff options
context:
space:
mode:
authorMariusz Wagner <mariusz.wagner@nokia.com>2018-07-12 08:36:13 +0200
committerMariusz Wagner <mariusz.wagner@nokia.com>2018-07-12 08:36:13 +0200
commit5f108de9ac6441f3465d39a6f7a5427f2363007b (patch)
tree856927060fae71d2f34625ad8f2424928997e192 /test/csit/tests/dcaegen2
parent820deb2b813c74cac5fbc3da3b1c72ad393b96aa (diff)
Refactor and added TC
- code refactor - added border tests Issue-ID: INT-510 Change-Id: I8d46508741c47983fd55fe5bf3f0dd9f716a8c81 Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
Diffstat (limited to 'test/csit/tests/dcaegen2')
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot111
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py21
-rw-r--r--test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot50
3 files changed, 114 insertions, 68 deletions
diff --git a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
index 1cfc2da71..52fe8557d 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
+++ b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot
@@ -1,76 +1,51 @@
*** Settings ***
-Library RequestsLibrary
+Documentation Integration tests for PRH.
+... PRH receive events from DMaaP and produce or not PNF_READY notification depends on required fields in received event.
+Suite Setup Run keywords Create headers
+... Create sessions
Library resources/PrhLibrary.py
+Resource resources/prh_library.robot
*** Variables ***
-${DMAAP_SIM_URL} http://${DMAAP_SIMULATOR}
-${AAI_SIM_URL} http://${AAI_SIMULATOR}
+${DMAAP_SIMULATOR_URL} http://${DMAAP_SIMULATOR}
+${AAI_SIMULATOR_URL} http://${AAI_SIMULATOR}
${PRH_URL} http://${PRH}
+${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+${Not_json_format} ""
*** Test Cases ***
-Getting and Consuming Positive Scenario
- [Documentation] Get message from new topic and consume it - positive scenarios
- [Tags] PRH
- [Template] Run Getting and Consuming
- {"pnf-name":"NOKQTFCOC540002E","ipaddress-v4-oam":"10.16.123.234","ipaddress-v6-oam":"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}}}
- {"pnf-name":"NOKQTFCOC540002F","ipaddress-v4-oam":"","ipaddress-v6-oam":"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}}}
- {"pnf-name":"NOKQTFCOC540002G","ipaddress-v4-oam":"10.16.123.234","ipaddress-v6-oam":""} 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}}}
- {"pnf-name":"ERIQTFCOC5400000","ipaddress-v4-oam":"10.16.123.23","ipaddress-v6-oam":""} 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}}}
-
-Missing IPv4 and IPv6
- [Documentation] Test get event from DMaaP without IPv4 and IPv6
- [Tags] PRH no_IPv4 no_IPv6
- 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}}}
-
-Wrong AAI record
- [Documentation] Wrong or missing record in AAI
- [Tags] PRH AAI
- 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}}}
-
-*** Keywords ***
-Wrong AAI record
- [Arguments] ${event_in_dmaap}
+Valid DMaaP event can be converted to PNF_READY notification
+ [Documentation] PRH get valid event from DMaaP with required fields - PRH produce PNF_READY notification
+ [Tags] PRH Valid event
+ [Template] Valid event processing
+ ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002G", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002F", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"Ericsson", "pnfSerialNumber":"QTFCOC5400000", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85b3:0000:0000:8a2e:0370:7334"}}}
+
+Invalid DMaaP event cannot be converted to PNF_READY notification
+ [Documentation] PRH get invalid event from DMaaP with missing required fields - PRH does not produce PNF_READY notification
+ [Tags] PRH Invalid event
+ [Template] Invalid event processing
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"Nokia", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"QTFCOC540002E", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"10.16.123.234", "pnfOamIpv6Address":""}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}}
+ {"event": {"otherFields": {"pnfVendorName":"", "pnfSerialNumber":"", "pnfOamIpv4Address":"", "pnfOamIpv6Address":""}}}
+ ${Not_json_format}
+
+Get valid event from DMaaP and record in AAI does not exist
+ [Documentation] PRH get valid event from DMaaP with all required fields and in AAI record doesn't exist - PRH does not produce PNF_READY notification
+ [Tags] PRH Missing AAI record
[Timeout] 30s
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- Set get event in DMAAP ${event_in_dmaap} ${headers}
- Set pnfs name in AAI wrong_aai_record
- ${check}= check for log org.onap.dcaegen2.services.prh.exceptions.AAINotFoundException: Incorrect response code for continuation of tasks workflow
- Should Be Equal As Strings ${check} True
-
-Missing IP
- [Arguments] ${event_in_dmaap}
- [Timeout] 30s
- ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
- Set get event in DMAAP ${event_in_dmaap} ${headers}
- ${check}= check for log org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: IPV4 and IPV6 are empty
- Should Be Equal As Strings ${check} True
-
-Run Getting and Consuming
- [Arguments] ${posted_event_to_dmaap} ${pnfs_name} ${event_in_dmaap}
- [Timeout] 1m
- ${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}
-
-Set pnfs name in AAI
- [Arguments] ${pnfs_name}
- [Timeout] 1m
- ${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] 1m
- 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}
+ Set pnf name in AAI wrong_aai_record
+ Set event in DMAAP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS}
+ Wait Until Keyword Succeeds 100x 100ms Check PRH log WARN 1 --- [pool-2-thread-1] o.o.d.s.prh.service.AAIProducerClient \ \ \ : Exception while executing http client:
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index aaae72a0f..e12816a2e 100644
--- a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
@@ -1,5 +1,8 @@
+import json
+
import docker
+
class PrhLibrary(object):
def __init__(self):
@@ -13,3 +16,21 @@ class PrhLibrary(object):
return True
else:
return False
+
+ def create_pnf_ready_notification(self, json_file):
+ jsonToPython = json.loads(json_file)
+ ipv4 = jsonToPython["event"]["otherFields"]["pnfOamIpv4Address"]
+ ipv6 = jsonToPython["event"]["otherFields"]["pnfOamIpv6Address"]
+ pnfName = _create_pnf_name(json_file)
+ strJson = '{"pnf-name":"' + pnfName + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 +'"}'
+ pythonToJson = json.dumps(strJson)
+ return pythonToJson.replace("\\", "")[1:-1]
+
+ def create_pnf_name(self, json_file):
+ return _create_pnf_name(json_file)
+
+def _create_pnf_name(json_file):
+ jsonToPython = json.loads(json_file)
+ vendor = jsonToPython["event"]["otherFields"]["pnfVendorName"]
+ serialNumber = jsonToPython["event"]["otherFields"]["pnfSerialNumber"]
+ return vendor[:3].upper() + serialNumber
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot
new file mode 100644
index 000000000..8a6046d9d
--- /dev/null
+++ b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -0,0 +1,50 @@
+*** Settings ***
+Library RequestsLibrary
+Library Collections
+
+*** Keywords ***
+Create headers
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ Set Global Variable ${global_headers} ${headers}
+
+Create sessions
+ Create Session dmaap_session ${DMAAP_SIMULATOR_URL}
+ Set Global Variable ${global_dmaap_session} dmaap_session
+ Create Session aai_session ${AAI_SIMULATOR_URL}
+ Set Global Variable ${global_aai_session} aai_session
+
+Invalid event processing
+ [Arguments] ${input_invalid_event_in_dmaap}
+ [Timeout] 30s
+ Set event in DMAAP ${input_invalid_event_in_dmaap}
+ Wait Until Keyword Succeeds 100x 100ms Check PRH log INFO 1 --- [pool-2-thread-1] o.o.d.s.prh.tasks.DmaapConsumerTaskImpl \ : Consumed model from DmaaP: ${input_invalid_event_in_dmaap}
+
+Valid event processing
+ [Arguments] ${input_valid_event_in_dmaap}
+ [Timeout] 30s
+ ${posted_event_to_dmaap}= Create pnf ready notification ${input_valid_event_in_dmaap}
+ ${pnf_name}= Create pnf name ${input_valid_event_in_dmaap}
+ Set pnf name in AAI ${pnf_name}
+ Set event in DMAAP ${input_valid_event_in_dmaap}
+ Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${posted_event_to_dmaap}
+
+Check PRH log
+ [Arguments] ${searched_log}
+ ${status}= Check for log ${searched_log}
+ Should Be Equal As Strings ${status} True
+
+Check PNF_READY notification
+ [Arguments] ${posted_event_to_dmaap}
+ ${resp}= Get Request ${global_dmaap_session} /events/pnfReady headers=${global_headers}
+ Should Be Equal ${resp.text} ${posted_event_to_dmaap}
+
+Set pnf name in AAI
+ [Arguments] ${pnfs_name}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=text/html
+ ${resp}= Put Request ${global_aai_session} /set_pnfs headers=${headers} data=${pnfs_name}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Set event in DMAAP
+ [Arguments] ${event_in_dmaap}
+ ${resp}= Put Request ${global_dmaap_session} /set_get_event headers=${global_headers} data=${event_in_dmaap}
+ Should Be Equal As Strings ${resp.status_code} 200