#NEWLINE# def _find_capable_switch( self , tree ) : #NEWLINE# #INDENT# capable_switch = None #NEWLINE# for element in tree : #NEWLINE# #INDENT# ( ns , tag ) = get_ns_tag ( element . tag ) #NEWLINE# if ( tag != ofc_consts . CAPABLE_SWITCH ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# assert ( capable_switch is None ) #NEWLINE# capable_switch = element #NEWLINE# if ( not self . version ) : #NEWLINE# #INDENT# versions = [ ( version , ns_ ) for ( version , ns_ ) in of_config . OFCONFIG_YANG_NAMESPACES . items ( ) if ( ns == ns_ ) ] #NEWLINE# if versions : #NEWLINE# #INDENT# assert ( len ( versions ) == 1 ) #NEWLINE# version = versions [ 0 ] #NEWLINE# ( self . version , self . namespace ) = version #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( not capable_switch ) : #NEWLINE# #INDENT# raise OFConfigCapableSwitchNotFound ( ) #NEWLINE# #UNINDENT# return capable_switch