#NEWLINE# def conv_format( args , flags , d ) : #NEWLINE# #INDENT# params = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# params [ 'flags' ] = flags #NEWLINE# params [ 'next_hop' ] = '' #NEWLINE# params [ 'pre_line' ] = '' #NEWLINE# params [ 'post_line' ] = '' #NEWLINE# params [ 'prefix_num' ] = 1 #NEWLINE# params [ 'prefix_before' ] = '' #NEWLINE# params [ 'ts_before' ] = ( - 1 ) #NEWLINE# params [ 'mp_withdrawn' ] = None #NEWLINE# params [ 'mp_nlri' ] = None #NEWLINE# params [ 'api_grp_syntax' ] = 'attributes' #NEWLINE# params [ 'api_grp' ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( flags & FLAG_T [ 'API_GROUP_OLD' ] ) : #NEWLINE# #INDENT# params [ 'api_grp_syntax' ] = 'attribute' #NEWLINE# #UNINDENT# if ( ( flags & FLAG_T [ 'API' ] ) == 0 ) : #NEWLINE# #INDENT# print_conf_header ( args ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( flags & FLAG_T [ 'API_PROG' ] ) : #NEWLINE# #INDENT# print_api_prog_header ( ) #NEWLINE# params [ 'pre_line' ] = "'" #NEWLINE# params [ 'post_line' ] = "'," #NEWLINE# #UNINDENT# #UNINDENT# for m in d : #NEWLINE# #INDENT# m = m . mrt #NEWLINE# if m . err : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( ( m . type == MRT_T [ 'TABLE_DUMP_V2' ] ) or ( m . type == MRT_T [ 'TABLE_DUMP' ] ) ) : #NEWLINE# #INDENT# print_route_td ( args , params , m ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( m . type == MRT_T [ 'BGP4MP' ] ) or ( m . type == MRT_T [ 'BGP4MP_ET' ] ) ) : #NEWLINE# #INDENT# params [ 'flags' ] |= ( FLAG_T [ 'API' ] | FLAG_T [ 'API_GROUP' ] ) #NEWLINE# print_route_bgp4mp ( args , params , m ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( ( args [ 'flags' ] & FLAG_T [ 'API' ] ) == 0 ) : #NEWLINE# #INDENT# print_conf_footer ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( params [ 'flags' ] & FLAG_T [ 'API_GROUP' ] ) : #NEWLINE# #INDENT# print_api_grp ( args , params ) #NEWLINE# #UNINDENT# if ( params [ 'flags' ] & FLAG_T [ 'API_PROG' ] ) : #NEWLINE# #INDENT# print_api_prog_footer ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# time . sleep ( 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return 0