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>
diff --git a/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/test/csit/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py
index aaae72a..e12816a 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 @@
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