How to use the exabgp.configuration.environment.environment function in exabgp

To help you get started, we’ve selected a few exabgp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Exa-Networks / exabgp / dev / unittest / flow.py View on Github external
#!/usr/bin/env python
# encoding: utf-8
"""
flow.py

Created by Thomas Mangin on 2010-01-14.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""

import unittest

from exabgp.configuration.environment import environment
env = environment.setup('')

from exabgp.bgp.message.update.nlri.flow import *
from exabgp.protocol.ip.inet import *
from exabgp.bgp.message.update.attribute.community import *


class TestFlow (unittest.TestCase):

	def setUp(self):
		pass

	def test_rule (self):
		components = {
			'destination': Destination("192.0.2.0",24),
			'source'     : Source("10.1.2.0",24),
			'anyport_1'  : AnyPort(NumericOperator.EQ,25),
github Exa-Networks / exabgp / dev / unittest / delta.py View on Github external
#!/usr/bin/env python
# encoding: utf-8
"""
protocol.py

Created by Thomas Mangin on 2009-08-27.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""

import unittest

from exabgp.configuration.environment import environment
env = environment.setup('')

from exabgp.bgp.message.open import Open
from exabgp.bgp.message.open import Capabilities
from exabgp.bgp.message.open import new_Open
from exabgp.bgp.message.notification import Notification
from exabgp.bgp.message.keepalive import KeepAlive
from exabgp.bgp.message.keepalive import new_KeepAlive
from exabgp.bgp.message.update import Update
from exabgp.bgp.message.update import Attributes

from exabgp.rib.table import Table
from exabgp.rib.delta import Delta
from exabgp.reactor.protocol import Protocol
from exabgp.bgp.neighbor import Neighbor

from StringIO import StringIO
github Exa-Networks / exabgp / lib / exabgp / bgp / message / update / attributes / __init__.py View on Github external
def __init__ (self):
		# cached representation of the object
		self._str = ''
		self._idx = ''
		self._json = ''
		# We should cache the attributes parsed
		self.cache_attributes = environment.settings().cache.attributes
		# some of the attributes are MP_REACH_NLRI or MP_UNREACH_NLRI
		self.hasmp = 0
		# The parsed attributes have no mp routes and/or those are last
		self.cacheable = True
		# for the last route, the part of the attributes which are not routes we can use for fast caching
		self.prefix = ''
github Exa-Networks / exabgp / lib / exabgp / configuration / file.py View on Github external
def __init__ (self,fname,text=False):
		self.debug = environment.settings().debug.configuration
		self.api_encoder = environment.settings().api.encoder

		self.logger = Logger()
		self._text = text
		self._fname = fname
		self._clear()
github Exa-Networks / exabgp / lib / exabgp / reactor / __init__.py View on Github external
def __init__ (self,configurations):
		self.ip = environment.settings().tcp.bind
		self.port = environment.settings().tcp.port
		self.respawn = environment.settings().api.respawn

		self.max_loop_time = environment.settings().reactor.speed

		self.logger = Logger()
		self.daemon = Daemon(self)
		self.processes = None
		self.listener = None
		self.configuration = Configuration(configurations)
		self.decoder = Decoder()

		self.peers = {}
		self.route_update = False

		self._shutdown = False
		self._reload = False
		self._reload_processes = False
		self._restart = False
		self._saved_pid = False
github Exa-Networks / exabgp / lib / exabgp / configuration / file.py View on Github external
def __init__ (self,fname,text=False):
		self.debug = environment.settings().debug.configuration
		self.api_encoder = environment.settings().api.encoder

		self.logger = Logger()
		self._text = text
		self._fname = fname
		self._clear()
github Exa-Networks / exabgp / lib / exabgp / configuration / experimental / show / __init__.py View on Github external
def version (self, tokeniser):
		self.content['version'] = '%s %s' % (environment.application,version)
		#self.content['version'] = '%s %s' % (environment.application,environment.version)
github openstack / networking-bagpipe / bagpipe / bgp / engine / upstream_exabgp_peer_worker.py View on Github external
def setupExaBGPEnv():
    # initialize ExaBGP config
    from exabgp.configuration.environment import environment
    import exabgp.configuration.setup  # initialises environment.configuration
    environment.application = 'bagpipe-bgp'
    conf = environment.setup(None)
    # tell exabgp to parse routes:
    conf.log.routes = True
    # FIXME: find a way to redirect exabgp logs into bagpipe's
    conf.log.destination = "stderr"
    conf.log.level = repr(log.getEffectiveLevel())
    conf.log.all = True
    conf.log.packets = True
github Exa-Networks / exabgp / lib / exabgp / reactor / api / processes.py View on Github external
def __init__ (self, reactor):
		self.logger = Logger()
		self.reactor = reactor
		self.clean()
		self.silence = False

		from exabgp.configuration.environment import environment
		self.highres = environment.settings().api.highres
github Exa-Networks / exabgp / lib / exabgp / application / bmp.py View on Github external
},
		'network':  {
			'read':  environment.boolean,
			'write': environment.lower,
			'value': 'true',
			'help':  'report networking information (TCP/IP, network state,...)',
		},
		'packets':  {
			'read':  environment.boolean,
			'write': environment.lower,
			'value': 'false',
			'help':  'report BGP packets sent and received',
		},
		'rib':  {
			'read':  environment.boolean,
			'write': environment.lower,
			'value': 'false',
			'help':  'report change in locally configured routes',
		},
		'message':  {
			'read':  environment.boolean,
			'write': environment.lower,
			'value': 'false',
			'help':  'report changes in route announcement on config reload',
		},
		'timers':  {
			'read':  environment.boolean,
			'write': environment.lower,
			'value': 'false',
			'help':  'report keepalives timers',
		},
		'routes':  {