#NEWLINE# def test200_IPVPNCreatePackUnpack( self ) : #NEWLINE# #INDENT# 'Test pack/unpack for IPVPN routes' #NEWLINE# nlri = IPVPN . new ( AFI ( AFI . ipv4 ) , SAFI ( SAFI . mpls_vpn ) , IP . pton ( '1.2.3.0' ) , 24 , Labels ( [ 42 ] , True ) , RouteDistinguisher . fromElements ( '42.42.42.42' , 5 ) ) #NEWLINE# packed = nlri . pack ( ) #NEWLINE# ( unpacked , leftover ) = IPVPN . unpack_nlri ( AFI ( AFI . ipv4 ) , SAFI ( SAFI . mpls_vpn ) , packed , OUT . UNSET , None ) #NEWLINE# self . assertEqual ( 0 , len ( leftover ) ) #NEWLINE# self . assertTrue ( isinstance ( unpacked , IPVPN ) ) #NEWLINE# self . assertEqual ( '1.2.3.0/24' , unpacked . cidr . prefix ( ) ) #NEWLINE# self . assertEqual ( 1 , len ( unpacked . labels . labels ) ) #NEWLINE# self . assertEqual ( 42 , unpacked . labels . labels [ 0 ] ) #NEWLINE# self . assertEqual ( '42.42.42.42:5' , unpacked . rd . _str ( ) )