Commit Graph

22 Commits

Author SHA1 Message Date
Takashi Kajinami c69701eb73 Bump hacking
hacking 3.0.x is really old. Let's bump it to the latest version
available.

This also fixes some errors detected but some rules are excluded now.
See the comments in tox.ini for further details.

Change-Id: I2565e5f5e791dfdd9bbc1890b35c413965d83626
2024-01-16 16:56:54 +00:00
elajkat 2dfe3c3983 Remove unimplemented api-def: BFD monitors
As discussed during the Zed PTG (see [1]) , due to changed product
development priorities we expect the BFD related extensions not
to get implemented. This patch reverts all relevant changes.

Revert Exception for BFD: BfdMonitorInUse,
a3b564dabf

Revert BFD validator, d126257982

Revert Fix hostroute validation with BFD,
5ff14c63c8

Revert extension for adding bfd monitors to extraroutes,
eb2c8a3c97

Revert BFD api def, f8c5b72cc8

[1]: https://etherpad.opendev.org/p/neutron-zed-ptg#L111
Related-Bug: #1907089

Change-Id: Ia532e4aa6ba2ed9e5ba4db75a250293890d9019d
2022-04-20 14:21:59 +02:00
Pedro Henrique 1dde6c24b7 Add custom range parameters on port_range validator
To maintain the behavior of port forwarding
validations that denies the port number 0 when
creating a new port forwarding rule for floating
IPs, we will need to extend the
'validate_port_range_or_none' validator to allow
us to define the acceptable port ranges when
validating a value.

This patch is one of a series of patches
to implement floating ip port forwarding with
port ranges.

The specification is defined in:
https://github.com/openstack/neutron-specs/blob/master/specs/wallaby/port-forwarding-port-ranges.rst

Change-Id: I0e11885e15616509942d60fbced3ff8e14cac654
Implements: blueprint floatingips-portforwarding-ranges
Related-Bug: #1885921
2022-03-14 08:42:21 -03:00
Harald Jensås 88b755c0e8 Fix collect duplicates TypeError for dict values
The _collect_duplicates uses a set for duplicates. This
does not work when the values in the list are dictionaries.

Instead of using a set, use a list and extend the condition to
only add to the list if seen and not already in dups.

Closes-Bug: #1956785
Change-Id: Iad627bcfb95699febd504d7dc7fc9e8a7d813a9e
2022-01-10 14:29:24 +00:00
Slawek Kaplonski 1f4c4031ee Add oneline_string validators
Those new validators are used to validate extra_dhcp_opt's opt_name and
opt_value fields to not allow multi-line strings to be set there.

Related-Bug: #1939733
Change-Id: I4dc3a09847205a660dc966d8eabccb4946f9bbc6
2021-10-25 22:06:40 +02:00
elajkat 5ff14c63c8 Fix hostroute validation with BFD
Change-Id: I594aa2837b38347a471be4e98c7d838c12c2e32b
Related-Bug: #1907089
See-Also: https://review.opendev.org/c/openstack/neutron-specs/+/767337
2021-08-26 16:43:03 +02:00
elajkat eb2c8a3c97 extension for adding bfd monitors to extraroutes
Change-Id: Ifff34a655170df4836dbcb2ff19effca644654bc
Related-Bug: #1907089
See-Also: https://review.opendev.org/c/openstack/neutron-specs/+/767337
2021-08-17 18:42:26 +02:00
Rodolfo Alonso Hernandez 1da279b3ad Use "unittest.mock" library and drop "mock" installation
As commented in [1], "unittest.mock" has been supported in the Python
internal unit testing framework since version 3.3.

[1]http://lists.openstack.org/pipermail/openstack-discuss/2020-March/013281.html

Change-Id: If71241a412ecfe3471a472802e18c986bd05d5b1
2020-03-13 12:10:36 +00:00
Nate Johnston 24aef1398b Ensure that extended ethertypes still work by name
When the change to add support for extended ethertypes was introduced,
one scenario for backwards compatibility was not addressed in the
validator: using the canonical string names for ethertypes.  This was
previously supported in the original implementation, using 'IPv4' or
'IPv6' for example.

Since the list of canonical ethertype names is available from os-ken we
consume it from there, which adds an additional dependency for
neutron-lib.

Related-Bug: #1838473
Change-Id: I53c6538dfbeea9691d95c6c555f0c56ae13d1a33
2019-07-30 17:29:08 -04:00
Nate Johnston db04334582 Add ethertype validator for custom ethertype validation
Since the restriction on ethertypes is being raised so that ethertypes
other than IPv4 and IPv6 can be specified in security group rules, add a
validator to ensure that ethertypes will be a valid two octet value.
The ethertype handling is configurable so make sure the validator
handles both possible configuration alternatives: the original style
where only IPv4 and IPv6 are valid, and the new style where any valid
two octet number (or it's string equivalent) works.

Related-Bug: #1832758
Needed-By: https://review.opendev.org/670203
Change-Id: I900f370f1de20b5137f138e54c5eec2102f77cce
2019-07-19 12:45:36 -04:00
Kobi Samoray 8417717411 Loopback address routing should be invalid
Host route validators should reject loopback CIDRs.

Change-Id: Ifa545242224bdc80a934b529e44b25b4492d4e0b
CLoses-bug: 1834012
2019-06-25 12:04:03 +03:00
zhufl 11f1fd85c4 Add missing ws seperator between words
This is to add missing ws seperator between words.

Change-Id: I095f698aa8999bd3a9a866f61ccd98a4156eecd2
2019-01-28 09:25:14 +08:00
longqianzhao 7da3684098 Modify the judgment method of CIDR and Add utests
The routing table could not add information, because
the original method could not identify the invalid CIDR.
This patch modify the judgement method. It will help
the router working normally.

Co-Authored-By: Allain Legacy <Allain.legacy@windriver.com>

Change-Id: I4db2e35303492aeda7e14cf9d525cc9b4a54ac36
Closes-Bug: #1805991
Story: 2004567
2019-01-04 09:23:29 +08:00
Paul Carver a508fa127c 'sfc' and 'flowclassifier' API extension definitions (networking-sfc)
Adds the API definitions for the 'sfc' and 'flow_classifier' API
extensions from networking-sfc.

Co-Authored-By: Thomas Morin <thomas.morin@orange.com>

Needed-By: I4958fb7b47050a76618183ab4f938622d95c8a0c
Change-Id: Id5aea04553b78dd17fca85de88cf076b42d24140
2018-04-27 10:46:02 +02:00
Hunt Xu 5f6a1259de Remove periods at the end of validator and converter messages
Messages fixed in this commit are wrapped at the end of other messages,
where the outer messages themselves have periods at the end. Thus the
extra periods of these messages should be removed to avoid duplication
in user facing messages.

An example for reference:

$ openstack firewall group rule create --source-port BEEF --protocol tcp
Invalid input for source_port. Reason: Invalid port: BEEF..

TrivialFix

Change-Id: I76bfed5a91cb569119e1e83ee3bf3917bb526e79
2018-01-03 13:36:43 +08:00
Hunt Xu 4c49003bb8 Fix port comparison in port range validation
Ports are compared as integers.

Change-Id: Icfe0c101f5095a779580ea3794d2e7c939b12af5
Closes-Bug: #1738371
2017-12-20 10:32:57 +08:00
Armando Migliaccio 8c021395c9 Check that duplicate Segmentation IDs 0 get caught
Related-bug: #1718385

Change-Id: I121b8dd886672840fccfc7382e594ad8611d78ad
2017-11-06 14:29:27 -08:00
ycx 045c0b18f4 Modify the validator for segmentation_id 0
When supplying a subport for a trunk with segmenation_id 0, Neutron
reports the error message about subport.
This patch lets the segmentation_id 0 pass through.

Change-Id: I3d164c1a1af89d7de20d90b3a6c6dcf6e8a1415b
Closes-bug: 1718385
2017-11-02 14:21:12 +08:00
Boden R 3ee0386c31 rehome flavor extension API definition
This patch rehomes the flavor extension API definition into neutron-lib
along with it's associated exceptions and validator. Please see the
release notes for some minor refactoring that's done as part of this
patch.

Change-Id: I0229a80bb168bac8dc0fa17fb2b06f1b140d27b4
2017-09-18 05:14:30 -06:00
Thomas Morin 0f4733db19 bgpvpn_routes_control: API definition fixes
* remove spurious comma in range definition for 'local_pref'
* add validator to allow a field to be an integer in a range or none
  and use it for the local_pref parameter
* the port association 'routes' attribute can be updated

Needed-By: I263e1ee6cf4e1a91be91a4a78f4a160f64d33cc6
Change-Id: I7995209459d5efa020a5e6c6335f4116df7f9f3f
2017-07-11 17:47:14 +02:00
YAMAMOTO Takashi 29a31c152c Make port_range validator accept an integer
It used to accept an integer but it has been changed for
some reasons when migrating to neutron-lib.
For compatibility, it's better to keep the original behaviour.
After all, the original behaviour seems reasonable to me.

Closes-Bug: #1696682
Related-Bug: #1696389
Change-Id: I60e1a99780202de14522f592288d3a9af7a75592
2017-06-08 17:46:28 +09:00
Hirofumi Ichihara 59005a0a78 Add validators package
Extension specific validators should be isolated from general
validators[1]. The existing validators are moved from
neutron_lib.api.validators to neutron_lib.api.validators.__init__
so that it doesn't affect existing consumers importing them.

[1]: https://review.openstack.org/#/c/459782/

Change-Id: I3434f9d7f504b78aca707e4fc8caad99c7af8dfc
2017-05-30 00:00:45 +09:00