aboutsummaryrefslogtreecommitdiffstats
path: root/test/csit/tests/dcaegen2/prh-testcases/resources
diff options
context:
space:
mode:
Diffstat (limited to 'test/csit/tests/dcaegen2/prh-testcases/resources')
-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
2 files changed, 71 insertions, 0 deletions
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