#NEWLINE# def test99_EVPNPrefixCreatePackUnpack( self ) : #NEWLINE# #INDENT# 'Test pack/unpack for E-VPN Prefix routes' #NEWLINE# nlri = EVPNPrefix ( RouteDistinguisher . fromElements ( '42.42.42.42' , 5 ) , ESI ( ) , EthernetTag ( 111 ) , Labels ( [ 42 ] , True ) , IP . create ( '1.1.1.0' ) , 24 , IP . create ( '2.2.2.2' ) ) #NEWLINE# packed = nlri . pack ( ) #NEWLINE# ( unpacked , leftover ) = EVPN . unpack_nlri ( AFI ( AFI . l2vpn ) , SAFI ( SAFI . evpn ) , packed , OUT . UNSET , None ) #NEWLINE# self . assertEqual ( 0 , len ( leftover ) ) #NEWLINE# self . assertTrue ( isinstance ( self , EVPNPrefix ) ) #NEWLINE# self . assertEqual ( '42.42.42.42:5' , unpacked . rd . _str ( ) ) #NEWLINE# self . assertEqual ( ESI . DEFAULT , unpacked . esi . esi ) #NEWLINE# self . assertEqual ( EthernetTag ( 111 ) , unpacked . etag ) #NEWLINE# self . assertEqual ( IP . create ( '1.1.1.0' ) , unpacked . ip ) #NEWLINE# self . assertEqual ( 24 , unpacked . iplen ) #NEWLINE# self . assertEqual ( IP . create ( '2.2.2.2' ) , unpacked . gwip ) #NEWLINE# self . assertEqual ( 1 , len ( unpacked . label . labels ) ) #NEWLINE# self . assertEqual ( 42 , unpacked . label . labels [ 0 ] )