#NEWLINE# def test_stats5( self ) : #NEWLINE# #INDENT# ' Check total stats are correct when adding and removing member prefix with childs from pool\n\n            This is trickier as there is now a child in the pool that needs to\n            be accounted for.\n        ' #NEWLINE# th = TestHelper ( ) #NEWLINE# pool1 = th . add_pool ( 'test' , 'assignment' , 31 , 112 ) #NEWLINE# p1 = th . add_prefix ( '1.0.0.0/24' , 'reservation' , 'test' , pool_id = pool1 . id ) #NEWLINE# p2 = th . add_prefix ( '2.0.0.0/24' , 'reservation' , 'test' , pool_id = pool1 . id ) #NEWLINE# p3 = th . add_prefix ( '2001:db8:1::/48' , 'reservation' , 'test' , pool_id = pool1 . id ) #NEWLINE# p4 = th . add_prefix ( '2001:db8:2::/48' , 'reservation' , 'test' , pool_id = pool1 . id ) #NEWLINE# pc1 = th . add_prefix_from_pool ( pool1 , 4 , 'foo' ) #NEWLINE# pc2 = th . add_prefix_from_pool ( pool1 , 6 , 'foo' ) #NEWLINE# p1 . pool = None #NEWLINE# p1 . save ( ) #NEWLINE# p3 . pool = None #NEWLINE# p3 . save ( ) #NEWLINE# res = Pool . list ( { #NEWLINE# #INDENT# 'id' : pool1 . id , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 1 , res [ 0 ] . member_prefixes_v4 ) #NEWLINE# self . assertEqual ( 0 , res [ 0 ] . used_prefixes_v4 ) #NEWLINE# self . assertEqual ( 128 , res [ 0 ] . free_prefixes_v4 ) #NEWLINE# self . assertEqual ( 128 , res [ 0 ] . total_prefixes_v4 ) #NEWLINE# self . assertEqual ( 256 , res [ 0 ] . total_addresses_v4 ) #NEWLINE# self . assertEqual ( 0 , res [ 0 ] . used_addresses_v4 ) #NEWLINE# self . assertEqual ( 256 , res [ 0 ] . free_addresses_v4 ) #NEWLINE# self . assertEqual ( 1 , res [ 0 ] . member_prefixes_v6 ) #NEWLINE# self . assertEqual ( 0 , res [ 0 ] . used_prefixes_v6 ) #NEWLINE# self . assertEqual ( 18446744073709551616 , res [ 0 ] . free_prefixes_v6 ) #NEWLINE# self . assertEqual ( 18446744073709551616 , res [ 0 ] . total_prefixes_v6 ) #NEWLINE# self . assertEqual ( 1208925819614629174706176 , res [ 0 ] . total_addresses_v6 ) #NEWLINE# self . assertEqual ( 0 , res [ 0 ] . used_addresses_v6 ) #NEWLINE# self . assertEqual ( 1208925819614629174706176 , res [ 0 ] . free_addresses_v6 ) #NEWLINE# p1 . pool = pool1 #NEWLINE# p1 . save ( ) #NEWLINE# p3 . pool = pool1 #NEWLINE# p3 . save ( ) #NEWLINE# res = Pool . list ( { #NEWLINE# #INDENT# 'id' : pool1 . id , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( 2 , res [ 0 ] . member_prefixes_v4 ) #NEWLINE# self . assertEqual ( 1 , res [ 0 ] . used_prefixes_v4 ) #NEWLINE# self . assertEqual ( 255 , res [ 0 ] . free_prefixes_v4 ) #NEWLINE# self . assertEqual ( 256 , pc2 [ 0 ] . total_prefixes_v4 ) #NEWLINE# self . assertEqual ( 512 , res [ 0 ] . total_addresses_v4 ) #NEWLINE# self . assertEqual ( 2 , res [ 0 ] . used_addresses_v4 ) #NEWLINE# self . assertEqual ( 510 , res [ 0 ] . free_addresses_v4 ) #NEWLINE# self . assertEqual ( 2 , res [ 0 ] . member_prefixes_v6 ) #NEWLINE# self . assertEqual ( 1 , res [ 0 ] . used_prefixes_v6 ) #NEWLINE# self . assertEqual ( 36893488147419103231 , res [ 0 ] . free_prefixes_v6 ) #NEWLINE# self . assertEqual ( 36893488147419103232 , res [ 0 ] . total_prefixes_v6 ) #NEWLINE# self . assertEqual ( 2417851639229258349412352 , res [ 0 ] . total_addresses_v6 ) #NEWLINE# self . assertEqual ( 65536 , res [ 0 ] . used_addresses_v6 ) #NEWLINE# self . assertEqual ( 2417851639229258349346816 , res [ 0 ] . free_addresses_v6 )