geantmpls.py
6.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/usr/bin/env python
"""
"""
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.node import Node
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.util import dumpNodeConnections
class GeantMplsTopo( Topo ):
"Internet Topology Zoo Specimen."
def __init__( self ):
"Create a topology."
# Initialize Topology
Topo.__init__( self )
# add nodes, switches first...
ATH = self.addSwitch( 's1' )
LIS = self.addSwitch( 's2', protocols='OpenFlow13' )
LON = self.addSwitch( 's3' )
BRU = self.addSwitch( 's4' )
PAR = self.addSwitch( 's5' )
DUB = self.addSwitch( 's6' )
MAD = self.addSwitch( 's7' )
GEN = self.addSwitch( 's8' )
MIL = self.addSwitch( 's9', protocols='OpenFlow13' )
SOF = self.addSwitch( 's10' )
BUC = self.addSwitch( 's11' )
VIE = self.addSwitch( 's12' )
FRA = self.addSwitch( 's13' )
COP = self.addSwitch( 's14' )
TLN = self.addSwitch( 's15' )
RIG = self.addSwitch( 's16' )
KAU = self.addSwitch( 's17' )
POZ = self.addSwitch( 's18' )
PRA = self.addSwitch( 's19' )
BRA = self.addSwitch( 's20' )
ZAG = self.addSwitch( 's21' )
LJU = self.addSwitch( 's22', protocols='OpenFlow13' )
BUD = self.addSwitch( 's23' )
MLT = self.addSwitch( 's24' )
LUX = self.addSwitch( 's25' )
MAR = self.addSwitch( 's26' )
HAM = self.addSwitch( 's27' )
AMS = self.addSwitch( 's28' )
STO = self.addSwitch( 's29' )
OSL = self.addSwitch( 's30' )
HEL = self.addSwitch( 's31' )
# ... and now hosts
ATH_host = self.addHost( 'h1' )
LIS_host = self.addHost( 'h2' )
LON_host = self.addHost( 'h3' )
BRU_host = self.addHost( 'h4' )
PAR_host = self.addHost( 'h5' )
DUB_host = self.addHost( 'h6' )
MAD_host = self.addHost( 'h7' )
GEN_host = self.addHost( 'h8' )
MIL_host = self.addHost( 'h9' )
SOF_host = self.addHost( 'h10' )
BUC_host = self.addHost( 'h11' )
VIE_host = self.addHost( 'h12' )
FRA_host = self.addHost( 'h13' )
COP_host = self.addHost( 'h14' )
TLN_host = self.addHost( 'h15' )
RIG_host = self.addHost( 'h16' )
KAU_host = self.addHost( 'h17' )
POZ_host = self.addHost( 'h18' )
PRA_host = self.addHost( 'h19' )
BRA_host = self.addHost( 'h20' )
ZAG_host = self.addHost( 'h21' )
LJU_host = self.addHost( 'h22' )
BUD_host = self.addHost( 'h23' )
MLT_host = self.addHost( 'h24' )
LUX_host = self.addHost( 'h25' )
MAR_host = self.addHost( 'h26' )
HAM_host = self.addHost( 'h27' )
AMS_host = self.addHost( 'h28' )
STO_host = self.addHost( 'h29' )
OSL_host = self.addHost( 'h30' )
HEL_host = self.addHost( 'h31' )
# add edges between switch and corresponding host
self.addLink( ATH , ATH_host )
self.addLink( LIS , LIS_host )
self.addLink( LON , LON_host )
self.addLink( BRU , BRU_host )
self.addLink( PAR , PAR_host )
self.addLink( DUB , DUB_host )
self.addLink( MAD , MAD_host )
self.addLink( GEN , GEN_host )
self.addLink( MIL , MIL_host )
self.addLink( SOF , SOF_host )
self.addLink( BUC , BUC_host )
self.addLink( VIE , VIE_host )
self.addLink( FRA , FRA_host )
self.addLink( COP , COP_host )
self.addLink( TLN , TLN_host )
self.addLink( RIG , RIG_host )
self.addLink( KAU , KAU_host )
self.addLink( POZ , POZ_host )
self.addLink( PRA , PRA_host )
self.addLink( BRA , BRA_host )
self.addLink( ZAG , ZAG_host )
self.addLink( LJU , LJU_host )
self.addLink( BUD , BUD_host )
self.addLink( MLT , MLT_host )
self.addLink( LUX , LUX_host )
self.addLink( MAR , MAR_host )
self.addLink( HAM , HAM_host )
self.addLink( AMS , AMS_host )
self.addLink( STO , STO_host )
self.addLink( HEL , HEL_host )
self.addLink( OSL , OSL_host )
# add edges between switches
self.addLink( ATH , MIL, bw=10 )
self.addLink( MIL , ATH, bw=10 )
self.addLink( MIL , VIE, bw=10 )
self.addLink( MIL , MAR, bw=10 )
self.addLink( MIL , GEN, bw=10 )
self.addLink( GEN , MIL, bw=10 )
self.addLink( MIL , MLT, bw=10 )
self.addLink( GEN , FRA, bw=10 )
self.addLink( FRA , GEN, bw=10 )
self.addLink( GEN , PAR, bw=10 )
self.addLink( PAR , GEN, bw=10 )
self.addLink( GEN , PAR, bw=10 )
self.addLink( FRA , POZ, bw=10 )
self.addLink( GEN , MAR, bw=10 )
self.addLink( MAR , MAD, bw=10 )
self.addLink( MAD , PAR, bw=10 )
self.addLink( MAD , LIS, bw=10 )
self.addLink( LIS , LON, bw=10 )
self.addLink( LON , LIS, bw=10 )
self.addLink( LON , PAR, bw=10 )
self.addLink( LON , DUB, bw=10 )
self.addLink( DUB , LON, bw=10 )
self.addLink( LON , BRU, bw=10 )
self.addLink( BRU , AMS, bw=10 )
self.addLink( AMS , LUX, bw=10 )
self.addLink( LUX , FRA, bw=10 )
self.addLink( AMS , HAM, bw=10 )
self.addLink( HAM , FRA, bw=10 )
self.addLink( HAM , COP, bw=10 )
self.addLink( COP , AMS, bw=10 )
self.addLink( FRA , POZ, bw=10 )
self.addLink( FRA , PRA, bw=10 )
self.addLink( FRA , BUD, bw=10 )
self.addLink( FRA , VIE, bw=10 )
self.addLink( POZ , PRA, bw=10 )
self.addLink( POZ , KAU, bw=10 )
self.addLink( KAU , RIG, bw=10 )
self.addLink( ZAG , VIE, bw=10 )
self.addLink( ZAG , BUD, bw=10 )
self.addLink( BUD , PRA, bw=10 )
self.addLink( BUD , BRA, bw=10 )
self.addLink( BUD , BUC, bw=10 )
self.addLink( BUD , SOF, bw=10 )
self.addLink( BUD , LJU, bw=10 )
self.addLink( BUC , SOF, bw=10 )
self.addLink( BUC , VIE, bw=10 )
self.addLink( VIE , BRA, bw=10 )
self.addLink( RIG , TLN, bw=10 )
self.addLink( TLN , HAM, bw=10 )
self.addLink( OSL , STO, bw=10 )
self.addLink( STO , HEL, bw=10 )
self.addLink( STO , COP, bw=10 )
self.addLink( OSL , COP, bw=10 )
self.addLink( TLN , HEL, bw=10 )
topos = { 'att': ( lambda: GeantMplsTopo() ) }
if __name__ == '__main__':
from onosnet import run
run( GeantMplsTopo() )