diff options
author | kurczews <krzysztof.kurczewski@nokia.com> | 2019-04-18 14:56:41 +0200 |
---|---|---|
committer | kurczews <krzysztof.kurczewski@nokia.com> | 2019-04-26 13:49:12 +0200 |
commit | cd057060c750914f9a1ca3578edc9f0223c73bd9 (patch) | |
tree | 6f266528ec132cf5406fb3fe6a3610759d600a22 /tests/dcaegen2/prh-testcases/resources | |
parent | 5f6b56855f325efb70212b3949d844f3a5c2856b (diff) |
PRH BBS tests - part 2
Issue-ID: INT-989
Change-Id: Ifa55723579d763e4bede7dbc373c7605dccb9b0e
Signed-off-by: kurczews <krzysztof.kurczewski@nokia.com>
Diffstat (limited to 'tests/dcaegen2/prh-testcases/resources')
5 files changed, 74 insertions, 24 deletions
diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index 597f8647..f6439be3 100644 --- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -10,7 +10,8 @@ class PrhLibrary(object): pass @staticmethod - def check_for_log(search_for): + def find_log_entry(search_for): + print (type(search_for)) client = docker.from_env() container = client.containers.get('prh') print ("Check for log searches for pattern: ", search_for ) @@ -126,4 +127,4 @@ class PrhLibrary(object): @staticmethod def is_in_status(client, name, status): - return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1 + return len(client.containers.list(all=True, filters={"name": "^/"+name+"$", "status": status})) == 1
\ No newline at end of file diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index cfe1d993..36b1a1c5 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -16,7 +16,7 @@ Create sessions Set Suite Variable ${aai_setup_session} aai_setup_session Create Session consul_setup_session ${CONSUL_SETUP_URL} Set Suite Variable ${consul_setup_session} consul_setup_session - Sleep 60s + Sleep 10s Reset Simulators Reset AAI simulator @@ -33,7 +33,7 @@ Valid event processing Set PNF name in AAI ${pnf_name} Set PNF content in AAI ${aai_entry_to_be_set} ${expected_event_pnf_ready_in_dpaap}= create pnf ready_notification as pnf ready ${data} - Wait Until Keyword Succeeds 10x 3000ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap} + Wait Until Keyword Succeeds 30x 3000ms Check PNF_READY notification ${expected_event_pnf_ready_in_dpaap} Invalid event processing [Arguments] ${input_invalid_event_in_dmaap} @@ -46,12 +46,12 @@ Invalid event processing Check PRH log [Arguments] ${searched_log} - ${status}= Check for log ${searched_log} + ${status}= Find log entry ${searched_log} Should Be Equal As Strings ${status} True Check PNF_READY notification [Arguments] ${expected_event_pnf_ready_in_dpaap} - ${resp}= Get Request ${dmaap_setup_session} /setup/get_pnf_ready headers=${suite_headers} + ${resp}= Get Request ${dmaap_setup_session} /setup/pnf_ready headers=${suite_headers} Should Be Equal ${resp.text} ${expected_event_pnf_ready_in_dpaap} Set PNF name in AAI @@ -74,7 +74,7 @@ Set PNF content in AAI Set event in DMaaP [Arguments] ${event_in_dmaap} - ${resp}= Put Request ${dmaap_setup_session} /setup/set_ves_event headers=${suite_headers} data=${event_in_dmaap} + ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${event_in_dmaap} Should Be Equal As Strings ${resp.status_code} 200 Reset AAI simulator @@ -89,4 +89,4 @@ Reset DMaaP simulator Check CBS ready ${resp}= Get Request ${consul_setup_session} /v1/catalog/service/cbs Should Be Equal As Strings ${resp.status_code} 200 - Log CBS ${resp.content}
\ No newline at end of file + Log CBS ${resp.content} diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library2.robot b/tests/dcaegen2/prh-testcases/resources/prh_library2.robot index 99939a06..ecc92f25 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library2.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library2.robot @@ -1,21 +1,57 @@ *** Settings *** Library RequestsLibrary -Library Collections +Library PrhLibrary.py Resource ../../../common.robot *** Keywords *** -VES event with additional fields +Verify PNF ready sent [Arguments] ${test_case_directory} ${pnf_entry}= Get Data From File ${test_case_directory}/aai-entry.json ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json ${expected_pnf_ready_event}= Get Data From File ${test_case_directory}/expected-pnf-ready-event.json - ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json Add PNF entry in AAI ${pnf_entry} Set VES event in DMaaP ${ves_event} Wait Until Keyword Succeeds 10x 3000ms Check CBS ready Wait Until Keyword Succeeds 10x 3000ms Check recorded PNF_READY notification ${expected_pnf_ready_event} + +Verify PNF ready sent and logical link created + [Arguments] ${test_case_directory} + ${expected_logical_link}= Get Data From File ${test_case_directory}/expected-logical-link.json + Verify PNF ready sent ${test_case_directory} Check recorded Logical Link ${expected_logical_link} +Verify event with missing required field is logged + [Arguments] ${test_case_directory} + ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json + Set VES event in DMaaP ${invalid_ves_event} + ${error_msg}= Create event parsing error ${invalid_ves_event} + Wait Until Keyword Succeeds 10x 3000ms Check PRH log ${error_msg} + +Verify incorrect JSON event is logged + [Timeout] 60s + [Arguments] ${test_case_directory} + ${invalid_ves_event}= Get Data From File ${test_case_directory}/invalid-ves-event.json + Set VES event in DMaaP ${invalid_ves_event} + # TODO hangs build + #Wait Until Keyword Succeeds 10x 3000ms Check PRH log |java.lang.IllegalStateException: Not a JSON Array: + +Verify missing AAI record is logged + [Arguments] ${test_case_directory} + ${incorrect_aai_entry}= Get Data From File ${test_case_directory}/incorrect-aai-entry.json + ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json + Add PNF entry in AAI ${incorrect_aai_entry} + Set VES event in DMaaP ${ves_event} + Wait Until Keyword Succeeds 10x 3000ms Check PRH log |AAIProducerTask exception has been registered + Wait Until Keyword Succeeds 10x 3000ms Check PRH log |Chain of tasks have been aborted due to errors in PRH workflow + +Verify AAI not responding is logged + [Arguments] ${test_case_directory} + ${ves_event}= Get Data From File ${test_case_directory}/ves-event.json + Ensure Container Is Exited aai_simulator + Set VES event in DMaaP ${ves_event} + Wait Until Keyword Succeeds 10x 3000ms Check PRH log java.net.UnknownHostException: aai + Ensure Container Is Running aai_simulator + Check CBS ready ${resp}= Get Request ${consul_setup_session} /v1/catalog/service/cbs Should Be Equal As Strings ${resp.status_code} 200 @@ -23,16 +59,27 @@ Check CBS ready Check recorded PNF_READY notification [Arguments] ${expected_event_pnf_ready_in_dpaap} - ${resp}= Get Request ${dmaap_setup_session} /setup/get_pnf_ready headers=${suite_headers} + ${resp}= Get Request ${dmaap_setup_session} /setup/pnf_ready headers=${suite_headers} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON ${resp.content} ${expected_event_pnf_ready_in_dpaap} Check recorded Logical Link [Arguments] ${expected_logical_link_in_aai} - ${resp}= Get Request ${aai_setup_session} /setup/get_created_logical_link headers=${suite_headers} + ${resp}= Get Request ${aai_setup_session} /setup/created_logical_link headers=${suite_headers} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai} +Check PRH log + [Arguments] ${log_entry} + ${found}= Find log entry ${log_entry} + Should Be True ${found} + +Create event parsing error + [Arguments] ${ves_event} + ${notification}= Create invalid notification ${ves_event} + ${error_msg}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${notification} + [Return] ${error_msg} + Add PNF entry in AAI [Arguments] ${pnf_entry} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json @@ -42,7 +89,7 @@ Add PNF entry in AAI Set VES event in DMaaP [Arguments] ${ves_event} - ${resp}= Put Request ${dmaap_setup_session} /setup/set_ves_event headers=${suite_headers} data=${ves_event} + ${resp}= Put Request ${dmaap_setup_session} /setup/ves_event headers=${suite_headers} data=${ves_event} Should Be Equal As Strings ${resp.status_code} 200 Should Be Equal As JSON @@ -71,4 +118,4 @@ Reset DMaaP simulator Create headers ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - Set Suite Variable ${suite_headers} ${headers}
\ No newline at end of file + Set Suite Variable ${suite_headers} ${headers} diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py index 55b2d1f6..4457ef15 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py @@ -27,12 +27,12 @@ class AAISetup(BaseHTTPRequestHandler): def do_GET(self): try: - if re.search('/setup/get_patched_pnf', self.path): + if re.search('/setup/patched_pnf', self.path): httpServerLib.set_response_200_ok(self, payload = patched_pnf) - logger.debug('AAISetup GET /setup/get_patched_pnf -> 200 OK') - elif re.search('/setup/get_created_logical_link', self.path): + logger.debug('AAISetup GET /setup/patched_pnf -> 200 OK') + elif re.search('/setup/created_logical_link', self.path): httpServerLib.set_response_200_ok(self, payload = created_logical_link) - logger.debug('AAISetup GET /setup/get_created_logical_link -> 200 OK') + logger.debug('AAISetup GET /setup/created_logical_link -> 200 OK') else: httpServerLib.set_response_404_not_found(self) logger.info('AAISetup GET ' + self.path + ' -> 404 Not found') @@ -129,7 +129,9 @@ class AAIHandler(BaseHTTPRequestHandler): created_logical_link = httpServerLib.get_payload(self) httpServerLib.set_response_200_ok(self) - logger.debug('AAIHandler PUT /aai/v12/network/logical-links/logical-link/' + created_logical_link + ' -> 200 OK') + + logical_link_name = basename(self.path) + logger.debug('AAIHandler PUT /aai/v12/network/logical-links/logical-link/' + logical_link_name + ' -> 200 OK') else: httpServerLib.set_response_404_not_found(self) logger.info('AAIHandler PUT ' + self.path + ' -> 404 Not found') diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py index b2716968..92985cb6 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py @@ -24,10 +24,10 @@ class DmaapSetup(BaseHTTPRequestHandler): def do_GET(self): try: - if re.search('/setup/get_pnf_ready', self.path): + if re.search('/setup/pnf_ready', self.path): global captured_prh_event httpServerLib.set_response_200_ok(self, payload = captured_prh_event) - logger.debug('DmaapSetup GET /setup/get_pnf_ready -> 200 OK') + logger.debug('DmaapSetup GET /setup/pnf_ready -> 200 OK') else: httpServerLib.set_response_404_not_found(self) logger.info('DmaapSetup GET ' + self.path + ' -> 404 Not found') @@ -37,11 +37,11 @@ class DmaapSetup(BaseHTTPRequestHandler): def do_PUT(self): try: - if re.search('/setup/set_ves_event', self.path): + if re.search('/setup/ves_event', self.path): global ves_event ves_event = httpServerLib.get_payload(self) httpServerLib.set_response_200_ok(self) - logger.debug('DmaapSetup PUT /setup/set_ves_event -> 200 OK') + logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK') else: httpServerLib.set_response_404_not_found(self) logger.info('DmaapSetup PUT ' + self.path + ' -> 404 Not found') |