Exemplo n.º 1
0
def main ():
	options = docopt.docopt(usage, help=False)

	major = int(sys.version[0])
	minor = int(sys.version[2])

	if major != 2 or minor < 5:
		sys.exit('This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)')

	if options["--version"]:
		print 'ExaBGP : %s' % version
		print 'Python : %s' % sys.version.replace('\n',' ')
		print 'Uname  : %s' % platform.version()
		sys.exit(0)

	if options["--folder"]:
		folder = os.path.realpath(os.path.normpath(options["--folder"]))
	elif os.environ.get('ETC',None):
		folder = os.path.join(os.path.realpath(os.path.normpath(os.environ.get('ETC','etc'))),'exabgp')
	elif sys.argv[0].endswith('/bin/exabgp'):
		folder = sys.argv[0][:-len('/bin/exabgp')] + '/etc/exabgp'
	elif sys.argv[0].endswith('/sbin/exabgp'):
		folder = sys.argv[0][:-len('/sbin/exabgp')] + '/etc/exabgp'
	else:
		folder = '/etc/exabgp'

	if not os.environ.get('ETC',''):
		os.environ['ETC'] = folder

	envfile = 'exabgp.env' if not options["--env"] else options["--env"]
	if not envfile.startswith('/'):
		envfile = '%s/%s' % (folder, envfile)

	from exabgp.configuration.setup import environment

	if options["--decode"]:
		decode = ''.join(options["--decode"]).replace(':','').replace(' ','')
		if not is_hex(decode):
			print usage
			print 'Environment values are:\n' + '\n'.join(' - %s' % _ for _ in environment.default())
			print ""
			print "The BGP message must be an hexadecimal string."
			print ""
			print "All colons or spaces are ignored, for example:"
			print ""
			print "  --decode 001E0200000007900F0003000101"
			print "  --decode 001E:02:0000:0007:900F:0003:0001:01"
			print "  --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF001E0200000007900F0003000101"
			print "  --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01"
			print "  --decode 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 001E02 00000007900F0003000101'"
			sys.exit(1)
	else:
		decode = ''

	try:
		env = environment.setup(envfile)
	except environment.Error,exc:
		print usage
		print '\nconfiguration issue,', str(exc)
		sys.exit(1)
Exemplo n.º 2
0
Arquivo: bgp.py Projeto: xw2060/exabgp
def main ():
	options = docopt.docopt(usage, help=False)

	major = int(sys.version[0])
	minor = int(sys.version[2])

	if major != 2 or minor < 5:
		sys.exit('This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)')

	if options["--version"]:
		print 'ExaBGP : %s' % version
		print 'Python : %s' % sys.version.replace('\n',' ')
		print 'Uname  : %s' % platform.version()
		sys.exit(0)

	if options["--folder"]:
		folder = os.path.realpath(os.path.normpath(options["--folder"]))
	elif os.environ.get('ETC',None):
		folder = os.path.join(os.path.realpath(os.path.normpath(os.environ.get('ETC','etc'))),'exabgp')
	elif sys.argv[0] == '/usr/local/bin/exabgp':
		folder = '/usr/local/etc/exabgp'
	else:
		folder = '/etc/exabgp'

	if not os.environ.get('ETC',''):
		os.environ['ETC'] = folder

	envfile = 'exabgp.env' if not options["--env"] else options["--env"]
	if not envfile.startswith('/'):
		envfile = '%s/%s' % (folder, envfile)

	from exabgp.configuration.setup import environment

	if options["--decode"]:
		decode = ''.join(options["--decode"]).replace(':','').replace(' ','')
		if not is_hex(decode):
			print usage
			print 'Environment values are:\n' + '\n'.join(' - %s' % _ for _ in environment.default())
			print ""
			print "The BGP message must be an hexadecimal string."
			print ""
			print "All colons or spaces are ignored, for example:"
			print ""
			print "  --decode 001E0200000007900F0003000101"
			print "  --decode 001E:02:0000:0007:900F:0003:0001:01"
			print "  --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF001E0200000007900F0003000101"
			print "  --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01"
			print "  --decode 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 001E02 00000007900F0003000101'"
			sys.exit(1)
	else:
		decode = ''

	try:
		env = environment.setup(envfile)
	except environment.Error,exc:
		print usage
		print '\nconfiguration issue,', str(exc)
		sys.exit(1)
Exemplo n.º 3
0
def main():
    options = docopt.docopt(usage, help=False)

    major = int(sys.version[0])
    minor = int(sys.version[2])

    if major != 2 or minor < 5:
        sys.exit(
            'This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)'
        )

    if options["--version"]:
        print 'ExaBGP : %s' % version
        print 'Python : %s' % sys.version.replace('\n', ' ')
        print 'Uname  : %s' % ' '.join(platform.uname()[:5])
        sys.exit(0)

    if options["--folder"]:
        folder = os.path.realpath(os.path.normpath(options["--folder"]))
    elif sys.argv[0].endswith('/bin/exabgp'):
        folder = sys.argv[0][:-len('/bin/exabgp')] + '/etc/exabgp'
    elif sys.argv[0].endswith('/sbin/exabgp'):
        folder = sys.argv[0][:-len('/sbin/exabgp')] + '/etc/exabgp'
    else:
        folder = '/etc/exabgp'

    os.environ['EXABGP_ETC'] = folder  # This is not most pretty

    if options["--run"]:
        sys.argv = sys.argv[sys.argv.index('--run') + 1:]
        if sys.argv[0] == 'healthcheck':
            from exabgp.application import run_healthcheck
            run_healthcheck()
        elif sys.argv[0] == 'cli':
            from exabgp.application import run_cli
            run_cli()
        else:
            print(usage)
            sys.exit(0)
        return

    envfile = 'exabgp.env' if not options["--env"] else options["--env"]
    if not envfile.startswith('/'):
        envfile = '%s/%s' % (folder, envfile)

    from exabgp.configuration.setup import environment

    try:
        env = environment.setup(envfile)
    except environment.Error, exc:
        print usage
        print '\nconfiguration issue,', str(exc)
        sys.exit(1)
Exemplo n.º 4
0
def main ():
	options = docopt.docopt(usage, help=False)

	major = int(sys.version[0])
	minor = int(sys.version[2])

	if major != 2 or minor < 5:
		sys.exit('This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)')

	if options["--version"]:
		print 'ExaBGP : %s' % version
		print 'Python : %s' % sys.version.replace('\n',' ')
		print 'Uname  : %s' % ' '.join(platform.uname()[:5])
		sys.exit(0)

	if options["--folder"]:
		folder = os.path.realpath(os.path.normpath(options["--folder"]))
	elif sys.argv[0].endswith('/bin/exabgp'):
		folder = sys.argv[0][:-len('/bin/exabgp')] + '/etc/exabgp'
	elif sys.argv[0].endswith('/sbin/exabgp'):
		folder = sys.argv[0][:-len('/sbin/exabgp')] + '/etc/exabgp'
	else:
		folder = '/etc/exabgp'

	os.environ['EXABGP_ETC'] = folder  # This is not most pretty

	if options["--run"]:
		sys.argv = sys.argv[sys.argv.index('--run')+1:]
		if sys.argv[0] == 'healthcheck':
			from exabgp.application import run_healthcheck
			run_healthcheck()
		elif sys.argv[0] == 'cli':
			from exabgp.application import run_cli
			run_cli()
		else:
			print(usage)
			sys.exit(0)
		return

	envfile = 'exabgp.env' if not options["--env"] else options["--env"]
	if not envfile.startswith('/'):
		envfile = '%s/%s' % (folder, envfile)

	from exabgp.configuration.setup import environment

	try:
		env = environment.setup(envfile)
	except environment.Error,exc:
		print usage
		print '\nconfiguration issue,', str(exc)
		sys.exit(1)
Exemplo n.º 5
0
def main ():
	options = docopt.docopt(usage, help=False)

	major = int(sys.version[0])
	minor = int(sys.version[2])

	if major != 2 or minor < 5:
		sys.exit('This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)')

	if options["--version"]:
		print 'ExaBGP : %s' % version
		print 'Python : %s' % sys.version.replace('\n',' ')
		print 'Uname  : %s' % platform.version()
		sys.exit(0)

	if options["--folder"]:
		folder = os.path.realpath(os.path.normpath(options["--folder"]))
	# elif os.environ.get('ETC',None):
	# 	folder = os.path.join(os.path.realpath(os.path.normpath(os.environ.get('ETC','etc'))),'exabgp')
	elif sys.argv[0].endswith('/bin/exabgp'):
		folder = sys.argv[0][:-len('/bin/exabgp')] + '/etc/exabgp'
	elif sys.argv[0].endswith('/sbin/exabgp'):
		folder = sys.argv[0][:-len('/sbin/exabgp')] + '/etc/exabgp'
	else:
		folder = '/etc/exabgp'

	# if not os.environ.get('ETC',''):
	# 	os.environ['ETC'] = folder
	os.environ['EXABGP_ETC'] = folder  # This is not most pretty

	envfile = 'exabgp.env' if not options["--env"] else options["--env"]
	if not envfile.startswith('/'):
		envfile = '%s/%s' % (folder, envfile)

	from exabgp.configuration.setup import environment

	try:
		env = environment.setup(envfile)
	except environment.Error,exc:
		print usage
		print '\nconfiguration issue,', str(exc)
		sys.exit(1)
Exemplo n.º 6
0
def main ():
	options = docopt.docopt(usage, help=False)

	major = int(sys.version[0])
	minor = int(sys.version[2])

	if major != 2 or minor < 5:
		sys.exit('This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)')

	if options["--version"]:
		print 'ExaBGP : %s' % version
		print 'Python : %s' % sys.version.replace('\n',' ')
		print 'Uname  : %s' % platform.version()
		sys.exit(0)

	if options["--folder"]:
		folder = os.path.realpath(os.path.normpath(options["--folder"]))
	elif os.environ.get('ETC',None):
		folder = os.path.join(os.path.realpath(os.path.normpath(os.environ.get('ETC','etc'))),'exabgp')
	elif sys.argv[0].endswith('/bin/exabgp'):
		folder = sys.argv[0][:-len('/bin/exabgp')] + '/etc/exabgp'
	elif sys.argv[0].endswith('/sbin/exabgp'):
		folder = sys.argv[0][:-len('/sbin/exabgp')] + '/etc/exabgp'
	else:
		folder = '/etc/exabgp'

	if not os.environ.get('ETC',''):
		os.environ['ETC'] = folder

	envfile = 'exabgp.env' if not options["--env"] else options["--env"]
	if not envfile.startswith('/'):
		envfile = '%s/%s' % (folder, envfile)

	from exabgp.configuration.setup import environment

	try:
		env = environment.setup(envfile)
	except environment.Error,exc:
		print usage
		print '\nconfiguration issue,', str(exc)
		sys.exit(1)
Exemplo n.º 7
0
def main ():
	options = docopt.docopt(usage, help=False)

	main = int(sys.version[0])
	secondary = int(sys.version[2])

	if main != 2 or secondary < 5:
		sys.exit('This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)')

	if options["--version"]:
		print(version)
		sys.exit(0)

	if options["--decode"]:
		decode = ''.join(options["--decode"]).replace(':','').replace(' ','')
		if not is_hex(decode):
			print(usage)
			print 'Environment values are:\n' + '\n'.join(' - %s' % _ for _ in environment.default())
			print ("\n\n"
				   "The BGP message must be an hexadecimal string.\n"
				   "All colons or spaces are ignored, for example:\n"
				   " --decode 001E0200000007900F0003000101\n"
				   " --decode 001E:02:0000:0007:900F:0003:0001:01\n"
				   " --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF001E0200000007900F0003000101\n"
				   " --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01\n"
				   " --decode 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 001E02 00000007900F0003000101'\n"
				  )
			sys.exit(1)
	else:
		decode = ''

	if options["--folder"]:
		etc = os.path.realpath(os.path.normpath(options["--folder"]))
	else:
		etc = os.path.realpath(os.path.normpath(os.environ.get('ETC','etc')))
	os.environ['ETC'] = etc

	envfile = 'exabgp.env' if not  options["--env"] else options["--env"]
	if not envfile.startswith('/'):
		envfile = '%s/%s' % (etc, envfile)

	from exabgp.configuration.environment import environment

	environment.application = 'exabgp'
	environment.configuration = {
		'profile' : {
			'enable'        : (environment.boolean,environment.lower,'false',    'toggle profiling of the code'),
			'file'          : (environment.unquote,environment.quote,'',         'profiling result file, none means stdout, no overwriting'),
		},
		'pdb' : {
			'enable'        : (environment.boolean,environment.lower,'false',    'on program fault, start pdb the python interactive debugger'),
		},
		'daemon' : {
	#		'identifier'    : (environment.unquote,environment.nop,'ExaBGP',     'a name for the log (to diferenciate multiple instances more easily)'),
			'pid'           : (environment.unquote,environment.quote,'',         'where to save the pid if we manage it'),
			'user'          : (environment.user,environment.quote,'nobody',      'user to run as'),
			'daemonize'     : (environment.boolean,environment.lower,'false',    'should we run in the background'),
		},
		'log' : {
			'enable'        : (environment.boolean,environment.lower,'true',     'enable logging'),
			'level'         : (environment.syslog_value,environment.syslog_name,'INFO', 'log message with at least the priority SYSLOG.<level>'),
			'destination'   : (environment.unquote,environment.quote,'stdout', 'where logging should log\n' \
			                  '                                  syslog (or no setting) sends the data to the local syslog syslog\n' \
			                  '                                  host:<location> sends the data to a remote syslog server\n' \
			                  '                                  stdout sends the data to stdout\n' \
			                  '                                  stderr sends the data to stderr\n' \
			                  '                                  <filename> send the data to a file' \
			),
			'all'           : (environment.boolean,environment.lower,'false',    'report debug information for everything'),
			'configuration' : (environment.boolean,environment.lower,'true',     'report command parsing'),
			'reactor'       : (environment.boolean,environment.lower,'true',     'report signal received, command reload'),
			'daemon'        : (environment.boolean,environment.lower,'true',     'report pid change, forking, ...'),
			'processes'     : (environment.boolean,environment.lower,'true',     'report handling of forked processes'),
			'network'       : (environment.boolean,environment.lower,'true',     'report networking information (TCP/IP, network state,...)'),
			'packets'       : (environment.boolean,environment.lower,'false',    'report BGP packets sent and received'),
			'rib'           : (environment.boolean,environment.lower,'false',    'report change in locally configured routes'),
			'message'       : (environment.boolean,environment.lower,'false',    'report changes in route announcement on config reload'),
			'timers'        : (environment.boolean,environment.lower,'false',    'report keepalives timers'),
			'routes'        : (environment.boolean,environment.lower,'false',    'report received routes'),
			'parser'        : (environment.boolean,environment.lower,'false',    'report BGP message parsing details'),
			'short'         : (environment.boolean,environment.lower,'false',    'use short log format (not prepended with time,level,pid and source)'),
		},
		'tcp' : {
			'once': (environment.boolean,environment.lower,'false', 'only one tcp connection attempt per peer (for debuging scripts)'),
			'delay': (environment.integer,environment.nop,'0',      'start to announce route when the minutes in the hours is a modulo of this number'),
			'bind': (environment.optional_ip,environment.quote,'', 'IP to bind on when listening (no ip to disable)'),
			'port': (environment.integer,environment.nop,'179', 'port to bind on when listening'),
			'acl': (environment.boolean,environment.lower,'', '(experimental) unimplemented'),
		},
		'bgp' : {
			'openwait': (environment.integer,environment.nop,'60','how many second we wait for an open once the TCP session is established'),
		},
		'cache' : {
			'attributes'  :  (environment.boolean,environment.lower,'true', 'cache all attributes (configuration and wire) for faster parsing'),
			'nexthops'    :  (environment.boolean,environment.lower,'true', 'cache routes next-hops (deprecated: next-hops are always cached)'),
		},
		'api' : {
			'encoder'  :  (environment.api,environment.lower,'text', '(experimental) default encoder to use with with external API (text or json)'),
			'highres'  :  (environment.boolean,environment.lower,'false','should we use highres timer in JSON'),
			'respawn'  :  (environment.boolean,environment.lower,'false','should we respawn a helper process if it dies'),
		},
		'reactor' : {
			'speed' : (environment.real,environment.nop,'1.0', 'time of one reactor loop\n'
			                                                   '%suse only if you understand the code.' % (' '* 34)),
		},
		# Here for internal use
		'internal' : {
			'name'    : (environment.nop,environment.nop,'ExaBGP', 'name'),
			'version' : (environment.nop,environment.nop,version,  'version'),
		},
		# Here for internal use
		'debug' : {
			'pdb' : (environment.boolean,environment.lower,'false','enable python debugger on errors'),
			'memory' : (environment.boolean,environment.lower,'false','command line option --memory'),
			'configuration' : (environment.boolean,environment.lower,'false','undocumented option: raise when parsing configuration errors'),
			'selfcheck' : (environment.boolean,environment.lower,'false','does a self check on the configuration file'),
			'route' : (environment.unquote,environment.quote,'','decode the route using the configuration'),
			'defensive' : (environment.boolean,environment.lower,'false', 'generate random fault in the code in purpose'),
		},
	}

	try:
		env = environment.setup(envfile)
	except environment.Error,e:
		print(usage)
		print '\nconfiguration issue,', str(e)
		sys.exit(1)
Exemplo n.º 8
0
def main():
    options = docopt.docopt(usage, help=False)

    main = int(sys.version[0])
    secondary = int(sys.version[2])

    if main != 2 or secondary < 5:
        sys.exit(
            'This program can not work (is not tested) with your python version (< 2.5 or >= 3.0)'
        )

    if options["--version"]:
        print(version)
        sys.exit(0)

    if options["--decode"]:
        decode = ''.join(options["--decode"]).replace(':', '').replace(' ', '')
        if not is_hex(decode):
            print(usage)
            print 'Environment values are:\n' + '\n'.join(
                ' - %s' % _ for _ in environment.default())
            print(
                "\n\n"
                "The BGP message must be an hexadecimal string.\n"
                "All colons or spaces are ignored, for example:\n"
                " --decode 001E0200000007900F0003000101\n"
                " --decode 001E:02:0000:0007:900F:0003:0001:01\n"
                " --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF001E0200000007900F0003000101\n"
                " --decode FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:001E:02:0000:0007:900F:0003:0001:01\n"
                " --decode 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 001E02 00000007900F0003000101'\n"
            )
            sys.exit(1)
    else:
        decode = ''

    if options["--folder"]:
        etc = os.path.realpath(os.path.normpath(options["--folder"]))
    else:
        etc = os.path.realpath(os.path.normpath(os.environ.get('ETC', 'etc')))
    os.environ['ETC'] = etc

    envfile = 'exabgp.env' if not options["--env"] else options["--env"]
    if not envfile.startswith('/'):
        envfile = '%s/%s' % (etc, envfile)

    from exabgp.configuration.environment import environment

    environment.application = 'exabgp'
    environment.configuration = {
     'profile' : {
      'enable'        : (environment.boolean,environment.lower,'false',    'toggle profiling of the code'),
      'file'          : (environment.unquote,environment.quote,'',         'profiling result file, none means stdout, no overwriting'),
     },
     'pdb' : {
      'enable'        : (environment.boolean,environment.lower,'false',    'on program fault, start pdb the python interactive debugger'),
     },
     'daemon' : {
    #		'identifier'    : (environment.unquote,environment.nop,'ExaBGP',     'a name for the log (to diferenciate multiple instances more easily)'),
      'pid'           : (environment.unquote,environment.quote,'',         'where to save the pid if we manage it'),
      'user'          : (environment.user,environment.quote,'nobody',      'user to run as'),
      'daemonize'     : (environment.boolean,environment.lower,'false',    'should we run in the background'),
     },
     'log' : {
      'enable'        : (environment.boolean,environment.lower,'true',     'enable logging'),
      'level'         : (environment.syslog_value,environment.syslog_name,'INFO', 'log message with at least the priority SYSLOG.<level>'),
      'destination'   : (environment.unquote,environment.quote,'stdout', 'where logging should log\n' \
                        '                                  syslog (or no setting) sends the data to the local syslog syslog\n' \
                        '                                  host:<location> sends the data to a remote syslog server\n' \
                        '                                  stdout sends the data to stdout\n' \
                        '                                  stderr sends the data to stderr\n' \
                        '                                  <filename> send the data to a file' \
      ),
      'all'           : (environment.boolean,environment.lower,'false',    'report debug information for everything'),
      'configuration' : (environment.boolean,environment.lower,'true',     'report command parsing'),
      'reactor'       : (environment.boolean,environment.lower,'true',     'report signal received, command reload'),
      'daemon'        : (environment.boolean,environment.lower,'true',     'report pid change, forking, ...'),
      'processes'     : (environment.boolean,environment.lower,'true',     'report handling of forked processes'),
      'network'       : (environment.boolean,environment.lower,'true',     'report networking information (TCP/IP, network state,...)'),
      'packets'       : (environment.boolean,environment.lower,'false',    'report BGP packets sent and received'),
      'rib'           : (environment.boolean,environment.lower,'false',    'report change in locally configured routes'),
      'message'       : (environment.boolean,environment.lower,'false',    'report changes in route announcement on config reload'),
      'timers'        : (environment.boolean,environment.lower,'false',    'report keepalives timers'),
      'routes'        : (environment.boolean,environment.lower,'false',    'report received routes'),
      'parser'        : (environment.boolean,environment.lower,'false',    'report BGP message parsing details'),
      'short'         : (environment.boolean,environment.lower,'false',    'use short log format (not prepended with time,level,pid and source)'),
     },
     'tcp' : {
      'once': (environment.boolean,environment.lower,'false', 'only one tcp connection attempt per peer (for debuging scripts)'),
      'delay': (environment.integer,environment.nop,'0',      'start to announce route when the minutes in the hours is a modulo of this number'),
      'bind': (environment.optional_ip,environment.quote,'', 'IP to bind on when listening (no ip to disable)'),
      'port': (environment.integer,environment.nop,'179', 'port to bind on when listening'),
      'acl': (environment.boolean,environment.lower,'', '(experimental) unimplemented'),
     },
     'bgp' : {
      'openwait': (environment.integer,environment.nop,'60','how many second we wait for an open once the TCP session is established'),
     },
     'cache' : {
      'attributes'  :  (environment.boolean,environment.lower,'true', 'cache all attributes (configuration and wire) for faster parsing'),
      'nexthops'    :  (environment.boolean,environment.lower,'true', 'cache routes next-hops (deprecated: next-hops are always cached)'),
     },
     'api' : {
      'encoder'  :  (environment.api,environment.lower,'text', '(experimental) default encoder to use with with external API (text or json)'),
      'highres'  :  (environment.boolean,environment.lower,'false','should we use highres timer in JSON'),
      'respawn'  :  (environment.boolean,environment.lower,'false','should we respawn a helper process if it dies'),
     },
     'reactor' : {
      'speed' : (environment.real,environment.nop,'1.0', 'time of one reactor loop\n'
                                                         '%suse only if you understand the code.' % (' '* 34)),
     },
     # Here for internal use
     'internal' : {
      'name'    : (environment.nop,environment.nop,'ExaBGP', 'name'),
      'version' : (environment.nop,environment.nop,version,  'version'),
     },
     # Here for internal use
     'debug' : {
      'pdb' : (environment.boolean,environment.lower,'false','enable python debugger on errors'),
      'memory' : (environment.boolean,environment.lower,'false','command line option --memory'),
      'configuration' : (environment.boolean,environment.lower,'false','undocumented option: raise when parsing configuration errors'),
      'selfcheck' : (environment.boolean,environment.lower,'false','does a self check on the configuration file'),
      'route' : (environment.unquote,environment.quote,'','decode the route using the configuration'),
      'defensive' : (environment.boolean,environment.lower,'false', 'generate random fault in the code in purpose'),
     },
    }

    try:
        env = environment.setup(envfile)
    except environment.Error, e:
        print(usage)
        print '\nconfiguration issue,', str(e)
        sys.exit(1)