import logging
import site
+import time
from subprocess import Popen
import os
from mininet.net import Dockernet
-from mininet.node import Controller, OVSSwitch, OVSKernelSwitch, Switch, Docker, Host, RemoteController
+from mininet.node import Controller, DefaultController, OVSSwitch, OVSKernelSwitch, Docker, RemoteController
from mininet.cli import CLI
-from mininet.log import setLogLevel, info, debug
from mininet.link import TCLink
import networkx as nx
from emuvim.dcemulator.monitoring import DCNetworkMonitor
This class is used by topology definition scripts.
"""
- def __init__(self, dc_emulation_max_cpu=1.0, **kwargs):
+ def __init__(self, controller=RemoteController, dc_emulation_max_cpu=1.0, **kwargs):
"""
Create an extended version of a Dockernet network
:param dc_emulation_max_cpu: max. CPU time used by containers in data centers
# call original Docker.__init__ and setup default controller
Dockernet.__init__(
- self, controller=RemoteController, switch=OVSKernelSwitch, **kwargs)
+ self, switch=OVSKernelSwitch, **kwargs)
- # ass a remote controller to be able to use Ryu
- self.addController('c0', controller=RemoteController)
+ # start Ryu controller
+ self.startRyu()
+
+ # add a remote controller to be able to use Ryu
+ self.addController('c0', controller=controller)
# graph of the complete DC network
- self.DCNetwork_graph=nx.DiGraph()
+ self.DCNetwork_graph = nx.DiGraph()
# monitoring agent
self.monitor_agent = DCNetworkMonitor(self)
- # start Ryu controller
- self.startRyu()
-
# initialize resource model registrar
self.rm_registrar = ResourceModelRegistrar(dc_emulation_max_cpu)
ryu_option = '--ofp-tcp-listen-port'
ryu_of_port = '6653'
ryu_cmd = 'ryu-manager'
- FNULL = open(os.devnull, 'w')
- self.ryu_process = Popen([ryu_cmd, ryu_path, ryu_path2, ryu_option, ryu_of_port], stdout=FNULL, stderr=FNULL)
\ No newline at end of file
+ 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)
+ time.sleep(1)
\ No newline at end of file
# stop Mininet network
self.stopNet()
- @unittest.skip("disabled to test if CI fails because this is the first test.")
+ #@unittest.skip("disabled to test if CI fails because this is the first test.")
def testMultipleDatacenterDirect(self):
"""
Create a two data centers and interconnect them.
assert(len(self.getDockernetContainers()) == 0)
assert(len(self.net.hosts) == 2)
assert(len(self.net.switches) == 2)
- time.sleep(5)
# check connectivity by using ping
assert(self.net.ping([self.h[0], self.h[1]]) <= 0.0)
# stop Mininet network