The Road to Ryu: Hi Ryu
生活随笔
收集整理的這篇文章主要介紹了
The Road to Ryu: Hi Ryu
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
參考:
ryu入門教程
ryu
ryu/ryu Structure
-ryu/ryuappbasecmdcontribcontrollerlibofprotoservicesteststopologyryu/ryu/app
基于ryu控制器開發的app,內含ryu的圖形界面、北向防火墻、北向QoS、簡易L2交換機、L3路由器等。
ryu/ryu/base
內含app_manager.py腳本,用于加載ryu應用程序,接受從APP發送過來的信息,同時也完成消息的路由。
定義了兩大基類:RyuApp和AppManager。RyuApp定義了App的基本屬性,AppManager則定義了用于管理多個App的方法和屬性。
ryu/ryu/controller
該文件夾中含有許多關鍵的ryu源碼文件,這里提一下controller.py,該文件中含有兩個十分重要的類:
class OpenFlowController(object)class Datapath(ofproto_protocol.ProtocolDesc)其中類OpenFlowController定義了構建一個控制器的基本方法和屬性,DataPath是用于描述OpenFlow控制器和交換機是如何連接的類:
A class to describe an OpenFlow switch connected to this controller.An instance has the following attributes... tabularcolumns:: |l|L|==================================== ======================================Attribute Description==================================== ======================================id 64-bit OpenFlow Datapath ID.Only available forryu.controller.handler.MAIN_DISPATCHERphase.ofproto A module which exports OpenFlowdefinitions, mainly constants appearedin the specification, for thenegotiated OpenFlow version. Forexample, ryu.ofproto.ofproto_v1_0 forOpenFlow 1.0.ofproto_parser A module which exports OpenFlow wiremessage encoder and decoder for thenegotiated OpenFlow version.For example,ryu.ofproto.ofproto_v1_0_parserfor OpenFlow 1.0.ofproto_parser.OFPxxxx(datapath,...) A callable to prepare an OpenFlowmessage for the given switch. It canbe sent with Datapath.send_msg later.xxxx is a name of the message. Forexample OFPFlowMod for flow-modmessage. Arguemnts depend on themessage.set_xid(self, msg) Generate an OpenFlow XID and put itin msg.xid.send_msg(self, msg) Queue an OpenFlow message to send tothe corresponding switch. If msg.xidis None, set_xid is automaticallycalled on the message before queueing.send_packet_out deprecatedsend_flow_mod deprecatedsend_flow_del deprecatedsend_delete_all_flows deprecatedsend_barrier Queue an OpenFlow barrier message tosend to the switch.send_nxt_set_flow_format deprecatedis_reserved_port deprecated==================================== ======================================ryu/ryu/cmd
定義了ryu的命令系統。
ryu/ryu/contrib
社區貢獻者的代碼。
ryu/ryu/lib
該目錄下定義了一些數據報的格式和數據結構,及諸多網絡協議。
ryu/ryu/ofproto
該目錄下的文件分為兩類,一類定義協議的數據結構,另外一類用于協議報文解析。
ryu/ryu/services
完成了bgp、vrrp協議及ovsdb的實現。
ryu/ryu/tests
用于測試。
ryu/ryu/topology
定義了自定義拓撲文件中需要的一些模塊和方法,其中的關鍵文件是switches.py,完成了對一整套交換機處理流程的定義。
Hi Ryu
Env:
Mac OS X.
0.pre:
python-eventletpython-routespython-webobpython-paramiko1.install it:
git clone git://github.com/osrg/ryu.git cd ryu sudo pip3 install -r tools/pip-requires sudo python setup.py install2.執行:
ryu-manager simple_switch.py2017/2/29
總結
以上是生活随笔為你收集整理的The Road to Ryu: Hi Ryu的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis pagehelper实现
- 下一篇: 【Redis】Redis介绍与Redis