[openstack-dev] [api][neutron] Best API for generating subnets from pool

Jay Pipes jaypipes at gmail.com
Fri Mar 20 19:07:24 UTC 2015


On 03/20/2015 02:51 PM, Carl Baldwin wrote:
> On Fri, Mar 20, 2015 at 12:18 PM, Jay Pipes <jaypipes at gmail.com> wrote:
>> What about this instead?
>>
>> POST /v2.0/subnets
>>
>> {
>>    'network_id': 'meh',
>>    'gateway_ip_template': '*.*.*.1'
>>    'prefix_len': 24,
>>    'pool_id': 'some_pool'
>> }
>>
>> At least that way it's clear the gateway attribute is not an IP, but a
>> template/string instead?
>
> I thought about doing *s but in the world of Classless Inter-Domain
> Routing where not all networks are /24, /16, or /8 it seemed a bit
> imprecise.  But, maybe that doesn't matter.

Understood.

> I think the more important difference with your proposal here is that
> it is passed as a new attribute called 'gateway_ip_template'.  I don't
> think that attribute would ever be sent back to the user.  Is it ok to
> have write-only attributes?  Is everyone comfortable with that?

I don't see anything wrong with attributes that are only in the request. 
I mean, we have attributes that are only in the response (things like 
status, for example).

Looking at the EC2 API, they support "write-only attributes" as well, 
for just this purpose:

http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html

The MaxCount and MinCount attributes are not in the response but are in 
the request. Same thing for Nova's POST /servers REST API (min_count, 
max_count).

Best,
-jay



More information about the OpenStack-dev mailing list