aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dcaegen2/prh-testcases/resources/simulator
diff options
context:
space:
mode:
authorMarcin Migdal <marcin.migdal@nokia.com>2019-04-04 11:13:09 +0200
committerMarcin Migdal <marcin.migdal@nokia.com>2019-04-04 16:33:26 +0200
commitd70b3bd459ddd60d01113ef1504961446f7ac0b2 (patch)
tree9ea1fd31fd322b95337beeacdfb2f0a06123cd76 /tests/dcaegen2/prh-testcases/resources/simulator
parente23e0472ef7d0766bab1e5d3e7b856f50ccc9f17 (diff)
Attempt to fix CSIT
Arm SIMs in logs Change-Id: I6242fb65f6fc8ca373d5862aed8fa55457f443ee Issue-ID: INT-989 Signed-off-by: Marcin Migdal <marcin.migdal@nokia.com>
Diffstat (limited to 'tests/dcaegen2/prh-testcases/resources/simulator')
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/AAI.py27
-rw-r--r--tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py17
2 files changed, 42 insertions, 2 deletions
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
index bacd1065..91a93de5 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py
@@ -1,26 +1,46 @@
+import logging
+import sys
import re
import time
from http.server import BaseHTTPRequestHandler
import httpServerLib
-pnfs = 'Empty'
+ch = logging.StreamHandler(sys.stdout)
+handlers = [ch]
+logging.basicConfig(
+ level=logging.DEBUG,
+ format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s',
+ handlers=handlers
+)
+
+logger = logging.getLogger('AAI-simulator-logger')
+pnfs = 'Empty'
+pnf_entry = 'Empty'
class AAISetup(BaseHTTPRequestHandler):
def do_PUT(self):
- if re.search('/set_pnfs', self.path):
+ logger.info('AAI SIM Setup Put execution')
+ if re.search('/set_pnf', self.path):
global pnfs
content_length = int(self.headers['Content-Length'])
pnfs = self.rfile.read(content_length)
+ logger.info('Execution status 200')
+ httpServerLib.header_200_and_json(self)
+
+ if re.search('/set_pnf_entry',self.path):
+ logger.info('Execution status 200')
httpServerLib.header_200_and_json(self)
return
def do_POST(self):
+ logger.info('AAI SIM Setup Post execution')
if re.search('/reset', self.path):
global pnfs
pnfs = 'Empty'
+ logger.info('Execution status 200')
httpServerLib.header_200_and_json(self)
return
@@ -29,12 +49,15 @@ class AAISetup(BaseHTTPRequestHandler):
class AAIHandler(BaseHTTPRequestHandler):
def do_PATCH(self):
+ logger.info('AAI SIM Patch execution')
pnfs_name = '/aai/v12/network/pnfs/pnf/' + pnfs.decode()
if re.search('wrong_aai_record', self.path):
self.send_response(400)
+ logger.info('Execution status 400')
self.end_headers()
elif re.search(pnfs_name, self.path):
self.send_response(200)
+ logger.info('Execution status 200')
self.end_headers()
return
diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
index 392c460d..da113e68 100644
--- a/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
+++ b/tests/dcaegen2/prh-testcases/resources/simulator/DMaaP.py
@@ -1,8 +1,20 @@
+import logging
import re
+import sys
import time
from http.server import BaseHTTPRequestHandler
import httpServerLib
+ch = logging.StreamHandler(sys.stdout)
+handlers = [ch]
+logging.basicConfig(
+ level=logging.DEBUG,
+ format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s',
+ handlers=handlers
+)
+
+logger = logging.getLogger('DMaaP-simulator-logger')
+
posted_event_from_prh = b'Empty'
received_event_to_get_method = b'Empty'
@@ -10,6 +22,7 @@ received_event_to_get_method = b'Empty'
class DmaapSetup(BaseHTTPRequestHandler):
def do_PUT(self):
+ logger.info('DMaaP SIM Setup Put execution')
if re.search('/set_get_event', self.path):
global received_event_to_get_method
content_length = int(self.headers['Content-Length'])
@@ -19,6 +32,7 @@ class DmaapSetup(BaseHTTPRequestHandler):
return
def do_GET(self):
+ logger.info('DMaaP SIM Setup Get execution')
if re.search('/events/pnfReady', self.path):
httpServerLib.header_200_and_json(self)
self.wfile.write(posted_event_from_prh)
@@ -26,6 +40,7 @@ class DmaapSetup(BaseHTTPRequestHandler):
return
def do_POST(self):
+ logger.info('DMaaP SIM Setup Post execution')
if re.search('/reset', self.path):
global posted_event_from_prh
global received_event_to_get_method
@@ -39,6 +54,7 @@ class DmaapSetup(BaseHTTPRequestHandler):
class DMaaPHandler(BaseHTTPRequestHandler):
def do_POST(self):
+ logger.info('DMaaP SIM Post execution')
if re.search('/events/unauthenticated.PNF_READY', self.path):
global posted_event_from_prh
content_length = int(self.headers['Content-Length'])
@@ -48,6 +64,7 @@ class DMaaPHandler(BaseHTTPRequestHandler):
return
def do_GET(self):
+ logger.info('DMaaP SIM Get execution')
if re.search('/events/unauthenticated.VES_PNFREG_OUTPUT/OpenDcae-c12/c12', self.path):
httpServerLib.header_200_and_json(self)
self.wfile.write(received_event_to_get_method)