#NEWLINE# def run( self , payload ) : #NEWLINE# #INDENT# ' Entry routing for this class ' #NEWLINE# if ( ( payload is None ) or ( payload == '' ) ) : #NEWLINE# #INDENT# raise InvalidNetConfRPC ( 'Invalid RPC message!!' ) #NEWLINE# #UNINDENT# reply = ET . Element ( 'reply' ) #NEWLINE# if ( not self . _is_connected ( ) ) : #NEWLINE# #INDENT# if ( not self . connect ( ) ) : #NEWLINE# #INDENT# reply . text = ( 'NetConf Session could not be established {%s}</error>' % str ( self ) ) #NEWLINE# return reply #NEWLINE# #UNINDENT# #UNINDENT# result = self . execute ( payload ) #NEWLINE# self . disconnect ( ) #NEWLINE# if ( result is None ) : #NEWLINE# #INDENT# logging . debug ( 'Failed to get reply' ) #NEWLINE# reply . text = 'Failed to get reply !!' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# xml = ET . fromstring ( result ) #NEWLINE# reply . append ( xml ) #NEWLINE# logging . debug ( ( 'RECIEVE: \n=====\n%s\n=====\n' % ET . tostring ( xml , pretty_print = True ) ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# reply . text = 'no data' #NEWLINE# logging . exception ( ( 'Faild to encode to XML: ' + str ( result ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return reply