Commit Graph

23 Commits

Author SHA1 Message Date
Boden R 29f56478d1 remove the neutron.db._resource_extend module
The _resource_extend module is already rehomed into neutron-lib and is
shimmed in neutron. This patch removes the module as no active
consumers are using it.

NeutronLibImpact

Change-Id: I1550075fa5fa2aa2f1a88ee7189d311a1fe78391
2019-01-02 13:02:06 -07: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
Jenkins bf5df0256b Merge "use is_port_trusted from neutron-lib" 2017-05-24 21:26:16 +00:00
Boden R b79f2b45be use is_port_trusted from neutron-lib
neutron-lib 1.6.0 is out and among other things contains the rehomed
is_port_trusted function. This patch switches usage of that function
from neutron to neutron-lib.

NeutronLibImpact

Change-Id: I1c8a32d4806092daae99cd4860523c7d6335fc75
2017-05-24 09:02:39 -06:00
Boden R 2e56ba4526 use neutron-lib port security api-def
The port security API definition has been in neutron-lib for awhile.
This patch consumes the definition from neutron-lib.

NeutronLibImpact
- Consumers using the public definitions from
neutron.extensions.portsecurity must now switch over to the api-def in
neutron-lib. See the changes herein for additional details.

Change-Id: If43b65861efc536d01c43dc0d2bbcbcf062c1271
2017-05-01 11:45:42 -06:00
Henry Gessau b3c0d5f239 Eliminate lookup of "resource extend" funcs by name
By registering functions directly we cut off the dependency of the
"resource extend" functions on the plugin. This is a step towards
the goal of removing the CommonDbMixin mixin class.

Also, we register all "resource extend" functions at plugin create
(in __new__) instead of in the class definition (which caused the
hooks to be registered on import). This ensures the "resource
extend" functions are only registered for the plugins/mixins that
are actually used.

Note that decorators are used to register "resource extend" methods,
similar to the callback receiver decorators.

Related-Blueprint: neutron-lib

Change-Id: I128cfda773d5f9597df9cd61261fdc05f2a174aa
2017-04-21 14:48:42 -04:00
Henry Gessau e7cd868c20 Decouple hook and func registration from CommonDbMixin
Move the model query hook registration and resource extend funcs
registration methods out of the CommonDbMixin class and make them
regular utility functions.

This is a step in refactoring the CommonDbMixin class.

Change-Id: Iec1bb7f7098c83640ae695fd7cf2f4736f414ad2
2017-03-11 18:04:11 -05:00
Henry Gessau 78fff41ee3 Use converters and validators from neutron-lib
Related-Blueprint: neutron-lib

Change-Id: I6b9079e9e703c6fd75adbed3846e7257685433e8
2016-04-24 19:13:10 -04:00
Ihar Hrachyshka b0519cf0ad port security: gracefully handle resources with no bindings
Resources could be created before the extension was enabled in the
setup. In that case, no bindings are created for them. In that case, we
should gracefully return default (True) value when extracting the value
using the mixin; and we should also create binding model on update
request, if there is no existing binding model for the resource.

While at it, introduced a constant to store the default value for port
security (True) and changed several tests to use the constant instead of
extracting it from extension resource map.

Change-Id: I8607cdecdc16c5f94635c94e2f02700c732806eb
Closes-Bug: #1509312
2016-03-24 22:27:31 +01:00
Kevin Benton 638d16c8a0 Add utility function for checking trusted port
Ports that have a device_owner that starts with 'network:'
are trusted in several places throughout the codebase. Each
of these did a startswith check on each field and it's not
immediately obvious why it's done.

This patch adds a utility function called 'is_port_trusted'
that performs the same check and makes it obvious what is
being done.

Change-Id: I542c753776d5cfb2fd736b25ea6e111867c89c89
2015-09-14 10:41:54 +00:00
Jenkins 87a534f9b0 Merge "Add portsecurity extension support" 2015-03-18 16:48:40 +00:00
Jenkins d409461ed1 Merge "portsecurity_db: Use is_attr_set instead of a home-grown equivalent" 2015-03-17 14:42:49 +00:00
Yalei Wang 554d266f56 Add portsecurity extension support
Add portsecurity extension driver into ML2 plugin and implement it in
iptables_firewall.

The scope of this change is:
    - Abstract a common class PortSecurityDbCommon from the old
      PortSecurityDbMixin
    - Add a new extension driver port-security, implement process_xxx and
      extend_xxx_dict method and provide a db migration from the existing
      networks and ports
    - Update the new added 'unfiltered_ports' in iptables firewall of l2 agent
      to reflect the update of port-security

Co-Authored-By: Shweta P <shpadubi@cisco.com>

Change-Id: I2da53168e2529db7a8094ce90ef3a8a93fe55727
Partially Implements: blueprint ml2-ovs-portsecurity
2015-03-17 05:13:04 +08:00
Jenkins 361bf4d1dc Merge "portsecurity_db: Fix a usage of is_attr_set" 2015-03-15 03:56:48 +00:00
Ihar Hrachyshka 22328baf1f Migrate to oslo.log
It's mostly a matter of changing imports to a new location.

Non-obvious changes needed:
* pass overwrite= argument to oslo_context since oslo.log reads context
  from its thread local store and not local.store from incubator
* don't store context at local.store now that there is no code that
  would consume it
* LOG.deprecated() -> versionutils.report_deprecated_feature()
* dropped LOG.audit check from hacking rule since now the method does
  not exist
* WritableLogger is now located in oslo_log.loggers

Dropped log module from the tree. Also dropped local module that is now
of no use (and obsolete, as per oslo team).

Added versionutils back to openstack-common.conf since now we use the
module directly from neutron code and not just as a dependency of some
other oslo-incubator module.

Note: tempest tests are expected to be broken now, so instead of fixing
all the oslo.log related issues for the subtree in this patch, I only
added TODOs with directions for later fix.

Closes-Bug: #1425013
Change-Id: I310e059a815377579de6bb2aa204de168e72571e
2015-03-12 11:22:56 +01:00
YAMAMOTO Takashi 3b05447577 portsecurity_db: Fix a usage of is_attr_set
I believe this is the intention of the original change.
commit a5ccc2358d

Also, add a test case which would have revealed the problem.

Closes-Bug: #1429754
Change-Id: I1481492404e7388b145860820a308452da24e24f
2015-03-10 03:59:39 +00:00
YAMAMOTO Takashi b0f8da6e2e portsecurity_db: Use is_attr_set instead of a home-grown equivalent
Change-Id: I72003a856315067105bbb2b764b8b608a393cd42
2015-03-09 17:32:04 +09:00
sanuptpm 598accd415 Fix spelling mistakes
Change-Id: Idedb39b43bc71db0a7e331cc23535d162177c8b5
2014-08-01 16:10:23 +00:00
armando-migliaccio 2d174a1876 Update License Headers to replace Nicira with VMware
In the process __init__.py involved have been emptied;
vim modelines and author lines have been dropped from
the license headers affected by the change as well.

Partial-implements blueprint nicira-plugin-renaming

Change-Id: I9c535b59bb2e83f275816472e0e32b41444d3bbe
2014-02-27 08:11:15 +00:00
Aaron Rosen a5ccc2358d Don't require passing in port_security=False if security_groups present
If creating a port on a network that is marked as port_security_enabled=False
and one passes in a security_group in the port_create request previously an
error was raised saying they needed to also pass in
port_security_enabled=False. This patch removes that requirement and instead
sets port_security_enabled=True internally if a port has an ip_address and a
security_group is passed in. This is more convient and does not break
backwards compatibility.

Closes-bug: #1267249
Change-Id: Ifb5a5511f016a5d8c5b5075c9fdc27279cdd9bb5
2014-02-20 20:50:35 -08:00
Salvatore Orlando a07bbac1c4 Allow subclasses to modify dict_extend hooks
Partial-Bug 1219991

This change modifies the hook processing for dict_extend routines
to call the method on the instance if a hook is registered as a string.
Otherwise, the callable hook is directly invoked as an unbound method.

This patch fixes hook registration for all extensions except port_binding.
This is because some plugins are currently working around this limitation
by invoking both the global hook and another dict_extend function,
which might either be registered as another hook, or invoked explicitly
before returning the response.
Fixing this would go beyong the scope of this patch.

Change-Id: Ibe78433e6554aa7fdf5156fc75b8339254876e78
2013-09-02 17:37:22 -07:00
Salvatore Orlando f581b2faf1 Avoid performing extra query for fetching port security binding
Bug 1201957

Add a relationship performing eager load in Port and Network
models, thus preventing the 'extend' function from performing
an extra database query.
Also fixes a comment in securitygroups_db.py

Change-Id: If0f0277191884aab4dcb1ee36826df7f7d66a8fa
2013-07-31 02:10:35 -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