--- /dev/null
+import Pyro4
+
+
+def main():
+ # create connection to remote Mininet instance
+ rmn = Pyro4.Proxy("PYRONAME:remote.mininet")
+
+ # do some API tests
+ h1 = rmn.addHost('h1')
+ h2 = rmn.addHost('h2')
+ #d1 = rmn.addDocker('d1', ip='10.0.0.253', dimage="ubuntu")
+
+ s1 = rmn.addSwitch("s1")
+
+ rmn.addLink(h1, s1)
+ rmn.addLink(h2, s1)
+
+ rmn.start()
+
+ h3 = rmn.addHost('h3', ip='10.0.0.200')
+ rmn.addLink(h3, s1)
+
+ rmn.stop()
+
+
+if __name__ == '__main__':
+ main()
--- /dev/null
+# We need a properly installed Dockernet
+from mininet.net import Mininet
+from mininet.node import Controller, Docker, OVSSwitch
+from mininet.cli import CLI
+import mininet.log
+import logging
+import os
+import Pyro4
+
+
+class RemoteMininetNetwork(object):
+
+ def __init__(self):
+ mininet.log.setLogLevel( 'debug' )
+ self.net = Mininet( controller=Controller )
+ self.net.addController( 'c0' )
+
+ def start(self):
+ self.net.start()
+
+ def stop(self):
+ CLI(self.net)
+ self.net.stop()
+
+ def addHost(self, name, cls=None, **params):
+ return str(self.net.addHost(name, cls=cls, **params))
+
+ def addDocker(self, name, **params):
+ return str(self.net.addDocker(name, **params))
+
+ def addSwitch(self, name, cls=None, **params):
+ return str(self.net.addSwitch(name, cls=cls, **params))
+
+ def addLink(self, node1, node2, port1=None, port2=None,
+ cls=None, **params):
+ return str(self.net.addLink(node1, node2,
+ port1, port2, cls=cls, **params))
+
+
+def start_server():
+ daemon = Pyro4.Daemon()
+ # ATTENTION:
+ # we need a PyroNS instance to be running: pyro4-ns (in new terminal)
+ ns = Pyro4.locateNS()
+ uri = daemon.register(RemoteMininetNetwork())
+ # map object URI to a nice name
+ ns.register("remote.mininet", uri)
+
+ logging.info("Server URI is: %s", uri)
+
+ # Start the server...
+ daemon.requestLoop()