aboutsummaryrefslogtreecommitdiffstats
path: root/tests/usecases-5G-bulkpm/5G-bulkpm/resources
diff options
context:
space:
mode:
Diffstat (limited to 'tests/usecases-5G-bulkpm/5G-bulkpm/resources')
-rw-r--r--tests/usecases-5G-bulkpm/5G-bulkpm/resources/JsonValidatorLibrary.py40
-rw-r--r--tests/usecases-5G-bulkpm/5G-bulkpm/resources/bulkpm_keywords.robot39
-rw-r--r--tests/usecases-5G-bulkpm/5G-bulkpm/resources/xNFLibrary.py30
3 files changed, 109 insertions, 0 deletions
diff --git a/tests/usecases-5G-bulkpm/5G-bulkpm/resources/JsonValidatorLibrary.py b/tests/usecases-5G-bulkpm/5G-bulkpm/resources/JsonValidatorLibrary.py
new file mode 100644
index 00000000..ed376ff2
--- /dev/null
+++ b/tests/usecases-5G-bulkpm/5G-bulkpm/resources/JsonValidatorLibrary.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+import logging
+
+from jsonschema import validate, ValidationError, SchemaError
+from simplejson import load
+
+
+class JsonValidatorLibrary(object):
+
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def validate(schema_path, json_path):
+ logging.info("Schema path: " + schema_path)
+ logging.info("JSON path: " + json_path)
+ schema = None
+ data = None
+ try:
+ schema = load(open(schema_path, 'r'))
+ data = load(open(json_path, 'r'))
+ except (IOError, ValueError, OSError) as e:
+ logging.error(e.message)
+ return 1
+
+ try:
+ validate(data, schema)
+ except (ValidationError, SchemaError) as e:
+ logging.error(e.message)
+ return 1
+
+ # logger.log("JSON validation successful")
+ print("JSON validation successful")
+ return 0
+
+
+if __name__ == '__main__':
+ lib = JsonValidatorLibrary()
+# sys.exit(JsonValidatorLibrary().validate(sys.argv[1], sys.argv[2]))
diff --git a/tests/usecases-5G-bulkpm/5G-bulkpm/resources/bulkpm_keywords.robot b/tests/usecases-5G-bulkpm/5G-bulkpm/resources/bulkpm_keywords.robot
new file mode 100644
index 00000000..9ef56c83
--- /dev/null
+++ b/tests/usecases-5G-bulkpm/5G-bulkpm/resources/bulkpm_keywords.robot
@@ -0,0 +1,39 @@
+ *** Settings ***
+Documentation The main interface for interacting with VES. It handles low level stuff like managing the http request library and VES required fields
+Library RequestsLibrary
+Library ../resources/xNFLibrary.py
+Library ../resources/JsonValidatorLibrary.py
+Library OperatingSystem
+Library Collections
+Library requests
+Library Collections
+Library String
+
+*** Variables ***
+
+*** Keywords ***
+
+Get Event Data From File
+ [Arguments] ${jsonfile}
+ ${data}= OperatingSystem.Get File ${jsonfile}
+ #Should Not Be_Equal ${data} None
+ [return] ${data}
+
+Publish Event To VES Collector
+ [Documentation] Send an event to VES Collector
+ [Arguments] ${url} ${evtpath} ${httpheaders} ${evtdata}
+ Log Creating session ${url}
+ ${session}= Create Session dcaegen2-d1 ${url}
+ ${resp}= Post Request dcaegen2-d1 ${evtpath} data=${evtdata} headers=${httpheaders}
+ #Log Received response from dcae ${resp.json()}
+ [return] ${resp}
+PostCall
+ [Arguments] ${url} ${data}
+ ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
+ ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
+ [Return] ${resp}
+
+GetCall
+ [Arguments] ${url}
+ ${resp}= Evaluate requests.get('${url}') requests
+ [Return] ${resp}
diff --git a/tests/usecases-5G-bulkpm/5G-bulkpm/resources/xNFLibrary.py b/tests/usecases-5G-bulkpm/5G-bulkpm/resources/xNFLibrary.py
new file mode 100644
index 00000000..b70d8095
--- /dev/null
+++ b/tests/usecases-5G-bulkpm/5G-bulkpm/resources/xNFLibrary.py
@@ -0,0 +1,30 @@
+'''
+Created on Aug 18, 2017
+
+@author: sw6830
+'''
+import time
+import uuid
+
+from robot.api import logger
+
+
+class xNFLibrary(object):
+
+ def __init__(self):
+ pass
+
+ @staticmethod
+ def create_header_from_string(dict_str):
+ logger.info("Enter create_header_from_string: dictStr")
+ return dict(u.split("=") for u in dict_str.split(","))
+
+ @staticmethod
+ def Generate_UUID(self):
+ """generate a uuid"""
+ return uuid.uuid4()
+
+
+if __name__ == '__main__':
+ lib = xNFLibrary()
+ time.sleep(100000)