Files
wlan-lanforge-scripts/py-scripts/ws_generic_monitor_test.py
erinnerim 1d7578251c Updates to import statements:
- Import importlib, os, and sys to each python script.
 - Append "lanforge-scripts" root directory to the system path, allowing each script to be called from an antecedent directory. e.g.
if 'lanforge-scripts' not in sys.path:
    sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../../")))
 - All statements of the form 'from <module> import <class>' replace with:
<module> = importlib.import_module("lanforge-scripts.<directory>.<module>")
<class> = <module>.<class>
2021-09-15 16:17:16 -07:00

50 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""
This example is to demonstrate ws_generic_monitor to monitor events triggered by scripts,
This script when running, will monitor the events triggered by test_ipv4_connection.py
"""
import sys
import os
import importlib
import json
if 'lanforge-scripts' not in sys.path:
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../")))
ws_generic_monitor = importlib.import_module("lanforge-scripts.py-json.ws_generic_monitor")
WS_Listener = ws_generic_monitor.WS_Listener
realm = importlib.import_module("lanforge-scripts.py-json.realm")
Realm = realm.Realm
reference = "test_ipv4_connection.py"
class GenericMonitorTest(Realm):
def __init__(self,
ssid=None,
security=None,
password=None,
radio=None):
self.ssid=ssid
self.security=security
self.password=password
self.radio=radio
def start(self):
pass
def stop(self):
pass
def monitor(self):
pass
def main():
WS_Listener(lfclient_host="localhost", _scriptname=reference)#, _callback=TestRun)
if __name__ == "__main__":
main()