def create_subnetpool(self, context, subnetpool):

        sp = subnetpool['subnetpool']
        sp_reader = subnet_alloc.SubnetPoolReader(sp)
        if sp_reader.address_scope_id is constants.ATTR_NOT_SPECIFIED:
            sp_reader.address_scope_id = None
        if sp_reader.is_default:
            self._check_default_subnetpool_exists(context,
                                                  sp_reader.ip_version)
        self._validate_address_scope_id(context, sp_reader.address_scope_id,
                                        id, sp_reader.prefixes,
                                        sp_reader.ip_version)
        with context.session.begin(subtransactions=True):
            pool_args = {'tenant_id': sp['tenant_id'],
                         'id': sp_reader.id,
                         'name': sp_reader.name,
                         'ip_version': sp_reader.ip_version,
                         'default_prefixlen':
                         sp_reader.default_prefixlen,
                         'min_prefixlen': sp_reader.min_prefixlen,
                         'max_prefixlen': sp_reader.max_prefixlen,
                         'is_default': sp_reader.is_default,
                         'shared': sp_reader.shared,
                         'default_quota': sp_reader.default_quota,
                         'address_scope_id': sp_reader.address_scope_id,
                         'description': sp_reader.description}
            subnetpool = models_v2.SubnetPool(**pool_args)
            context.session.add(subnetpool)
            for prefix in sp_reader.prefixes:
                self._create_subnetpool_prefix(context,
                                               prefix,
                                               subnetpool.id)

        return self._make_subnetpool_dict(subnetpool)
Create a subnetpool
dataset/ETHPy150Open openstack/neutron/neutron/db/db_base_plugin_v2.py/NeutronDbPluginV2.create_subnetpool