-
class
ryu.base.app_manager.
RyuApp
(*_args, **_kwargs) -
The base class for Ryu applications. Ryu应用程序的基类
RyuApp subclasses are instantiated after ryu-manager loaded all requested Ryu application modules.__init__ should call RyuApp.__init__ with the same arguments.It's illegal to send any events in __init__.
-
RyuApp子类实例化ryu-manager加载所有Ryu应用程序模块的请求__init__应该调用RyuApp.__init__带着一些参数。在__init__中发送一些事件是不合法的。
The instance attribute 'name' is the name of the class used for message routing among Ryu applications. (Cf. send_event)It's set to __class__.__name__ by RyuApp.__init__.It's discouraged for subclasses to override this.
-
实例属性“名称”是Ryu程序中用于消息发送的类的名称
-
-
OFP_VERSIONS
= None 设置Openflow版本
-
A list of supported OpenFlow versions for this RyuApp.The default is all versions supported by the framework.
-
列出该应用支持Openflow的版本。默认的是框架支持的所有版本。
Examples: 用法如下
OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION, ofproto_v1_2.OFP_VERSION]
If multiple Ryu applications are loaded in the system,the intersection of their OFP_VERSIONS is used.
-
如果在系统中加载多个应用,则使用交叉点版本
-
-
_CONTEXTS
= {} -
A dictionary to specify contexts which this Ryu application wants to use.Its key is a name of context and its value is an ordinary class which implements the context. The class is instantiated by app_manager and the instance is shared among RyuApp subclasses which has _CONTEXTS member with the same key. A RyuApp subclass can obtain a reference to the instance via its __init__'s kwargs as the following.
-
Ryu应用程序希望使用字典指定的上下文。关键是上下文的名字和值是一个普通类继承上下文。这个类被实例化通过app_manager和实例在众多RyuApp子类中共享包含_CONTEXTS member带有相同的key
-
一个RyuApp子类可以可以通过实例获得对实例的引用,如下所示
Example:
_CONTEXTS = { 'network': network.Network } def __init__(self, *args, *kwargs): self.network = kwargs['network']
-
_EVENTS
= [] -
-
A list of event classes which this RyuApp subclass would generate.This should be specified if and only if event classes are defined in a different python module from the RyuApp subclass is.
-
一系列事件类由RyuApp子类产生。这应该是指定的当且仅当事件类都从ryuapp类不同的Python模块定义
-
close
() -
teardown method.The method name, close, is chosen for python context manager
-
close()是拆卸方法。close是方法的名称,被Python长下文管理器选择使用
-
classmethod
context_iteritems
() -
Return iterator over the (key, contxt class) of application context
-
返回的迭代器在(关键,contxt类)应用上下文
-
reply_to_request
(req, rep) -
Send a reply for a synchronous request sent by send_request.The first argument(参数) should be an instance of EventRequestBase.The second argument should be an instance of EventReplyBase.
-
通过send_request发送同步请求回复。第一个参数应该是EventRequestBase的实例。第二个参数应该是eventreplybase实例。
-
send_event
(name, ev, state=None) -
Send the specified(指定的) event to the RyuApp instance(实例) specified by name.
-
发送指定的事件给RyuApp通过指定的名称实例化
-
send_event_to_observers
(ev, state=None) -
Send the specified event to all observers of this RyuApp.
-
发送指定的事件给RyuApp的监测者
-
send_request
(req) -
Make a synchronous(同步的) request.Set req.sync to True, send it to a Ryu application specified by req.dst, and block until receiving a reply.Returns the received reply.The argument should be an instance of EventRequestBase.
-
产生一个同步请求。设置req.sync为真,发送到一个指定Ryu应用通过req.dst,然后锁止知道接收到一个回复。返回接收到的回复。参数应该被EventRequestBase实例
-
start
() -
Hook that is called after startup initialization is done.
-
当开始初始化完成之后被调用
-
-
class
ryu.controller.dpset.
DPSet
(*args, **kwargs) -
DPSet application manages a set of switches (datapaths)connected to this controller.
-
dpset应用管理一组开关(数据通路)连接到该控制器。
-
get
(dp_id) -
This method returns the ryu.controller.controller.Datapathinstance for the given Datapath ID.
-
这个方法返回Datapath的ID给ryu.controller.controller.Datapathinstance
-
get_all
() -
This method returns a list of tuples which represents instances for switches connected to this controller.The tuple consists of a Datapath Id and an instance of ryu.controller.controller.Datapath. A return value looks like the following:
-
此方法返回表示连接到该控制器的交换机实例的元组列表。元组由一个数据通路的ID和ryu.controller.controller.datapath实例。返回值如下所示:
[ (dpid_A, Datapath_A), (dpid_B, Datapath_B), ... ] -
-
get_port
(dpid, port_no) -
This method returns the ryu.controller.dpset.PortState instance for the given Datapath ID and the port number.Raises ryu_exc.PortNotFound if no such a datapath connected tothis controller or no such a port exists.
-
此方法返回给定数据通路的ID和端口号的ryu.controller.dpset.portstate实例。提出了ryu_exc.portnotfound如果没有这样一个数据通路连接到该控制器或者没有这样一个端口的存在。
-
get_ports
(dpid) -
This method returns a list of ryu.controller.dpset.PortStateinstances for the given Datapath ID.Raises KeyError if no such a datapath connected to this controller.
-
如有翻译不到位的地方,欢迎留言提出帮忙改进。