[root@host-10-10-18-131 ~]# docker search onos
[root@host-10-10-18-131 ~]# docker image list REPOSITORY TAG IMAGE ID CREATED SIZE maojianwei2020/onos_docker_cluster latest 2e66841945f7 19 months ago 425MB [root@host-10-10-18-131 ~]# docker run -t -d --name onos1 maojianwei2020/onos_docker_cluster 3940408f1d05b55bf4ff1f721c5b321c24da38a450463b641da59155f0f25b36 [root@host-10-10-18-131 ~]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3940408f1d05 maojianwei2020/onos_docker_cluster "./bin/onos-service …" 3 minutes ago Up 3 minutes 22/tcp, 6640/tcp, 6653/tcp, 8101/tcp, 8181/tcp, 9876/tcp onos1 [root@host-10-10-18-131 ~]# docker inspect --format '{{ .NetworkSettings.IPAddress }}' 3940408f1d05 172.17.0.2 [root@host-10-10-18-131 ~]#
在终端输入:ssh -p 8101 karaf@172.17.0.2
,使用密码:karaf登陆
4.激活openflow和fwd 使用ssh进入onos,在终端输入: app activate org.onosproject.openflow(启用openflow) 和 app activate org.onosproject.fwd(启用forward转发功能) 当然也可以在web图形界面启用,点击界面左上角的图标,选择Applications,搜索以上两个应用然后启用即可
docker run -i -t -p 0.0.0.0:6633:6633 -p 0.0.0.0:8181:8181 --name onos2 maojianwei2020/onos_docker_cluster
查看openflow端口是否打开: netstat -anput|grep 6633
mn --topo tree,2 --controller remote,ip=10.10.18.131,port=6633
mn --topo tree,2 --controller remote,ip=10.10.18.131,port=6633
ssh -p 8101 karaf@172.17.0.2
Accessing the CLI To access the CLI directly from a target machine, refer to these instructions. If you're deploying ONOS from a management machine, the onos command can be used to attach to a remote ONOS instance (i.e. without logging in first). For example, to access the CLI of an ONOS running on a target machine at 192.168.56.30: $ onos 192.168.56.30 Both Ctrl-D and logout exits the CLI.
onos> app -s onos> app download onos-appfwd onos> feature:list | grep onos-app onos> feature:install onos-apps-fwd onos> list | grep onos-* onos> app activate org.onosproject.openflow onos> app -a -s
onos> netcfg { "devices" : { }, "apps" : { "org.onosproject.provider.lldp" : { "suppression" : { "deviceTypes" : [ "ROADM", "OTN", "FIBER_SWITCH", "OPTICAL_AMPLIFIER" ], "annotation" : "{"no-lldp":null}" } } }, "ports" : { }, "links" : { }, "regions" : { }, "layouts" : { }, "hosts" : { } } onos>
遇见的问题 onos启动了,ui也能看到,但是mininet不能连接上controller, 如果是因为6633端口没起来,解决办法:在onos端输入 apps -a -s 看看里面有没有: org.onosproject.openflow 没有的话,输入如下命令启动openflow这个app: app activate org.onosproject.openflow
启动onos的openflow和fwd模块,否则mininet无法连接
onos> app activate org.onosproject.openflow Activated org.onosproject.openflow onos> app activate org.onosproject.fwd Activated org.onosproject.fwd onos> hosts onos> devices onos>
http://localhost:8181/onos/ui 用户名密码:onos/rocks
ONOS> commands apps -s apps -s -a app install/unistall/activate/deactivate
onos> log:exception-display io.netty.handler.codec.DecoderException: org.projectfloodlight.openflow.exceptions.OFParseError: Wrong length: Expected=40(40), got=32 at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:459)[110:io.netty.codec:4.1.27.Final] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)[110:io.netty.codec:4.1.27.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:646)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:581)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)[108:io.netty.transport:4.1.27.Final] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:460)[108:io.netty.transport:4.1.27.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)[106:io.netty.common:4.1.27.Final] at java.lang.Thread.run(Thread.java:748)[:1.8.0_192] Caused by: org.projectfloodlight.openflow.exceptions.OFParseError: Wrong length: Expected=40(40), got=32 at org.projectfloodlight.openflow.protocol.ver15.OFMeterFeaturesStatsReplyVer15$Reader.readFrom(OFMeterFeaturesStatsReplyVer15.java:281)[176:org.onosproject.openflowj:3.2.1.onos] at org.projectfloodlight.openflow.protocol.ver15.OFStatsReplyVer15$Reader.readFrom(OFStatsReplyVer15.java:94)[176:org.onosproject.openflowj:3.2.1.onos] at org.projectfloodlight.openflow.protocol.ver15.OFMessageVer15$Reader.readFrom(OFMessageVer15.java:54)[176:org.onosproject.openflowj:3.2.1.onos] at org.projectfloodlight.openflow.protocol.ver15.OFMessageVer15$Reader.readFrom(OFMessageVer15.java:39)[176:org.onosproject.openflowj:3.2.1.onos] at org.projectfloodlight.openflow.protocol.OFFactories$GenericReader.readFrom(OFFactories.java:81)[176:org.onosproject.openflowj:3.2.1.onos] at org.projectfloodlight.openflow.protocol.OFFactories$GenericReader.readFrom(OFFactories.java:53)[176:org.onosproject.openflowj:3.2.1.onos] at org.onosproject.openflow.controller.impl.OFMessageDecoder.decode(OFMessageDecoder.java:68)[182:org.onosproject.onos-protocols-openflow-ctl:1.15.0.SNAPSHOT] at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)[110:io.netty.codec:4.1.27.Final] at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)[110:io.netty.codec:4.1.27.Final] ... 15 more onos>
mn --topo tree,2 --switch ovs,protocols=OpenFlow13 --controller remote,ip=10.10.18.131,port=6633
「ONOS x Mininet」从0开始搭建环境 _
Running the published Docker ONOS images in a Cluster (OUTDATED)
https://wiki.onosproject.org/pages/viewpage.action?pageId=3444271