#NEWLINE# @ auth #NEWLINE# def _GET( self , * param , **params ) : #NEWLINE# #INDENT# host_id = self . chk_hostby1 ( param ) #NEWLINE# if ( host_id is None ) : #NEWLINE# #INDENT# return web . notfound ( ) #NEWLINE# #UNINDENT# host = findbyhost1 ( self . orm , host_id ) #NEWLINE# self . view . host_id = host_id #NEWLINE# excludes = { #NEWLINE# #INDENT# 'device' : [ '^peth' , '^virbr' , '^sit' , '^xenbr' , '^lo' , '^br' ] , #NEWLINE# 'ipaddr' : [ '^0\\.0\\.0\\.0$' , '^169\\.254\\.0\\.0$' ] , #NEWLINE# #UNINDENT# } #NEWLINE# devices = [ ] #NEWLINE# phydev_regex = re . compile ( '^eth[0-9]+' ) #NEWLINE# for ( dev , dev_info ) in get_ifconfig_info ( ) . iteritems ( ) : #NEWLINE# #INDENT# if phydev_regex . match ( dev ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# if ( dev_info [ 'ipaddr' ] is not None ) : #NEWLINE# #INDENT# devices . append ( dev ) #NEWLINE# net = NetworkAddress ( ( '%s/%s' % ( dev_info [ 'ipaddr' ] , dev_info [ 'mask' ] ) ) ) #NEWLINE# excludes [ 'ipaddr' ] . append ( net . network ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . view . devices = devices #NEWLINE# parser = Parser ( ) #NEWLINE# status = parser . do_status ( ) #NEWLINE# routes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( _k , _v ) in status . iteritems ( ) : #NEWLINE# #INDENT# for ( _k2 , _v2 ) in _v . iteritems ( ) : #NEWLINE# #INDENT# name = base64_encode ( ( '%s@%s' % ( _k2 , _k ) ) ) #NEWLINE# routes [ name ] = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# routes [ name ] [ 'name' ] = name #NEWLINE# routes [ name ] [ 'device' ] = _k #NEWLINE# routes [ name ] [ 'gateway' ] = _v2 [ 'gateway' ] #NEWLINE# routes [ name ] [ 'flags' ] = _v2 [ 'flags' ] #NEWLINE# routes [ name ] [ 'ref' ] = _v2 [ 'ref' ] #NEWLINE# routes [ name ] [ 'use' ] = net [ 'use' ] #NEWLINE# net = NetworkAddress ( _k2 ) #NEWLINE# routes [ name ] [ 'ipaddr' ] = net . ipaddr #NEWLINE# routes [ name ] [ 'netlen' ] = net . netlen #NEWLINE# routes [ name ] [ 'netmask' ] = net . netmask #NEWLINE# removable = True #NEWLINE# for ( _ex_key , _ex_val ) in excludes . iteritems ( ) : #NEWLINE# #INDENT# ex_regex = '|' . join ( _ex_val ) #NEWLINE# mm = re . search ( ex_regex , routes [ name ] [ _ex_key ] ) #NEWLINE# if mm : #NEWLINE# #INDENT# removable = False #NEWLINE# #UNINDENT# #UNINDENT# routes [ name ] [ 'removable' ] = removable #NEWLINE# #UNINDENT# #UNINDENT# self . view . routes = routes #NEWLINE# if self . is_mode_input ( ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return True