Commit Graph

39 Commits

Author SHA1 Message Date
Takashi Kajinami 46c1220b38 Remove deprecated [designate] admin_* parameters
These were deprecated during Xena cycle[1], so can be removed now.

[1] adfd853267

Related-Bug: #1927494
Change-Id: I9fadaa6cfcd66409da47422505c145d9d67f6b8c
2023-11-04 22:47:55 +09:00
Zuul 232a67f444 Merge "[S-RBAC] Switch to new policies by default" 2023-05-05 11:10:24 +00:00
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 a5e26408d2 Fix dns_integration and ml2 plugin unit tests modules
Those modules needs to ensure that common config options
are registered.
Otherwise it can't be successfully run without other tests as it was
then failing due to unregistered config option.

Trivial-fix

Change-Id: Ifa348218229b6be64bb7403d933df82f03afafdf
2023-04-19 16:56:22 +02:00
hamalq ea13f2e83f Sync the dns-assignment with the actual designate dns-domain
When a port is created the dns-assignment (dns-domain part)
was always taken form Neutron config dns_domain which is not
always true, since it could be Neutron network dns_domain or
the dns_domain sent when creating the port

Change-Id: I7f4366ff5a26f73013433bfbfb299fd06294f359
Closes-Bug:1873091
2020-06-04 20:45:55 +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
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
Monty Taylor e982506c20 Stop mocking keystoneauth internals
The unittests do some mocks of the keystoneauth Session contructor to
make sure Sessions are being constructed properly. In keystoneauth 3.7.0
we added two new options that can be used from oslo.config files, and
those options in turn now get passed to the Session constructor - which
breaks the mocks.

The thing is, neutron doesn't need to test that
load_session_from_conf_options works, keystoneauth tests that. What we
want to test here is that setting various config options has a specific
result. So instead of testing the entire args list (which could change)
test for the specific results we're concerned about.

Change-Id: I3048cdb8f8b07f6b243a0ab7d08484278c60995f
Needed-By: https://review.openstack.org/569447
2018-06-02 11:25:20 +00:00
Brian Haley 90cd939047 Fix W503 pep8 warnings
Fix W503 (line break before binary operator) pep8 warnings
and no longer ignore new failures.

Trivialfix

Change-Id: I7539f3b7187f2ad40681781f74b6e05a01bac474
2018-04-17 14:22:58 +00:00
Boden R 72b6db9379 use dns api def from neutron-lib
neutron-lib contains the dns API definition and associated exceptions,
constants, etc. This patch moves all references over to use the API
def from neutron-lib.

NeutronLibImpact

Change-Id: If180cf92d8ae31a0857080239e8233095cd6c768
2017-10-20 16:38:33 -06:00
Jenkins 433d5a0353 Merge "Refactoring config options for ml2 config opts" 2017-09-13 09:54:47 +00:00
Aradhana Singh d00a50aad1 Refactoring config options for ml2 config opts
Refactoring neutron ml2 config opts to be in neutron/conf/plugins/ml2.
This would allow centralization of all configuration options and
provides an easy way to import.

NeutronLibImpact

Change-Id: Ibc5a9ab268578c243ef13f7e0041bacd6c0c410b
Partial-Bug: #1563069
Needed-By: Id0a97dda7718f06e33b2d30ce01cdcb3e9a46f7d
2017-09-08 15:34:49 -04:00
Jens Harbott 22d6a1540f Fix port deletion when dns_integration is enabled
The records found in ip_allocations contain objects of type IPAddress,
but the external dns service expects them as string, so we need to
insert a conversion.

Change-Id: I622993fc273121bfd051d2fd9c7811e2ae49a1d8
Closes-Bug: 1714641
2017-09-03 08:05:49 +00:00
Miguel Lavalle 589d206987 Add unit tests for dns_domain for ports
This patchset adds unit tests for dns_domain for ports.

Change-Id: Ib8c05260334703088f48ce932054146d796e56e0
2017-08-09 16:12:53 -05:00
Miguel Lavalle 4a77533259 Add port dns_domain processing logic
This patchset adds logic to the ML2 DNS integration extension to process
a new dns_domain attribute associated to ports.

This patchset belongs to a series that adds dns_domain attribute
functionality to ports.

DocImpact: Ports have a new dns_domain attribute, that takes precedence
           over networks dns_domain when published to an external DNS
           service.

APIImpact: Users can now specify a dns_domain attribute in port POST and
           PUT operations.

Change-Id: I02d8587d3a1f9f3f6b8cbc79dbe8df4b4b99a893
Partial-Bug: #1650678
2017-08-08 18:42:43 -05:00
Miguel Lavalle 190b31e03a Add dns_domain attribute to ports in the API
This change adds a dns_domain attribute to ports in the API.

This patchset belongs to a series that adds dns_domain attribute
functionality to ports.

Change-Id: Ied1f2f0c1e96ae21c309b6e6fed9e3c602b0450b
Partial-Bug: #1650678
2017-07-13 16:51:54 -05:00
Jenkins f58904e669 Merge "use neutron_lib's provider_net api-def" 2017-03-30 10:20:32 +00:00
melissaml 37fc39fda3 Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack common has a wrapper for generating uuids. We should
use that function when generating uuids for consistency.

Change-Id: I9e8097f7254e9cd63f27898ab49c473aa6177121
Closes-Bug: #1082248
2017-03-24 06:25:31 +08:00
Boden R 9658b4b34e use neutron_lib's provider_net api-def
Neutron-lib 1.1.0 is now out and contains the provider
network API definition (as per commit [1]). This patch
moves neutron references over to the neutron-lib
version.

NeutronLibImpact
- Consumers using the public constants within neutron's
providernet API extension must now use the values
from neutron-lib.

[1] cba0f9f0dd920b1f828c4bba3bd388d5b4eb9abf

Change-Id: I46390a159e93642901de87ea6604f2e7ffa03bad
2017-03-15 06:27:58 -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
Cedric Brandily c88debc44f Use addCleanup instead of tearDown
We should use addCleanup instead of tearDown because:
- tearDown is executed only if the test succeeds
- cleanups (defined with addCleanup) are executed even if the test fails

This change removes useless tearDown and transforms remaining ones into
addCleanup.

Change-Id: I44bd26dcb5c8456126a35cb807f0bafc772c0ab0
2017-02-02 22:07:26 +01:00
Gyorgy Szombathelyi b38f1cb1f7 Use the session loader in keystoneauth1 for designate
Using the session loader has the benefit of compatibility with
settings in other sections (like keystone_authtoken), and the
ability to use client certs and setting the timeout. This changes
the designate.ca_cert setting to designate.cafile, but the former
is added as a deprecated option, so existing config files will work.

DocImpact
ca_cert in [designate] is deprecated, use cafile instead.

Change-Id: I9f2173b02af5c3929a96ef8c773d587e9b673d62
2017-01-11 11:37:09 +01:00
Jenkins 7836516808 Merge "Allow keystone v3 in the designate driver" 2016-12-23 16:23:48 +00:00
Gyorgy Szombathelyi 91d048dbde Allow keystone v3 in the designate driver
Using the loader from keystoneauth1, it is possible to easily use
keystone v3 options in [designate].
For the end user, it means she/he must specify designate.auth_type,
then she/he can specify an Keystone v3 endpoint in designate.auth_url.

Change-Id: I8bb02f11e60767dacdf6ac852979cfa82de1e08b
Closes-bug: #1585976
DocImpact
2016-12-05 17:54:41 +01:00
Armando Migliaccio 17563a802e Adopt neutron-lib plugin directory
Neutron Manager is loaded at the very startup of the neutron
server process and with it plugins are loaded and stored for
lookup purposes as their references are widely used across the
entire neutron codebase.

Rather than holding these references directly in NeutronManager
this patch refactors the code so that these references are held
by a plugin directory.

This allows subprojects and other parts of the Neutron codebase
to use the directory in lieu of the manager. The result is a
leaner, cleaner, and more decoupled code.

Usage pattern [1,2] can be translated to [3,4] respectively.

[1] manager.NeutronManager.get_service_plugins()[FOO]
[2] manager.NeutronManager.get_plugin()
[3] directory.get_plugin(FOO)
[4] directory.get_plugin()

The more entangled part is in the neutron unit tests, where the
use of the manager can be simplified as mocking is typically
replaced by a call to the directory add_plugin() method. This is
safe as each test case gets its own copy of the plugin directory.
That said, unit tests that look more like API tests and that rely on
the entire plugin machinery, need some tweaking to avoid stumbling
into plugin loading failures.

Due to the massive use of the manager, deprecation warnings are
considered impractical as they cause logs to bloat out of proportion.

Follow-up patches that show how to adopt the directory in neutron
subprojects are tagged with topic:plugin-directory.

NeutronLibImpact

Partially-implements: blueprint neutron-lib

Change-Id: I7331e914234c5f0b7abe836604fdd7e4067551cf
2016-11-23 04:45:33 -07:00
Manjeet Singh Bhatia 837abf5d4d Add OVO for dns Objects
This patch will introduce ovo for NetworkDNSDomain and
FloatingIPDNS. It also integrates the ovo use for PortDNS
NetworkDNSDomain, FloatingIPDNS

Co-Authored-By: Brandon Logan <brandon.logan@rackspace.com>

Change-Id: I90ace59735c8cb9fa8a02b0e7636a58f0912efa7
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
2016-10-27 17:39:45 +00:00
Jenkins 65a3b89116 Merge "Use more specific asserts in tests" 2016-10-11 11:41:55 +00:00
Manjeet Singh Bhatia ead39faa37 Relocate DNS db models
This patch relocate db models for dns.

Partial-Bug: #1597913

Change-Id: I6d1b43d8c5c8d6f8b80730a16eedac5e59cbed44
2016-10-07 21:35:35 +00:00
Carl Baldwin 14fee9cfcc Try to reuse existing IPs when a port update specifies subnet
If a port update specifies only a subnet_id for a fixed_ip then we
want to look at existing fixed_ips to see if that subnet_id is already
there. This avoids allocating a new IP address on the subnet and
deallocating the old one.

Without some special care, this breaks the code path for prefix
delegation. One could argue that PD needs reworking. However, as a
stop-gap measure, we still run the old code path if the address is an
EUI-64 address. This allows PD to continue to work as it was
originally written and it doesn't do any harm because allocating
EUI-64 addresses is repeatable.

This commit removes a test case from the DNS integration tests. The
test was specifically testing that DNS records we updated in the case
where a subnet id was passed to re-allocate a fixed_ip. Since the use
case no longer works, the test doesn't make sense.

This commit also preserves the ability to add an additional IP from a
subnet for which the port already has IPs.

Change-Id: Iba5d54efa7f99ed82275ffc8e5be975b373c29d3
Related-Bug: #1622616
Closes-Bug: #1625334
2016-09-20 21:58:55 -06:00
Kevin Benton 748faa0579 Revert "Don't allocate IP on port update when existing subnet specified"
This reverts commit f07c07b16f.
This broke the ability to add fixed IPs to a port based on
subnet_id.

API test to prevent regression in child patch.

Change-Id: Ia13abea59431744ce7a0270f480f4bf61a7161e0
Closes-Bug: #1623800
2016-09-14 20:39:41 -07:00
Carl Baldwin f07c07b16f Don't allocate IP on port update when existing subnet specified
If a port update specifies only a subnet_id for a fixed_ip then we
want to look at existing fixed_ips to see if that subnet_id is already
there. This avoids allocating a new IP address on the subnet and
deallocating the old one.

Without some special care, this breaks the code path for prefix
delegation. One could argue that PD needs reworking. However, as a
stop-gap measure, we still run the old code path if the address is an
EUI-64 address. This allows PD to continue to work as it was
originally written and it doesn't do any harm because allocating
EUI-64 addresses is repeatable.

This commit removes a test case from the DNS integration tests. The
test was specifically testing that DNS records we updated in the case
where a subnet id was passed to re-allocate a fixed_ip. Since the use
case no longer works, the test doesn't make sense.

Change-Id: I887cd23cf65a1df9bd1d59ab897a1ecd005a588c
Closes-Bug: #1622616
2016-09-13 13:37:44 -06:00
Béla Vancsics 7deba33bf3 Use more specific asserts in tests
Instead of assertTrue and assertFalse use more specific asserts.
They are compatible with Python 2.7[1] and 3.4[2]

[1]: https://docs.python.org/2.7/library/unittest.html
[2]: https://docs.python.org/3.4/library/unittest.html

Change-Id: I0e6cc33a54e35fe663e5cdf2b947053528a8775f
2016-08-23 07:36:49 +02:00
Graham Hayes 625fdb423e Avoid KeyError when accessing "dns_name" as it may not exist
Neutron LBaaS does not pass a full copy of the request_data
into this function, and causes the port create to fail
with a KeyError

Change-Id: Ib81cbbaf24a4ffaa983e1b05146aea0dc74e29bb
Fixes-Bug: #1605336
2016-08-18 15:43:53 +01:00
Bin Yu 64f5fc8259 Refactor DNS integration out of DB core plugin
This patch set aims to move all the code related to DNS integration
from the DB core plugin to the DNS ML2 extension module.

By doing this, this patchset removes the dns related code in
db_base_plugin_v2 and the dns exteions module talks with core plugin
only through the method extension_manager and apply_dict_extend_functions

By properly implementing the generation of the dns_assignment attribute
for ports in the DNS ML2 extension module, this patchset also fixes
https://bugs.launchpad.net/neutron/+bug/1579977

Change-Id: I63afb1a1bfeeb14eefb54681dc64959144deeb25
Closes-Bug: #1579601
Closes-Bug: #1579977
2016-07-26 07:33:50 +00:00
Ihar Hrachyshka 3703b31eea tests: clean up designate client session mock on test exit
This test was modifying the driver session method without making an
effort to restore the original value after the test case completion.
This resulted in two consequent tests that relied on the method that
were triggered in the same test thread, to trigger a failure for one of
them.

Changed the setup logic for the test class to use mock.patch(..).start()
instead.

Closes-Bug: #1593647
Change-Id: I08be90691b5417025c40c5a18308d820dc7a43d2
2016-06-20 07:49:14 +00:00
imran malik 9cd95366a0 Fix designate dns driver for SSL based endpoints
Allow setting options in designate section to specify if want
to skip SSL cert check. This makes it possible to work with HTTPS
based endpoints, the default behavior of keystoneclient is to always
set verify=True however in current code, one cannot either provide
a valid CA cert or skip the verification.

DocImpact: Introduce two additional options for `[designate]` section
in neutron.conf
CONF.designate.insecure to allow insecure connections over SSL.
CONF.designate.ca_cert for a valid cert when connecting over SSL

Change-Id: Ic371cc11d783618c38ee40a18206b0c2a197bb3e
Closes-Bug: #1588067
2016-06-15 15:06:40 -07:00
Dustin Lundquist ae613a0157 Use IPv[46]_BITS instead of IPV[46]_MAX_PREFIXLEN
Replace references to IPV[46]_MAX_PREFIXLEN with IPv[46]_BITS from
neutron-lib. Replace several integer literals used to represent IP
address sizes with these constants too.

Remove IPV4_MAX_PREFIXLEN and IPV6_MAX_PREFIXLEN from neutron constants
as they are no longer referenced:
    http://codesearch.openstack.org/?q=IPV[46]_MAX_PREFIXLEN

Change-Id: I03e1405e71f08db9ac6e759258625139c28ecc89
2016-06-02 10:42:28 -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
Miguel Lavalle 9df22afb38 Adds unit tests for external DNS integration
Adds unit tests for external DNS integration

Change-Id: I91a9f6b496a6a6c544e824508dfb349f68de9dbd
2016-03-09 18:00:39 +00:00