#NEWLINE# @ set_ev_handler ( ofp_event . EventOFPSwitchFeatures , CONFIG_DISPATCHER ) #NEWLINE# def switch_features_handler( self , ev ) : #NEWLINE# #INDENT# msg = ev . msg #NEWLINE# datapath = msg . datapath #NEWLINE# self . logger . debug ( 'switch features ev %s' , msg ) #NEWLINE# datapath . id = msg . datapath_id #NEWLINE# if ( datapath . ofproto . OFP_VERSION < 4 ) : #NEWLINE# #INDENT# datapath . ports = msg . ports #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# datapath . ports = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( datapath . ofproto . OFP_VERSION < 4 ) : #NEWLINE# #INDENT# self . logger . debug ( 'move onto main mode' ) #NEWLINE# ev . msg . datapath . set_state ( MAIN_DISPATCHER ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# port_desc = datapath . ofproto_parser . OFPPortDescStatsRequest ( datapath , 0 ) #NEWLINE# datapath . send_msg ( port_desc )