Monitoring should be optional, not default to keep emulate footprint small.
[osm/vim-emu.git] / src / emuvim / dcemulator / net.py
index ede593a..110256e 100755 (executable)
@@ -26,7 +26,7 @@ class DCNetwork(Dockernet):
     This class is used by topology definition scripts.
     """
 
-    def __init__(self, controller=RemoteController,
+    def __init__(self, controller=RemoteController, monitor=False,
                  dc_emulation_max_cpu=1.0,  # fraction of overall CPU time for emulation
                  dc_emulation_max_mem=512,  # emulation max mem in MB
                  **kwargs):
@@ -55,7 +55,10 @@ class DCNetwork(Dockernet):
         self.DCNetwork_graph = nx.MultiDiGraph()
 
         # monitoring agent
-        self.monitor_agent = DCNetworkMonitor(self)
+        if monitor:
+            self.monitor_agent = DCNetworkMonitor(self)
+        else:
+            self.monitor_agent = None
 
         # initialize resource model registrar
         self.rm_registrar = ResourceModelRegistrar(
@@ -175,8 +178,10 @@ class DCNetwork(Dockernet):
         Dockernet.start(self)
 
     def stop(self):
+
         # stop the monitor agent
-        self.monitor_agent.stop()
+        if self.monitor_agent is not None:
+            self.monitor_agent.stop()
 
         # stop emulator net
         Dockernet.stop(self)