Commit Graph

22 Commits

Author SHA1 Message Date
Slawek Kaplonski 670cc383e0 [S-RBAC] Switch to new policies by default
As part of the Secure RBAC community goal, we should switch options
"enforce_new_defaults" and "enforce_scope" to be True by default.
It will be still possible to fallback to old policy rules by configuring
those config options to False in Neutron config.

Change-Id: I09c0026ccf87e6c0bb1fa59165c03dc508fba6fa
2023-04-21 16:22:42 +02:00
Slawek Kaplonski 042de7e6bb Deprecate 'allow_overlapping_ips' config option
Config option allow_overlapping_ips is deprecated to removal now and
will be removed in the Z cycle.
Default value for that option is now set to True as this is supported by
IPAM module in Neutron.

Related-Bug: #1942294
Change-Id: I17bf5e4483025e9cc4ee04dd3e7c925f7bddc3db
2021-10-21 10:56:33 +00:00
Brian Haley b79842f289 Start enforcing E125 flake8 directive
Removed E125 (continuation line does not distinguish itself
from next logical line) from the ignore list and fixed all
the indentation issues.  Didn't think it was going to be
close to 100 files when I started.

Change-Id: I0a6f5efec4b7d8d3632dd9dbb43e0ab58af9dff3
2019-07-19 23:39:41 -04:00
Boden R ee77344ac1 use api def ALIAS in supported_extension_aliases
Today a number of classes define their supported_extension_aliases
using static strings rather than API definition ALIASes. This patch
switches them to use the ALIAS where applicable.

Change-Id: I716270c68a9fcd850c3c26de31bc13ea16def23d
2019-04-08 08:30:20 -06:00
longqianzhao 4cbaa06031 Add test cases: invalidate CIDR
Add the invalid CIDR for verifing the modified
method is valid.

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

Depends-On: https://review.openstack.org/623415/
Change-Id: I0f051130e4708682104bd935b23991b534fc99d2
Related-Bug: #1805991
Story: 2004567
2019-01-25 10:50:43 +08:00
Boden R 54444407f4 use l3 api def from neutron-lib
Commit I81748aa0e48b1275df3e1ea41b1d36a117d0097d added the l3 extension
API definition to neutron-lib and commit
I2324a3a02789c798248cab41c278a2d9981d24be rehomed the l3 exceptions,
while Ifd79eb1a92853e49bd4ef028e7a7bd89811c6957 shims the l3
exceptions.

This patch consumes the l3 api def by:
- Removing the code from neutron that's now in lib.
- Using lib's version of the code where applicable.
- Tidying up the related unit tests as now that the l3 api def from lib
is used the necessary fixture is already setup in the parent chain when
setting up the unit test class.

NeutronLibImpact

Change-Id: If2e66e06b83e15ee2851ea2bc3b64ad366e675dd
2017-12-15 07:03:14 -07:00
Boden R 5319522bff use extra route api def from lib
Commit I0425384d5fd6864f336bd7a5c9a5e70f2b3568ff rehomed the extra route
extension's API defintion to neutron-lib. This patch consumes it
updating the code to use lib's implementation.

NeutronLibImpact

Change-Id: Iae3bd4f15e12c401e615cc06358b376b81b53dc5
2017-11-02 13:11:25 -06:00
Boden R 277996b68d cleanup unit test usage of api extension maps
Today our unit test code uses various ways to "patch" the global
RESOURCE_ATTRIBUTE_MAP as well as extension specific maps in some cases.
This patch consolidates such patching whereby tests should use neutron's
AttributeMapMemento in their setup() chain (only once) if they update
the global map and they should individually handle backup/restore of per
extension map updates. This change will simplify the code and make it
easier to phase-in API definition usage with neutron-lib where we have
some as API definitions and others not. Longer term the
AttributeMapMemento will be replace with neutron-lib's fixture as we
move all extension maps to API definitions in neutron-lib.

Change-Id: I2586f0b11b107d7f57214a0d65bcf7c38a5f0ebb
2017-10-24 10:38:52 -06:00
Nguyen Van Trung 1b7d6da521 Redundant alias in import statement
Change-Id: I4a48eef728fff824461344efaf377ccbbc02726b
2017-10-19 15:31:03 +07:00
Armando Migliaccio ca751a1486 Spin off context module
NeutronLibImpact

Partially-implements: blueprint neutron-lib

Change-Id: I48cf45dc1b07035d952152eac2548a3bd9fc2832
2017-03-06 16:25:29 +00:00
Gary Kotton 396abb8ccb neutron-lib: start using neutron-lib helpers
The following helpers are used:
	parse_mappings
	compare_elements
	safe_sort_key

Change-Id: I5947b473330fd29f8d4c1a08f03d007a52c8dfd9
2016-10-10 01:30:26 -07:00
Ryan Tidwell cbc15d2e1d Ensure unit tests don't assume an IP address allocation strategy
These unit tests initially asserted sequential allocation of IP
addresses, even though they have no need to specifically assert
that a specific IP was allocated. This made it difficult to
change out the IP allocation algorithm in the future and made
these tests fragile and poorly isolated.

This change breaks the dependency these unit tests have on a
specific IP allocation strategy and isolates them from any
changes that may be made to the order in which IP addresses
are allocated on a subnet.

Change-Id: Idc879b7f1e6496aa96b4f7ae6c3eaca6079bdcac
Partial-Bug: #1543094
2016-05-17 09:50:25 -07:00
Henry Gessau 4148a347b3 Use constants from neutron-lib
With this we enable the deprecation warnings by default.

Related-Blueprint: neutron-lib

Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
2016-04-23 21:23:56 -04:00
Shih-Hao Li 22aed6d806 Fix the context passed to get_subnets in _validate_routes
In the patch for bug #1538767 (https://review.openstack.org/#/c/273278),
get_ports() is passed with context.elevated(), while later get_subnet()
for those ports is still passed with the original context. This could
cause "Subnet could not be found" exception for ports only accessible
in context.elevated() but not in the original context.

This commit replaces context with context.elevated() in get_subnet().

Related-Bug: #1538767
Change-Id: I21e73625e0a625a431bfb22f847c3b6f9671daea
2016-03-11 00:39:32 +00:00
Cedric Brandily 3d5d378769 Allow non-admins to define "external" extra-routes
Currently non-admin users can create extra-routes when the nexthop is on
router-interfaces subnets but not on external-network subnet. Indeed
user permissions are used to get router ports in order to validate
nexthops BUT non-admin users don't "see" router port on its external
network.

This change uses an elevated context instead of user context to enable
non-admins to create "external" extra-routes.

APIImpact
Closes-Bug: #1538767
Change-Id: I08b1d8586a4cd241a3589e8cb7151b77ab679124
2016-02-21 14:41:17 +01:00
Yatin Kumbhare 6b4be76e14 Fix params order in assertEqual
Fix params order to correspond to real signature:
assertEqual(expected, actual)

Change-Id: I722b998f6eae47076f3d10213073296a0a9a2081
Closes-Bug: #1277104
2016-02-03 11:54:29 +05:30
lzklibj 3491cbc0c5 Unify assertEqual for empty usages
Update previous assertEqual(observed, *empty) usages to
assertEqual(*empty*, observed).

This patch aslo update hacking check for assertEqual with
empty types.

Change-Id: I981277618f92254a5beb9d3308a317d8c14e125c
2016-01-07 10:06:35 +00:00
ChangBo Guo(gcb) 06174a41e4 Trival: Remove unused logging import
Change-Id: I13298e642f25c9f70dcff9b1e056b418edf0a461
2015-12-26 12:49:56 +08:00
Cedric Brandily 99c9af8f7a Python 3: use a hash to sort dictionaries
Dictionaries are unorderable in py3K. This change defines the method
safe_sort_key[1] which could be used a sort function for list of
dictionaries and non-dictionaries.

[1] neutron.common.utils

Change-Id: I9c9fae53bb3ac5b8611c92164c9630c82c2d0ceb
Blueprint: neutron-python3
2015-08-31 22:53:27 +02:00
ChangBo Guo(gcb) c3d65a0ed9 Switch to oslo_utils.uuidutils
Get rid of oslo-incubator uuidutils

Closes-Bug: #1467020
Depends-On: I2df519965883b05d5d58cdc4785c850b0685dc2c
Depends-On: I9f8e98ad9517864a9ffdacf01c0a9a5aab554edb
Depends-On: Ied0faac809a5b72b1cd466c8babc9ca5418692c3
Change-Id: Iebe491b981b4b7c02785412fadd27678bb5e47de
2015-06-22 11:06:18 +00:00
Adrien Vergé 422588e133 Get completely rid of contextlib.nested
`contextlib.nested` is deprecated since Python 2.7 and incompatible with
Python 3. This patch removes all its occurences by using the helper
script at [1].

This is a necessary step to allow us running all unit tests with
Python 3 (not just a small subset as it is done now).

[1]: https://github.com/adrienverge/context_unnester

Change-Id: I8d1de09ff38ed0af9fb56f423a2c43476408e0fb
Blueprint: neutron-python3
Closes-Bug: #1428424
2015-05-29 23:18:46 +02:00
Maru Newby 1105782e39 Reorganize unit test tree
This change ensures that the structure of the unit test tree matches
that of the code tree to make it obvious where to find tests for a
given module.  A check is added to the pep8 job to protect against
regressions.

The plugin test paths are relocated to neutron/tests/unit/plugins
but are otherwise ignored for now.

Change-Id: If307593259139171be21a71c58e3a34bf148cc7f
Partial-Bug: #1440834
2015-04-06 23:28:31 +00:00