Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
sdn-topo-mininet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nawasan Wisitsingkhon
sdn-topo-mininet
Commits
c1cd8c92
Commit
c1cd8c92
authored
Feb 11, 2024
by
Nawasan Wisitsingkhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial commit
parents
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1182 additions
and
0 deletions
+1182
-0
multi-topo.mn
multi-topo.mn
+487
-0
multi-topo.py
multi-topo.py
+120
-0
single-topo.mn
single-topo.mn
+465
-0
single-topo.py
single-topo.py
+110
-0
No files found.
multi-topo.mn
0 → 100644
View file @
c1cd8c92
{
"application": {
"dpctl": "",
"ipBase": "172.16.0.0/16",
"netflow": {
"nflowAddId": "0",
"nflowTarget": "",
"nflowTimeout": "600"
},
"openFlowVersions": {
"ovsOf10": "0",
"ovsOf11": "0",
"ovsOf12": "0",
"ovsOf13": "1"
},
"sflow": {
"sflowHeader": "128",
"sflowPolling": "30",
"sflowSampling": "400",
"sflowTarget": ""
},
"startCLI": "1",
"switchType": "ovs",
"terminalType": "xterm"
},
"controllers": [
{
"opts": {
"controllerProtocol": "tcp",
"controllerType": "ref",
"hostname": "c2",
"remoteIP": "127.0.0.1",
"remotePort": 6635
},
"x": "1463.0",
"y": "147.0"
},
{
"opts": {
"controllerProtocol": "tcp",
"controllerType": "remote",
"hostname": "c0",
"remoteIP": "127.0.0.1",
"remotePort": 6633
},
"x": "914.0",
"y": "142.0"
},
{
"opts": {
"controllerProtocol": "tcp",
"controllerType": "ref",
"hostname": "c1",
"remoteIP": "127.0.0.1",
"remotePort": 6634
},
"x": "359.0",
"y": "144.0"
}
],
"hosts": [
{
"number": "11",
"opts": {
"defaultRoute": "172.16.0.248",
"hostname": "h11",
"ip": "172.16.0.11",
"nodeNum": 11,
"sched": "host"
},
"x": "1711.0",
"y": "682.0"
},
{
"number": "7",
"opts": {
"defaultRoute": "172.16.0.250",
"hostname": "h7",
"ip": "172.16.0.7",
"nodeNum": 7,
"sched": "host"
},
"x": "1129.0",
"y": "703.0"
},
{
"number": "3",
"opts": {
"defaultRoute": "172.16.0.252",
"hostname": "h3",
"ip": "172.16.0.3",
"nodeNum": 3,
"sched": "host"
},
"x": "399.0",
"y": "710.0"
},
{
"number": "6",
"opts": {
"defaultRoute": "172.16.0.251",
"hostname": "h6",
"ip": "172.16.0.6",
"nodeNum": 6,
"sched": "host"
},
"x": "803.0",
"y": "496.0"
},
{
"number": "4",
"opts": {
"defaultRoute": "172.16.0.252",
"hostname": "h4",
"ip": "172.16.0.4",
"nodeNum": 4,
"sched": "host"
},
"x": "444.0",
"y": "897.0"
},
{
"number": "5",
"opts": {
"defaultRoute": "172.16.0.252",
"hostname": "a1",
"ip": "172.16.0.5",
"nodeNum": 5,
"sched": "host"
},
"x": "637.0",
"y": "901.0"
},
{
"number": "8",
"opts": {
"defaultRoute": "172.16.0.250",
"hostname": "h8",
"ip": "172.16.0.8",
"nodeNum": 8,
"sched": "host"
},
"x": "843.0",
"y": "870.0"
},
{
"number": "10",
"opts": {
"defaultRoute": "172.16.0.249",
"hostname": "h10",
"ip": "172.16.0.10",
"nodeNum": 10,
"sched": "host"
},
"x": "1359.0",
"y": "497.0"
},
{
"number": "1",
"opts": {
"defaultRoute": "172.16.0.254",
"hostname": "h1",
"ip": "172.16.0.1",
"nodeNum": 1,
"sched": "host"
},
"x": "356.0",
"y": "536.0"
},
{
"number": "13",
"opts": {
"defaultRoute": "172.16.0.248",
"hostname": "h13",
"ip": "172.16.0.13",
"nodeNum": 13,
"sched": "host"
},
"x": "1563.0",
"y": "876.0"
},
{
"number": "9",
"opts": {
"defaultRoute": "172.16.0.253",
"hostname": "h2",
"ip": "172.16.0.2",
"nodeNum": 9,
"sched": "host"
},
"x": "135.0",
"y": "731.0"
},
{
"number": "9",
"opts": {
"defaultRoute": "172.16.0.250",
"hostname": "a2",
"ip": "172.16.0.9",
"nodeNum": 9,
"sched": "host"
},
"x": "1030.0",
"y": "857.0"
},
{
"number": "12",
"opts": {
"defaultRoute": "172.16.0.248",
"hostname": "h12",
"ip": "172.16.0.12",
"nodeNum": 12,
"sched": "host"
},
"x": "1375.0",
"y": "877.0"
}
],
"links": [
{
"dest": "s4",
"opts": {},
"src": "h2"
},
{
"dest": "s1",
"opts": {},
"src": "s4"
},
{
"dest": "h1",
"opts": {},
"src": "s1"
},
{
"dest": "s5",
"opts": {},
"src": "s1"
},
{
"dest": "h3",
"opts": {},
"src": "s5"
},
{
"dest": "s9",
"opts": {},
"src": "s5"
},
{
"dest": "h4",
"opts": {},
"src": "s9"
},
{
"dest": "a1",
"opts": {},
"src": "s9"
},
{
"dest": "s2",
"opts": {},
"src": "h6"
},
{
"dest": "s7",
"opts": {},
"src": "s2"
},
{
"dest": "s7",
"opts": {},
"src": "s10"
},
{
"dest": "h7",
"opts": {},
"src": "s7"
},
{
"dest": "a2",
"opts": {},
"src": "s10"
},
{
"dest": "h8",
"opts": {},
"src": "s10"
},
{
"dest": "s3",
"opts": {},
"src": "h10"
},
{
"dest": "s8",
"opts": {},
"src": "s3"
},
{
"dest": "h11",
"opts": {},
"src": "s8"
},
{
"dest": "s11",
"opts": {},
"src": "s8"
},
{
"dest": "h12",
"opts": {},
"src": "s11"
},
{
"dest": "h13",
"opts": {},
"src": "s11"
},
{
"dest": "s2",
"opts": {},
"src": "s3"
},
{
"dest": "s1",
"opts": {},
"src": "s2"
}
],
"switches": [
{
"number": "3",
"opts": {
"controllers": [
"c2"
],
"dpid": "3",
"hostname": "s3",
"netflow": "0",
"nodeNum": 3,
"sflow": "0",
"switchIP": "172.16.0.249",
"switchType": "default"
},
"x": "1458.0",
"y": "416.0"
},
{
"number": "11",
"opts": {
"controllers": [],
"hostname": "s11",
"nodeNum": 11,
"switchType": "legacySwitch"
},
"x": "1454.0",
"y": "741.0"
},
{
"number": "5",
"opts": {
"controllers": [
"c1"
],
"dpid": "5",
"hostname": "s5",
"netflow": "0",
"nodeNum": 5,
"sflow": "0",
"switchIP": "172.16.0.252",
"switchType": "default"
},
"x": "489.0",
"y": "615.0"
},
{
"number": "2",
"opts": {
"controllers": [
"c0"
],
"dpid": "2",
"hostname": "s2",
"netflow": "0",
"nodeNum": 2,
"sflow": "0",
"switchIP": "172.16.0.251",
"switchType": "default"
},
"x": "908.0",
"y": "424.0"
},
{
"number": "9",
"opts": {
"controllers": [],
"hostname": "s9",
"nodeNum": 9,
"switchType": "legacySwitch"
},
"x": "585.0",
"y": "792.0"
},
{
"number": "8",
"opts": {
"controllers": [
"c2"
],
"dpid": "8",
"hostname": "s8",
"netflow": "0",
"nodeNum": 8,
"sflow": "0",
"switchIP": "172.16.0.248",
"switchType": "default"
},
"x": "1613.0",
"y": "588.0"
},
{
"number": "10",
"opts": {
"controllers": [],
"hostname": "s10",
"nodeNum": 10,
"switchType": "legacySwitch"
},
"x": "952.0",
"y": "750.0"
},
{
"number": "4",
"opts": {
"controllers": [
"c1"
],
"dpid": "4",
"hostname": "s4",
"netflow": "0",
"nodeNum": 4,
"sflow": "0",
"switchIP": "172.16.0.253",
"switchType": "default"
},
"x": "224.0",
"y": "608.0"
},
{
"number": "7",
"opts": {
"controllers": [
"c0"
],
"dpid": "7",
"hostname": "s7",
"netflow": "0",
"nodeNum": 7,
"sflow": "0",
"switchIP": "172.16.0.250",
"switchType": "default"
},
"x": "1039.0",
"y": "610.0"
},
{
"number": "1",
"opts": {
"controllers": [
"c1"
],
"dpid": "1",
"hostname": "s1",
"netflow": "0",
"nodeNum": 1,
"sflow": "0",
"switchIP": "172.16.0.254",
"switchType": "default"
},
"x": "361.0",
"y": "407.0"
}
],
"version": "2"
}
\ No newline at end of file
multi-topo.py
0 → 100644
View file @
c1cd8c92
#!/usr/bin/env 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
from
subprocess
import
call
def
myNetwork
():
net
=
Mininet
(
topo
=
None
,
build
=
False
,
ipBase
=
'172.16.0.0/16'
)
info
(
'*** Adding controller
\n
'
)
c1
=
net
.
addController
(
name
=
'c1'
,
controller
=
Controller
,
protocol
=
'tcp'
,
port
=
6634
)
c2
=
net
.
addController
(
name
=
'c2'
,
controller
=
Controller
,
protocol
=
'tcp'
,
port
=
6635
)
c0
=
net
.
addController
(
name
=
'c0'
,
controller
=
RemoteController
,
ip
=
'127.0.0.1'
,
protocol
=
'tcp'
,
port
=
6633
)
info
(
'*** Add switches
\n
'
)
s10
=
net
.
addSwitch
(
's10'
,
cls
=
OVSKernelSwitch
,
failMode
=
'standalone'
)
s9
=
net
.
addSwitch
(
's9'
,
cls
=
OVSKernelSwitch
,
failMode
=
'standalone'
)
s11
=
net
.
addSwitch
(
's11'
,
cls
=
OVSKernelSwitch
,
failMode
=
'standalone'
)
s4
=
net
.
addSwitch
(
's4'
,
cls
=
OVSKernelSwitch
,
dpid
=
'4'
)
s3
=
net
.
addSwitch
(
's3'
,
cls
=
OVSKernelSwitch
,
dpid
=
'3'
)
s7
=
net
.
addSwitch
(
's7'
,
cls
=
OVSKernelSwitch
,
dpid
=
'7'
)
s8
=
net
.
addSwitch
(
's8'
,
cls
=
OVSKernelSwitch
,
dpid
=
'8'
)
s1
=
net
.
addSwitch
(
's1'
,
cls
=
OVSKernelSwitch
,
dpid
=
'1'
)
s2
=
net
.
addSwitch
(
's2'
,
cls
=
OVSKernelSwitch
,
dpid
=
'2'
)
s5
=
net
.
addSwitch
(
's5'
,
cls
=
OVSKernelSwitch
,
dpid
=
'5'
)
info
(
'*** Add hosts
\n
'
)
h10
=
net
.
addHost
(
'h10'
,
cls
=
Host
,
ip
=
'172.16.0.10'
,
defaultRoute
=
'via 172.16.0.249'
)
h6
=
net
.
addHost
(
'h6'
,
cls
=
Host
,
ip
=
'172.16.0.6'
,
defaultRoute
=
'via 172.16.0.251'
)
h12
=
net
.
addHost
(
'h12'
,
cls
=
Host
,
ip
=
'172.16.0.12'
,
defaultRoute
=
'via 172.16.0.248'
)
h1
=
net
.
addHost
(
'h1'
,
cls
=
Host
,
ip
=
'172.16.0.1'
,
defaultRoute
=
'via 172.16.0.254'
)
h11
=
net
.
addHost
(
'h11'
,
cls
=
Host
,
ip
=
'172.16.0.11'
,
defaultRoute
=
'via 172.16.0.248'
)
h13
=
net
.
addHost
(
'h13'
,
cls
=
Host
,
ip
=
'172.16.0.13'
,
defaultRoute
=
'via 172.16.0.248'
)
a1
=
net
.
addHost
(
'a1'
,
cls
=
Host
,
ip
=
'172.16.0.5'
,
defaultRoute
=
'via 172.16.0.252'
)
h7
=
net
.
addHost
(
'h7'
,
cls
=
Host
,
ip
=
'172.16.0.7'
,
defaultRoute
=
'via 172.16.0.250'
)
h2
=
net
.
addHost
(
'h2'
,
cls
=
Host
,
ip
=
'172.16.0.2'
,
defaultRoute
=
'via 172.16.0.253'
)
h8
=
net
.
addHost
(
'h8'
,
cls
=
Host
,
ip
=
'172.16.0.8'
,
defaultRoute
=
'via 172.16.0.250'
)
h3
=
net
.
addHost
(
'h3'
,
cls
=
Host
,
ip
=
'172.16.0.3'
,
defaultRoute
=
'via 172.16.0.252'
)
h4
=
net
.
addHost
(
'h4'
,
cls
=
Host
,
ip
=
'172.16.0.4'
,
defaultRoute
=
'via 172.16.0.252'
)
a2
=
net
.
addHost
(
'a2'
,
cls
=
Host
,
ip
=
'172.16.0.9'
,
defaultRoute
=
'via 172.16.0.250'
)
info
(
'*** Add links
\n
'
)
net
.
addLink
(
h2
,
s4
)
net
.
addLink
(
s4
,
s1
)
net
.
addLink
(
s1
,
h1
)
net
.
addLink
(
s1
,
s5
)
net
.
addLink
(
s5
,
h3
)
net
.
addLink
(
s5
,
s9
)
net
.
addLink
(
s9
,
h4
)
net
.
addLink
(
s9
,
a1
)
net
.
addLink
(
h6
,
s2
)
net
.
addLink
(
s2
,
s7
)
net
.
addLink
(
s10
,
s7
)
net
.
addLink
(
s7
,
h7
)
net
.
addLink
(
s10
,
a2
)
net
.
addLink
(
s10
,
h8
)
net
.
addLink
(
h10
,
s3
)
net
.
addLink
(
s3
,
s8
)
net
.
addLink
(
s8
,
h11
)
net
.
addLink
(
s8
,
s11
)
net
.
addLink
(
s11
,
h12
)
net
.
addLink
(
s11
,
h13
)
net
.
addLink
(
s3
,
s2
)
net
.
addLink
(
s2
,
s1
)
info
(
'*** Starting network
\n
'
)
net
.
build
()
info
(
'*** Starting controllers
\n
'
)
for
controller
in
net
.
controllers
:
controller
.
start
()
info
(
'*** Starting switches
\n
'
)
net
.
get
(
's10'
)
.
start
([])
net
.
get
(
's9'
)
.
start
([])
net
.
get
(
's11'
)
.
start
([])
net
.
get
(
's4'
)
.
start
([
c1
])
net
.
get
(
's3'
)
.
start
([
c2
])
net
.
get
(
's7'
)
.
start
([
c0
])
net
.
get
(
's8'
)
.
start
([
c2
])
net
.
get
(
's1'
)
.
start
([
c1
])
net
.
get
(
's2'
)
.
start
([
c0
])
net
.
get
(
's5'
)
.
start
([
c1
])
info
(
'*** Post configure switches and hosts
\n
'
)
s4
.
cmd
(
'ifconfig s4 172.16.0.253'
)
s3
.
cmd
(
'ifconfig s3 172.16.0.249'
)
s7
.
cmd
(
'ifconfig s7 172.16.0.250'
)
s8
.
cmd
(
'ifconfig s8 172.16.0.248'
)
s1
.
cmd
(
'ifconfig s1 172.16.0.254'
)
s2
.
cmd
(
'ifconfig s2 172.16.0.251'
)
s5
.
cmd
(
'ifconfig s5 172.16.0.252'
)
CLI
(
net
)
net
.
stop
()
if
__name__
==
'__main__'
:
setLogLevel
(
'info'
)
myNetwork
()
single-topo.mn
0 → 100644
View file @
c1cd8c92
{
"application": {
"dpctl": "",
"ipBase": "172.16.0.0/16",
"netflow": {
"nflowAddId": "0",
"nflowTarget": "",
"nflowTimeout": "600"
},
"openFlowVersions": {
"ovsOf10": "0",
"ovsOf11": "0",
"ovsOf12": "0",
"ovsOf13": "1"
},
"sflow": {
"sflowHeader": "128",
"sflowPolling": "30",
"sflowSampling": "400",
"sflowTarget": ""
},
"startCLI": "1",
"switchType": "ovs",
"terminalType": "xterm"
},
"controllers": [
{
"opts": {
"controllerProtocol": "tcp",
"controllerType": "remote",
"hostname": "c0",
"remoteIP": "127.0.0.1",
"remotePort": 6633
},
"x": "892.0",
"y": "162.0"
}
],
"hosts": [
{
"number": "11",
"opts": {
"defaultRoute": "172.16.0.248",
"hostname": "h11",
"ip": "172.16.0.11",
"nodeNum": 11,
"sched": "host"
},
"x": "1711.0",
"y": "682.0"
},
{
"number": "7",
"opts": {
"defaultRoute": "172.16.0.250",
"hostname": "h7",
"ip": "172.16.0.7",
"nodeNum": 7,
"sched": "host"
},
"x": "1129.0",
"y": "703.0"
},
{
"number": "3",
"opts": {
"defaultRoute": "172.16.0.252",
"hostname": "h3",
"ip": "172.16.0.3",
"nodeNum": 3,
"sched": "host"
},
"x": "399.0",
"y": "710.0"
},
{
"number": "6",
"opts": {
"defaultRoute": "172.16.0.251",
"hostname": "h6",
"ip": "172.16.0.6",
"nodeNum": 6,
"sched": "host"
},
"x": "803.0",
"y": "496.0"
},
{
"number": "4",
"opts": {
"defaultRoute": "172.16.0.252",
"hostname": "h4",
"ip": "172.16.0.4",
"nodeNum": 4,
"sched": "host"
},
"x": "444.0",
"y": "897.0"
},
{
"number": "5",
"opts": {
"defaultRoute": "172.16.0.252",
"hostname": "a1",
"ip": "172.16.0.5",
"nodeNum": 5,
"sched": "host"
},
"x": "637.0",
"y": "901.0"
},
{
"number": "8",
"opts": {
"defaultRoute": "172.16.0.250",
"hostname": "h8",
"ip": "172.16.0.8",
"nodeNum": 8,
"sched": "host"
},
"x": "843.0",
"y": "870.0"
},
{
"number": "10",
"opts": {
"defaultRoute": "172.16.0.249",
"hostname": "h10",
"ip": "172.16.0.10",
"nodeNum": 10,
"sched": "host"
},
"x": "1359.0",
"y": "497.0"
},
{
"number": "1",
"opts": {
"defaultRoute": "172.16.0.254",
"hostname": "h1",
"ip": "172.16.0.1",
"nodeNum": 1,
"sched": "host"
},
"x": "356.0",
"y": "536.0"
},
{
"number": "13",
"opts": {
"defaultRoute": "172.16.0.248",
"hostname": "h13",
"ip": "172.16.0.13",
"nodeNum": 13,
"sched": "host"
},
"x": "1563.0",
"y": "876.0"
},
{
"number": "9",
"opts": {
"defaultRoute": "172.16.0.253",
"hostname": "h2",
"ip": "172.16.0.2",
"nodeNum": 9,
"sched": "host"
},
"x": "135.0",
"y": "731.0"
},
{
"number": "9",
"opts": {
"defaultRoute": "172.16.0.250",
"hostname": "a2",
"ip": "172.16.0.9",
"nodeNum": 9,
"sched": "host"
},
"x": "1030.0",
"y": "857.0"
},
{
"number": "12",
"opts": {
"defaultRoute": "172.16.0.248",
"hostname": "h12",
"ip": "172.16.0.12",
"nodeNum": 12,
"sched": "host"
},
"x": "1375.0",
"y": "877.0"
}
],
"links": [
{
"dest": "s4",
"opts": {},
"src": "h2"
},
{
"dest": "s1",
"opts": {},
"src": "s4"
},
{
"dest": "h1",
"opts": {},
"src": "s1"
},
{
"dest": "s5",
"opts": {},
"src": "s1"
},
{
"dest": "h3",
"opts": {},
"src": "s5"
},
{
"dest": "s9",
"opts": {},
"src": "s5"
},
{
"dest": "h4",
"opts": {},
"src": "s9"
},
{
"dest": "a1",
"opts": {},
"src": "s9"
},
{
"dest": "s2",
"opts": {},
"src": "h6"
},
{
"dest": "s7",
"opts": {},
"src": "s2"
},
{
"dest": "s7",
"opts": {},
"src": "s10"
},
{
"dest": "h7",
"opts": {},
"src": "s7"
},
{
"dest": "a2",
"opts": {},
"src": "s10"
},
{
"dest": "h8",
"opts": {},
"src": "s10"
},
{
"dest": "s3",
"opts": {},
"src": "h10"
},
{
"dest": "s8",
"opts": {},
"src": "s3"
},
{
"dest": "h11",
"opts": {},
"src": "s8"
},
{
"dest": "s11",
"opts": {},
"src": "s8"
},
{
"dest": "h12",
"opts": {},
"src": "s11"
},
{
"dest": "h13",
"opts": {},
"src": "s11"
},
{
"dest": "s2",
"opts": {},
"src": "s3"
},
{
"dest": "s1",
"opts": {},
"src": "s2"
}
],
"switches": [
{
"number": "3",
"opts": {
"controllers": [
"c0"
],
"dpid": "3",
"hostname": "s3",
"netflow": "0",
"nodeNum": 3,
"sflow": "0",
"switchIP": "172.16.0.249",
"switchType": "default"
},
"x": "1458.0",
"y": "416.0"
},
{
"number": "11",
"opts": {
"controllers": [],
"hostname": "s11",
"nodeNum": 11,
"switchType": "legacySwitch"
},
"x": "1454.0",
"y": "741.0"
},
{
"number": "5",
"opts": {
"controllers": [
"c0"
],
"dpid": "5",
"hostname": "s5",
"netflow": "0",
"nodeNum": 5,
"sflow": "0",
"switchIP": "172.16.0.252",
"switchType": "default"
},
"x": "489.0",
"y": "615.0"
},
{
"number": "2",
"opts": {
"controllers": [
"c0"
],
"dpid": "2",
"hostname": "s2",
"netflow": "0",
"nodeNum": 2,
"sflow": "0",
"switchIP": "172.16.0.251",
"switchType": "default"
},
"x": "908.0",
"y": "424.0"
},
{
"number": "9",
"opts": {
"controllers": [],
"hostname": "s9",
"nodeNum": 9,
"switchType": "legacySwitch"
},
"x": "585.0",
"y": "792.0"
},
{
"number": "8",
"opts": {
"controllers": [
"c0"
],
"dpid": "8",
"hostname": "s8",
"netflow": "0",
"nodeNum": 8,
"sflow": "0",
"switchIP": "172.16.0.248",
"switchType": "default"
},
"x": "1613.0",
"y": "588.0"
},
{
"number": "10",
"opts": {
"controllers": [],
"hostname": "s10",
"nodeNum": 10,
"switchType": "legacySwitch"
},
"x": "952.0",
"y": "750.0"
},
{
"number": "4",
"opts": {
"controllers": [
"c0"
],
"dpid": "4",
"hostname": "s4",
"netflow": "0",
"nodeNum": 4,
"sflow": "0",
"switchIP": "172.16.0.253",
"switchType": "default"
},
"x": "224.0",
"y": "608.0"
},
{
"number": "7",
"opts": {
"controllers": [
"c0"
],
"dpid": "7",
"hostname": "s7",
"netflow": "0",
"nodeNum": 7,
"sflow": "0",
"switchIP": "172.16.0.250",
"switchType": "default"
},
"x": "1039.0",
"y": "610.0"
},
{
"number": "1",
"opts": {
"controllers": [
"c0"
],
"dpid": "1",
"hostname": "s1",
"netflow": "0",
"nodeNum": 1,
"sflow": "0",
"switchIP": "172.16.0.254",
"switchType": "default"
},
"x": "361.0",
"y": "407.0"
}
],
"version": "2"
}
\ No newline at end of file
single-topo.py
0 → 100644
View file @
c1cd8c92
#!/usr/bin/env 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
from
subprocess
import
call
def
myNetwork
():
net
=
Mininet
(
topo
=
None
,
build
=
False
,
ipBase
=
'172.16.0.0/16'
)
info
(
'*** Adding controller
\n
'
)
c0
=
net
.
addController
(
name
=
'c0'
,
controller
=
RemoteController
,
ip
=
'127.0.0.1'
,
protocol
=
'tcp'
,
port
=
6633
)
info
(
'*** Add switches
\n
'
)
s8
=
net
.
addSwitch
(
's8'
,
cls
=
OVSKernelSwitch
,
dpid
=
'8'
)
s11
=
net
.
addSwitch
(
's11'
,
cls
=
OVSKernelSwitch
,
failMode
=
'standalone'
)
s1
=
net
.
addSwitch
(
's1'
,
cls
=
OVSKernelSwitch
,
dpid
=
'1'
)
s2
=
net
.
addSwitch
(
's2'
,
cls
=
OVSKernelSwitch
,
dpid
=
'2'
)
s10
=
net
.
addSwitch
(
's10'
,
cls
=
OVSKernelSwitch
,
failMode
=
'standalone'
)
s9
=
net
.
addSwitch
(
's9'
,
cls
=
OVSKernelSwitch
,
failMode
=
'standalone'
)
s5
=
net
.
addSwitch
(
's5'
,
cls
=
OVSKernelSwitch
,
dpid
=
'5'
)
s3
=
net
.
addSwitch
(
's3'
,
cls
=
OVSKernelSwitch
,
dpid
=
'3'
)
s4
=
net
.
addSwitch
(
's4'
,
cls
=
OVSKernelSwitch
,
dpid
=
'4'
)
s7
=
net
.
addSwitch
(
's7'
,
cls
=
OVSKernelSwitch
,
dpid
=
'7'
)
info
(
'*** Add hosts
\n
'
)
h7
=
net
.
addHost
(
'h7'
,
cls
=
Host
,
ip
=
'172.16.0.7'
,
defaultRoute
=
'via 172.16.0.250'
)
h2
=
net
.
addHost
(
'h2'
,
cls
=
Host
,
ip
=
'172.16.0.2'
,
defaultRoute
=
'via 172.16.0.253'
)
h8
=
net
.
addHost
(
'h8'
,
cls
=
Host
,
ip
=
'172.16.0.8'
,
defaultRoute
=
'via 172.16.0.250'
)
h3
=
net
.
addHost
(
'h3'
,
cls
=
Host
,
ip
=
'172.16.0.3'
,
defaultRoute
=
'via 172.16.0.252'
)
a2
=
net
.
addHost
(
'a2'
,
cls
=
Host
,
ip
=
'172.16.0.9'
,
defaultRoute
=
'via 172.16.0.250'
)
h10
=
net
.
addHost
(
'h10'
,
cls
=
Host
,
ip
=
'172.16.0.10'
,
defaultRoute
=
'via 172.16.0.249'
)
h6
=
net
.
addHost
(
'h6'
,
cls
=
Host
,
ip
=
'172.16.0.6'
,
defaultRoute
=
'via 172.16.0.251'
)
h12
=
net
.
addHost
(
'h12'
,
cls
=
Host
,
ip
=
'172.16.0.12'
,
defaultRoute
=
'via 172.16.0.248'
)
h1
=
net
.
addHost
(
'h1'
,
cls
=
Host
,
ip
=
'172.16.0.1'
,
defaultRoute
=
'via 172.16.0.254'
)
h4
=
net
.
addHost
(
'h4'
,
cls
=
Host
,
ip
=
'172.16.0.4'
,
defaultRoute
=
'via 172.16.0.252'
)
h11
=
net
.
addHost
(
'h11'
,
cls
=
Host
,
ip
=
'172.16.0.11'
,
defaultRoute
=
'via 172.16.0.248'
)
h13
=
net
.
addHost
(
'h13'
,
cls
=
Host
,
ip
=
'172.16.0.13'
,
defaultRoute
=
'via 172.16.0.248'
)
a1
=
net
.
addHost
(
'a1'
,
cls
=
Host
,
ip
=
'172.16.0.5'
,
defaultRoute
=
'via 172.16.0.252'
)
info
(
'*** Add links
\n
'
)
net
.
addLink
(
h2
,
s4
)
net
.
addLink
(
s4
,
s1
)
net
.
addLink
(
s1
,
h1
)
net
.
addLink
(
s1
,
s5
)
net
.
addLink
(
s5
,
h3
)
net
.
addLink
(
s5
,
s9
)
net
.
addLink
(
s9
,
h4
)
net
.
addLink
(
s9
,
a1
)
net
.
addLink
(
h6
,
s2
)
net
.
addLink
(
s2
,
s7
)
net
.
addLink
(
s10
,
s7
)
net
.
addLink
(
s7
,
h7
)
net
.
addLink
(
s10
,
a2
)
net
.
addLink
(
s10
,
h8
)
net
.
addLink
(
h10
,
s3
)
net
.
addLink
(
s3
,
s8
)
net
.
addLink
(
s8
,
h11
)
net
.
addLink
(
s8
,
s11
)
net
.
addLink
(
s11
,
h12
)
net
.
addLink
(
s11
,
h13
)
net
.
addLink
(
s3
,
s2
)
net
.
addLink
(
s2
,
s1
)
info
(
'*** Starting network
\n
'
)
net
.
build
()
info
(
'*** Starting controllers
\n
'
)
for
controller
in
net
.
controllers
:
controller
.
start
()
info
(
'*** Starting switches
\n
'
)
net
.
get
(
's8'
)
.
start
([
c0
])
net
.
get
(
's11'
)
.
start
([])
net
.
get
(
's1'
)
.
start
([
c0
])
net
.
get
(
's2'
)
.
start
([
c0
])
net
.
get
(
's10'
)
.
start
([])
net
.
get
(
's9'
)
.
start
([])
net
.
get
(
's5'
)
.
start
([
c0
])
net
.
get
(
's3'
)
.
start
([
c0
])
net
.
get
(
's4'
)
.
start
([
c0
])
net
.
get
(
's7'
)
.
start
([
c0
])
info
(
'*** Post configure switches and hosts
\n
'
)
s8
.
cmd
(
'ifconfig s8 172.16.0.248'
)
s1
.
cmd
(
'ifconfig s1 172.16.0.254'
)
s2
.
cmd
(
'ifconfig s2 172.16.0.251'
)
s5
.
cmd
(
'ifconfig s5 172.16.0.252'
)
s3
.
cmd
(
'ifconfig s3 172.16.0.249'
)
s4
.
cmd
(
'ifconfig s4 172.16.0.253'
)
s7
.
cmd
(
'ifconfig s7 172.16.0.250'
)
CLI
(
net
)
net
.
stop
()
if
__name__
==
'__main__'
:
setLogLevel
(
'info'
)
myNetwork
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment