diff options
author | Mariusz Wagner <mariusz.wagner@nokia.com> | 2018-09-14 14:24:02 +0200 |
---|---|---|
committer | Mariusz Wagner <mariusz.wagner@nokia.com> | 2018-09-14 14:24:02 +0200 |
commit | 831baffde96cd7f644375a2e24f3c39fdd2b7616 (patch) | |
tree | 69d5a90cbac279c40afd4bffc928dffebda6f8eb /test/csit/tests/dcaegen2/prh-testcases | |
parent | 856c8b960d127d1a425c70070c92406f9239c831 (diff) |
Added keyword to common.robot
- add new keyword to read files in common.robot
- fix one keyword in common.robot
- used new keyword in PRH suite
- use new keyword in dcaegen2 suite
Issue-ID: INT-661
Change-Id: I36cd2d5b82a20938a7b0775c9792dc2364a21922
Signed-off-by: Mariusz Wagner <mariusz.wagner@nokia.com>
Diffstat (limited to 'test/csit/tests/dcaegen2/prh-testcases')
11 files changed, 134 insertions, 22 deletions
diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json new file mode 100644 index 000000000..2ffe356fc --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW2" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.17.123.234", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json new file mode 100644 index 000000000..c4a0e7271 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"ERI6061ZW3" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json new file mode 100644 index 000000000..16963e1bc --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.16.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json new file mode 100644 index 000000000..1e3afa9df --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW4" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json new file mode 100644 index 000000000..126987fd6 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.18.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json new file mode 100644 index 000000000..de1f576c8 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json new file mode 100644 index 000000000..4838f1b01 --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json new file mode 100644 index 000000000..04ab7cebd --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.17.163.234", + "oamV6IpAddress":"" + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json new file mode 100644 index 000000000..c87e188ff --- /dev/null +++ b/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.16.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", + } + } +} diff --git a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot index 5150a4b35..23d86663a 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot +++ b/test/csit/tests/dcaegen2/prh-testcases/prh_tests.robot @@ -1,17 +1,24 @@ *** Settings *** 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 header -... Create sessions +Suite Setup Run keywords Create header Create sessions Library resources/PrhLibrary.py Resource resources/prh_library.robot +Resource ../../common.robot *** Variables *** ${DMAAP_SIMULATOR_URL} http://${DMAAP_SIMULATOR} ${AAI_SIMULATOR_URL} http://${AAI_SIMULATOR} ${PRH_URL} http://${PRH} -${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW1"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.16.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"}}} -${Not_json_format} "" +${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json +${EVENT_WITH_IPV4} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json +${EVENT_WITH_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json +${EVENT_WITH_MISSING_IPV4_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json +${EVENT_WITH_MISSING_SOURCENAME} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json +${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json +${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json +${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json +${Not_json_format} %{WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json *** Test Cases *** Valid DMaaP event can be converted to PNF_READY notification @@ -19,37 +26,40 @@ Valid DMaaP event can be converted to PNF_READY notification [Tags] PRH Valid event [Template] Valid event processing ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} - {"event": {"commonEventHeader": {"sourceName":"NOK6061ZW2"}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.123.234", "oamV6IpAddress":""}}} - {"event": {"commonEventHeader": {"sourceName":"ERI6061ZW3"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334"}}} + ${EVENT_WITH_IPV4} + ${EVENT_WITH_IPV6} 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": {"commonEventHeader": {"sourceName":"NOK6061ZW4"}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.18.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334"}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"10.17.163.234", "oamV6IpAddress":""}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334"}}} - {"event": {"commonEventHeader": {"sourceName":""}, "pnfRegistrationFields": {"oamV4IpAddress":"", "oamV6IpAddress":""}}} + ${EVENT_WITH_MISSING_IPV4_AND_IPV6} + ${EVENT_WITH_MISSING_SOURCENAME} + ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV4} + ${EVENT_WITH_MISSING_SOURCENAME_AND_IPV6} + ${EVENT_WITH_MISSING_SOURCENAME_IPV4_AND_IPV6} 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 + ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} Set PNF name in AAI wrong_aai_record - Set event in DMaaP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log java.io.IOException: Connection closed prematurely Event in DMaaP is not JSON format [Documentation] PRH get not JSON format event from DMaaP - PRH does not produce PNF_READY notification [Tags] PRH - Set event in DMaaP ${Not_json_format} + ${data}= Get Data From File ${Not_json_format} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array: Get valid event from DMaaP and AAI is not responding [Documentation] PRH get valid event from DMaaP with all required fields and AAI is not responding - PRH does not produce PNF_READY notification [Tags] PRH AAI [Timeout] 180s + ${data}= Get Data From File ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} Stop AAI - Set event in DMaaP ${EVENT_WITH_ALL_VALID_REQUIRED_FIELDS} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PRH log java.net.UnknownHostException: aai diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot index b7e339bc9..73ce2a2c4 100644 --- a/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/test/csit/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -2,6 +2,7 @@ Library RequestsLibrary Library Collections Library PrhLibrary.py +Resource ../../../common.robot *** Keywords *** Create header @@ -17,18 +18,20 @@ Create sessions Invalid event processing [Arguments] ${input_invalid_event_in_dmaap} [Timeout] 30s - Set event in DMaaP ${input_invalid_event_in_dmaap} - ${invalid_notification}= Create invalid notification ${input_invalid_event_in_dmaap} - ${notification}= Catenate SEPARATOR= \\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} - Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} - + ${data}= Get Data From File ${input_invalid_event_in_dmaap} + Set event in DMaaP ${data} + ${invalid_notification}= Create invalid notification ${data} + ${notification}= Catenate SEPARATOR= \\n |org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException: Incorrect json, consumerDmaapModel can not be created: ${invalid_notification} + Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification} + 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} + ${data}= Get Data From File ${input_valid_event_in_dmaap} + ${posted_event_to_dmaap}= Create PNF_Ready notification ${data} + ${pnf_name}= Create PNF name ${data} Set PNF name in AAI ${pnf_name} - Set event in DMaaP ${input_valid_event_in_dmaap} + Set event in DMaaP ${data} Wait Until Keyword Succeeds 100x 300ms Check PNF_READY notification ${posted_event_to_dmaap} Check PRH log |