blob: 97f22282670c00ec3e7abec1c560ee3a908a2f29 [file] [log] [blame]
Jonathan Hartce97e5b2016-04-19 01:41:31 -07001#!/usr/bin/python
2
3from mininet.topo import Topo
4from mininet.net import Mininet
5from mininet.cli import CLI
6from mininet.log import setLogLevel, info
7from mininet.node import RemoteController, OVSSwitch
8from routinglib import BgpRouter
9
10class BgpRouterDeployTopo( Topo ):
11 "Sets up control plane components for BgpRouter deployment"
12
13 def __init__( self, *args, **kwargs ):
14 Topo.__init__( self, *args, **kwargs )
15 s1 = self.addSwitch('s1', dpid='0000000000000001')
16
17 sdnAs = 65000
18
19 # Set up BGP speakers
20 bgp1eth0 = { 'ipAddrs' : ['1.1.1.11/24'] }
21
22 bgp1eth1 = [
23 { 'vlan': 1,
24 'mac':'00:00:00:00:00:01',
25 'ipAddrs' : ['192.168.10.101/24'] },
26 { 'vlan': 2,
27 'mac':'00:00:00:00:00:02',
28 'ipAddrs' : ['192.168.20.101/24'] }
29 ]
30
31 bgp1Intfs = { 'bgp1-eth0' : bgp1eth0,
32 'bgp1-eth1' : bgp1eth1 }
33
34 neighbors = [{'address':'192.168.10.1', 'as':65001},
35 {'address':'192.168.20.1', 'as':65001},
36 {'address':'192.168.30.1', 'as':65002},
37 {'address':'192.168.40.1', 'as':65003},
38 {'address':'1.1.1.1', 'as':sdnAs, 'port': 2000}]
39
40 bgp1 = self.addHost( "bgp1", interfaces=bgp1Intfs, asNum=sdnAs,
41 neighbors=neighbors, routes=[], cls=BgpRouter)
42
43 root = self.addHost('root', ip='1.1.1.1/24', inNamespace=False)
44
45 self.addLink( bgp1, root )
46 self.addLink( bgp1, s1 )
47
48if __name__ == "__main__":
49 setLogLevel('debug')
50 topo = BgpRouterDeployTopo()
51
52 net = Mininet(topo=topo, controller=RemoteController, switch=OVSSwitch)
53
54 net.start()
55
56 CLI(net)
57
58 net.stop()
59
60 info("done\n")