启动编译好的ONOS并连接OpenFlow交换机
centec@centec:/opt$ sudo /opt/onos/bin/onos-service start
karaf: JAVA_HOME not set; results may vary
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>
onos>
onos> devices
id=of:0000001e080a6101, available=true, local-status=connected 1m40s ago, role=MASTER, type=SWITCH, mfr=2004-2017 Centec Networks Inc, hw=32X2Q, sw=5.1.8.1, serial=E135GD155006, driver=default, channelId=10.10.33.220:60110, managementAddress=10.10.33.220, protocol=OF_13
使用REST API添加一个meter
- POST添加meter的时候,是不需要指定meter id,自动从可用的最小值开始分
- 确认交换机上已经添加成功
Switch# ovs-ofctl dump-meters br0 -O openflow13
OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
meter=1 kbps burst bands=type=drop rate=50000 burst_size=1048
- 此时出现了第一个问题:查看log发现添加meter后,持续打印
onos> log:tail
...
2018-04-24 08:36:25,524 | ERROR | ew I/O worker #2 | OFChannelHandler | 174 - org.onosproject.onos-protocols-openflow-ctl - 1.10.8 | OFMeterModFailedErrorMsgVer13(xid=1, code=METER_EXISTS, data=OFMeterModVer13(xid=1, command=0, flags=5, meterId=1, meters=[OFMeterBandDropVer13(rate=50000, burstSize=1048)])) from switch org.onosproject.driver.handshaker.DefaultSwitchHandshaker [/10.10.33.220:60110 DPID[00:00:00:1e:08:0a:61:01]] in state ACTIVE
2018-04-24 08:36:25,525 | WARN | vent-error-msg-0 | OpenFlowRuleProvider | 177 - org.onosproject.onos-providers-openflow-flow - 1.10.8 | Received error message OFMeterModFailedErrorMsgVer13(xid=1, code=METER_EXISTS, data=OFMeterModVer13(xid=1, command=0, flags=5, meterId=1, meters=[OFMeterBandDropVer13(rate=50000, burstSize=1048)])) from 00:00:00:1e:08:0a:61:01
2018-04-24 08:36:35,614 | ERROR | ew I/O worker #2 | OFChannelHandler | 174 - org.onosproject.onos-protocols-openflow-ctl - 1.10.8 | OFMeterModFailedErrorMsgVer13(xid=1, code=METER_EXISTS, data=OFMeterModVer13(xid=1, command=0, flags=5, meterId=1, meters=[OFMeterBandDropVer13(rate=50000, burstSize=1048)])) from switch org.onosproject.driver.handshaker.DefaultSwitchHandshaker [/10.10.33.220:60110 DPID[00:00:00:1e:08:0a:61:01]] in state ACTIVE
2018-04-24 08:36:35,614 | WARN | vent-error-msg-0 | OpenFlowRuleProvider | 177 - org.onosproject.onos-providers-openflow-flow - 1.10.8 | Received error message OFMeterModFailedErrorMsgVer13(xid=1, code=METER_EXISTS, data=OFMeterModVer13(xid=1, command=0, flags=5, meterId=1, meters=[OFMeterBandDropVer13(rate=50000, burstSize=1048)])) from 00:00:00:1e:08:0a:61:01
...
-
从报文上看,会反复进行modify和add
modify操作
使用REST API删除刚刚添加的meter
image.pngDELETE删除meter的时候,需要指定meter_id
- 从交换机上看,meter并没有被删除
Switch# ovs-ofctl dump-meters br0 -O openflow13
OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
meter=1 kbps burst bands=type=drop rate=50000 burst_size=1048
- 从交换机的debug的log来看,meter被先删后加
OFPT_METER_MOD (OF1.3) (xid=0x1): DEL meter=1 bands=
OFPST_METER request (OF1.3) (xid=0x0): meter=4294967295
OFPST_METER reply (OF1.3) (xid=0x0):
OFPT_METER_MOD (OF1.3) (xid=0x1): ADD meter=1 kbps burst bands=type=drop rate=50000 burst_size=1048
使用REST API查看当前的meter
image.png- ONOS认为meter已经被删除了,实际上又被加回来了
- 这个应该是ONOS的bug,具体原因需要分享ONOS的源码了
- 后面升级ONOS到1.12版本,发现这个bug已经被fix了
网友评论