Commit Graph

39 Commits

Author SHA1 Message Date
Rodolfo Alonso Hernandez 3a9e39b9ef [netaddr>=1.0.0] Do not use netaddr.core.ZEROFILL flag with IPv6
The flag "netaddr.core.ZEROFILL" cannot be used with IPv6 addresses
with netaddr>=1.0.0

Change-Id: I116ea2abbee13a73302ebca9c65707f427a7d9d0
Closes-Bug: #2055173
2024-02-29 08:33:13 +00:00
Dmitrii Shcherbakov e52a9372f7 ext-gw-multihoming: api-def and api-ref
API additions for [1].

* Added a new router attribute: external_gateways;
* Added new API definitions for:
    PUT add_external_gateways
    PUT update_external_gateways
    PUT remove_external_gateways
* Added extensions for each of the new router-level attributes:
  * enable_default_route_ecmp
  * enable_default_route_bfd
* Combined the validation logic for the external_gateway_info type
  across extensions (l3_ext_gw_mode, qos_gateway_ip and the new
  extension called l3_ext_gw_multihoming).

[1] https://review.opendev.org/c/openstack/neutron-specs/+/870030/

Change-Id: I2618475636b2bb9bfd743a62f5d4859d4f68a547
Related-Bug: #2002687
2023-04-20 19:18:02 +03:00
Zuul ccb996fbe5 Merge "Remove unimplemented api-def: BFD monitors" 2022-04-29 11:52:35 +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
Bence Romsics a5b9390858 Remove unimplemented api-def: multiple-external-gateways
As discussed on the 2022-04 PTG, due to changed product development
priorities we expect the multiple-external-gateways extension not
to get implemented. This patch reverts all relevant changes.

Revert "Use explicit "dict_or_nodata" validation for "external_gateway_info""
This reverts commit c6f576e66b.

Revert "multi-ext-gw: api-def and api-ref"
This reverts commit 75057767eb.

Change-Id: I485a7bb3d73b675661c03ec883f457586071c21d
2022-04-08 16:31:47 +02:00
zhouhenglc 75a5fbc88b Don't translate logs
According to HACKING.rst[1] description, we shouldn't traslate logs

[1] 0f53b32d06/HACKING.rst

Change-Id: Iecc9d5e12c2782d6a4c3f486f26a83b79feeb0a3
2022-04-05 09:01:53 +08: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
Zuul 4e42419df0 Merge "extension for adding bfd monitors to extraroutes" 2021-08-18 08:56:41 +00: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
Bence Romsics 75057767eb multi-ext-gw: api-def and api-ref
New router attribute:
    external_gateways

New router actions:
    PUT add_external_gateways
    PUT update_external_gateways
    PUT remove_external_gateways

Change-Id: I46381b70f770ccd32943644341388b09f7e14556
Partial-Bug: #1905295
Related-Change (spec): https://review.opendev.org/c/openstack/neutron-specs/+/779511
2021-08-03 16:02:35 +02:00
Brian Haley e92e98f8c6 Start running pylint for pep8 tests
When 'tox -e pep8' was run it didn't run any pylint
checks, let's start doing it.

Fixed issues pylint found, 2.6.0 added two new checkers
[1] that make pep8 validation fail:

- raise-missing-from (W0707)
- super-with-arguments (R1725)

[1] http://pylint.pycqa.org/en/latest/technical_reference/features.html

Change-Id: Ib83f30696269c968f41f9c1131596268a4412658
2020-09-17 09:53:01 -04:00
Rodolfo Alonso Hernandez 478502b3df Remove library "six"
Now Python2 is not supported, this compatibility library for both
versions is not needed anymore.

Change-Id: Ic6da328a6219c8a00d38602f6b539a2ff5be1b2e
2020-01-22 13:16:45 +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
zhulingjie 975d6641f4 Update hacking version
Change-Id: I0f018fe963256658682676fcd86520ceae590c75
2019-04-23 01:13:21 +00:00
Boden R 43cece7381 rehome subnet service types extension
This patch rehomes the API definition for the subnet service types
extension. Note that the valid_prefixes list is removed from the
implementation as it isn't used today [1].

For additional details on this rehome, please see the release note
included herein.

[1] http://codesearch.openstack.org/?q=valid_prefixes

Change-Id: Iabcb21d4f6e2c2863bc96149da907e1f39c8de6e
2019-03-13 11:14:55 -06: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
Zuul 1ad38f81cd Merge "fix vpnaas subnet_list_or_none type" 2018-04-24 00:54:41 +00:00
Boden R 59797ca408 fix vpnaas subnet_list_or_none type
The validate_subnet_list_or_none validator was rehomed into lib as part
of [1] and registered with the type of 'subnet_list_or_none'. While this
is a good type name, vpnaas already adds a validator with that type in
their master branch today [2]. As a result, running with neutron-lib
master can fail due to re-registration [3]. The way we've addressed this
in the past is to use a new type name in neutron-lib and then just
ensure the new type is used upon consumption.

This patch renames the validation type subnet_list_or_none to
list_of_subnets_or_none to address the issue [3].

[1] https://review.openstack.org/#/c/439972/
[2] https://github.com/openstack/neutron-vpnaas/blob/master/
neutron_vpnaas/extensions/vpnaas.py#L177
[3] http://logs.openstack.org/periodic/git.openstack.org/openstack/
vmware-nsx/master/openstack-tox-py35-with-neutron-lib-master/227d2f0/
job-output.txt.gz#_2018-04-23_06_17_55_841555

Change-Id: If1713edb26fd923047f2f6c022f0557b2f3ec41e
2018-04-23 09:53:44 -06:00
Thomas Morin c8e1389a55 API attribute processing: allow to populate dict attribute default values
Currently, the neutron-lib API code fills defaults values for the
attributes defined in a resource map, but does not fill defaults inside
the attributes that are dictionaries.

This change introduces a 'dict_populate_defaults' flag that allows the
defaults to be filled inside dictionary attributes (attributes of any
dictionary type).

This is useful to incorporate networking-sfc APIs and avoid using
the specific normalize_* converter methods [1] (see follow-up changes).

[1] https://github.com/openstack/networking-sfc/blob/master/networking_sfc/extensions/sfc.py#L226-L239

Change-Id: I0d7ff1981aa92d17811233e29a6ca7264a9ddb6c
2018-04-17 17:25:31 +02:00
Akihiro Motoki 98d261468c Fix pep8 errors
Recent pep8 upgrade and corresponding pycodestyle update break
pep8 job due to the new rules.
- E402 module level import not at top of file
- E731 do not assign a lambda expression, use a def
- W503 line break before binary operator

Change-Id: I40d386b44489e6847dd9c441b3feb56e099d252e
2018-04-11 01:10:23 +09:00
Cao Xuan Hoang 053eae0c8b Migrate neutron-vpnaas API definitions to neutron-lib
Neutron-vpnaas is intending to bring back into the stadium.
So, neutron-vpnaas must migrate it's API definition to neutron-lib.

Co-Authored-By: Anh Tran <trananhkma@gmail.com>
Co-Authored-By: Hunt Xu <mhuntxu@gmail.com>

Change-Id: I06760fbbbc87570412a21364fba58efe880a907b
2018-01-26 09:14:42 +08: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
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
Jenkins 59e906c2f0 Merge "bgpvpn_routes_control: API definition fixes" 2017-07-12 10:07:54 +00: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
Jenkins 8deff26d53 Merge "Enable module reference" 2017-07-11 01:58:26 +00:00
Gary Kotton fafb101538 Use flake8-import-order plugin
This enables the process to be automated and not rely on
review inputs.

Change-Id: Ie829b9c53dd1b251785802ecbf364e97b1437ff5
2017-07-05 00:53:13 -07:00
Akihiro Motoki f9b06e8937 Enable module reference
Also fixes sphinx warnings in existing docstrings.

Change-Id: Iccccd782ff8b80a3fd2764e7ef9cc3dde46e32ee
2017-07-05 12:09:10 +09: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