<s> """<STR_LIT>""" <EOL> from exabgp . protocol . family import AFI <EOL> from exabgp . protocol . family import SAFI <EOL> from exabgp . protocol . family import Family <EOL> from exabgp . bgp . message import OUT <EOL> from exabgp . bgp . message . notification import Notify <EOL> from exabgp . logger import Logger <EOL> from exabgp . logger import LazyNLRI <EOL> class NLRI ( Family ) : <EOL> __slots__ = [ '<STR_LIT:action>' ] <EOL> EOR = False <EOL> registered_nlri = dict ( ) <EOL> registered_families = [ ( AFI ( AFI . ipv4 ) , SAFI ( SAFI . multicast ) ) ] <EOL> logger = None <EOL> def __init__ ( self , afi , safi , action = OUT . UNSET ) : <EOL> Family . __init__ ( self , afi , safi ) <EOL> self . action = action <EOL> def assign ( self , name , value ) : <EOL> setattr ( self , name , value ) <EOL> def index ( self ) : <EOL> return '<STR_LIT>' % ( self . afi , self . safi , self . pack ( ) ) <EOL> def pack ( self , negotiated = None ) : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> def pack_nlri ( self , negotiated = None ) : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> def __eq__ ( self , other ) : <EOL> return self . index ( ) == other . index ( ) <EOL> def __ne__ ( self , other ) : <EOL> return not self . __eq__ ( other ) <EOL> def __lt__ ( self , other ) : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> def __le__ ( self , other ) : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> def __gt__ ( self , other ) : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> def __ge__ ( self , other ) : <EOL> raise RuntimeError ( '<STR_LIT>' ) <EOL> @ classmethod <EOL> def has_label ( cls ) : <EOL> return False <EOL> @ classmethod <EOL> def has_rd ( cls ) : <EOL> return False <EOL> @ classmethod <EOL> def register ( cls , afi , safi , force = False ) : <EOL> def register_nlri ( klass ) : <EOL> new = ( AFI ( afi ) , SAFI ( safi ) ) <EOL> if new in cls . registered_nlri : <EOL> if force : <EOL> cls . registered_nlri [ '<STR_LIT>' % new ] = klass <EOL> else : <EOL> raise RuntimeError ( '<STR_LIT>' % new ) <EOL> else : <EOL> cls . registered_nlri [ '<STR_LIT>' % new ] = klass <EOL> cls . registered_families . append ( new ) <EOL> return klass <EOL> return register_nlri <EOL> @ staticmethod <EOL> def known_families ( ) : <EOL> return list ( NLRI . registered_families ) <EOL> @ classmethod <EOL> def unpack_nlri ( cls , afi , safi , data , action , addpath ) : <EOL> if not cls . logger : <EOL> cls . logger = Logger ( ) <EOL> cls . logger . parser ( LazyNLRI ( afi , safi , data ) ) <EOL> key = '<STR_LIT>' % ( AFI ( afi ) , SAFI ( safi ) ) <EOL> if key in cls . registered_nlri : <EOL> return cls . registered_nlri [ key ] . unpack_nlri ( afi , safi , data , action , addpath ) <EOL> raise Notify ( <NUM_LIT:3> , <NUM_LIT:0> , '<STR_LIT>' % ( AFI ( afi ) , SAFI ( safi ) ) ) </s>
