neutron/neutron/pecan_wsgi/constants.py
Salvatore Orlando ea4ba642dd Pecan: implement DHCP notifications in NotifierHook
This patch adds support for DHCP notifications into the Notifier hook,
which so far has been pretty much a placeholder for future work.

To this aim its priority has been changed in order to ensure the
'after' hook is executed after the 'after' hook for the policy engine.
This will ensure that any 'alien' data returned from the plugin is
stripped off before being sent to the notifiers, as well as any
attribute that the user is not authorized to access.

Since delete operations require to send the original object to the
notifier, this patch leverages the "prefetch" feature of the policy
hook to avoid loading again the object from the plugin. This is not
ideal and will be fixed in another patch where prefetching will be
performed in its own hook.

The ACTION_MAP constant has been factored out in an appropriate
module for constants as it is now used by the NotifierHook class as
well. The decision of using a new constant module is rather
arbitrary as the module neutron.common.constants could have been
used as well.

With this patch, the notifier hook only sends events signalling
completion of operations (e.g.: network.create.end) as these are
the only events processed by the DHCP agent. Support for 'start'
events will be added in a subsequent patch.

Related-Blueprint: pecan-wsgi-switch

Change-Id: I69680952f99c404d4535db48db73fc815977f2ee
2016-02-15 10:50:28 +00:00

19 lines
723 B
Python

# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
ACTION_MAP = {'POST': 'create',
'PUT': 'update',
'GET': 'get',
'DELETE': 'delete'}