MonitorModule

class MonitorModule(*args, **kwargs)[source]

Bases: ryu.base.app_manager.RyuApp

負責處理檢測網路

Methods

add_all_flow_to_table

所有封包從`from_table_id`轉送到`to_table_id`

check_all_topology_finish

close

teardown method.

context_iteritems

Return iterator over the (key, contxt class) of application context

control_and_except

設定flow table 0 過濾要特殊處理的封包

decode_opeld

echo_reply_handler

交換機回答控制器

encode_opeld

error_msg_handler

負責處理所有錯誤訊息

get_handlers

Returns a list of handlers for the specific event.

get_observers

handle_arp

handle_opeld

init_node

初始化交換機節點在拓樸

init_port_node

初始化交換機的port節點在拓樸

monitor

observe_event

packet_in_handler

非同步接收來自交換機OFPT_PACKET_IN message

port_desc_stats_reply_handler

reply OFPMP_PORT_DESCRIPTION,接收port的規格細節請看-openflow spec 1.5.1-7.2.1.1 Port Description Structures

port_stats_reply_handler

port 的統計狀態

register_handler

register_observer

reply_to_request

Send a reply for a synchronous request sent by send_request.

reward_cal

send_echo_request

控制器問交換機

send_event

Send the specified event to the RyuApp instance specified by name.

send_event_to_observers

Send the specified event to all observers of this RyuApp.

send_opeld_packet

# 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) .

send_port_desc_stats_request

跟交換機要port的規格資訊

send_port_stats_request

[summary]

send_request

Make a synchronous request.

set_flow_table_0_control_and_except

負責在交換機flow table 0 過濾需要特殊處理的封包給控制器

set_flow_table_1

設定flow table 1 的flow entry

set_flow_table_2

設定flow table 2 的flow entry

set_main_thread

Set self.main_thread so that stop() can terminate it.

start

Hook that is called after startup initialization is done.

stop

switch_features_handler

當交換機連線完成 OFPT_FEATURES_REPLY

table_1_change_update_package

如果交換機與HOST相連就需要上傳封包紀錄

unknow_route_ask_controller

flow table 2負責路由,當交換機未知此封包如何路由需要轉送給交換機

unobserve_event

unregister_handler

unregister_observer

unregister_observer_all_event

Attributes

ARP_Table

維護arp table

OFP_VERSIONS

A list of supported OpenFlow versions for this RyuApp.

OpELD_start_time

delta

echo_latency

monitor_each_opeld_extra_byte

每個封包額外大小 最大數值為:MTU-16(OPELD header size)

monitor_sent_opedl_packets

一次發送多少個封包

monitor_thread

monitor_wait_opeld_back

超過此時間的封包都會被monitor當作遺失

monitor_wait_update_path

set_weight_call_back_function

ARP_Table = {}

維護arp table

__init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

_flow_removed_handler(ev)[source]

處理flow entry刪除

_handle_package_analysis(ev)[source]

負責處理GLOBAL_VALUE.REWARD

_port_status_handler(ev)[source]

當port被刪除

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

control_and_except(datapath, **kwargs)[source]

設定flow table 0 過濾要特殊處理的封包

echo_reply_handler(ev)[source]

交換機回答控制器

error_msg_handler(ev)[source]

負責處理所有錯誤訊息

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.

init_node(datapath)[source]

初始化交換機節點在拓樸

init_port_node(datapath, port_no)[source]

初始化交換機的port節點在拓樸

monitor_each_opeld_extra_byte = 0

每個封包額外大小 最大數值為:MTU-16(OPELD header size)

monitor_sent_opedl_packets = 3

一次發送多少個封包

monitor_wait_opeld_back = 1.0

超過此時間的封包都會被monitor當作遺失

packet_in_handler(ev)[source]

非同步接收來自交換機OFPT_PACKET_IN message

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
port_stats_reply_handler(ev)[source]

port 的統計狀態

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_echo_request(datapath)[source]

控制器問交換機

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_port_desc_stats_request(datapath)[source]

跟交換機要port的規格資訊

send_port_stats_request(datapath)[source]

[summary]

Args:

datapath ([type]): [description]

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_flow_table_0_control_and_except(datapath)[source]

負責在交換機flow table 0 過濾需要特殊處理的封包給控制器

set_flow_table_1(datapath)[source]

設定flow table 1 的flow entry

set_flow_table_2(datapath)[source]

設定flow table 2 的flow entry

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.

switch_features_handler(ev)[source]

當交換機連線完成 OFPT_FEATURES_REPLY

table_1_change_update_package(datapath)[source]

如果交換機與HOST相連就需要上傳封包紀錄

unknow_route_ask_controller(datapath)[source]

flow table 2負責路由,當交換機未知此封包如何路由需要轉送給交換機