Commit Graph

37 Commits

Author SHA1 Message Date
Boden R 839e575fa6 use plugin utils from neutron-lib
The remainder of the neutron.plugins.common.utils were rehomed into
neutron-lib with [1][2]. This patch consumes them by using the functions
from neutron-lib, and removing the neutron.plugins.common.utils module
all together as it's fully rehomed now.

NeutronLibImpact

[1] https://review.openstack.org/#/c/560950/
[2] https://review.openstack.org/#/c/554546/

Change-Id: Ic0f7b37861f078ce8c5ee92d97e977b8d2b468ad
2018-07-12 08:13:05 -06:00
Boden R 410a83c89d use plugin common utils from neutron-lib
A bulk of the public APIs that are part of neutron.plugins.common.utils
were rehomed into neutron-lib with [1] and the remaining with [2].

This patch consumes [1] by:
- Removing the rehomed code from neutron.
- Removing the UTs that are no longer applicable.
- Leaving the functions in [2][3] in neutron.plugins.common.utils until
we release [2][3] and can consume it at which point we should be able to
remove the utils module.

NeutronLibImpact

[1] Iabb155b5d2d0ec6104ebee5dd42cf292bdf3ec61
[2] I2c0e4ef03425ba0bb2651ae3e68d6c8cde7b8f90
[3] I73f5e8ad7a1a83392094db846d18964d811b8bb2

Change-Id: I1d63cbea463e92e1d2e053f8e1a564ed52cb84f8
2018-04-17 12:06:28 -06:00
Boden R 2b3fdc871c remove unused common exceptions
This patch removes a handful of unused exceptions from
neutron.common.exceptions as follows:

The following exceptions already live in neutron-lib and are thus
duplicates in neutron:
PlacementEndpointNotFound
PlacementResourceProviderNotFound
PlacementInventoryNotFound
PlacementAggregateNotFound
PlacementInventoryUpdateConflict
NetworkVlanRangeError
PhysicalNetworkNameError
MacAddressGenerationFailure

The following exception is not used anywhere today:
TenantNetworksDisabled

NeutronLibImpact

Change-Id: Ie8227954681292ead1da0dedc950c54028ce84f1
2018-04-09 15:08:05 -06:00
Boden R 44292f4c9a consume neutron-lib resources attr map
Today we shim the RESOURCE_ATTRIBUTE_MAP in neutron; it references the
equivelant in neutron-lib named RESOURCES.

This patch removes neutron's RESOURCE_ATTRIBUTE_MAP and cleans up
neutron.api.v2.attributes in prep to delete it.
To do so:
- CORE_RESOURCES and RESOURCE_FOREIGN_KEYS are moved to the single
module that references them respectively and the are made private (no
consumers use them).
- get_collection_info is removed and instead the 2 uses in neutron
just use the get() method of the RESOURCES map. There are no external
uses of get_collection_info.
- References using RESOURCE_ATTRIBUTE_MAP are switched over to
neutron-lib's RESOURCES.
- The neutron.api.v2.attributes module is removed as it's empty now.
- A few api attribute UTs are removed; there's nothing to test as per
this patch.

NeutronLibImpact

Change-Id: Iaacee584d499c4d33d6d2dd9609c7ac0f2cfc386
2018-03-09 13:37:28 -07:00
Boden R 95f1e03446 use plugin constants from neutron-lib
neutron-lib contains a number of the plugin related constants from
neutron.plugins.common.constants. This patch consumes those constants
from neutron-lib and removes them from neutron. In addition the notion
of the dummy plugin service type is moved strictly into the test
package of neutron since it's not a real service plugin.

NeutronLibImpact

Change-Id: I767c626f3fe6159ab3abd6a7ae3cb9893b79bf66
2017-10-16 09:32:20 -06:00
Inessa Vasilevskaya 7322bd6efb Make code follow log translation guideline
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
2017-08-14 02:01:48 +00:00
Boden R 62576cabf7 use core resource attribute constants from neutron-lib
neutron-lib now contains the API definitions for neutron's core
resources. This patch removes the constant core resource and collection
variables and uses them from lib. Subsequent patches will consume the
actual core resource attribute definitions.

NeutronLibImpact

Change-Id: Ia9afdf620cd538b2aa420593277d6403a45c996b
2017-06-30 06:25:36 -06:00
Boden R cbb0970b36 use attribute functions/operations from neutron-lib
neutron-lib now contains the functionality from neutron's attributes
module. This patch moves the local references over to neturon-lib's
implementation and removes the functionality from the attributes
module.

NeutronLibImpact

Change-Id: I773702ebd4b66d28059cb3ced64b2b477ceff8af
2017-06-21 10:58:28 -06:00
Gary Kotton 99d0ff92e8 Utils: make delete_port_on_error more informative
When under load the port may have been deleted by another process.
Here we will log the port that was not found. This will help
debug.

Change-Id: I2556c54584c84cbdb777a4fa366b18a9195b60c5
Closes-bug: #1694389
2017-05-02 06:23:51 +03:00
Kevin Benton c5662c86a4 Exhaust VLAN allocations in physnet order
When an operator configured multiple network VLAN ranges, we
had no guarantee that we would actually allocate in the order
specified like we do with segmentation types. In *most* cases,
the natural database order would be that the returned available
segment IDs would come back in the order of the physnets because
the sync_allocations code inserted them in that order. So it
became something some deployments would rely on and operators
would get a surprise when suddenly an allocation would happen
from the later physnets while many VLANs were still available
in the first one.

This patch just strictly makes allocation attempts in the order
of the network_vlan_ranges so operators are always guaranteed that
the later physnets will not automatically be allocated from unless
the earlier physnets are exhausted.

Change-Id: I14ca9b7e1141199f3ec221184fbbe156f1f9e18b
2017-04-15 19:43:44 -07:00
Dariusz Smigiel eb430620ff Removed update_network from plugin.common.utils
Change I607635601caff0322fd0c80c9023f5c4f663ca25 deprecated update_network
from plugin.common.utils. Please call update_network directly on the plugin.

Change-Id: I5a014ef457b09803d3d90e7735fae991be697d53
Related-Bug: #1621345
2016-11-07 20:24:22 +00:00
Kevin Benton 181bdb374f Make DHCP notifier use core resource events
This makes the notifier subscribe to core resource events
and leverage them if they are available. This solves the
issue where internal core plugin calls from service plugins
were not generating DHCP agent notifications.

Closes-Bug: #1621345
Change-Id: I607635601caff0322fd0c80c9023f5c4f663ca25
2016-09-14 00:40:09 -07:00
Anh Tran 17005132d1 Rollback port after failed to add it to router
After failed to add port to a router, we cannot re-use and/or delete
this port.

With concurrent requests occuring, neutron will accept one request
and the other will be rejected with an 'overlapped CIDR' message.
Patch [1] fixed the race condition, but neutron raises
'Port already has an attached device' instead of
'overlapped CIDR', because neutron didn't cleanup the port when
the request was retried.
[1] https://review.openstack.org/#/c/303966/

This patch is needed to fix the bug completely. We will catch any
exception when adding an interface by port to a router. After that,
we rollback this port to its original state.

Change-Id: Ib68aee164a3062648fc882012d57b5e381f52196
Closes-Bug: #1535549
2016-09-08 12:59:26 +00:00
Kevin Benton fbd3578d64 Delete gw port on exceptions
Clean up related core plugin ports on routers when there is a failure
creating the record for the router port.

The two partial bugs will be fixed after
I476d3e03c8ee763cc4be6d679fe9f501eb3a19b5 has merged.

Closes-Bug: #1600344
Partial-Bug: #1535225
Partial-Bug: #1535226
Change-Id: I8dd832f35e20d1ee090ebab921f0deea533b6fc8
2016-07-11 06:07:03 -07:00
Jens Rosenboom 3a17c308a1 Do not depend on Python error strings in parse_network_vlan_range()
Instead of using Python error strings in the error messages for
parse_network_vlan_range(), which are unstable and not translatable,
use our own fixed error message.

Change-Id: Iae4484b0a9a983452812bc76b47f5e16850641d5
Closes-Bug: 1559191
2016-06-28 19:29:36 +02:00
Armando Migliaccio d91a4e1930 Create auto allocated networks in disabled state
Under particular circumstances, multiple requests to the
auto-allocated-topology extension may lead to the transient
creation of duplicated resources. This is dealt with by the
service plugin code, which cleans them up once the condition
is detected. However the client may accidentally be impacted
and potentially left in error (recoverable on retry).

In order to address this error condition, the logic to
provision the network for any given tenant is tweaked
slightly so that the network is created in disabled state
and re-enabled when it is safe to do so. A Neutron client
should check the network status to see if the network is
ready for use before getting its hands on it.

Closes-bug: #1591766

Change-Id: Ia6ff5ad975673875216eb470080dfc0dcf6b9ab2
2016-06-24 00:42:42 -07:00
Armando Migliaccio 5089f41d50 Extend utils create methods to accept check_allow_post
Just like create_port, these methods should also accept the parameter
that is used to control whether to validate that the request body
contains attributes not allowed during POST requests.

Change-Id: Ibbdb7960342dbd298e81b5ae17f50c1a279a2284
2016-06-13 03:43:16 -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
Henry Gessau ae5bad49cc Use exceptions from neutron-lib
Related-Blueprint: neutron-lib

Change-Id: Ia014468bd621c4ee6aea95bf19328c61070174c4
2016-04-21 21:29:44 -04:00
Victor Stinner 6355173e4c Reuse to_utf8() and jsonutils.dump_as_bytes()
Reactor code:

* Reuse oslo_utils.encodeutils.to_utf8() instead of existing
  isinstance(text, six.text_type) test
* Replace jsonutils.dumps(obj).encode('utf-8') with
  jsonutils.dump_as_bytes(obj).
* Other minor bytes/Unicode changes

Change-Id: I03b8eff0fd70ab65ac66d6f3221e8ced0a56db17
2016-04-11 12:25:53 +02:00
Kevin Benton ae45cd5732 Add global_physnet_mtu and deprecate segment_mtu
Introduce the neutron-wide 'global_physnet_mtu' option that
references the underlying physical network MTU. This also
introduces a method in plugin.common.utils that all plugins
should use to retrieve it. This value should be used to
calculate the proper MTU for virtual network components.

This patch also deprecate the 'segment_mtu' option specific
to the ML2 plug-in and makes ML2 reference this new option.

Closes-Bug: #1542475
Closes-Bug: #1542108
Change-Id: I6ffc8973c9b8f46cc19922ff04fdd2d23646b878
2016-03-08 11:11:08 -08:00
Akihiro Motoki 2d8632e412 Use _ from neutron._i18n
Partial-Bug: #1520094
Change-Id: I874a4aa1d71d1f7034a1ff0b7450b419ef5c6864
2015-12-06 19:39:04 +09:00
Doug Wiegley dd726ed494 Move i18n to _i18n, as per oslo_i18n guidelines
- This does NOT break other projects that rely on neutron.i18n,
  as this change includes a debtcollector shim to maintain those
  older entry points, until they can migrate.
- Also updates _i18n.py to the latest pattern defined by oslo_i18n
- Guidance and template are from the reference:
  http://docs.openstack.org/developer/oslo.i18n/usage.html

Partially-Closes-Bug: #1519493
Change-Id: I1aa3a5fd837d9156da4643a367013c869ed8bf9d
2015-12-01 19:29:10 -07:00
Jenkins 9b531b9e4e Merge "Change instances of Openstack to OpenStack." 2015-11-26 01:43:14 +00:00
venkatamahesh bf915b001d Change instances of Openstack to OpenStack.
Change Openstack to OpenStack
as per standards

Change-Id: I10f33c1e70fb5f2d74e6feda0a4a266d7071e1ab
2015-11-25 20:47:58 +00:00
Andreas Scheuring c3d2526727 ovs: Make interface name hashing algorithm common and extend it
The OVS device name hashing algorithm shortens interface names that are too
long. To ensure uniqueness it makes use of a hashing algorithm.

Move this function to a common place where it can be shared between ml2
drivers and agents.

Extend the function to support defining the max device length to be used.

Change LOG level to info to help deployers figuring out the unhashed name
of an hashed inteface.

Adapt OVS agent to use this common function instead of its
own implementation.

Change-Id: I5c04f39928d070aa7e372934fcb2675609d2761c
Partial-Bug: #1495960
2015-11-23 09:26:37 +01:00
Sean M. Collins e7488570e7 Revert "Make OVS interface name hashing algorithm common and extend it"
Based on discussion with Ihar and Cedric, this may break upgrades. Let's
revert it for the time being and reassess.

This reverts commit 3d0db13370.

Change-Id: I69d74befb08e074c1bccd823cca0899de6ed57d6
Closes-Bug: 1504647
2015-10-15 11:10:52 -04:00
Andreas Scheuring 3d0db13370 Make OVS interface name hashing algorithm common and extend it
The OVS devcie name hashing algorithm shortens interface names that are too
long. To ensure uniqueness it takes use of a hashing algorithm.

Move this function to a common place where it can be shared between ml2
drivers and agents.

Extend the function to support interface name postfix in addition to the
prefix.

Change LOG level to info to help deployers figuring out the unhashed name
of an hashed inteface.

Adapt OVS and linuxbridge agent to use this common function instead of their
own implementation.

Change-Id: If7ee8240c8f60da3400365138832a5d9badf98b4
Closes-Bug: #1495960
2015-09-30 10:04:49 +02:00
Aaron Rosen 7b7c15ba4e Add Geneve type driver support to ML2
More information about Geneve protocol can be found here:
  https://tools.ietf.org/pdf/draft-gross-geneve-02.pdf

Following configuration variables were added:
[ml2_type_geneve]
  vni_ranges - Comma-separated list of <vni_min>:<vni_max> tuples
               enumerating ranges of Geneve VNI IDs that are
               available for tenant network allocation
  max_header_size - Geneve encapsulation header size is dynamic, this
                    value is used to calculate the maximum MTU for the driver
                    this is the sum of the sizes of the outer
                    ETH + IP + UDP + GENEVE header sizes

DocImpact

Change-Id: I8c29a1c1a7c79e02c26ac9e2ad2645d30dfbeefc
Closes-Bug: #1461069
2015-08-27 20:04:35 +03:00
Isaku Yamahata f1457af336 Replace internal calls of create_{network, subnet, port}
When API controller calls method create_{network, subnet, port),
it made sure that the necessary default values for attrs are filled properly
according to attr mapping.

However, internal calls to these methods do not follow the convention,
when extension codes miss these values, exceptions will be thrown.

This patch introduces helper functions to fix up arguments and replaces
the direct callers of those methods.

Co-Authored-By: gong yong sheng <gong.yongsheng@99cloud.net>
Co-Authored-By: yalei wang <yalei.wang@intel.com>

Change-Id: Ibc6ff897a1a00665a403981a218100a698eb1c33
Closes-Bug: #1383546
2015-08-14 19:34:54 +08:00
Romil Gupta 7f406805d9 Move values for network_type to plugins.common.constants.py
It is quite confusing to have values for network type in common.constants.py
instead of having in plugins.common.constants.py.

Currently, the plugins/common/constants.py consists network_type constants
like VLAN, VXLAN, GRE etc. but values for network type like ranges
are defined in common.constants.py which is not good, it is better to have
both things at the same place.

This patch set addresses the same.

Moved out few methods which are predominantly used in plugins
from common.utils.py to plugins.common.utils.py.

Removed constants which were used in neutron-fwaas from
plugins.common.constants.py: https://review.openstack.org/#/c/168709/

Closes-Bug: #1441043

Change-Id: Iecfb15c541ed5d3cce95ba48f072af7fa60ac6f1
2015-04-12 23:59:31 -07:00
Manish Godara 7d77769721 Validate network config (vlan)
Validate to make sure empty physical networks
are not permitted. Added unit test as well.

Change-Id: Ie55fab3c53276ed48d5e9d603e8c1dc59fa9cc32
Closes-Bug: 1325664
2014-10-22 10:29:33 -07:00
yangxurong 22bec67395 Tunnel ID range validation for VXLAN/GRE networks
Currently, there is no check which validates the values of
tunnel range for VXLAN/GRE networks. The VXLAN VNI is 24 bit
which have range between 1 to 2^24 - 1. Similarly, GRE key field
is 32 bit which have range between 1 to 2^32 - 1.

Closes-Bug: #1306488

Co-Authored-By: romilg romilg@hp.com

Change-Id: Idb3d0f41166df589a1e90394d9319901b5f9b439
2014-09-15 08:41:09 -07:00
liu-sheng b30c47233d Remove the useless vim modelines
Change-Id: I41286e0b8f74c90b7078c3d3fb041b6586d95ab0
Closes-Bug: #1229324
2014-06-21 15:07:31 +08:00
Aaron Rosen 2a2d566be3 replace rest of q_exc to n_exc in code base
The following patch renames the rest of q_exc to n_exc which were
left when quantum was renamed to neutron.

used: find . -name "*.py"  -print | xargs sed -i 's/q_exc/n_exc/g'

Change-Id: I04041030694b28c400b6c9c552433f2eaa4a37ba
Closes-bug: #1287462
2014-03-03 17:42:20 -08:00
Nachi Ueno bba99f29ad Reference driver implementation (IPsec) for VPNaaS
Implements blueprint ipsec-vpn-reference

This patch implements reference driver implementation for VPNaaS.
The driver uses openswan to manage vpn connections.

Future work: Support ikepolicy and ipsec update
Support service type framework
Intelligent updating of resources

This commit adds jinja2 for requirements.txt for
generating cofig file.

Change-Id: I8c5ed800a71ca014dc7bdbb6a57c4f8d18fa82e0
2013-09-04 00:32:39 -07:00
Mark McClain ee3fe4e836 Rename Quantum to Neutron
This change renames everything to Neutron while providing backwards
compatible adjustments for Grizzly configuration files.

implements blueprint: remove-use-of-quantum

Change-Id: Ie7d07ba7c89857e13d4ddc8f0e9b68de020a3d19
2013-07-06 15:02:43 -04:00