projects
/
osm
/
vim-emu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: I somehow messed up some commits by clicking the "revert" button on the github...
[osm/vim-emu.git]
/
src
/
emuvim
/
dcemulator
/
net.py
diff --git
a/src/emuvim/dcemulator/net.py
b/src/emuvim/dcemulator/net.py
index
d6bb5bb
..
110256e
100755
(executable)
--- a/
src/emuvim/dcemulator/net.py
+++ b/
src/emuvim/dcemulator/net.py
@@
-18,7
+18,6
@@
from emuvim.dcemulator.monitoring import DCNetworkMonitor
from emuvim.dcemulator.node import Datacenter, EmulatorCompute
from emuvim.dcemulator.resourcemodel import ResourceModelRegistrar
from emuvim.dcemulator.node import Datacenter, EmulatorCompute
from emuvim.dcemulator.resourcemodel import ResourceModelRegistrar
-
class DCNetwork(Dockernet):
"""
Wraps the original Mininet/Dockernet class and provides
class DCNetwork(Dockernet):
"""
Wraps the original Mininet/Dockernet class and provides
@@
-27,7
+26,7
@@
class DCNetwork(Dockernet):
This class is used by topology definition scripts.
"""
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):
dc_emulation_max_cpu=1.0, # fraction of overall CPU time for emulation
dc_emulation_max_mem=512, # emulation max mem in MB
**kwargs):
@@
-56,7
+55,10
@@
class DCNetwork(Dockernet):
self.DCNetwork_graph = nx.MultiDiGraph()
# monitoring agent
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(
# initialize resource model registrar
self.rm_registrar = ResourceModelRegistrar(
@@
-176,10
+178,18
@@
class DCNetwork(Dockernet):
Dockernet.start(self)
def stop(self):
Dockernet.start(self)
def stop(self):
- # stop Ryu controller
+
+ # stop the monitor agent
+ if self.monitor_agent is not None:
+ self.monitor_agent.stop()
+
+ # stop emulator net
Dockernet.stop(self)
Dockernet.stop(self)
+
+ # stop Ryu controller
self.stopRyu()
self.stopRyu()
+
def CLI(self):
CLI(self)
def CLI(self):
CLI(self)
@@
-308,9
+318,9
@@
class DCNetwork(Dockernet):
ryu_of_port = '6653'
ryu_cmd = 'ryu-manager'
FNULL = open("/tmp/ryu.log", 'w')
ryu_of_port = '6653'
ryu_cmd = 'ryu-manager'
FNULL = open("/tmp/ryu.log", 'w')
-
#
self.ryu_process = Popen([ryu_cmd, ryu_path, ryu_path2, ryu_option, ryu_of_port], stdout=FNULL, stderr=FNULL)
+ self.ryu_process = Popen([ryu_cmd, ryu_path, ryu_path2, ryu_option, ryu_of_port], stdout=FNULL, stderr=FNULL)
# no learning switch
# no learning switch
- self.ryu_process = Popen([ryu_cmd, ryu_path2, ryu_option, ryu_of_port], stdout=FNULL, stderr=FNULL)
+
#
self.ryu_process = Popen([ryu_cmd, ryu_path2, ryu_option, ryu_of_port], stdout=FNULL, stderr=FNULL)
time.sleep(1)
def stopRyu(self):
time.sleep(1)
def stopRyu(self):