<s> """<STR_LIT>""" <EOL> from exabgp . protocol . ip import IP <EOL> from exabgp . bgp . message . update . nlri . qualifier import RouteDistinguisher <EOL> from exabgp . bgp . message . update . nlri . qualifier import EthernetTag <EOL> from exabgp . bgp . message . update . nlri . evpn . nlri import EVPN <EOL> @ EVPN . register <EOL> class Multicast ( EVPN ) : <EOL> CODE = <NUM_LIT:3> <EOL> NAME = "<STR_LIT>" <EOL> SHORT_NAME = "<STR_LIT>" <EOL> def __init__ ( self , rd , etag , ip , packed = None , nexthop = None , action = None , addpath = None ) : <EOL> EVPN . __init__ ( self , packed , nexthop , action , addpath ) <EOL> self . rd = rd <EOL> self . etag = etag <EOL> self . ip = ip <EOL> self . _pack ( ) <EOL> def __ne__ ( self , other ) : <EOL> return not self . __eq__ ( other ) <EOL> def __str__ ( self ) : <EOL> return "<STR_LIT>" % ( <EOL> self . _prefix ( ) , <EOL> self . rd . _str ( ) , <EOL> self . etag , <EOL> self . ip , <EOL> ) <EOL> def __hash__ ( self ) : <EOL> return hash ( ( self . afi , self . safi , self . CODE , self . rd , self . etag , self . ip ) ) <EOL> def _pack ( self ) : <EOL> if not self . _packed : <EOL> ip = self . ip . pack ( ) <EOL> self . _packed = '<STR_LIT>' % ( <EOL> self . rd . pack ( ) , <EOL> self . etag . pack ( ) , <EOL> chr ( len ( ip ) * <NUM_LIT:8> ) , <EOL> ip <EOL> ) <EOL> return self . _packed <EOL> @ classmethod <EOL> def unpack ( cls , data ) : <EOL> rd = RouteDistinguisher . unpack ( data [ : <NUM_LIT:8> ] ) <EOL> etag = EthernetTag . unpack ( data [ <NUM_LIT:8> : <NUM_LIT:12> ] ) <EOL> iplen = ord ( data [ <NUM_LIT:12> ] ) <EOL> if iplen not in ( <NUM_LIT:4> * <NUM_LIT:8> , <NUM_LIT:16> * <NUM_LIT:8> ) : <EOL> raise Exception ( "<STR_LIT>" % iplen ) <EOL> ip = IP . unpack ( data [ <NUM_LIT> : <NUM_LIT> + iplen / <NUM_LIT:8> ] ) <EOL> return cls ( rd , etag , ip , data ) </s>
