Kunihiro Ishiguro
Committed by Pavlin Radoslavov

ONOS-639 SDN-IP tutorial script for IPv6

IPv6 netowrk is advertised.
IPv6 address is used for BGP peering.
Still using IPv4 address for ONOS peering.
*.json files are updated correspondingly.

Change-Id: I8fdac12d2d25b840dcadfb261667a9f98eb9f6be
1 +{
2 + "addresses" : [
3 + {
4 + "dpid" : "00:00:00:00:00:00:00:a1",
5 + "port" : "1",
6 + "ips" : ["2001:1::101/48"],
7 + "mac" : "00:00:00:00:00:01"
8 + },
9 + {
10 + "dpid" : "00:00:00:00:00:00:00:a2",
11 + "port" : "1",
12 + "ips" : ["2001:2::101/48"],
13 + "mac" : "00:00:00:00:00:01"
14 + },
15 + {
16 + "dpid" : "00:00:00:00:00:00:00:a5",
17 + "port" : "1",
18 + "ips" : ["2001:3::101/48"],
19 + "mac" : "00:00:00:00:00:01"
20 + },
21 + {
22 + "dpid" : "00:00:00:00:00:00:00:a6",
23 + "port" : "1",
24 + "ips" : ["2001:4::101/48"],
25 + "mac" : "00:00:00:00:00:01"
26 + }
27 + ]
28 +}
1 +{
2 + "hosts" : [
3 + { "mac": "00:00:00:00:00:01", "vlan": -1, "location": "of:00000000000000a3/1", "ip": "2001:1::101, 2001:2::101, 2001:3::101, 2001:4::101", "annotations": { "type": "bgpSpeaker" } },
4 + { "mac": "00:00:00:00:01:01", "vlan": -1, "location": "of:00000000000000a1/1", "ip": "2001:1::1", "annotations": { "type": "router" } },
5 + { "mac": "00:00:00:00:02:01", "vlan": -1, "location": "of:00000000000000a2/1", "ip": "2001:2::1", "annotations": { "type": "router" } },
6 + { "mac": "00:00:00:00:03:01", "vlan": -1, "location": "of:00000000000000a5/1", "ip": "2001:3::1", "annotations": { "type": "router" } },
7 + { "mac": "00:00:00:00:04:01", "vlan": -1, "location": "of:00000000000000a6/1", "ip": "2001:4::1", "annotations": { "type": "router" } }
8 + ]
9 +}
1 +!
2 +hostname bgp
3 +password sdnip
4 +!
5 +!
6 +router bgp 65000
7 + bgp router-id 10.10.10.1
8 + timers bgp 3 9
9 + !
10 + neighbor 2001:1::1 remote-as 65001
11 + neighbor 2001:1::1 ebgp-multihop
12 + neighbor 2001:1::1 timers connect 5
13 + neighbor 2001:1::1 advertisement-interval 5
14 + !
15 + neighbor 2001:2::1 remote-as 65002
16 + neighbor 2001:2::1 ebgp-multihop
17 + neighbor 2001:2::1 timers connect 5
18 + neighbor 2001:2::1 advertisement-interval 5
19 + !
20 + neighbor 2001:3::1 remote-as 65003
21 + neighbor 2001:3::1 ebgp-multihop
22 + neighbor 2001:3::1 timers connect 5
23 + neighbor 2001:3::1 advertisement-interval 5
24 + !
25 + neighbor 2001:4::1 remote-as 65004
26 + neighbor 2001:4::1 ebgp-multihop
27 + neighbor 2001:4::1 timers connect 5
28 + neighbor 2001:4::1 advertisement-interval 5
29 + !
30 + ! ONOS
31 + neighbor 10.10.10.2 remote-as 65000
32 + neighbor 10.10.10.2 port 2000
33 + neighbor 10.10.10.2 timers connect 5
34 + !
35 + ! IPv6
36 + !
37 + address-family ipv6
38 + neighbor 2001:1::1 activate
39 + neighbor 2001:2::1 activate
40 + neighbor 2001:3::1 activate
41 + neighbor 2001:4::1 activate
42 + neighbor 10.10.10.2 activate
43 + exit-address-family
44 +!
45 +log stdout
1 +! BGP configuration for r1
2 +!
3 +hostname r1
4 +password sdnip
5 +!
6 +router bgp 65001
7 + bgp router-id 10.0.1.1
8 + timers bgp 3 9
9 + neighbor 2001:1::101 remote-as 65000
10 + neighbor 2001:1::101 ebgp-multihop
11 + neighbor 2001:1::101 advertisement-interval 5
12 + neighbor 2001:1::101 timers connect 5
13 + neighbor 2001:1::101 route-map nexthop out
14 +!
15 + address-family ipv6
16 + network 2001:101::/48
17 + neighbor 2001:1::101 activate
18 + exit-address-family
19 +!
20 +route-map nexthop permit 10
21 + set ipv6 next-hop global 2001:1::1
22 +!
23 +log stdout
1 +! BGP configuration for r2
2 +!
3 +hostname r2
4 +password sdnip
5 +!
6 +router bgp 65002
7 + bgp router-id 10.0.2.1
8 + timers bgp 3 9
9 + neighbor 2001:2::101 remote-as 65000
10 + neighbor 2001:2::101 ebgp-multihop
11 + neighbor 2001:2::101 timers connect 5
12 + neighbor 2001:2::101 advertisement-interval 5
13 + neighbor 2001:2::101 route-map nexthop out
14 +!
15 + address-family ipv6
16 + network 2001:102::/48
17 + neighbor 2001:2::101 activate
18 + exit-address-family
19 +!
20 +route-map nexthop permit 10
21 + set ipv6 next-hop global 2001:2::1
22 +!
23 +log stdout
1 +! BGP configuration for r3
2 +!
3 +hostname r3
4 +password sdnip
5 +!
6 +router bgp 65003
7 + bgp router-id 10.0.3.1
8 + timers bgp 3 9
9 + neighbor 2001:3::101 remote-as 65000
10 + neighbor 2001:3::101 ebgp-multihop
11 + neighbor 2001:3::101 timers connect 5
12 + neighbor 2001:3::101 advertisement-interval 5
13 + neighbor 2001:3::101 route-map nexthop out
14 +!
15 + address-family ipv6
16 + network 2001:103::/48
17 + neighbor 2001:3::101 activate
18 + exit-address-family
19 +!
20 +route-map nexthop permit 10
21 + set ipv6 next-hop global 2001:3::1
22 +!
23 +log stdout
1 +! BGP configuration for r4
2 +!
3 +hostname r4
4 +password sdnip
5 +!
6 +router bgp 65004
7 + bgp router-id 10.0.4.1
8 + timers bgp 3 9
9 + neighbor 2001:4::101 remote-as 65000
10 + neighbor 2001:4::101 ebgp-multihop
11 + neighbor 2001:4::101 timers connect 5
12 + neighbor 2001:4::101 advertisement-interval 5
13 + neighbor 2001:4::101 route-map nexthop out
14 +!
15 + address-family ipv6
16 + !network 2001:104::/48
17 + neighbor 2001:4::101 activate
18 + exit-address-family
19 +!
20 +route-map nexthop permit 10
21 + set ipv6 next-hop global 2001:4::1
22 +!
23 +log stdout
1 +{
2 + "bgpPeers" : [
3 + {
4 + "attachmentDpid" : "00:00:00:00:00:00:00:a1",
5 + "attachmentPort" : "1",
6 + "ipAddress" : "2001:1::1"
7 + },
8 + {
9 + "attachmentDpid" : "00:00:00:00:00:00:00:a2",
10 + "attachmentPort" : "1",
11 + "ipAddress" : "2001:2::1"
12 + },
13 + {
14 + "attachmentDpid" : "00:00:00:00:00:00:00:a5",
15 + "attachmentPort" : "1",
16 + "ipAddress" : "2001:3::1"
17 + },
18 + {
19 + "attachmentDpid" : "00:00:00:00:00:00:00:a6",
20 + "attachmentPort" : "1",
21 + "ipAddress" : "2001:4::1"
22 + }
23 + ],
24 + "bgpSpeakers" : [
25 + {
26 + "name" : "bgp",
27 + "attachmentDpid" : "00:00:00:00:00:00:00:a3",
28 + "attachmentPort" : "1",
29 + "macAddress" : "00:00:00:00:00:01",
30 + "interfaceAddresses" : [
31 + {
32 + "interfaceDpid" : "00:00:00:00:00:00:00:a1",
33 + "interfacePort" : "1",
34 + "ipAddress" : "2001:1::101"
35 + },
36 + {
37 + "interfaceDpid" : "00:00:00:00:00:00:00:a2",
38 + "interfacePort" : "1",
39 + "ipAddress" : "2001:2::101"
40 + },
41 + {
42 + "interfaceDpid" : "00:00:00:00:00:00:00:a5",
43 + "interfacePort" : "1",
44 + "ipAddress" : "2001:3::101"
45 + },
46 + {
47 + "interfaceDpid" : "00:00:00:00:00:00:00:a6",
48 + "interfacePort" : "1",
49 + "ipAddress" : "2001:4::101"
50 + }
51 + ]
52 + }
53 + ]
54 +}
1 +! Configuration for zebra (NB: it is the same for all routers)
2 +!
3 +hostname zebra
4 +password sdnip
5 +log stdout
...@@ -9,12 +9,14 @@ from mininet.node import Host, RemoteController, OVSSwitch ...@@ -9,12 +9,14 @@ from mininet.node import Host, RemoteController, OVSSwitch
9 QUAGGA_DIR = '/usr/lib/quagga' 9 QUAGGA_DIR = '/usr/lib/quagga'
10 # Must exist and be owned by quagga user (quagga:quagga by default on Ubuntu) 10 # Must exist and be owned by quagga user (quagga:quagga by default on Ubuntu)
11 QUAGGA_RUN_DIR = '/var/run/quagga' 11 QUAGGA_RUN_DIR = '/var/run/quagga'
12 -CONFIG_DIR = 'configs' 12 +CONFIG_DIR = 'configs-ipv6'
13 13
14 class SdnIpHost(Host): 14 class SdnIpHost(Host):
15 def __init__(self, name, ip, route, *args, **kwargs): 15 def __init__(self, name, ip, route, *args, **kwargs):
16 Host.__init__(self, name, ip=ip, *args, **kwargs) 16 Host.__init__(self, name, ip=ip, *args, **kwargs)
17 17
18 + self.name = name
19 + self.ip = ip
18 self.route = route 20 self.route = route
19 21
20 def config(self, **kwargs): 22 def config(self, **kwargs):
...@@ -22,6 +24,7 @@ class SdnIpHost(Host): ...@@ -22,6 +24,7 @@ class SdnIpHost(Host):
22 24
23 debug("configuring route %s" % self.route) 25 debug("configuring route %s" % self.route)
24 26
27 + self.cmd('ip addr add %s dev %s-eth0' % (self.ip, self.name))
25 self.cmd('ip route add default via %s' % self.route) 28 self.cmd('ip route add default via %s' % self.route)
26 29
27 class Router(Host): 30 class Router(Host):
...@@ -84,8 +87,8 @@ class SdnIpTopo( Topo ): ...@@ -84,8 +87,8 @@ class SdnIpTopo( Topo ):
84 name = 'r%s' % i 87 name = 'r%s' % i
85 88
86 eth0 = { 'mac' : '00:00:00:00:0%s:01' % i, 89 eth0 = { 'mac' : '00:00:00:00:0%s:01' % i,
87 - 'ipAddrs' : ['10.0.%s.1/24' % i] } 90 + 'ipAddrs' : ['2001:%s::1/48' % i] }
88 - eth1 = { 'ipAddrs' : ['192.168.%s.254/24' % i] } 91 + eth1 = { 'ipAddrs' : ['2001:10%s::101/48' % i] }
89 intfs = { '%s-eth0' % name : eth0, 92 intfs = { '%s-eth0' % name : eth0,
90 '%s-eth1' % name : eth1 } 93 '%s-eth1' % name : eth1 }
91 94
...@@ -94,19 +97,19 @@ class SdnIpTopo( Topo ): ...@@ -94,19 +97,19 @@ class SdnIpTopo( Topo ):
94 router = self.addHost(name, cls=Router, quaggaConfFile=quaggaConf, 97 router = self.addHost(name, cls=Router, quaggaConfFile=quaggaConf,
95 zebraConfFile=zebraConf, intfDict=intfs) 98 zebraConfFile=zebraConf, intfDict=intfs)
96 99
97 - host = self.addHost('h%s' % i, cls=SdnIpHost, 100 + host = self.addHost('h%s' % i, cls=SdnIpHost,
98 - ip='192.168.%s.1/24' % i, 101 + ip='2001:10%s::1/48' % i,
99 - route='192.168.%s.254' % i) 102 + route='2001:10%s::101' % i)
100 103
101 self.addLink(router, attachmentSwitches[i-1]) 104 self.addLink(router, attachmentSwitches[i-1])
102 self.addLink(router, host) 105 self.addLink(router, host)
103 106
104 # Set up the internal BGP speaker 107 # Set up the internal BGP speaker
105 bgpEth0 = { 'mac':'00:00:00:00:00:01', 108 bgpEth0 = { 'mac':'00:00:00:00:00:01',
106 - 'ipAddrs' : ['10.0.1.101/24', 109 + 'ipAddrs' : ['2001:1::101/48',
107 - '10.0.2.101/24', 110 + '2001:2::101/48',
108 - '10.0.3.101/24', 111 + '2001:3::101/48',
109 - '10.0.4.101/24',] } 112 + '2001:4::101/48',] }
110 bgpEth1 = { 'ipAddrs' : ['10.10.10.1/24'] } 113 bgpEth1 = { 'ipAddrs' : ['10.10.10.1/24'] }
111 bgpIntfs = { 'bgp-eth0' : bgpEth0, 114 bgpIntfs = { 'bgp-eth0' : bgpEth0,
112 'bgp-eth1' : bgpEth1 } 115 'bgp-eth1' : bgpEth1 }
......