summaryrefslogtreecommitdiff
path: root/examples/py-schema-validation
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-04-08 20:33:25 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-04-09 00:18:35 +0200
commit0a7ad7a76ac34d7a0c7635591203de08979b60da (patch)
tree28b1afb918be5733b85501df4affbded3c4fe100 /examples/py-schema-validation
parente576162a43c78290961b0b6c8cd3e5cc2965316f (diff)
nDPId-test: added JSON distribution + JSON parsing (Multithreaded design re-using most of nDPId/nDPIsrvd core)
* improved Makefile.old install targets * splitted nDPIsrvd_parse into nDPIsrvd_parse_line and nDPIsrvd_parse_all for the sake of readability * minor Python script improvments (check for nDPIsrvd.py on multiple locations, may be superseeded by setuptools in the future) * some paths needs to be absolute (chdir() during daemonize) and therefor additional checks introduced * test run script checks and fails if certain files are are missing (PCAP file <=> result output file) * removed not very useful "internal format error" JSON serialization if a BUG for same exists * fixed invalid l4 type statistics counters for nDPIsrvd-collectd Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'examples/py-schema-validation')
-rwxr-xr-xexamples/py-schema-validation/py-schema-validation.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/py-schema-validation/py-schema-validation.py b/examples/py-schema-validation/py-schema-validation.py
index ca269e0c3..583612516 100755
--- a/examples/py-schema-validation/py-schema-validation.py
+++ b/examples/py-schema-validation/py-schema-validation.py
@@ -3,9 +3,14 @@
import os
import sys
-sys.path.append(os.path.dirname(sys.argv[0]) + '/../../dependencies')
-import nDPIsrvd
-from nDPIsrvd import nDPIsrvdSocket, TermColor
+sys.path.append(os.path.dirname(sys.argv[0]) + '/../usr/share/nDPId')
+try:
+ import nDPIsrvd
+ from nDPIsrvd import nDPIsrvdSocket, TermColor
+except ModuleNotFoundError:
+ sys.path.append(os.path.dirname(sys.argv[0]) + '/../../dependencies')
+ import nDPIsrvd
+ from nDPIsrvd import nDPIsrvdSocket, TermColor
class Stats:
lines_processed = 0