<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 21, 2013 at 7:14 AM, Kenichi Oomichi <span dir="ltr"><<a href="mailto:oomichi@mxs.nes.nec.co.jp" target="_blank">oomichi@mxs.nes.nec.co.jp</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi Doug,<br>
<br>
Thank you for your advice.<br>
<br>
Some validation features seem necessary as basic features for Nova APIs.<br>
so I am trying to pick necessary features for WSME on the following<br>
inline messages.<br>
<br>
Could you check them?<br>
<div class="im"><br>
> -----Original Message-----<br>
> From: Doug Hellmann [mailto:<a href="mailto:doug.hellmann@dreamhost.com">doug.hellmann@dreamhost.com</a>]<br>
> Sent: Thursday, October 17, 2013 3:51 AM<br>
> To: OpenStack Development Mailing List<br>
> Subject: Re: [openstack-dev] [Nova] What validation feature is necessary for Nova v3 API<br>
>>><br>
>>> For discussing, I have investigated all validation ways of current Nova v3<br>
>>> API parameters. There are 79 API methods, and 49 methods use API parameters<br>
>>> of a request body. Totally, they have 148 API parameters. (details: [1])<br>
>>><br>
>>> Necessary features, what I guess now, are the following:<br>
>>><br>
>>> << Basic Validation Feature >><br>
>>> Through this investigation, it seems that we need some basic validation<br>
>>> features such as:<br>
>>> * Type validation<br>
>>>   str(name, ..), int(vcpus, ..), float(rxtx_factor), dict(metadata, ..),<br>
>>>   list(networks, ..), bool(conbine, ..), None(availability_zone)<br>
>>> * String length validation<br>
>>>   1 - 255<br>
>>> * Value range validation<br>
>>>   value >= 0(rotation, ..), value > 0(vcpus, ..),<br>
>>>   value >= 1(os-multiple-create:min_count, os-multiple-create:max_count)<br>
<br>
</div>Ceilometer has class BoundedInt.<br>
(<a href="https://github.com/openstack/ceilometer/blob/master/ceilometer/api/controllers/v2.py#L79" target="_blank">https://github.com/openstack/ceilometer/blob/master/ceilometer/api/controllers/v2.py#L79</a>)<br>
This class seems useful for the above value range validation.<br>
Can we implement this feature on WSME?<br>
Or should we implement this on Oslo?<br></blockquote><div><br></div><div>I think it makes sense to add some of these validation features directly to WSME unless they are OpenStack-specific.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Also we would be able to implement the string length validation with<br>
the similar code.<br></blockquote><div><br></div><div>Yes, I think you're right.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<br>
>>> * Data format validation<br>
>>>  * Pattern:<br>
>>>    uuid(volume_id, ..), boolean(on_shared_storage, ..), base64encoded(contents),<br>
>>>    ipv4(access_ip_v4, fixed_ip), ipv6(access_ip_v6)<br>
<br>
</div>This feature also seems implemantable by enhancing the above string validation.<br></blockquote><div><br></div><div>Yes, I could see having different types for each of those things. I believe there is already a boolean type.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
>>>  * Allowed list:<br>
>>>    'active' or 'error'(state), 'parent' or 'child'(cells.type),<br>
>>>    'MANUAL' or 'AUTO'(os-disk-config:disk_config), ...<br>
<br>
</div>WSME has this feature(wtypes.Enum) already.<br></blockquote><div><br></div><div>Yes</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
>>>  * Allowed string:<br>
>>>    not contain '!' and '.'(<a href="http://cells.name" target="_blank">cells.name</a>),<br>
>>>    contain [a-zA-Z0-9_.- ] only(<a href="http://flavor.name" target="_blank">flavor.name</a>, <a href="http://flavor.id" target="_blank">flavor.id</a>)<br>
<br>
</div>This feature also seems implemantable.<br></blockquote><div><br></div><div>Yes</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
>>> * Mandatory validation<br>
>>>  * Required: <a href="http://server.name" target="_blank">server.name</a>, <a href="http://flavor.name" target="_blank">flavor.name</a>, ..<br>
>>>  * Optional: flavor.ephemeral, flavor.swap, ..<br>
<br>
</div>WSME has this feature(mandatory argument) already.<br></blockquote><div><br></div><div>Yes</div><div><br></div><div>Thanks for doing this analysis. It looks like with a little bit of work on WSME, we will have a nice library of reusable validators.</div>
<div><br></div><div>Doug</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
Thanks<br>
Ken'ichi Ohmichi<br>
<br>
</blockquote></div><br></div></div>