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
{
"addresses" : [
{
"dpid" : "00:00:00:00:00:00:00:a1",
"port" : "1",
"ips" : ["2001:1::101/48"],
"mac" : "00:00:00:00:00:01"
},
{
"dpid" : "00:00:00:00:00:00:00:a2",
"port" : "1",
"ips" : ["2001:2::101/48"],
"mac" : "00:00:00:00:00:01"
},
{
"dpid" : "00:00:00:00:00:00:00:a5",
"port" : "1",
"ips" : ["2001:3::101/48"],
"mac" : "00:00:00:00:00:01"
},
{
"dpid" : "00:00:00:00:00:00:00:a6",
"port" : "1",
"ips" : ["2001:4::101/48"],
"mac" : "00:00:00:00:00:01"
}
]
}
{
"hosts" : [
{ "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" } },
{ "mac": "00:00:00:00:01:01", "vlan": -1, "location": "of:00000000000000a1/1", "ip": "2001:1::1", "annotations": { "type": "router" } },
{ "mac": "00:00:00:00:02:01", "vlan": -1, "location": "of:00000000000000a2/1", "ip": "2001:2::1", "annotations": { "type": "router" } },
{ "mac": "00:00:00:00:03:01", "vlan": -1, "location": "of:00000000000000a5/1", "ip": "2001:3::1", "annotations": { "type": "router" } },
{ "mac": "00:00:00:00:04:01", "vlan": -1, "location": "of:00000000000000a6/1", "ip": "2001:4::1", "annotations": { "type": "router" } }
]
}
!
hostname bgp
password sdnip
!
!
router bgp 65000
bgp router-id 10.10.10.1
timers bgp 3 9
!
neighbor 2001:1::1 remote-as 65001
neighbor 2001:1::1 ebgp-multihop
neighbor 2001:1::1 timers connect 5
neighbor 2001:1::1 advertisement-interval 5
!
neighbor 2001:2::1 remote-as 65002
neighbor 2001:2::1 ebgp-multihop
neighbor 2001:2::1 timers connect 5
neighbor 2001:2::1 advertisement-interval 5
!
neighbor 2001:3::1 remote-as 65003
neighbor 2001:3::1 ebgp-multihop
neighbor 2001:3::1 timers connect 5
neighbor 2001:3::1 advertisement-interval 5
!
neighbor 2001:4::1 remote-as 65004
neighbor 2001:4::1 ebgp-multihop
neighbor 2001:4::1 timers connect 5
neighbor 2001:4::1 advertisement-interval 5
!
! ONOS
neighbor 10.10.10.2 remote-as 65000
neighbor 10.10.10.2 port 2000
neighbor 10.10.10.2 timers connect 5
!
! IPv6
!
address-family ipv6
neighbor 2001:1::1 activate
neighbor 2001:2::1 activate
neighbor 2001:3::1 activate
neighbor 2001:4::1 activate
neighbor 10.10.10.2 activate
exit-address-family
!
log stdout
! BGP configuration for r1
!
hostname r1
password sdnip
!
router bgp 65001
bgp router-id 10.0.1.1
timers bgp 3 9
neighbor 2001:1::101 remote-as 65000
neighbor 2001:1::101 ebgp-multihop
neighbor 2001:1::101 advertisement-interval 5
neighbor 2001:1::101 timers connect 5
neighbor 2001:1::101 route-map nexthop out
!
address-family ipv6
network 2001:101::/48
neighbor 2001:1::101 activate
exit-address-family
!
route-map nexthop permit 10
set ipv6 next-hop global 2001:1::1
!
log stdout
! BGP configuration for r2
!
hostname r2
password sdnip
!
router bgp 65002
bgp router-id 10.0.2.1
timers bgp 3 9
neighbor 2001:2::101 remote-as 65000
neighbor 2001:2::101 ebgp-multihop
neighbor 2001:2::101 timers connect 5
neighbor 2001:2::101 advertisement-interval 5
neighbor 2001:2::101 route-map nexthop out
!
address-family ipv6
network 2001:102::/48
neighbor 2001:2::101 activate
exit-address-family
!
route-map nexthop permit 10
set ipv6 next-hop global 2001:2::1
!
log stdout
! BGP configuration for r3
!
hostname r3
password sdnip
!
router bgp 65003
bgp router-id 10.0.3.1
timers bgp 3 9
neighbor 2001:3::101 remote-as 65000
neighbor 2001:3::101 ebgp-multihop
neighbor 2001:3::101 timers connect 5
neighbor 2001:3::101 advertisement-interval 5
neighbor 2001:3::101 route-map nexthop out
!
address-family ipv6
network 2001:103::/48
neighbor 2001:3::101 activate
exit-address-family
!
route-map nexthop permit 10
set ipv6 next-hop global 2001:3::1
!
log stdout
! BGP configuration for r4
!
hostname r4
password sdnip
!
router bgp 65004
bgp router-id 10.0.4.1
timers bgp 3 9
neighbor 2001:4::101 remote-as 65000
neighbor 2001:4::101 ebgp-multihop
neighbor 2001:4::101 timers connect 5
neighbor 2001:4::101 advertisement-interval 5
neighbor 2001:4::101 route-map nexthop out
!
address-family ipv6
!network 2001:104::/48
neighbor 2001:4::101 activate
exit-address-family
!
route-map nexthop permit 10
set ipv6 next-hop global 2001:4::1
!
log stdout
{
"bgpPeers" : [
{
"attachmentDpid" : "00:00:00:00:00:00:00:a1",
"attachmentPort" : "1",
"ipAddress" : "2001:1::1"
},
{
"attachmentDpid" : "00:00:00:00:00:00:00:a2",
"attachmentPort" : "1",
"ipAddress" : "2001:2::1"
},
{
"attachmentDpid" : "00:00:00:00:00:00:00:a5",
"attachmentPort" : "1",
"ipAddress" : "2001:3::1"
},
{
"attachmentDpid" : "00:00:00:00:00:00:00:a6",
"attachmentPort" : "1",
"ipAddress" : "2001:4::1"
}
],
"bgpSpeakers" : [
{
"name" : "bgp",
"attachmentDpid" : "00:00:00:00:00:00:00:a3",
"attachmentPort" : "1",
"macAddress" : "00:00:00:00:00:01",
"interfaceAddresses" : [
{
"interfaceDpid" : "00:00:00:00:00:00:00:a1",
"interfacePort" : "1",
"ipAddress" : "2001:1::101"
},
{
"interfaceDpid" : "00:00:00:00:00:00:00:a2",
"interfacePort" : "1",
"ipAddress" : "2001:2::101"
},
{
"interfaceDpid" : "00:00:00:00:00:00:00:a5",
"interfacePort" : "1",
"ipAddress" : "2001:3::101"
},
{
"interfaceDpid" : "00:00:00:00:00:00:00:a6",
"interfacePort" : "1",
"ipAddress" : "2001:4::101"
}
]
}
]
}
! Configuration for zebra (NB: it is the same for all routers)
!
hostname zebra
password sdnip
log stdout
......@@ -9,12 +9,14 @@ from mininet.node import Host, RemoteController, OVSSwitch
QUAGGA_DIR = '/usr/lib/quagga'
# Must exist and be owned by quagga user (quagga:quagga by default on Ubuntu)
QUAGGA_RUN_DIR = '/var/run/quagga'
CONFIG_DIR = 'configs'
CONFIG_DIR = 'configs-ipv6'
class SdnIpHost(Host):
def __init__(self, name, ip, route, *args, **kwargs):
Host.__init__(self, name, ip=ip, *args, **kwargs)
self.name = name
self.ip = ip
self.route = route
def config(self, **kwargs):
......@@ -22,6 +24,7 @@ class SdnIpHost(Host):
debug("configuring route %s" % self.route)
self.cmd('ip addr add %s dev %s-eth0' % (self.ip, self.name))
self.cmd('ip route add default via %s' % self.route)
class Router(Host):
......@@ -84,8 +87,8 @@ class SdnIpTopo( Topo ):
name = 'r%s' % i
eth0 = { 'mac' : '00:00:00:00:0%s:01' % i,
'ipAddrs' : ['10.0.%s.1/24' % i] }
eth1 = { 'ipAddrs' : ['192.168.%s.254/24' % i] }
'ipAddrs' : ['2001:%s::1/48' % i] }
eth1 = { 'ipAddrs' : ['2001:10%s::101/48' % i] }
intfs = { '%s-eth0' % name : eth0,
'%s-eth1' % name : eth1 }
......@@ -94,19 +97,19 @@ class SdnIpTopo( Topo ):
router = self.addHost(name, cls=Router, quaggaConfFile=quaggaConf,
zebraConfFile=zebraConf, intfDict=intfs)
host = self.addHost('h%s' % i, cls=SdnIpHost,
ip='192.168.%s.1/24' % i,
route='192.168.%s.254' % i)
host = self.addHost('h%s' % i, cls=SdnIpHost,
ip='2001:10%s::1/48' % i,
route='2001:10%s::101' % i)
self.addLink(router, attachmentSwitches[i-1])
self.addLink(router, host)
# Set up the internal BGP speaker
bgpEth0 = { 'mac':'00:00:00:00:00:01',
'ipAddrs' : ['10.0.1.101/24',
'10.0.2.101/24',
'10.0.3.101/24',
'10.0.4.101/24',] }
'ipAddrs' : ['2001:1::101/48',
'2001:2::101/48',
'2001:3::101/48',
'2001:4::101/48',] }
bgpEth1 = { 'ipAddrs' : ['10.10.10.1/24'] }
bgpIntfs = { 'bgp-eth0' : bgpEth0,
'bgp-eth1' : bgpEth1 }
......