On Wed, Jun 20, 2012 at 9:39 AM, Jason Kölker <jkoel...@rackspace.com>wrote:

> On Wed, 2012-06-20 at 19:05 +0300, Gary Kotton wrote:
> > Hi,
> > In the API (http://wiki.openstack.org/QuantumV2APIIntro#Port), the user
> > is able to pass /*fixed_ips_v4*/ and /*fixed_ips_v6*/. If possible can
> > we please change this to /*fixed_ips*/_,_ where the /*fixed_ips*/ is a
> > list of dictionary's. The dictionary has the following key value pairs:
> >      'subnet_id' : <subnet uuid> This is mandatory if configured.
> >      'ip_address': <a ip v4 or ipv6 address - depending on the subnet
> > defined above>. This is optional.
> >
> > The server will treat the values as follows:
> >      i. If this is not set then then a address will be allocated if
> > there is a subnet defined on the network. This will be done for IPv4 and
> > IPv6 subnets.
> >      ii. If only the subnet ID is set then the server will assign an IP
> > address from the specific subnet
> >      iii. If both are set the server will allocate this address (if it
> > has not already been allocated :))
> >
> > Please note that in all of the above cases the input will be checked for
> > validity, for example - the subnet_id is a configured subnet on the
> > network etc.
> >
> > Please let me know if you have any comments.
>
> The only issue is then we can't search by ip unless we invent a schema
> for nested resource searching. One of the reasons I was an advocate of a
> top level /ips resource.
>

Hi Jason,

The fact that the existing API doesn't have a straightforward way of
searching for ports by IP is definitely something that bothers me as well,
and we need a good solution for it.

I believe the basic filtering model were were originally shooting for with
the v2 API is that we could do exact match filtering on any top-level
dictionary key.  However, I don't think that supports searching on IPs,
even with the old model.

For example, if port was just:

{ 'id' : XYZ,
  'network_id': "ABC"
  'fixed_ips': [ "10.0.0.2" ]
}

We could do a query that specified filter network_id=ABC, but it was
already a bit wonky to do something like fixed_ips=10.0.0.2 because
fixed_ip was really a list, not a string.  Were you envisioning a model
where a filter on a list was implicitly converted to a ORed comparison
against each list item?

If thats the case, then the same trick could still be used, if we have a
way of referring to nested keys.  One option would be to do something like:

{ 'id' : XYZ,
  'network_id': "ABC"
  'fixed_ips': [ { "address": "10.0.0.2", "subnet_id": "DEF"} ]
}

and allow filters like fixed_ips.address=10.0.0.2 .  Essentially, nested
keys are joined by some delimiter, like ".".

Another option would be to just define a filter key that does not directly
map to a top-level attribute (e.g. fixed_ip_address=10.0.0.2).

On the plus side, I think the idea of passing in the subnet-id handles the
other issue you mentioned previously, in that it gives us a clean way to
add an IP to a port even if the user wants that IP to be allocated from a
pool, since the user can add an entry to the fixed ips list, but only
specify the subnet.

any other ideas on this front?

Dan




>
> Happy Hacking!
>
> 7-11
>
>
> --
> Mailing list: https://launchpad.net/~netstack
> Post to     : netstack@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~netstack
> More help   : https://help.launchpad.net/ListHelp
>



-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Wendlandt
Nicira, Inc: www.nicira.com
twitter: danwendlandt
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
Mailing list: https://launchpad.net/~netstack
Post to     : netstack@lists.launchpad.net
Unsubscribe : https://launchpad.net/~netstack
More help   : https://help.launchpad.net/ListHelp

Reply via email to