Last active
August 29, 2015 14:23
-
-
Save pichuang/ce5e4a56fd4e0870d854 to your computer and use it in GitHub Desktop.
mininet clusterdemo.py by pichuang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
"clusterdemo.py: demo of Mininet Cluster Edition prototype" | |
from mininet.examples.cluster import MininetCluster, SwitchBinPlacer | |
from mininet.topolib import TreeTopo | |
from mininet.log import setLogLevel | |
from mininet.examples.clustercli import ClusterCLI as CLI | |
from mininet.node import Controller, RemoteController | |
def demo(): | |
"Simple Demo of Cluster Mode" | |
CONTROLLER_IP="168.95.1.1" | |
CONTROLLER_PORT=6633 | |
servers = [ 'mininet1', 'mininet2' ] | |
topo = TreeTopo( depth=2, fanout=2 ) | |
net = MininetCluster( controller=RemoteController, topo=topo, servers=servers, | |
placement=SwitchBinPlacer ) | |
net.addController( 'controller',controller=RemoteController,ip=CONTROLLER_IP,port=CONTROLLER_PORT) | |
net.start() | |
CLI( net ) | |
net.stop() | |
if __name__ == '__main__': | |
setLogLevel( 'debug' ) | |
demo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment