import tools
from config import Config
-from plcapi import PLCAPI
-
+from plcapi import PLCAPI
+import random
savedargv = sys.argv[:]
def GetSlivers(plc):
data = plc.GetSlivers()
+ # net needs access to API for i2 nodes.
for module in modules:
- callback = getattr(module, 'GetSlivers')
- callback(data)
+ if module.__name__ == 'net':
+ module.GetSlivers(plc, data)
+ else:
+ callback = getattr(module, 'GetSlivers')
+ callback(data)
def run():
try:
print "Warning while writing PID file:", err
# Load and start modules
- for module in ['net', 'proper', 'conf_files', 'sm', 'bwmon']:
+ for module in ['net', 'proper', 'conf_files', 'sm']:
try:
m = __import__(module)
m.start(options, config)
while True:
try: GetSlivers(plc)
except: logger.log_exc()
- time.sleep(options.period)
+ time.sleep(options.period + random.randrange(0,301))
except: logger.log_exc()