pingping-lin | 26990f0 | 2015-11-30 15:48:06 -0800 | [diff] [blame^] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | """ |
| 4 | Set up the SDN-IP topology as same as it on Internet2 |
| 5 | """ |
| 6 | |
| 7 | """ |
| 8 | AS 64513, (SDN AS) |
| 9 | AS 64514, reachable by 10.0.4.1, 10.0.14.1 |
| 10 | AS 64515, reachable by 10.0.5.1, 10.0.15.1 |
| 11 | AS 64516, reachable by 10.0.6.1, 10.0.16.1 |
| 12 | """ |
| 13 | |
| 14 | from mininet.net import Mininet |
| 15 | from mininet.node import Controller, RemoteController |
| 16 | from mininet.log import setLogLevel, info |
| 17 | from mininet.cli import CLI |
| 18 | from mininet.topo import Topo |
| 19 | from mininet.util import quietRun |
| 20 | from mininet.moduledeps import pathCheck |
| 21 | |
| 22 | import os.path |
| 23 | import time |
| 24 | from subprocess import Popen, STDOUT, PIPE |
| 25 | |
| 26 | QUAGGA_DIR = '/usr/lib/quagga' |
| 27 | QUAGGA_RUN_DIR = '/usr/local/var/run/quagga' |
| 28 | QUAGGA_CONFIG_DIR = '~/OnosSystemTest/TestON/tests/USECASE_SdnipFunctionCluster_fsfw/Dependency/' |
| 29 | numSw = 39 |
| 30 | |
| 31 | # net = Mininet( controller = RemoteController ) |
| 32 | |
| 33 | class SDNTopo( Topo ): |
| 34 | "SDN Topology" |
| 35 | |
| 36 | def __init__( self, *args, **kwargs ): |
| 37 | |
| 38 | Topo.__init__( self, *args, **kwargs ) |
| 39 | |
| 40 | # BGP peer hosts |
| 41 | peer64514 = self.addHost( 'peer64514' ) |
| 42 | peer64515 = self.addHost( 'peer64515' ) |
| 43 | peer64516 = self.addHost( 'peer64516' ) |
| 44 | |
| 45 | ''' |
| 46 | sw1 = self.addSwitch( 'SEAT', dpid = '00000000000000a1' ) |
| 47 | sw2 = self.addSwitch( 'PORT', dpid = '00000000000000a2' ) |
| 48 | sw3 = self.addSwitch( 'SUNN', dpid = '00000000000000a3' ) |
| 49 | sw4 = self.addSwitch( 'RENO', dpid = '00000000000000a4' ) |
| 50 | sw5 = self.addSwitch( 'LOSA', dpid = '00000000000000a5' ) |
| 51 | sw6 = self.addSwitch( 'MISS', dpid = '00000000000000a6' ) |
| 52 | sw7 = self.addSwitch( 'LASV', dpid = '00000000000000a7' ) |
| 53 | sw8 = self.addSwitch( 'SALT', dpid = '00000000000000a8' ) |
| 54 | sw9 = self.addSwitch( 'PHOE', dpid = '00000000000000a9' ) |
| 55 | sw10 = self.addSwitch( 'TUCS', dpid = '0000000000000a10' ) |
| 56 | sw11 = self.addSwitch( 'DENV', dpid = '0000000000000a11' ) |
| 57 | sw12 = self.addSwitch( 'ELPA', dpid = '0000000000000a12' ) |
| 58 | sw13 = self.addSwitch( 'MINN', dpid = '0000000000000a13' ) |
| 59 | sw14 = self.addSwitch( 'KANS', dpid = '0000000000000a14' ) |
| 60 | sw15 = self.addSwitch( 'TULS', dpid = '0000000000000a15' ) |
| 61 | sw16 = self.addSwitch( 'DALL', dpid = '0000000000000a16' ) |
| 62 | sw17 = self.addSwitch( 'HOUH', dpid = '0000000000000a17' ) |
| 63 | sw18 = self.addSwitch( 'COLU', dpid = '0000000000000a18' ) |
| 64 | sw19 = self.addSwitch( 'JCSN', dpid = '0000000000000a19' ) |
| 65 | sw20 = self.addSwitch( 'BATO', dpid = '0000000000000a20' ) |
| 66 | sw21 = self.addSwitch( 'EQCH', dpid = '0000000000000a21' ) |
| 67 | sw22 = self.addSwitch( 'STAR', dpid = '0000000000000a22' ) |
| 68 | sw23 = self.addSwitch( 'CHIC', dpid = '0000000000000a23' ) |
| 69 | sw24 = self.addSwitch( 'INDI', dpid = '0000000000000a24' ) |
| 70 | sw25 = self.addSwitch( 'CINC', dpid = '0000000000000a25' ) |
| 71 | sw26 = self.addSwitch( 'LOUI', dpid = '0000000000000a26' ) |
| 72 | sw27 = self.addSwitch( 'ATLA', dpid = '0000000000000a27' ) |
| 73 | sw28 = self.addSwitch( 'JACK', dpid = '0000000000000a28' ) |
| 74 | sw29 = self.addSwitch( 'CLEV', dpid = '0000000000000a29' ) |
| 75 | sw30 = self.addSwitch( 'PITT', dpid = '0000000000000a30' ) |
| 76 | sw31 = self.addSwitch( 'ASHB', dpid = '0000000000000a31' ) |
| 77 | sw32 = self.addSwitch( 'WASH', dpid = '0000000000000a32' ) |
| 78 | sw33 = self.addSwitch( 'RALE', dpid = '0000000000000a33' ) |
| 79 | sw34 = self.addSwitch( 'CHAR', dpid = '0000000000000a34' ) |
| 80 | sw35 = self.addSwitch( 'ALBA', dpid = '0000000000000a35' ) |
| 81 | sw36 = self.addSwitch( 'BOST', dpid = '0000000000000a36' ) |
| 82 | sw37 = self.addSwitch( 'HART', dpid = '0000000000000a37' ) |
| 83 | sw38 = self.addSwitch( 'NEWY', dpid = '0000000000000a38' ) |
| 84 | sw39 = self.addSwitch( 'PHIL', dpid = '0000000000000a39' ) |
| 85 | ''' |
| 86 | sw1 = self.addSwitch( 'sw1', dpid = '00000000000000a1' ) |
| 87 | sw2 = self.addSwitch( 'sw2', dpid = '00000000000000a2' ) |
| 88 | sw3 = self.addSwitch( 'sw3', dpid = '00000000000000a3' ) |
| 89 | sw4 = self.addSwitch( 'sw4', dpid = '00000000000000a4' ) |
| 90 | sw5 = self.addSwitch( 'sw5', dpid = '00000000000000a5' ) |
| 91 | sw6 = self.addSwitch( 'sw6', dpid = '00000000000000a6' ) |
| 92 | sw7 = self.addSwitch( 'sw7', dpid = '00000000000000a7' ) |
| 93 | sw8 = self.addSwitch( 'sw8', dpid = '00000000000000a8' ) |
| 94 | sw9 = self.addSwitch( 'sw9', dpid = '00000000000000a9' ) |
| 95 | sw10 = self.addSwitch( 'sw10', dpid = '0000000000000a10' ) |
| 96 | sw11 = self.addSwitch( 'sw11', dpid = '0000000000000a11' ) |
| 97 | sw12 = self.addSwitch( 'sw12', dpid = '0000000000000a12' ) |
| 98 | sw13 = self.addSwitch( 'sw13', dpid = '0000000000000a13' ) |
| 99 | sw14 = self.addSwitch( 'sw14', dpid = '0000000000000a14' ) |
| 100 | sw15 = self.addSwitch( 'sw15', dpid = '0000000000000a15' ) |
| 101 | sw16 = self.addSwitch( 'sw16', dpid = '0000000000000a16' ) |
| 102 | sw17 = self.addSwitch( 'sw17', dpid = '0000000000000a17' ) |
| 103 | sw18 = self.addSwitch( 'sw18', dpid = '0000000000000a18' ) |
| 104 | sw19 = self.addSwitch( 'sw19', dpid = '0000000000000a19' ) |
| 105 | sw20 = self.addSwitch( 'sw20', dpid = '0000000000000a20' ) |
| 106 | sw21 = self.addSwitch( 'sw21', dpid = '0000000000000a21' ) |
| 107 | sw22 = self.addSwitch( 'sw22', dpid = '0000000000000a22' ) |
| 108 | sw23 = self.addSwitch( 'sw23', dpid = '0000000000000a23' ) |
| 109 | sw24 = self.addSwitch( 'sw24', dpid = '0000000000000a24' ) |
| 110 | sw25 = self.addSwitch( 'sw25', dpid = '0000000000000a25' ) |
| 111 | sw26 = self.addSwitch( 'sw26', dpid = '0000000000000a26' ) |
| 112 | sw27 = self.addSwitch( 'sw27', dpid = '0000000000000a27' ) |
| 113 | sw28 = self.addSwitch( 'sw28', dpid = '0000000000000a28' ) |
| 114 | sw29 = self.addSwitch( 'sw29', dpid = '0000000000000a29' ) |
| 115 | sw30 = self.addSwitch( 'sw30', dpid = '0000000000000a30' ) |
| 116 | sw31 = self.addSwitch( 'sw31', dpid = '0000000000000a31' ) |
| 117 | sw32 = self.addSwitch( 'sw32', dpid = '0000000000000a32' ) |
| 118 | sw33 = self.addSwitch( 'sw33', dpid = '0000000000000a33' ) |
| 119 | sw34 = self.addSwitch( 'sw34', dpid = '0000000000000a34' ) |
| 120 | sw35 = self.addSwitch( 'sw35', dpid = '0000000000000a35' ) |
| 121 | sw36 = self.addSwitch( 'sw36', dpid = '0000000000000a36' ) |
| 122 | sw37 = self.addSwitch( 'sw37', dpid = '0000000000000a37' ) |
| 123 | sw38 = self.addSwitch( 'sw38', dpid = '0000000000000a38' ) |
| 124 | sw39 = self.addSwitch( 'sw39', dpid = '0000000000000a39' ) |
| 125 | |
| 126 | |
| 127 | # Add a layer2 switch for control plane connectivity |
| 128 | # This switch isn't part of the SDN topology |
| 129 | # We'll use the ovs-controller to turn this into a learning switch |
| 130 | swCtl100 = self.addSwitch( 'swCtl100', dpid = '0000000000000100' ) |
| 131 | |
| 132 | |
| 133 | # BGP speaker hosts |
| 134 | speaker1 = self.addHost( 'speaker1' ) |
| 135 | speaker2 = self.addHost( 'speaker2' ) |
| 136 | |
| 137 | root = self.addHost( 'root', inNamespace = False , ip = '0' ) |
| 138 | |
| 139 | # hosts behind each AS |
| 140 | host64514 = self.addHost( 'host64514' ) |
| 141 | host64515 = self.addHost( 'host64515' ) |
| 142 | host64516 = self.addHost( 'host64516' ) |
| 143 | |
| 144 | self.addLink( 'speaker1', sw24 ) |
| 145 | self.addLink( 'speaker2', sw24 ) |
| 146 | |
| 147 | # connect all switches |
| 148 | self.addLink( sw1, sw2 ) |
| 149 | self.addLink( sw1, sw6 ) |
| 150 | self.addLink( sw1, sw8 ) |
| 151 | self.addLink( sw2, sw3 ) |
| 152 | self.addLink( sw3, sw4 ) |
| 153 | self.addLink( sw3, sw5 ) |
| 154 | self.addLink( sw4, sw8 ) |
| 155 | self.addLink( sw5, sw7 ) |
| 156 | self.addLink( sw5, sw9 ) |
| 157 | self.addLink( sw6, sw13 ) |
| 158 | self.addLink( sw7, sw8 ) |
| 159 | self.addLink( sw8, sw11 ) |
| 160 | self.addLink( sw9, sw10 ) |
| 161 | self.addLink( sw10, sw12 ) |
| 162 | self.addLink( sw11, sw12 ) |
| 163 | self.addLink( sw11, sw14 ) |
| 164 | self.addLink( sw12, sw17 ) |
| 165 | self.addLink( sw13, sw14 ) |
| 166 | self.addLink( sw13, sw21 ) |
| 167 | self.addLink( sw14, sw15 ) |
| 168 | self.addLink( sw14, sw18 ) |
| 169 | self.addLink( sw14, sw23 ) |
| 170 | self.addLink( sw15, sw16 ) |
| 171 | self.addLink( sw16, sw17 ) |
| 172 | self.addLink( sw17, sw19 ) |
| 173 | self.addLink( sw17, sw20 ) |
| 174 | self.addLink( sw18, sw23 ) |
| 175 | self.addLink( sw19, sw27 ) |
| 176 | self.addLink( sw20, sw28 ) |
| 177 | self.addLink( sw21, sw22 ) |
| 178 | self.addLink( sw21, sw29 ) |
| 179 | self.addLink( sw22, sw23 ) |
| 180 | self.addLink( sw23, sw24 ) |
| 181 | self.addLink( sw23, sw31 ) |
| 182 | self.addLink( sw24, sw25 ) |
| 183 | self.addLink( sw25, sw26 ) |
| 184 | self.addLink( sw26, sw27 ) |
| 185 | self.addLink( sw27, sw28 ) |
| 186 | self.addLink( sw27, sw34 ) |
| 187 | self.addLink( sw29, sw30 ) |
| 188 | self.addLink( sw29, sw35 ) |
| 189 | self.addLink( sw30, sw31 ) |
| 190 | self.addLink( sw31, sw32 ) |
| 191 | self.addLink( sw32, sw33 ) |
| 192 | self.addLink( sw32, sw39 ) |
| 193 | self.addLink( sw33, sw34 ) |
| 194 | self.addLink( sw35, sw36 ) |
| 195 | self.addLink( sw36, sw37 ) |
| 196 | self.addLink( sw37, sw38 ) |
| 197 | self.addLink( sw38, sw39 ) |
| 198 | |
| 199 | # connection between switches and peers |
| 200 | self.addLink( peer64514, sw32 ) |
| 201 | self.addLink( peer64515, sw8 ) |
| 202 | self.addLink( peer64516, sw28 ) |
| 203 | |
| 204 | # connection between BGP peer and hosts behind the BGP peer |
| 205 | self.addLink( peer64514, host64514 ) |
| 206 | self.addLink( peer64515, host64515 ) |
| 207 | self.addLink( peer64516, host64516 ) |
| 208 | |
| 209 | # Internal Connection To Hosts |
| 210 | self.addLink( swCtl100, peer64514 ) |
| 211 | self.addLink( swCtl100, peer64515 ) |
| 212 | self.addLink( swCtl100, peer64516 ) |
| 213 | self.addLink( swCtl100, speaker1 ) |
| 214 | self.addLink( swCtl100, speaker2 ) |
| 215 | |
| 216 | |
| 217 | # add host64514 to control plane for ping test |
| 218 | self.addLink( swCtl100, host64514 ) |
| 219 | self.addLink( swCtl100, root ) |
| 220 | self.addLink( swCtl100, root ) |
| 221 | self.addLink( swCtl100, root ) |
| 222 | |
| 223 | |
| 224 | def startsshd( host ): |
| 225 | "Start sshd on host" |
| 226 | info( '*** Starting sshd\n' ) |
| 227 | name, intf, ip = host.name, host.defaultIntf(), host.IP() |
| 228 | banner = '/tmp/%s.banner' % name |
| 229 | host.cmd( 'echo "Welcome to %s at %s" > %s' % ( name, ip, banner ) ) |
| 230 | host.cmd( '/usr/sbin/sshd -o "Banner %s"' % banner, '-o "UseDNS no"' ) |
| 231 | info( '***', host.name, 'is running sshd on', intf, 'at', ip, '\n' ) |
| 232 | |
| 233 | def startsshds ( hosts ): |
| 234 | for h in hosts: |
| 235 | startsshd( h ) |
| 236 | |
| 237 | def stopsshd(): |
| 238 | "Stop *all* sshd processes with a custom banner" |
| 239 | info( '*** Shutting down stale sshd/Banner processes ', |
| 240 | quietRun( "pkill -9 -f Banner" ), '\n' ) |
| 241 | |
| 242 | def startquagga( host, num, config_file ): |
| 243 | info( '*** Starting Quagga on %s\n' % host ) |
| 244 | host.cmd( "cd %s" % QUAGGA_CONFIG_DIR ) |
| 245 | zebra_cmd = \ |
| 246 | '%s/zebra -d -f ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid'\ |
| 247 | % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num ) |
| 248 | quagga_cmd = '%s/bgpd -d -f %s -z %s/zserv%s.api -i %s/bgpd%s.pid' \ |
| 249 | % ( QUAGGA_DIR, config_file, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num ) |
| 250 | |
| 251 | print zebra_cmd |
| 252 | print quagga_cmd |
| 253 | |
| 254 | host.cmd( zebra_cmd ) |
| 255 | host.cmd( quagga_cmd ) |
| 256 | |
| 257 | ''' |
| 258 | def startQuaggaFromTeston( host, num, config_file ): |
| 259 | global net |
| 260 | h = net.get( str( host ) ) |
| 261 | startquagga( h, num, config_file ) |
| 262 | ''' |
| 263 | |
| 264 | def startquaggahost5( host, num ): |
| 265 | info( '*** Starting Quagga on %s\n' % host ) |
| 266 | zebra_cmd = \ |
| 267 | '%s/zebra -d -f ./zebra.conf -z %s/zserv%s.api -i %s/zebra%s.pid' \ |
| 268 | % ( QUAGGA_DIR, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num ) |
| 269 | quagga_cmd = \ |
| 270 | '%s/bgpd -d -f ./as4quaggas/quagga%s.conf -z %s/zserv%s.api -i %s/bgpd%s.pid'\ |
| 271 | % ( QUAGGA_DIR, num, QUAGGA_RUN_DIR, num, QUAGGA_RUN_DIR, num ) |
| 272 | |
| 273 | host.cmd( zebra_cmd ) |
| 274 | host.cmd( quagga_cmd ) |
| 275 | |
| 276 | |
| 277 | def stopquagga(): |
| 278 | quietRun( 'sudo pkill -9 -f bgpd' ) |
| 279 | quietRun( 'sudo pkill -9 -f zebra' ) |
| 280 | |
| 281 | def sdn1net(): |
| 282 | topo = SDNTopo() |
| 283 | info( '*** Creating network\n' ) |
| 284 | |
| 285 | # global net |
| 286 | net = Mininet( topo = topo, controller = RemoteController ) |
| 287 | |
| 288 | |
| 289 | speaker1, speaker2, peer64514, peer64515, peer64516 = \ |
| 290 | net.get( 'speaker1', 'speaker2' , |
| 291 | 'peer64514', 'peer64515', 'peer64516' ) |
| 292 | |
| 293 | # Adding addresses to speakers' interface connected to sw24 |
| 294 | # for BGP peering |
| 295 | speaker1.setMAC( '00:00:00:00:00:01', 'speaker1-eth0' ) |
| 296 | speaker1.cmd( 'ip addr add 10.0.4.101/24 dev speaker1-eth0' ) |
| 297 | speaker1.cmd( 'ip addr add 10.0.5.101/24 dev speaker1-eth0' ) |
| 298 | speaker1.cmd( 'ip addr add 10.0.6.101/24 dev speaker1-eth0' ) |
| 299 | |
| 300 | speaker1.defaultIntf().setIP( '10.0.4.101/24' ) |
| 301 | speaker1.defaultIntf().setMAC( '00:00:00:00:00:01' ) |
| 302 | |
| 303 | speaker2.setMAC( '00:00:00:00:00:02', 'speaker2-eth0' ) |
| 304 | speaker2.cmd( 'ip addr add 10.0.14.101/24 dev speaker2-eth0' ) |
| 305 | speaker2.cmd( 'ip addr add 10.0.15.101/24 dev speaker2-eth0' ) |
| 306 | speaker2.cmd( 'ip addr add 10.0.16.101/24 dev speaker2-eth0' ) |
| 307 | |
| 308 | speaker2.defaultIntf().setIP( '10.0.14.101/24' ) |
| 309 | speaker2.defaultIntf().setMAC( '00:00:00:00:00:02' ) |
| 310 | |
| 311 | # Net has to be start after adding the above link |
| 312 | net.start() |
| 313 | |
| 314 | # setup configuration on the interface connected to switch |
| 315 | peer64514.cmd( "ifconfig peer64514-eth0 10.0.4.1 up" ) |
| 316 | peer64514.cmd( "ip addr add 10.0.14.1/24 dev peer64514-eth0" ) |
| 317 | peer64514.setMAC( '00:00:00:00:00:04', 'peer64514-eth0' ) |
| 318 | peer64515.cmd( "ifconfig peer64515-eth0 10.0.5.1 up" ) |
| 319 | peer64515.cmd( "ip addr add 10.0.15.1/24 dev peer64515-eth0" ) |
| 320 | peer64515.setMAC( '00:00:00:00:00:05', 'peer64515-eth0' ) |
| 321 | peer64516.cmd( "ifconfig peer64516-eth0 10.0.6.1 up" ) |
| 322 | peer64516.cmd( "ip addr add 10.0.16.1/24 dev peer64516-eth0" ) |
| 323 | peer64516.setMAC( '00:00:00:00:00:06', 'peer64516-eth0' ) |
| 324 | |
| 325 | # setup configuration on the interface connected to hosts |
| 326 | peer64514.setIP( "4.0.0.254", 8, "peer64514-eth1" ) |
| 327 | peer64514.setMAC( '00:00:00:00:00:44', 'peer64514-eth1' ) |
| 328 | peer64515.setIP( "5.0.0.254", 8, "peer64515-eth1" ) |
| 329 | peer64515.setMAC( '00:00:00:00:00:55', 'peer64515-eth1' ) |
| 330 | peer64516.setIP( "6.0.0.254", 8, "peer64516-eth1" ) |
| 331 | peer64516.setMAC( '00:00:00:00:00:66', 'peer64516-eth1' ) |
| 332 | |
| 333 | # enable forwarding on BGP peer hosts |
| 334 | peer64514.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' ) |
| 335 | peer64515.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' ) |
| 336 | peer64516.cmd( 'sysctl net.ipv4.conf.all.forwarding=1' ) |
| 337 | |
| 338 | # config interface for control plane connectivity |
| 339 | peer64514.setIP( "192.168.0.4", 24, "peer64514-eth2" ) |
| 340 | peer64515.setIP( "192.168.0.5", 24, "peer64515-eth2" ) |
| 341 | peer64516.setIP( "192.168.0.6", 24, "peer64516-eth2" ) |
| 342 | |
| 343 | # Setup hosts in each non-SDN AS |
| 344 | host64514, host64515, host64516 = \ |
| 345 | net.get( 'host64514', 'host64515', 'host64516' ) |
| 346 | host64514.cmd( 'ifconfig host64514-eth0 4.0.0.1 up' ) |
| 347 | host64514.cmd( 'ip route add default via 4.0.0.254' ) |
| 348 | host64514.setIP( '192.168.0.44', 24, 'host64514-eth1' ) # for control plane |
| 349 | host64515.cmd( 'ifconfig host64515-eth0 5.0.0.1 up' ) |
| 350 | host64515.cmd( 'ip route add default via 5.0.0.254' ) |
| 351 | host64516.cmd( 'ifconfig host64516-eth0 6.0.0.1 up' ) |
| 352 | host64516.cmd( 'ip route add default via 6.0.0.254' ) |
| 353 | |
| 354 | |
| 355 | # set up swCtl100 as a learning |
| 356 | swCtl100 = net.get( 'swCtl100' ) |
| 357 | swCtl100.cmd( 'ovs-vsctl set-controller swCtl100 none' ) |
| 358 | swCtl100.cmd( 'ovs-vsctl set-fail-mode swCtl100 standalone' ) |
| 359 | |
| 360 | # connect all switches to controller |
| 361 | ''' |
| 362 | onos1IP = "10.128.4.52" |
| 363 | onos2IP = "10.128.4.53" |
| 364 | onos3IP = "10.128.4.54" |
| 365 | for i in range ( 1, numSw + 1 ): |
| 366 | swX = net.get( 'sw%s' % ( i ) ) |
| 367 | swX.cmd( 'ovs-vsctl set-controller sw%s tcp:%s:6653 tcp:%s:6653 tcp:%s:6653' % ( i, onos1IP, onos2IP, onos3IP) ) |
| 368 | ''' |
| 369 | |
| 370 | # Start Quagga on border routers |
| 371 | startquagga( peer64514, 64514, 'quagga64514.conf' ) |
| 372 | startquagga( peer64515, 64515, 'quagga64515.conf' ) |
| 373 | startquagga( peer64516, 64516, 'quagga64516.conf' ) |
| 374 | |
| 375 | # start Quagga in SDN network |
| 376 | startquagga( speaker1, 64513, 'quagga-sdn.conf' ) |
| 377 | startquagga( speaker2, 64512, 'quagga-sdn-speaker2.conf' ) |
| 378 | |
| 379 | |
| 380 | root = net.get( 'root' ) |
| 381 | root.intf( 'root-eth0' ).setIP( '1.1.1.2/24' ) |
| 382 | root.cmd( 'ip addr add 192.168.0.100/24 dev root-eth0' ) |
| 383 | |
| 384 | root.intf( 'root-eth1' ).setIP( '1.1.1.4/24' ) |
| 385 | root.cmd( 'ip addr add 192.168.0.101/24 dev root-eth1' ) |
| 386 | |
| 387 | root.intf( 'root-eth2' ).setIP( '1.1.1.6/24' ) |
| 388 | root.cmd( 'ip addr add 192.168.0.102/24 dev root-eth2' ) |
| 389 | |
| 390 | speaker1.intf( 'speaker1-eth1' ).setIP( '1.1.1.1/24' ) |
| 391 | speaker2.intf( 'speaker2-eth1' ).setIP( '1.1.1.3/24' ) |
| 392 | |
| 393 | |
| 394 | stopsshd() |
| 395 | |
| 396 | hosts = [ peer64514, peer64515, peer64516, host64514]; |
| 397 | startsshds( hosts ) |
| 398 | |
| 399 | |
| 400 | ''' |
| 401 | forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', onos1IP ) |
| 402 | root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \ |
| 403 | -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, onos1IP ) ) |
| 404 | |
| 405 | forwarding2 = '%s:2000:%s:2000' % ( '1.1.1.4', onos2IP ) |
| 406 | root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \ |
| 407 | -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding2, onos2IP ) ) |
| 408 | |
| 409 | forwarding3 = '%s:2000:%s:2000' % ( '1.1.1.6', onos3IP ) |
| 410 | root.cmd( 'ssh -nNT -o "PasswordAuthentication no" \ |
| 411 | -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding3, onos3IP ) ) |
| 412 | ''' |
| 413 | CLI( net ) |
| 414 | |
| 415 | stopsshd() |
| 416 | stopquagga() |
| 417 | net.stop() |
| 418 | |
| 419 | |
| 420 | if __name__ == '__main__': |
| 421 | setLogLevel( 'debug' ) |
| 422 | sdn1net() |