环境及软件版本说明
===
SN-Controller:
CPU: 2 Cores
RAM: 4GB
Disk: 32GB
Operating System: CentOS7 x86_64 1611(Linux 3.10.0-514) Infrastructure Server
IP1: 10.0.3.100/24 (Public Network)
IP2: 172.16.3.100/24 (SDN Network)
===
OpenDaylight: Boron
参考文献
L2 Switch架构
L2 Switch项目包含以下几个部分:
- Packet Handler (包处理) :对发往控制器的数据包进行解析并将数据包正确地转发
- Loop Remover (环路消除) :消除网络链路中的环路
- Arp Handler (ARP处理) :解析并处理ARP数据包
- Address Tracker (地址跟踪) :学习网络中的MAC或IP
- Host Tracker (主机跟踪) :跟踪网络中的主机位置
- L2 Switch Main (二层交换主要部件) :根据网络流量对每一个交换机下发流表
安装L2Switch模块
进入karaf控制台,进行以下的指令安装:
opendaylight-user@root>feature:install odl-l2switch-all
odl-l2switch-all包含以下几个模块:
- odl-l2switch-switch
- odl-l2switch-switch-rest
- odl-l2switch-switch-ui
- odl-l2switch-hosttracker
- odl-l2switch-addresstracker
- odl-l2switch-arphandler
- odl-l2switch-loopremover
- odl-l2switch-packethandler
功能体验
使用Mininet创建拓扑
Mininet虚拟机参数:
- HostName:mininet-vm1
- CPU: 2核
- RAM: 4GB
- IP1:10.0.3.101(Public Network)
- IP2: 172.16.3.101(SDN Network)
在mininet-vm1中创建包含3个交换机,每台交换机各连1台主机的拓扑,并产生网络流量(Ping):
mininet@mininet-vm1:~$ sudo mn --controller=remote,ip=10.0.3.100 --mac --topo=linear,3 --switch ovsk,protocols=OpenFlow13
mininet> pingall
此时在ODL的控制页面中的Topology标签中可以看到网络拓扑。
地址学习检测
在本地使用Rest调试工具(如Opera的RestMan)往ODL控制器发送以下Rest请求,按提示输入用户名(admin)和密码(admin)后,可以查看第一个交换机第一个端口所学习到的MAC和IP地址。
http://10.0.3.100:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/node-connector/openflow:1:1
可以看到响应部分的内容:
{
"node-connector": [
{
"id": "openflow:1:1",
"flow-node-inventory:state": {
"link-down": false,
"live": false,
"blocked": false
},
"flow-node-inventory:name": "s1-eth1",
"flow-node-inventory:maximum-speed": 0,
"flow-node-inventory:configuration": "",
"flow-node-inventory:supported": "",
"flow-node-inventory:peer-features": "",
"flow-node-inventory:port-number": "1",
"flow-node-inventory:advertised-features": "",
"flow-node-inventory:current-feature": "ten-gb-fd copper",
"flow-node-inventory:hardware-address": "12:ea:18:e9:ee:28",
"flow-node-inventory:current-speed": 10000000,
"opendaylight-port-statistics:flow-capable-node-connector-statistics": {
"transmit-drops": 0,
"receive-frame-error": 0,
"receive-drops": 0,
"receive-crc-error": 0,
"bytes<