MonitorModule¶
- class MonitorModule(*args, **kwargs)[source]¶
Bases:
ryu.base.app_manager.RyuApp負責處理檢測網路
Methods
所有封包從`from_table_id`轉送到`to_table_id`
check_all_topology_finishteardown method.
Return iterator over the (key, contxt class) of application context
設定flow table 0 過濾要特殊處理的封包
decode_opeld交換機回答控制器
encode_opeld負責處理所有錯誤訊息
Returns a list of handlers for the specific event.
get_observershandle_arphandle_opeld初始化交換機節點在拓樸
初始化交換機的port節點在拓樸
monitorobserve_event非同步接收來自交換機OFPT_PACKET_IN message
reply OFPMP_PORT_DESCRIPTION,接收port的規格細節請看-openflow spec 1.5.1-7.2.1.1 Port Description Structures
port 的統計狀態
register_handlerregister_observerSend a reply for a synchronous request sent by send_request.
reward_cal控制器問交換機
Send the specified event to the RyuApp instance specified by name.
Send the specified event to all observers of this RyuApp.
# NOTE Openflow Extend Link Detect(OpELD) # uint64_t datapath_id OF1.5 SPEC # uint32_t port_no OF1.5 SPEC # uint16_t eth_type=0X1105,or GLOBAL_VALUE.OpELD_EtherType # uint16_t: Sequence Number(SEQ) .
跟交換機要port的規格資訊
[summary]
Make a synchronous request.
負責在交換機flow table 0 過濾需要特殊處理的封包給控制器
設定flow table 1 的flow entry
設定flow table 2 的flow entry
Set self.main_thread so that stop() can terminate it.
Hook that is called after startup initialization is done.
stop當交換機連線完成 OFPT_FEATURES_REPLY
如果交換機與HOST相連就需要上傳封包紀錄
flow table 2負責路由,當交換機未知此封包如何路由需要轉送給交換機
unobserve_eventunregister_handlerunregister_observerunregister_observer_all_eventAttributes
維護arp table
OFP_VERSIONSA list of supported OpenFlow versions for this RyuApp.
OpELD_start_timedeltaecho_latency每個封包額外大小 最大數值為:
MTU-16(OPELD header size)一次發送多少個封包
monitor_thread超過此時間的封包都會被monitor當作遺失
monitor_wait_update_pathset_weight_call_back_function- ARP_Table = {}¶
維護arp table
- add_all_flow_to_table(datapath, from_table_id, to_table_id)[source]¶
所有封包從`from_table_id`轉送到`to_table_id`
- close()¶
teardown method. The method name, close, is chosen for python context manager
- classmethod context_iteritems()¶
Return iterator over the (key, contxt class) of application context
- get_handlers(ev, state=None)¶
Returns a list of handlers for the specific event.
- Parameters
ev – The event to handle.
state – The current state. (“dispatcher”) If None is given, returns all handlers for the event. Otherwise, returns only handlers that are interested in the specified state. The default is None.
- monitor_each_opeld_extra_byte = 0¶
每個封包額外大小 最大數值為:
MTU-16(OPELD header size)
- monitor_sent_opedl_packets = 3¶
一次發送多少個封包
- monitor_wait_opeld_back = 1.0¶
超過此時間的封包都會被monitor當作遺失
- port_desc_stats_reply_handler(ev)[source]¶
reply OFPMP_PORT_DESCRIPTION,接收port的規格細節請看-openflow spec 1.5.1-7.2.1.1 Port Description Structures
weight=0 +----+ 交換機 | | port +--------+ +--------+ |(1,None)| | (1,22) | +--------+ +--------+ | | +------+ weight=0
- 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_event(name, ev, state=None)¶
Send the specified event to the RyuApp instance specified by name.
- send_event_to_observers(ev, state=None)¶
Send the specified event to all observers of this RyuApp.
- send_opeld_packet(datapath, out_port, extra_byte=0, num_packets=1)[source]¶
# NOTE Openflow Extend Link Detect(OpELD) # uint64_t datapath_id OF1.5 SPEC # uint32_t port_no OF1.5 SPEC # uint16_t eth_type=0X1105,or GLOBAL_VALUE.OpELD_EtherType # uint16_t: Sequence Number(SEQ)
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + datapath_id(64bits) + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | port_no(32bits) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | eth_type(16bits) | SEQ(16bits) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- 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.
- set_main_thread(thread)¶
Set self.main_thread so that stop() can terminate it.
Only AppManager.instantiate_apps should call this function.
- start()¶
Hook that is called after startup initialization is done.