def test_stats3(self):
        th = TestHelper()

        # add a pool
        pool1 = th.add_pool('test', 'assignment', 31, 112)

        # add some members to the pool
        p1 = th.add_prefix('1.0.0.0/24', 'reservation', 'test', pool_id=pool1.id)
        p2 = th.add_prefix('2001:db8::/48', 'reservation', 'test', pool_id=pool1.id)

        # add child from pool
        pc1 = th.add_prefix_from_pool(pool1, 4, 'foo')
        pc2 = th.add_prefix_from_pool(pool1, 6, 'foo')

        # check stats for pool1
        res = Pool.list({ 'id': pool1.id })
        # ipv4
        self.assertEqual(1, res[0].member_prefixes_v4)
        self.assertEqual(1, res[0].used_prefixes_v4)
        self.assertEqual(127, res[0].free_prefixes_v4)
        self.assertEqual(128, res[0].total_prefixes_v4)
        self.assertEqual(256, res[0].total_addresses_v4)
        self.assertEqual(2, res[0].used_addresses_v4)
        self.assertEqual(254, res[0].free_addresses_v4)
        # ipv6
        self.assertEqual(1, res[0].member_prefixes_v6)
        self.assertEqual(1, res[0].used_prefixes_v6)
        self.assertEqual(18446744073709551615, res[0].free_prefixes_v6)
        self.assertEqual(18446744073709551616, res[0].total_prefixes_v6)
        self.assertEqual(1208925819614629174706176, res[0].total_addresses_v6)
        self.assertEqual(65536, res[0].used_addresses_v6)
        self.assertEqual(1208925819614629174640640, res[0].free_addresses_v6)

        # remove child prefixes
        pc1.remove()
        pc2.remove()

        # check stats for pool1
        res = Pool.list({ 'id': pool1.id })
        # ipv4
        self.assertEqual(1, res[0].member_prefixes_v4)
        self.assertEqual(0, res[0].used_prefixes_v4)
        self.assertEqual(128, res[0].free_prefixes_v4)
        self.assertEqual(128, res[0].total_prefixes_v4)
        self.assertEqual(256, res[0].total_addresses_v4)
        self.assertEqual(0, res[0].used_addresses_v4)
        self.assertEqual(256, res[0].free_addresses_v4)
        # ipv6
        self.assertEqual(1, res[0].member_prefixes_v6)
        self.assertEqual(0, res[0].used_prefixes_v6)
        self.assertEqual(18446744073709551616, res[0].free_prefixes_v6)
        self.assertEqual(18446744073709551616, res[0].total_prefixes_v6)
        self.assertEqual(1208925819614629174706176, res[0].total_addresses_v6)
        self.assertEqual(0, res[0].used_addresses_v6)
        self.assertEqual(1208925819614629174706176, res[0].free_addresses_v6)
Check total stats are correct when adding and removing child prefixes from pool
dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipaptest.py/TestPoolStatistics.test_stats3