Commit Graph

21 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
zhouhenglc cc50b45ca3 [test][unit]creating resources support set project_id
To write a new unit test, need to set "project_id", and then
use the discarded "tenant_id" is not appropriate.

this patch updated creating resources method, both "project_id"
and "tenant_id" are acceptable. of course, "project_id" priority.

Closes-bug: #1966354

Change-Id: Ic24f03da169dd3d1549b05b35ec77d3e9a25f17b
2022-03-28 05:41:48 +00:00
Brian Haley 7594bb0627 Remove the dependency on the "mock" package
Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

This patch moves all references to "import mock" to
"from unittest import mock". It also cleans up some new line
inconsistency.

Fixed an inconsistency in the OVSBridge.deferred() definition
as it needs to also have an *args argument.

Fixed an issue where an l3-agent test was mocking
functools.partial, causing a python3.8 failure.

Unit tests only, removing from tests/base.py affects
functional tests which need additional work.

Change-Id: I40e8a8410840c3774c72ae1a8054574445d66ece
2020-04-28 18:05:37 -04:00
Igor Malinovskiy eb6104c0ac Allow sharing of address scopes via RBAC mechanism
Neutron-lib api ref: https://review.opendev.org/#/c/707407/
Client: https://review.opendev.org/#/c/709124/
Tempest tests: https://review.opendev.org/#/c/711610/

Change-Id: I74bedae4de4eb25e5427ecb129543885a020a0a8
Depends-On: https://review.opendev.org/712633
Partial-Bug: #1862968
Closes-Bug: #1697925
2020-03-19 16:51:39 +02:00
Ryan Tidwell 32182010c2
Relax subnet pool network affinity constraints
This change relaxes the constraint that all subnets of the same
address family on a network must be allocated from the same subnet
pool. It allows subnets that share the same address scope to
co-exist on a network. If there is no address scope involved the
subnet pool / network affinity constraints continue to  enforced
as done previously.

Change-Id: I33bd17c723b3e8d409415bda008440f8ed9cfa68
Closes: 1830240
Implements: subnets-different-pools-same-net
2019-07-31 10:01:55 -05: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
Boden R 8e29f67920 use payloads for all SUBNETPOOL_ADDRESS_SCOPE events
This patch switches the code over to the payload style of callbacks [1]
for SUBNETPOOL_ADDRESS_SCOPE events.

NeutronLibImpact

[1] https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html

Change-Id: I9048b2026571694eb39279e3c0fc1d598ee1fd05
2019-01-30 14:32:08 -07:00
Hongbin Lu 12bb26fd0e Use constant IP_VERSION_4/6 in unit tests
Change-Id: I54bec2c06940b0b1362fecacef7860361d081601
2018-08-27 21:45:39 +00: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
Boden R 3af82c4161 use neutron-lib address scope apidef
neutron-lib contains the address scope API definition. This
patch moves neutron over to lib's API def for it.

NeutronLibImpact

Change-Id: Ib11b90500e871ecf3f23ba262c3c9199611cc6a7
2017-09-20 10:58:12 -06:00
Boden R 0e2b667bf1 use neutron-lib callbacks
The callback modules have been available in neutron-lib since commit [1]
and are ready for consumption.

As the callback registry is implemented with a singleton manager
instance, sync complications can arise ensuring all consumers switch to
lib's implementation at the same time. Therefore this consumption has
been broken down:
1) Shim neutron's callbacks using lib's callback system and remove
existing neutron internals related to callbacks (devref, UTs, etc.).
2) Switch all neutron's callback imports over to neutron-lib's.
3) Have all sub-projects using callbacks move their imports over to use
neutron-lib's callbacks implementation.
4) Remove the callback shims in neutron-lib once sub-projects are moved
over to lib's callbacks.
5) Follow-on patches moving our existing uses of callbacks to the new
event payload model provided by neutron-lib.callback.events

This patch implements #2 from above, moving all neutron's callback
imports to use neutron-lib's callbacks.

There are also a few places in the UT code that still patch callbacks,
we can address those in step #4 which may need [2].

NeutronLibImpact

[1] fea8bb64ba7ff52632c2bd3e3298eaedf623ee4f
[2] I9966c90e3f90552b41ed84a68b19f3e540426432

Change-Id: I8dae56f0f5c009bdf3e8ebfa1b360756216ab886
2017-04-26 12:12:53 -06: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
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
Hong Hui Xiao 635581912f Correlate address scope with network
With address scope being enabled, networks now are in one ipv4
address scope and one ipv6 address scope.

This patch adds derived attributes to the network as part of the
address scopes extension that will show related address scopes
when viewing a network through the API.

APIImpact

Change-Id: Ib1657636033ad2c0009d50ebe7c5ae4f72f6b175
Closes-Bug: #1547380
2016-02-22 22:46:18 -05:00
Jenkins 8627fad607 Merge "Update related router when subnetpool change scope" 2016-02-07 04:24:22 +00:00
Hong Hui Xiao e1df8b54d2 Update related router when subnetpool change scope
When the address scope of a subnetpool changes, the scope of related
subnet will change too. If this subnet has been connected to a router,
the related routing information needs to be updated.
This patch will fire the router update to correlative routers. The
routers will get all things updated in the update action.

Change-Id: Ia2eb484eb949a8d42fc909291de7be07b002adda
Partially-Implements: blueprint address-scopes
2016-02-04 16:25:48 -07: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
Bhagyashri Shewale 88e899f7a0 Fix module's import order
Made corrections in import order for built-in, third party and
project specific modules as per OpenStack import standards [1].

[1] http://docs.openstack.org/developer/hacking/#import-order-template

Change-Id: I899deefd6ee4732d6c0afd17a5afbe42b0fa37ba
2016-01-22 06:38:42 -08:00
Ryan Tidwell 6894e7db22 Add explicit address family to AddressScope
Adds an ip_version field for enforcing an address family on
an AddressScope.  All SubnetPools in an AddressScope must be
from the same address family. A SubnetPool cannot be created
in an AddressScope with a different address family.

Change-Id: Ibc6de08e0ef58a5da954d13f274f6003012a76cd
Partially-Implements: blueprint address-scopes
2015-12-14 11:02:27 -08:00
vikram.choudhary bde7838d04 Support subnetpool association to an address scope
This patch supports the following
 - create a subnetpool with address scope
 - update a subnetpool
     - to associate with an address scope
     - to change the association to another address scope
     - to remove the association with the address scope

DocImpact
APIImpact

Change-Id: I889096235ae81fcc736fabd4686c8e88b1a226b7
Co-Authored-By: Ryan Tidwell <rktidwell85@gmail.com>
Co-Authored-By: Numan Siddique <nusiddiq@redhat.com>
Partially-implements:  blueprint address-scopes
2015-08-04 12:09:15 +05:30
vikram.choudhary cbd95318ad Support Basic Address Scope CRUD as extensions
This patch adds the support for basic address scope CRUD.
Subsequent patches will be added to use this address scope
on subnet pools.

DocImpact
APIImpact

Co-Authored-By: Ryan Tidwell <rktidwell85@gmail.com>
Co-Authored-By: Numan Siddique <nusiddiq@redhat.com>
Change-Id: Icabdd22577cfda0e1fbf6042e4b05b8080e54fdb
Partially-implements:  blueprint address-scopes
2015-07-02 13:49:06 +05:30