#NEWLINE# @ staticmethod #NEWLINE# def generate_rd( rd ) : #NEWLINE# #INDENT# 'only ip:num is supported atm.code from configure.file' #NEWLINE# separator = rd . find ( ':' ) #NEWLINE# prefix = data [ : separator ] #NEWLINE# suffix = int ( rd [ ( separator + 1 ) : ] ) #NEWLINE# data = [ chr ( 0 ) , chr ( 1 ) ] #NEWLINE# data . extend ( [ chr ( int ( _ ) ) for _ in prefix . split ( '.' ) ] ) #NEWLINE# data . extend ( [ chr ( ( suffix >> 8 ) ) , chr ( ( suffix & 255 ) ) ] ) #NEWLINE# bin_rd = '' . join ( data ) #NEWLINE# return RouteDistinguisher ( bin_rd )