]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Validate CIDR given as ip-prefix in security-group-rule-create
authormarios <marios@redhat.com>
Fri, 29 Nov 2013 16:23:54 +0000 (18:23 +0200)
committerThomas Goirand <thomas@goirand.fr>
Mon, 9 Jun 2014 15:06:53 +0000 (23:06 +0800)
commit602ff0374c65e32456b65fb44a5c9c007379311c
treedd2397a0d85db55435792bd94e0a57015220ee24
parent90fd9fbeb2b2bdfe456db3e86f8bbe40832c2487
Validate CIDR given as ip-prefix in security-group-rule-create

There was no validation for the provided ip prefix. This just adds
a simple parse using netaddr and explodes with appropriate message.
Also makes sure ip prefix _is_ cidr (192.168.1.1-->192.168.1.1/32).

Validation occurs at the attribute level (API model) as well as at
the db level, where the ethertype is validated against the ip_prefix
address type.

Unit test cases added - bad prefix, unmasked prefix and incorrect
ethertype. Also adds attribute test cases for the added
convert_ip_prefix_to_cidr method

Closes-Bug: 1255338

Conflicts:
neutron/tests/unit/test_security_groups_rpc.py

Change-Id: I71fb8c887963a122a5bd8cfdda800026c1cd3954
(cherry picked from commit 65aa92b0348b7ab8413f359b00825610cdf66607)
neutron/common/exceptions.py
neutron/db/securitygroups_db.py
neutron/extensions/securitygroup.py
neutron/tests/unit/test_extension_security_group.py