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