def test_find_free_prefix2(self):
        schema = { 'id': self.schema_attrs['id'] }
        # we need a bloody pool first!
        pool = self.nipap.list_pool(self.auth, schema, { 'id': self.pool_attrs['id'] })
        # first make sure our pool exists
        self.assertNotEqual(pool[0], [], 'Pool must exist!')
        pfxs = [
                '10.0.0.0/24',
                '10.0.1.0/24',
                '10.0.2.0/24',
                '10.0.3.0/24',
                '10.0.4.0/24'
                ]
        for p in pfxs:
            prefix_attrs = {
                    'type': 'reservation',
                    'authoritative_source': 'nipap-test',
                    'prefix': p,
                    'description': 'test prefix',
                    'pool_id': self.pool_attrs['id'],
                    'comment': 'test comment, please remove! ;)'
                    }
            self.nipap.add_prefix(self.auth, schema, prefix_attrs)

        # from-pool test
        res = self.nipap.find_free_prefix(self.auth, schema, { 'from-pool': { 'name': self.pool_attrs['name'] }, 'count': 1, 'family': 4})
        self.assertEqual(res, ['10.0.1.0/30'], "Incorrect prefix set returned when requesting default prefix-length")

        # from-pool test, specify wanted prefix length
        res = self.nipap.find_free_prefix(self.auth, schema, { 'from-pool': { 'name': self.pool_attrs['name'] }, 'count': 1, 'family': 4, 'prefix_length': 31})
        self.assertEqual(res, ['10.0.1.0/31'], "Incorrect prefix set returned with explicit prefix-length")
Functionality testing of find_free_prefix
dataset/ETHPy150Open SpriteLink/NIPAP/tests/nipapbase.py/NipapTest.test_find_free_prefix2