From: stevenvanrossem Date: Fri, 15 Apr 2016 13:31:28 +0000 (+0200) Subject: add monitor as an option to start emulator X-Git-Tag: v3.1~148^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=60670da78ec2167314af21fa527cd3b58d173c4c;p=osm%2Fvim-emu.git add monitor as an option to start emulator --- diff --git a/src/emuvim/api/zerorpc/network.py b/src/emuvim/api/zerorpc/network.py index d4ca794..ac17e25 100644 --- a/src/emuvim/api/zerorpc/network.py +++ b/src/emuvim/api/zerorpc/network.py @@ -110,24 +110,3 @@ class DCNetworkApi(object): logging.exception("RPC error.") return ex.message - # setup the rate measurement for a vnf interface - def monitor_setup_rate_measurement(self, vnf_name, vnf_interface, metric): - logging.debug("RPC CALL: get rate") - try: - c = self.net.monitor_agent.setup_rate_measurement(vnf_name, vnf_interface, metric) - return c - except Exception as ex: - logging.exception("RPC error.") - return ex.message - - # get egress(default) or ingress rate of a vnf - def monitor_get_rate(self, vnf_name, vnf_interface, metric): - logging.debug("RPC CALL: get rate") - try: - c = self.net.monitor_agent.get_rate(vnf_name, vnf_interface, metric) - return c - except Exception as ex: - logging.exception("RPC error.") - return ex.message - - diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index ede593a..f237cb5 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -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=True, 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)