def default_route(family=None):
 if ((family != 'inet') and (family != 'inet6') and (family is not None)):
  raise CommandExecutionError('Invalid address family {0}'.format(family))
 _routes = routes()
 default_route = {}
 if (__grains__['kernel'] == 'Linux'):
  default_route['inet'] = ['0.0.0.0', 'default']
  default_route['inet6'] = ['::/0', 'default']
 elif ((__grains__['os'] in ['FreeBSD', 'NetBSD', 'OpenBSD', 'MacOS', 'Darwin']) or (__grains__['kernel'] == 'SunOS')):
  default_route['inet'] = ['default']
  default_route['inet6'] = ['default']
 else:
  raise CommandExecutionError('Not yet supported on this platform')
 ret = []
 for route in _routes:
  if family:
   if (route['destination'] in default_route[family]):
    if ((__grains__['kernel'] == 'SunOS') and (route['addr_family'] != family)):
     continue
    ret.append(route)
  elif ((route['destination'] in default_route['inet']) or (route['destination'] in default_route['inet6'])):
   ret.append(route)
 return ret

def default_route ( family = None ) : if ( ( family != 'inet' ) and ( family != 'inet6' ) and ( family is not None ) ) : raise CommandExecutionError ( 'Invalid address family {0}' . format ( family ) ) _routes = routes ( ) default_route = { } if ( __grains__ [ 'kernel' ] == 'Linux' ) : default_route [ 'inet' ] = [ '0.0.0.0' , 'default' ] default_route [ 'inet6' ] = [ '::/0' , 'default' ] elif ( ( __grains__ [ 'os' ] in [ 'FreeBSD' , 'NetBSD' , 'OpenBSD' , 'MacOS' , 'Darwin' ] ) or ( __grains__ [ 'kernel' ] == 'SunOS' ) ) : default_route [ 'inet' ] = [ 'default' ] default_route [ 'inet6' ] = [ 'default' ] else : raise CommandExecutionError ( 'Not yet supported on this platform' ) ret = [ ] for route in _routes : if family : if ( route [ 'destination' ] in default_route [ family ] ) : if ( ( __grains__ [ 'kernel' ] == 'SunOS' ) and ( route [ 'addr_family' ] != family ) ) : continue ret . append ( route ) elif ( ( route [ 'destination' ] in default_route [ 'inet' ] ) or ( route [ 'destination' ] in default_route [ 'inet6' ] ) ) : ret . append ( route ) return ret
return default route(s) from routing table .