class State(object): IDLE = 0x01 CONNECT = 0x02 ACTIVE = 0x03 OPENSENT = 0x04 OPENCONFIRM = 0x05 ESTABLISHED = 0x06 # ==================================================================== Direction # from exabgp.util.enumeration import Enumeration OUT = Enumeration('announce', 'withdraw') IN = Enumeration('announced', 'withdrawn') # ================================================================== BGP Message # # 0 1 2 3 # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # | | # + + # | | # + + # | Marker | # + + # | |
key = ord(data[0]) value = data[2:boundary] rest = data[boundary:] return key, value, rest capabilities = Capabilities() option_len = ord(data[0]) # XXX: FIXME: check the length of data if option_len: data = data[1:] while data: key, value, data = _key_values('parameter', data) # Paramaters must only be sent once. if key == Parameter.AUTHENTIFICATION_INFORMATION: raise Notify(2, 5) if key == Parameter.CAPABILITIES: while value: capability, capv, value = _key_values( 'capability', value) capabilities[capability] = Capability.unpack( capability, capabilities, capv) else: raise Notify(2, 0, 'Unknow OPEN parameter %s' % hex(key)) return capabilities from exabgp.util.enumeration import Enumeration REFRESH = Enumeration('absent', 'normal', 'enhanced')
# encoding: utf-8 ''' check.py Created by Thomas Mangin on 2013-03-18. Copyright (c) 2009-2013 Exa Networks. All rights reserved. ''' from exabgp.util.enumeration import Enumeration TYPE = Enumeration ( 'null', # - 1 'boolean', # - 2 'integer', # - 4 'string', # - 8 'array', # - 16 'object', # - 32 ) PRESENCE = Enumeration( 'optional', # - 1 'mandatory', # - 2 ) # TYPE CHECK def null (data): return type(data) == type(None) def boolean (data): return type(data) == type(True) def integer (data): return type(data) == type(0)
from exabgp.rib.change import Change from exabgp.configuration.environment import environment from exabgp.logger import Logger from exabgp.logger import FakeLogger from exabgp.logger import LazyFormat from exabgp.util.counter import Counter from exabgp.util.trace import trace from exabgp.util.enumeration import Enumeration STATE = Enumeration ( 'idle', 'active', 'connect', 'opensent', 'openconfirm', 'established', ) ACTION = Enumeration ( 'close', 'later', 'immediate', ) SEND = Enumeration ( 'done', 'normal', 'refresh', )
from exabgp.reactor.api.processes import ProcessError from exabgp.rib.change import Change from exabgp.configuration.environment import environment from exabgp.logger import Logger, FakeLogger, LazyFormat from exabgp.util.counter import Counter from exabgp.util.trace import trace from exabgp.util.enumeration import Enumeration STATE = Enumeration( 'idle', 'active', 'connect', 'opensent', 'openconfirm', 'established', ) ACTION = Enumeration( 'close', 'later', 'immediate', ) # As we can not know if this is our first start or not, this flag is used to # always make the program act like it was recovering from a failure # If set to FALSE, no EOR and OPEN Flags set for Restart will be set in the # OPEN Graceful Restart Capability FORCE_GRACEFUL = True