[openstack-dev] [Horizon] Redundant checks in form values

Suraj Deshmukh surajdeshmukh9595 at gmail.com
Wed Nov 18 17:05:19 UTC 2015


In file [1] in `class AddRule` in method `_clean_rule_icmp` why checkups
are performed on if `icmp_type` or `icmp_code` is `None` or in range of `-1
to 255`.

What I mean here is that in `class AddRule` while values are being accepted
from form data and being stored, validators do their job of checking
whether that field is valid, so why a redundant checkup in method
`_clean_rule_icmp`?

Please correct me if I am wrong in understanding anything. Currently I am
working on the Bug #1511748 [2]. Previously while checking the validity of
`icmp_type` and `icmp_code`, the functionality of tcp_ports was used. This
is wrong because, TCP ports have a range of 0 to 65535 while `icmp_type`
and `icmp_code` have a range of 0 to 255.

So now oslo_utils.netutils has dedicated functionality to check if
`icmp_type` and `icmp_code` are valid here is a recent code merger [3].

So I was trying to add this newly added functionality into Horizon but the
test cases run older code and hence needed help in getting my head around
with the source.


[1]
openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py
[2] https://bugs.launchpad.net/horizon/+bug/1511748
[3] https://review.openstack.org/#/c/240661/

Thanks and Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20151118/d6a66aaf/attachment.html>


More information about the OpenStack-dev mailing list