關(guān)于Atrium項目的簡介
Atrium
- 2015年6月,開放網(wǎng)絡(luò)基金會(ONF)正式推出了一個自上而下嫁赏、完整的開源SDN實現(xiàn)平臺——Atrium其掂,旨在幫助網(wǎng)絡(luò)運營商更容易的部署SDN。
- 目前Atrium共有兩個版本(15/A和16/A)潦蝇,最新的16/A是2016年2月16號發(fā)布
- 16/A版本相對于15/A的改進在于
- 控制平面除了ONOS外款熬,還新加了對Opendaylight的支持
- Atrium Router with ONOS除了BGP外,還實驗性地加入了IGP(例如OSPF/ISIS)
- 新加了為數(shù)據(jù)中心服務(wù)的Leaf-Spine的網(wǎng)絡(luò)解決方案
- 本文關(guān)注的护蝶,是Atrium-ONOS 16/A的BGP speaker的測試環(huán)境搭建
Atrium-ONOS
- 該方案的目的华烟,就是讓ONOS和Quagga配合,使得openflow交換機表現(xiàn)的就像是一臺運行BGP協(xié)議的路由器
- 測試如下圖所示
- Atrium VM通過eth0和交換機建立OpenFlow通道持灰,進行OpenFlow協(xié)議報文的交互和流表的下發(fā)
- Quagga通過eth1(經(jīng)過安裝VM的服務(wù)器的物理網(wǎng)卡橋接)盔夜,和交換機的業(yè)務(wù)口相連
- 因為多個BGP peer的報文交互都要通過eth1進行,因此用子接口和vlan來區(qū)分堤魁,例如本例中喂链,vlan100表示peer1,untag表示peer2
Atrium虛擬機的安裝
準備工作
- 需要用到的設(shè)備:一臺Linux服務(wù)器
- 從Atrium的github官網(wǎng)下載的Atrium-16A的鏡像文件Atrium_ONOS_2016_A.ova
- 在服務(wù)器上啟動VirtualBox妥泉,并打開這個ova文件
- 可以看到啟動的VM擁有兩張網(wǎng)卡椭微,硬盤20G占用率100%
- 通過將VM的eth0/eth1置于兩個bridge上,使得VM可以通過服務(wù)器和外界通信
- VM的eth0配置管理IP(和默認網(wǎng)關(guān))盲链,就可以ssh登陸了蝇率,用戶名/密碼=admin/atriumonos
- VM的eth1不需要配置IP
VM硬盤擴容
- 如果不擴容迟杂,就無法創(chuàng)建文件,也就無法編譯運行了
- 對ova文件做如下操作,從20G擴容為30G
[centec@R1C2 atrium]$ VBoxManage clonehd Atrium_ONOS_2016_A-disk1.vmdk clone.vdi --format vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'vdi'. UUID: 6506c71a-c7d2-49c9-96bd-f4fe20e12f3f
[centec@R1C2 atrium]$
[centec@R1C2 atrium]$ VBoxManage modifyhd clone.vdi --resize 30720 #size in MB (30 GB) 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
-
virtualbox新建一個虛機本慕,刪除默認的硬盤控制器排拷,新加SCSI硬盤控制器,加載clone.vdi
啟動虛機后做如下操作
admin@atrium16A:~$ sudo swapoff /dev/sda5
admin@atrium16A:~$ sudo fdisk /dev/sda
Command (m for help): d
Partition number (1-5): 5
Command (m for help): d
Partition number (1-5): 2
Command (m for help): d
Selected partition 1
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62914559, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-62914559, default 62914559):
Using default value 62914559
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
admin@atrium16A:~$
admin@atrium16A:~$ sudo touch /forcefsck
admin@atrium16A:~$ sudo reboot
- 重啟后
admin@atrium16A:~$ sudo resize2fs /dev/sda1
resize2fs 1.42.9 (4-Feb-2014)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 2
The filesystem on /dev/sda1 is now 7864064 blocks long.
admin@atrium16A:~$
- 然后再次重啟锅尘,查看硬盤容量
admin@atrium16A:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 30G 19G 9.5G 67% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 2.0G 8.0K 2.0G 1% /dev
tmpfs 396M 428K 396M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 2.0G 0 2.0G 0% /run/shm
none 100M 0 100M 0% /run/user
網(wǎng)絡(luò)設(shè)置
- 在重啟前监氢,需要在Virtualbox中設(shè)置虛機的網(wǎng)絡(luò)
- 虛機加載后會有兩個網(wǎng)口,Quagga會使用adapter2(eth1)來和交換機通信
-
這個接口的混雜模式要設(shè)置成allow all藤违,以便接收帶vlan的報文
使用正確的cell
- 一個cell就是一個ONOS腳本運行環(huán)境參數(shù)的集合,本例使用默認的atrium_router
root@atrium16A:~# cell atrium_router
ONOS_CELL=atrium_router
OCI=127.0.0.1
OC1=127.0.0.1
OCN=127.0.0.1
ONOS_APPS=drivers,openflow,vrouter
ONOS_GROUP=admin
ONOS_NIC=127.0.0.*
ONOS_SCENARIOS=/home/admin/onos/tools/test/scenarios
ONOS_USER=admin
ONOS_WEB_PASS=rocks
ONOS_WEB_USER=onos
root@atrium16A:~#
Atrium環(huán)境的搭建
環(huán)境的搭建分為兩種浪腐,一種是設(shè)備全部用軟件模擬的,還有一種是使用物理設(shè)備
軟件模擬環(huán)境的搭建
修改network-cfg.json
- 文件位于目錄~/Applications/config/
- 該文件夾下已經(jīng)有兩個示例文件network-cfg.json.fabric.hw和network-cfg.json.fabric.mn
- 其中network-cfg.json.router.hw適用于物理交換機顿乒,network-cfg.json.router.mn適用于軟件交換機
- 本例中使用network-cfg.json.router.mn议街,復(fù)制后不需要做修改
admin@atrium16A:~/Applications/config$ cp network-cfg.json.router.mn network-cfg.json
admin@atrium16A:~/Applications/config$
admin@atrium16A:~/Applications/config$ more network-cfg.json
admin@atrium16A:~/Applications/config$ more network-cfg.json
{
"devices" : {
"of:0000000000000001" : {
"basic" : {
"driver" : "softrouter"
}
}
},
"ports" : {
"of:0000000000000001/1" : {
"interfaces" : [
{
"ips" : [ "192.168.10.101/24" ],
"mac" : "00:00:00:00:00:01",
"vlan" : "100"
}
]
},
"of:0000000000000001/2" : {
"interfaces" : [
{
"ips" : [ "192.168.20.101/24" ],
"mac" : "00:00:00:00:00:02"
}
]
}
},
"apps" : {
"org.onosproject.router" : {
"bgp" : {
"bgpSpeakers" : [
{
"connectPoint" : "of:0000000000000001/3",
"peers" : [
"192.168.10.1",
"192.168.20.1"
]
}
]
},
"router" : {
"controlPlaneConnectPoint" : "of:0000000000000001/3",
"ospfEnabled" : "true",
"pimEnabled" : "true"
}
}
}
}
admin@atrium16A:~/Applications/config$
- 可以看到設(shè)置涉及到openflow交換機的dpid,以及Quagga的BGP的配置
軟件模擬環(huán)境的啟動和驗證
- 啟動ONOS(后面稱終端A)
admin@atrium16A:~/Applications/config$ ok clean
Creating local cluster configs for IP 127.0.0.1...
Staging builtin apps...
Customizing apps to be auto-activated: drivers,openflow,vrouter...
Welcome to Open Network Operating System (ONOS)!
____ _ ______ ____
/ __ \/ |/ / __ \/ __/
/ /_/ / / /_/ /\ \
\____/_/|_/\____/___/
Documentation: wiki.onosproject.org
Tutorials: tutorials.onosproject.org
Mailing lists: lists.onosproject.org
Come help out! Find out how at: contribute.onosproject.org
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown ONOS.
onos>
- VM上新開一個終端(后面稱終端B)淆游,啟動route-test腳本并讓它保持在后臺運行
admin@atrium16A:~$ sudo ./router-test.py &
- 此時在終端A上傍睹,可以查看到softswitch已經(jīng)連上
onos> devices
id=of:0000000000000001, available=true, role=MASTER, type=SWITCH, mfr=Stanford University, Ericsson Research and CPqD Research, hw=OpenFlow 1.3 Reference Userspace Switch, sw=May 21 2015 08:32:26, serial=1, managementAddress=127.0.0.1, protocol=OF_13, driver=softrouter, name=of:0000000000000001, channelId=127.0.0.1:49415
onos>
- 在終端B上,可以看到啟動的mininet實例,登陸密碼默認都是sdnip
admin@atrium16A:~$ ps -ef | grep mininet
root 20033 20029 0 22:09 pts/12 00:00:00 bash --norc -is mininet:c0
root 20039 20029 0 22:09 pts/13 00:00:00 bash --norc -is mininet:host1 #peer1后面的主機
root 20043 20029 0 22:09 pts/14 00:00:00 bash --norc -is mininet:host2 #peer2后面的主機
root 20047 20029 0 22:09 pts/15 00:00:00 bash --norc -is mininet:peer1 # peer router 1,和qh建立BGP連接
root 20049 20029 0 22:09 pts/16 00:00:00 bash --norc -is mininet:peer2 # peer router 2,和qh建立BGP連接
root 20051 20029 0 22:09 pts/17 00:00:00 bash --norc -is mininet:qh # Quagga linux主機,提供IP/BGP協(xié)議棧服務(wù)
root 20055 20029 0 22:09 pts/18 00:00:00 bash --norc -is mininet:root1
root 20057 20029 0 22:09 pts/19 00:00:00 bash --norc -is mininet:router # 用CPqD交換機實例化出的router
admin 20324 16304 0 22:16 pts/1 00:00:00 grep --color=auto mininet
admin@atrium16A:~$
- 在終端B上犹菱,切換到qh,然后登陸Quagga并查看BGP的peer
admin@atrium16A:~$ ./mininet/util/m qh
ONOS_CELL=atrium_router
OCI=127.0.0.1
OC1=127.0.0.1
OCN=127.0.0.1
ONOS_APPS=drivers,openflow,vrouter
ONOS_GROUP=admin
ONOS_NIC=127.0.0.*
ONOS_SCENARIOS=/home/admin/onos/tools/test/scenarios
ONOS_USER=admin
ONOS_WEB_PASS=rocks
ONOS_WEB_USER=onos
root@atrium16A:~#
root@atrium16A:~#
root@atrium16A:~# telnet localhost 2605
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello, this is Quagga (version 0.99.24.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
User Access Verification
Password:
qh> en
qh#
qh# show ip bgp
qh# show ip bgp su
qh# show ip bgp summary
BGP router identifier 1.1.1.11, local AS number 65000
RIB entries 3, using 336 bytes of memory
Peers 2, using 9136 bytes of memory
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.10.1 4 65001 314 315 0 0 0 00:15:33 1
192.168.20.1 4 65002 313 316 0 0 0 00:15:33 1
Total number of neighbors 2
qh#
- 終端B切換到peer1,查看BGP路由,發(fā)現(xiàn)本端的1.0.0.0/16網(wǎng)段已經(jīng)宣告吮炕,并且學(xué)習(xí)到peer1那邊的2.0.0.0/16網(wǎng)段
root@atrium16A:~# ./mininet/util/m peer1
ONOS_CELL=atrium_router
OCI=127.0.0.1
OC1=127.0.0.1
OCN=127.0.0.1
ONOS_APPS=drivers,openflow,vrouter
ONOS_GROUP=admin
ONOS_NIC=127.0.0.*
ONOS_SCENARIOS=/home/admin/onos/tools/test/scenarios
ONOS_USER=admin
ONOS_WEB_PASS=rocks
ONOS_WEB_USER=onos
root@atrium16A:~#
root@atrium16A:~# telnet localhost 2605
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello, this is Quagga (version 0.99.24.1).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
User Access Verification
Password:
peer1> en
peer1# show ip bgp
peer1# show ip bgp
BGP table version is 0, local router ID is 1.0.0.254
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.0.0.0/16 0.0.0.0 0 32768 i
*> 2.0.0.0/16 192.168.10.101 0 65000 65002 i
Total number of prefixes 2
peer1#
- 終端B切換到host1腊脱,去ping host2
root@atrium16A:~# ./mininet/util/m host1
ONOS_CELL=atrium_router
OCI=127.0.0.1
OC1=127.0.0.1
OCN=127.0.0.1
ONOS_APPS=drivers,openflow,vrouter
ONOS_GROUP=admin
ONOS_NIC=127.0.0.*
ONOS_SCENARIOS=/home/admin/onos/tools/test/scenarios
ONOS_USER=admin
ONOS_WEB_PASS=rocks
ONOS_WEB_USER=onos
root@atrium16A:~#
root@atrium16A:~# ping 2.0.0.1
PING 2.0.0.1 (2.0.0.1) 56(84) bytes of data.
64 bytes from 2.0.0.1: icmp_req=1 ttl=62 time=0.776 ms
64 bytes from 2.0.0.1: icmp_req=2 ttl=62 time=0.678 ms
64 bytes from 2.0.0.1: icmp_req=3 ttl=62 time=0.493 ms
^C
--- 2.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.493/0.649/0.776/0.117 ms
root@atrium16A:~#
- 終端A上查看ONOS的流表
onos> flows
deviceId=of:0000000000000001, flowRuleCount=21
id=460000488fb8ff, state=ADDED, bytes=60, packets=1, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:2, ETH_TYPE:arp, VLAN_VID:-1], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER, OUTPUT:3], deferred=[], transition=None, cleared=false, metadata=null}
id=460000488fc51b, state=ADDED, bytes=60, packets=1, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:1, ETH_TYPE:arp, VLAN_VID:100], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER, OUTPUT:3], deferred=[], transition=None, cleared=false, metadata=null}
id=46000048906477, state=ADDED, bytes=0, packets=0, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:2, ETH_TYPE:ipv4, VLAN_VID:-1, IP_PROTO:89], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:3], deferred=[], transition=None, cleared=false, metadata=null}
id=46000048907093, state=ADDED, bytes=0, packets=0, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:1, ETH_TYPE:ipv4, VLAN_VID:100, IP_PROTO:89], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:3], deferred=[], transition=None, cleared=false, metadata=null}
id=460000b1f09f85, state=ADDED, bytes=50170, packets=613, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:1, ETH_DST:00:00:00:00:00:01, ETH_TYPE:ipv4, VLAN_VID:100, IPV4_DST:192.168.10.101/32], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:3], deferred=[], transition=None, cleared=false, metadata=null}
id=460000b1f09fc3, state=ADDED, bytes=59538, packets=748, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:3, ETH_SRC:00:00:00:00:00:01, ETH_TYPE:ipv4, VLAN_VID:100, IPV4_SRC:192.168.10.101/32], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:1], deferred=[], transition=None, cleared=false, metadata=null}
id=460000b1f51f3e, state=ADDED, bytes=56425, packets=746, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:2, ETH_DST:00:00:00:00:00:02, ETH_TYPE:ipv4, VLAN_VID:-1, IPV4_DST:192.168.20.101/32], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:3], deferred=[], transition=None, cleared=false, metadata=null}
id=460000b1f51f5d, state=ADDED, bytes=56427, packets=745, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:3, ETH_SRC:00:00:00:00:00:02, ETH_TYPE:ipv4, VLAN_VID:-1, IPV4_SRC:192.168.20.101/32], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:2], deferred=[], transition=None, cleared=false, metadata=null}
id=460000c7d63a3b, state=ADDED, bytes=60, packets=1, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:3, ETH_SRC:00:00:00:00:00:01, ETH_TYPE:arp, VLAN_VID:100, ARP_SPA:192.168.10.101], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER, OUTPUT:1], deferred=[], transition=None, cleared=false, metadata=null}
id=460000c7d653a9, state=ADDED, bytes=60, packets=1, duration=1115, priority=40001, tableId=0, appId=org.onosproject.cpredirect, payLoad=null, selector=[IN_PORT:3, ETH_SRC:00:00:00:00:00:02, ETH_TYPE:arp, VLAN_VID:-1, ARP_SPA:192.168.20.101], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER, OUTPUT:2], deferred=[], transition=None, cleared=false, metadata=null}
id=20000487f4dd5, state=ADDED, bytes=0, packets=0, duration=1115, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:lldp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, cleared=false, metadata=null}
id=20000487f5c1f, state=ADDED, bytes=0, packets=0, duration=1115, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:bddp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, cleared=false, metadata=null}
id=20000488eb5db, state=ADDED, bytes=0, packets=0, duration=1115, priority=40000, tableId=0, appId=org.onosproject.core, payLoad=null, selector=[ETH_TYPE:arp], treatment=DefaultTrafficTreatment{immediate=[OUTPUT:CONTROLLER], deferred=[], transition=None, cleared=false, metadata=null}
id=45000048262824, state=ADDED, bytes=0, packets=0, duration=1115, priority=32768, tableId=0, appId=org.onosproject.router, payLoad=null, selector=[IN_PORT:2, ETH_DST:00:00:00:00:00:02, ETH_TYPE:ipv4, VLAN_VID:-1], treatment=DefaultTrafficTreatment{immediate=[], deferred=[], transition=TABLE:1, cleared=false, metadata=null}
id=45000048262843, state=ADDED, bytes=0, packets=0, duration=1115, priority=32768, tableId=0, appId=org.onosproject.router, payLoad=null, selector=[IN_PORT:3, ETH_DST:00:00:00:00:00:02, ETH_TYPE:ipv4, VLAN_VID:-1], treatment=DefaultTrafficTreatment{immediate=[], deferred=[], transition=TABLE:1, cleared=false, metadata=null}
id=45000048263421, state=ADDED, bytes=0, packets=0, duration=1115, priority=32768, tableId=0, appId=org.onosproject.router, payLoad=null, selector=[IN_PORT:1, ETH_DST:00:00:00:00:00:01, ETH_TYPE:ipv4, VLAN_VID:100], treatment=DefaultTrafficTreatment{immediate=[VLAN_POP], deferred=[], transition=TABLE:1, cleared=false, metadata=null}
id=4500004826345f, state=ADDED, bytes=0, packets=0, duration=1115, priority=32768, tableId=0, appId=org.onosproject.router, payLoad=null, selector=[IN_PORT:3, ETH_DST:00:00:00:00:00:01, ETH_TYPE:ipv4, VLAN_VID:100], treatment=DefaultTrafficTreatment{immediate=[VLAN_POP], deferred=[], transition=TABLE:1, cleared=false, metadata=null}
id=4700004642a9bd, state=ADDED, bytes=2214, packets=29, duration=1115, priority=0, tableId=0, appId=org.onosproject.driver.SoftRouterPipeline, payLoad=null, selector=[], treatment=DefaultTrafficTreatment{immediate=[NOACTION], deferred=[], transition=None, cleared=false, metadata=null}
id=450000236433e5, state=ADDED, bytes=0, packets=0, duration=1108, priority=180, tableId=1, appId=org.onosproject.router, payLoad=null, selector=[ETH_TYPE:ipv4, IPV4_DST:1.0.0.0/16], treatment=DefaultTrafficTreatment{immediate=[ETH_SRC:00:00:00:00:00:01, ETH_DST:00:00:00:00:10:01, VLAN_PUSH:vlan, VLAN_ID:100, VLAN_PCP:0, OUTPUT:1], deferred=[], transition=None, cleared=false, metadata=null}
id=45000025190c84, state=ADDED, bytes=0, packets=0, duration=1108, priority=180, tableId=1, appId=org.onosproject.router, payLoad=null, selector=[ETH_TYPE:ipv4, IPV4_DST:2.0.0.0/16], treatment=DefaultTrafficTreatment{immediate=[ETH_SRC:00:00:00:00:00:02, ETH_DST:00:00:00:00:20:01, OUTPUT:2], deferred=[], transition=None, cleared=false, metadata=null}
id=4700004642a9be, state=ADDED, bytes=0, packets=0, duration=1115, priority=0, tableId=1, appId=org.onosproject.driver.SoftRouterPipeline, payLoad=null, selector=[], treatment=DefaultTrafficTreatment{immediate=[NOACTION], deferred=[], transition=None, cleared=false, metadata=null}
onos>
一些說明
- ONOS首先下發(fā)的默認流表,會保證peer1/peer2能夠和Quagga進行正常的ARP交互和BGP的連接建立
- Quagga通過BGP從其它AS學(xué)習(xí)到新的網(wǎng)段后(例如1.0.0.0/16)龙亲,會通告給ONOS陕凹,ONOS會下發(fā)對應(yīng)的流表,保證發(fā)往目的網(wǎng)段的流量會發(fā)往該路由通告的來源端口鳄炉,并做必要的報文編輯杜耙,例如
id=450000236433e5, state=ADDED, bytes=0, packets=0, duration=1108, priority=180, tableId=1, appId=org.onosproject.router, payLoad=null, selector=[ETH_TYPE:ipv4, IPV4_DST:1.0.0.0/16], treatment=DefaultTrafficTreatment{immediate=[ETH_SRC:00:00:00:00:00:01, ETH_DST:00:00:00:00:10:01, VLAN_PUSH:vlan, VLAN_ID:100, VLAN_PCP:0, OUTPUT:1], deferred=[], transition=None, cleared=false, metadata=null}
- 測試完畢后用腳本停止Quagga和其它的mininet實例
root@atrium16A:~# sudo ./router-cleanup.sh
硬件環(huán)境的啟動和驗證
環(huán)境搭建
- 將原來拓撲中的switch/peer/host用實際的物理設(shè)備代替
- 記錄連線關(guān)系
硬件交換機的設(shè)置
- 在硬件交換機上配置好控制器的信息(VM的IP和port:6653)
- 其它必要配置(例如支持的OpenFlow協(xié)議,需要支持1.3)
修改network-cfg.json
- 復(fù)制network-cfg.json.router.hw
admin@atrium16A:~/Applications/config$ cp network-cfg.json.router.hw network-cfg.json
- 對network-cfg.json文件對照交換機和連線進行修改(dpid/port/vlan)拂盯,mac不用修改
開發(fā)適用于硬件交換機的driver
- 已經(jīng)提交并被Atrium接收的driver文件佑女,放在下面的目錄
admin@atrium16A:~/onos/drivers/default/src/main/java/org/onosproject/driver/pipeline$
- 因為各家的交換機對于流表級數(shù)以及各級流表適用范圍存在差異,因此一般來說各款產(chǎn)品的driver都是不同的
- 例如新加支持盛科網(wǎng)絡(luò)V580交換機的CentecV580Pipeline.java放在該目錄下
修改onos-drivers.xml
- 該xml文件位于
admin@atrium16A:~/onos/drivers/default/src/main/resources$
- 這個文件描述了ONOS獲取交換機信息后谈竿,如何匹配進而選擇對應(yīng)的driver团驱,例如增加如下字段
<driver name="centec-V580" extends="default"
manufacturer=".*Centec.*" hwVersion=".*" swVersion="5.*">
<behaviour api="org.onosproject.net.behaviour.Pipeliner"
impl="org.onosproject.driver.pipeline.CentecV580Pipeline"/>
重新編譯
- 對driver做了改動后,需要重新編譯
admin@atrium16A:~/onos$ mvn install
- 如果編譯通過空凸,會看到如下顯示
......
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:12 min
[INFO] Finished at: 2016-07-08T15:19:51-07:00
[INFO] Final Memory: 185M/674M
[INFO] ------------------------------------------------------------------------
admin@atrium16A:~/onos$
啟動和驗證
- 啟動ONOS的步驟沒有變化
- ONOS上查看交換機信息和使用的Pipeline
onos> devices
id=of:0000001e080a5607, available=true, role=MASTER, type=SWITCH, mfr=2004-2016 Centec Networks Inc, hw=20Q4Z, sw=5.0.3xxx
onos>
onos> log:display | grep Pipeline
2016-07-11 23:59:57,258 | INFO | server boss #17 | OpenflowPipelineFactory | 167 - org.onosproject.onos-of-ctl - 1.5.0.SNAPSHOT | OpenFlow SSL disabled
2016-07-11 23:59:57,363 | INFO | ice-operations-6 | CentecV580Pipeline | 164 - org.onosproject.onos-drivers - 1.5.0.SNAPSHOT | Provisioned drop rules in both tables
onos>
- 啟動Quagga需要用另外一個腳本
admin@atrium16A:~$ sudo ./router-deploy.py &
- 啟動后可以查看mininet實例嚎花,少了host和peer,但是多了一個s1
admin@atrium16A:~$ ps -ef | grep mininet
root 23695 23691 0 14:10 pts/18 00:00:00 bash --norc -is mininet:c0
root 23701 23691 0 14:10 pts/19 00:00:00 bash --norc -is mininet:qh
root 23705 23691 0 14:10 pts/20 00:00:00 bash --norc -is mininet:root1
root 23710 23691 0 14:10 pts/21 00:00:00 bash --norc -is mininet:s1
admin 23818 21388 0 14:10 pts/8 00:00:00 grep --color=auto mininet
admin@atrium16A:~$
- 這個s1是一個虛擬的二層交換機呀洲,它將Quagga的qh-eth1和VM的eth1連接連接起來紊选,這樣Quagga就可以和外界做報文交互了
- 查看Quagga學(xué)習(xí)到的1.0.0.0/16和2.0.0.0/16網(wǎng)段有沒有在OpenFlow交換機上添加正確處理的流表啼止,如果有問題,就需要繼續(xù)調(diào)試pipeline文件了
- 最后兩邊的host能夠互相ping通兵罢,測試通過族壳。
本文首發(fā)于SDNLAB http://www.sdnlab.com/17472.html