示例#1
0
    def _test__no_pool_changes(self, new_pools):
        id = uuidutils.generate_uuid()
        ipam_subnet = driver.NeutronDbSubnet(id, self.ctx)
        pools = [ipam_obj.IpamAllocationPool(self.ctx,
                                             ipam_subnet_id=id,
                                             first_ip='192.168.10.20',
                                             last_ip='192.168.10.41'),
                 ipam_obj.IpamAllocationPool(self.ctx,
                                             ipam_subnet_id=id,
                                             first_ip='192.168.10.50',
                                             last_ip='192.168.10.60')]

        ipam_subnet.subnet_manager.list_pools = mock.Mock(return_value=pools)
        return ipam_subnet._no_pool_changes(self.ctx, new_pools)
示例#2
0
    def create_pool(self, context, pool_start, pool_end):
        """Create an allocation pool for the subnet.

        This method does not perform any validation on parameters; it simply
        persist data on the database.

        :param pool_start: string expressing the start of the pool
        :param pool_end: string expressing the end of the pool
        :return: the newly created pool object.
        """
        ip_pool_obj = ipam_objs.IpamAllocationPool(
            context,
            ipam_subnet_id=self._ipam_subnet_id,
            first_ip=pool_start,
            last_ip=pool_end)
        ip_pool_obj.create()
        return ip_pool_obj