Created
February 25, 2014 18:00
-
-
Save costash/9214304 to your computer and use it in GitHub Desktop.
Simple topology for mininet created with miniedit.
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
{ | |
"application": { | |
"dpctl": "", | |
"ipBase": "10.0.0.0/8", | |
"netflow": { | |
"nflowAddId": "0", | |
"nflowTarget": "", | |
"nflowTimeout": "600" | |
}, | |
"openFlowVersions": { | |
"ovsOf10": "1", | |
"ovsOf11": "0", | |
"ovsOf12": "0", | |
"ovsOf13": "0" | |
}, | |
"sflow": { | |
"sflowHeader": "128", | |
"sflowPolling": "30", | |
"sflowSampling": "400", | |
"sflowTarget": "" | |
}, | |
"startCLI": "0", | |
"switchType": "ovs", | |
"terminalType": "xterm" | |
}, | |
"controllers": [], | |
"hosts": [ | |
{ | |
"number": "1", | |
"opts": { | |
"hostname": "h1", | |
"ip": "10.0.0.1", | |
"nodeNum": 1, | |
"sched": "host" | |
}, | |
"x": "186.0", | |
"y": "64.0" | |
}, | |
{ | |
"number": "2", | |
"opts": { | |
"hostname": "h2", | |
"ip": "10.0.0.2", | |
"nodeNum": 2, | |
"sched": "host" | |
}, | |
"x": "367.0", | |
"y": "71.0" | |
} | |
], | |
"links": [ | |
{ | |
"dest": "s1", | |
"opts": {}, | |
"src": "h1" | |
}, | |
{ | |
"dest": "h2", | |
"opts": {}, | |
"src": "s1" | |
} | |
], | |
"switches": [ | |
{ | |
"number": "1", | |
"opts": { | |
"controllers": [], | |
"hostname": "s1", | |
"netflow": "0", | |
"nodeNum": 1, | |
"sflow": "0", | |
"switchIP": "", | |
"switchType": "ovs" | |
}, | |
"x": "281.0", | |
"y": "236.0" | |
} | |
], | |
"version": "2" | |
} |
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 | |
from mininet.net import Mininet | |
from mininet.node import Controller, RemoteController, OVSController | |
from mininet.node import CPULimitedHost, Host, Node | |
from mininet.node import OVSKernelSwitch, UserSwitch | |
from mininet.node import IVSSwitch | |
from mininet.cli import CLI | |
from mininet.log import setLogLevel, info | |
from mininet.link import TCLink, Intf | |
def myNetwork(): | |
net = Mininet( topo=None, | |
build=False, | |
ipBase='10.0.0.0/8') | |
info( '*** Adding controller\n' ) | |
info( '*** Add switches\n') | |
s1 = net.addSwitch('s1', cls=OVSKernelSwitch) | |
info( '*** Add hosts\n') | |
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None) | |
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None) | |
info( '*** Add links\n') | |
net.addLink(h1, s1) | |
net.addLink(s1, h2) | |
info( '*** Starting network\n') | |
net.build() | |
info( '*** Starting controllers\n') | |
for controller in net.controllers: | |
controller.start() | |
info( '*** Starting switches\n') | |
net.get('s1').start([]) | |
info( '*** Configuring switches\n') | |
CLI(net) | |
net.stop() | |
if __name__ == '__main__': | |
setLogLevel( 'info' ) | |
myNetwork() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment