aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkurczews <krzysztof.kurczewski@nokia.com>2019-04-18 09:07:14 +0200
committerkurczews <krzysztof.kurczewski@nokia.com>2019-04-18 09:32:28 +0200
commitb66da2b3b8519866973badc4e19f1ae717e77d1f (patch)
tree200e1615cb9b2a7426b54708d1516a5b02d36fa2
parenta6795420765b4455dbc761bfc4a70ecb457693ad (diff)
PRH BBS tests
Issue-ID: INT-989 Change-Id: I2963a7b0df2ee16a8cf5bc3144510950a1fd7ad2 Signed-off-by: kurczews <krzysztof.kurczewski@nokia.com>
-rw-r--r--tests/dcaegen2/prh-testcases/assets/bbs_registration/aai-entry.json23
-rw-r--r--tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-logical-link.json11
-rw-r--r--tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-pnf-ready-event.json6
-rw-r--r--tests/dcaegen2/prh-testcases/assets/bbs_registration/ves-event.json40
-rw-r--r--tests/dcaegen2/prh-testcases/bbs_tests.robot27
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_library.robot6
-rw-r--r--tests/dcaegen2/prh-testcases/resources/prh_library2.robot74
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI.py8
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py8
9 files changed, 191 insertions, 12 deletions
diff --git a/tests/dcaegen2/prh-testcases/assets/bbs_registration/aai-entry.json b/tests/dcaegen2/prh-testcases/assets/bbs_registration/aai-entry.json
new file mode 100644
index 00000000..8787dc1b
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/bbs_registration/aai-entry.json
@@ -0,0 +1,23 @@
+{
+ "pnf-name": "NOK6061ZW9",
+ "pnf-name2": "example-pnf-name2-val-58071",
+ "pnf-name2-source": "example-pnf-name2-source-val-22408",
+ "pnf-id": "example-pnf-id-val-55834",
+ "equip-type": "example-equip-type-val-5497",
+ "equip-vendor": "example-equip-vendor-val-85730",
+ "equip-model": "example-equip-model-val-38526",
+ "management-option": "example-management-option-val-15776",
+ "ipaddress-v4-oam": "example-ipaddress-v4-oam-val-33556",
+ "sw-version": "example-sw-version-val-64239",
+ "in-maint": true,
+ "frame-id": "example-frame-id-val-76733",
+ "serial-number": "example-serial-number-val-79366",
+ "ipaddress-v4-loopback-0": "example-ipaddress-v4-loopback0-val-34781",
+ "ipaddress-v6-loopback-0": "example-ipaddress-v6-loopback0-val-29979",
+ "ipaddress-v4-aim": "example-ipaddress-v4-aim-val-53703",
+ "ipaddress-v6-aim": "example-ipaddress-v6-aim-val-93386",
+ "ipaddress-v6-oam": "example-ipaddress-v6-oam-val-92665",
+ "inv-status": "example-inv-status-val-8477",
+ "prov-status": "example-prov-status-val-68268",
+ "nf-role": "example-nf-role-val-68489"
+} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-logical-link.json b/tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-logical-link.json
new file mode 100644
index 00000000..c48c841c
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-logical-link.json
@@ -0,0 +1,11 @@
+{
+ "link-name": "bbs-link",
+ "link-type": "attachmentPoint",
+ "relationship-list": [
+ {
+ "relationship": {
+ "related-link": "/network/pnfs/pnf/NOK6061ZW9"
+ }
+ }
+ ]
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-pnf-ready-event.json b/tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-pnf-ready-event.json
new file mode 100644
index 00000000..9da0201c
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/bbs_registration/expected-pnf-ready-event.json
@@ -0,0 +1,6 @@
+{
+ "additionalFields": {
+ "attachmentPoint": "bbs-link"
+ },
+ "correlationId": "NOK6061ZW9"
+}
diff --git a/tests/dcaegen2/prh-testcases/assets/bbs_registration/ves-event.json b/tests/dcaegen2/prh-testcases/assets/bbs_registration/ves-event.json
new file mode 100644
index 00000000..c67d863e
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/assets/bbs_registration/ves-event.json
@@ -0,0 +1,40 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "startEpochMicrosec": 1540212137393,
+ "sourceId": "val13",
+ "eventId": "registration_40212137",
+ "nfcNamingCode": "oam",
+ "internalHeaderFields": {
+ "collectorTimeStamp": "Mon, 10 22 2018 12:42:18 UTC"
+ },
+ "eventType": "pnfRegistration",
+ "priority": "Normal",
+ "version": "4.0.1",
+ "reportingEntityName": "NOK6061ZW9",
+ "sequence": 0,
+ "domain": "pnfRegistration",
+ "lastEpochMicrosec": 1540212137393,
+ "eventName": "pnfRegistration_Nokia_5gDu",
+ "vesEventListenerVersion": "7.0.1",
+ "sourceName": "NOK6061ZW9",
+ "nfNamingCode": "gNB"
+ },
+ "pnfRegistrationFields": {
+ "unitType": "val8",
+ "serialNumber": "6061ZW9",
+ "pnfRegistrationFieldsVersion": "2.0",
+ "manufactureDate": "1540212137393",
+ "modelNumber": "val6",
+ "lastServiceDate": "1540212137393",
+ "unitFamily": "BBU",
+ "vendorName": "Nokia",
+ "oamV4IpAddress": "val3",
+ "oamV6IpAddress": "val4",
+ "softwareVersion": "val7",
+ "additionalFields": {
+ "attachmentPoint": "bbs-link"
+ }
+ }
+ }
+}
diff --git a/tests/dcaegen2/prh-testcases/bbs_tests.robot b/tests/dcaegen2/prh-testcases/bbs_tests.robot
new file mode 100644
index 00000000..e9bc999a
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/bbs_tests.robot
@@ -0,0 +1,27 @@
+*** 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 Headers AND Create sessions AND Ensure Container Is Running prh AND Ensure Container Is Exited ssl_prh
+Suite Teardown Ensure Container Is Running ssl_prh
+Test Teardown Reset Simulators
+
+#Suite Setup Run keywords Create headers AND Create sessions AND Ensure Container Is Running prh AND Ensure Container Is Exited ssl_prh
+#Suite Teardown Run keywords Ensure Container Is Running ssl_prh AND Ensure Container Is Exited prh AND Reset Simulators
+#Test Teardown Reset Simulators
+Library resources/PrhLibrary.py
+Resource resources/prh_library2.robot
+Resource ../../common.robot
+
+*** Variables ***
+${TEST_CASE_DIR} %{WORKSPACE}/tests/dcaegen2/prh-testcases/assets
+
+${DMAAP_SIMULATOR_SETUP_URL} http://${DMAAP_SIMULATOR_SETUP}
+${AAI_SIMULATOR_SETUP_URL} http://${AAI_SIMULATOR_SETUP}
+${CONSUL_SETUP_URL} http://${CONSUL_SETUP}
+
+*** Test Cases ***
+
+Correct VES event with additional fields
+ [Tags] PRH
+ [Template] VES event with additional fields
+ ${TEST_CASE_DIR}/bbs_registration \ 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 29203ecd..cfe1d993 100644
--- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot
@@ -43,8 +43,6 @@ Invalid event processing
${invalid_notification}= Create invalid notification ${data}
${notification}= Catenate SEPARATOR= \\n |Incorrect json, consumerDmaapModel can not be created: ${invalid_notification}
Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification}
- #Wait Until Keyword Succeeds 100x 100ms Check PRH log ${notification}
-
Check PRH log
[Arguments] ${searched_log}
@@ -53,7 +51,7 @@ Check PRH log
Check PNF_READY notification
[Arguments] ${expected_event_pnf_ready_in_dpaap}
- ${resp}= Get Request ${dmaap_setup_session} /events/pnfReady headers=${suite_headers}
+ ${resp}= Get Request ${dmaap_setup_session} /setup/get_pnf_ready headers=${suite_headers}
Should Be Equal ${resp.text} ${expected_event_pnf_ready_in_dpaap}
Set PNF name in AAI
@@ -76,7 +74,7 @@ Set PNF content in AAI
Set event in DMaaP
[Arguments] ${event_in_dmaap}
- ${resp}= Put Request ${dmaap_setup_session} /set_get_event headers=${suite_headers} data=${event_in_dmaap}
+ ${resp}= Put Request ${dmaap_setup_session} /setup/set_ves_event headers=${suite_headers} data=${event_in_dmaap}
Should Be Equal As Strings ${resp.status_code} 200
Reset AAI simulator
diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library2.robot b/tests/dcaegen2/prh-testcases/resources/prh_library2.robot
new file mode 100644
index 00000000..99939a06
--- /dev/null
+++ b/tests/dcaegen2/prh-testcases/resources/prh_library2.robot
@@ -0,0 +1,74 @@
+*** Settings ***
+Library RequestsLibrary
+Library Collections
+Resource ../../../common.robot
+
+*** Keywords ***
+VES event with additional fields
+ [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}
+ Check recorded Logical Link ${expected_logical_link}
+
+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}
+
+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}
+ 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}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As JSON ${resp.content} ${expected_logical_link_in_aai}
+
+Add PNF entry in AAI
+ [Arguments] ${pnf_entry}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ Log AAI url ${AAI_SIMULATOR_SETUP_URL}
+ ${resp}= Put Request ${aai_setup_session} /setup/add_pnf_entry headers=${suite_headers} data=${pnf_entry}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Set VES event in DMaaP
+ [Arguments] ${ves_event}
+ ${resp}= Put Request ${dmaap_setup_session} /setup/set_ves_event headers=${suite_headers} data=${ves_event}
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Should Be Equal As JSON
+ [Arguments] ${given} ${expected}
+ Should Be True ${given}==${expected}
+
+Create sessions
+ Create Session dmaap_setup_session ${DMAAP_SIMULATOR_SETUP_URL}
+ Set Suite Variable ${dmaap_setup_session} dmaap_setup_session
+ Create Session aai_setup_session ${AAI_SIMULATOR_SETUP_URL}
+ 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
+
+Reset Simulators
+ Reset AAI simulator
+ Reset DMaaP simulator
+
+Reset AAI simulator
+ ${resp}= Post Request ${aai_setup_session} /reset
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Reset DMaaP simulator
+ ${resp}= Post Request ${dmaap_setup_session} /reset
+ Should Be Equal As Strings ${resp.status_code} 200
+
+Create headers
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ Set Suite Variable ${suite_headers} ${headers} \ No newline at end of file
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index 010c5231..55b2d1f6 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/patched_pnf', self.path):
+ if re.search('/setup/get_patched_pnf', self.path):
httpServerLib.set_response_200_ok(self, payload = patched_pnf)
- logger.debug('AAISetup GET /setup/patched_pnf -> 200 OK')
- elif re.search('/setup/created_logical_link', self.path):
+ logger.debug('AAISetup GET /setup/get_patched_pnf -> 200 OK')
+ elif re.search('/setup/get_created_logical_link', self.path):
httpServerLib.set_response_200_ok(self, payload = created_logical_link)
- logger.debug('AAISetup GET /setup/created_logical_link -> 200 OK')
+ logger.debug('AAISetup GET /setup/get_created_logical_link -> 200 OK')
else:
httpServerLib.set_response_404_not_found(self)
logger.info('AAISetup GET ' + 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 2d4fbd65..b2716968 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/pnf_ready', self.path) or re.search('events/pnfReady', self.path):
+ if re.search('/setup/get_pnf_ready', self.path):
global captured_prh_event
httpServerLib.set_response_200_ok(self, payload = captured_prh_event)
- logger.debug('DmaapSetup GET /setup/pnf_ready -> 200 OK')
+ logger.debug('DmaapSetup GET /setup/get_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/ves_event', self.path) or re.search('/set_get_event', self.path):
+ if re.search('/setup/set_ves_event', self.path):
global ves_event
ves_event = httpServerLib.get_payload(self)
httpServerLib.set_response_200_ok(self)
- logger.debug('DmaapSetup PUT /setup/ves_event -> 200 OK')
+ logger.debug('DmaapSetup PUT /setup/set_ves_event -> 200 OK')
else:
httpServerLib.set_response_404_not_found(self)
logger.info('DmaapSetup PUT ' + self.path + ' -> 404 Not found')