b6244f5b37
Migrate neutron agent extensions to neutron-lib. This includes both the common abstract object as well as the l2 and l3-specific objects for agent extensions. This functionality is used by neutron, neutron-fwaas, networking-sfc, and tap-as-a-service. Please note that this does not migrate the l3_agent_extensions_api to neutron-lib. This is because that specifically has a long dependency chain that ends up requiring agent/[linux,windows]/utils.py, which should be migrated separately. Change-Id: I7255a5ae6b706c09acecc0dea5dbd2febae0c282 Needed-By: I6d2cff03207924c7492c6136d4b21a9817769c67 Needed-By: If9235c1cf39b8ad2ef049e8154b82736e1f1d763 Needed-By: Ie8f0e70b11435d627f73e3fed45f946e863e90bc Needed-By: Ia5962acfd737b4b350b94591802928a5a4dc53fb
56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
# 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.
|
|
|
|
import abc
|
|
|
|
import six
|
|
|
|
from neutron_lib.agent import extension
|
|
|
|
|
|
@six.add_metaclass(abc.ABCMeta)
|
|
class L2AgentExtension(extension.AgentExtension):
|
|
"""Define stable abstract interface for l2 agent extensions.
|
|
|
|
An agent extension extends the agent core functionality.
|
|
"""
|
|
|
|
def initialize(self, connection, driver_type):
|
|
"""Initialize agent extension.
|
|
|
|
:param connection: RPC connection that can be reused by the extension
|
|
to define its RPC endpoints
|
|
:param driver_type: String that defines the agent type to the
|
|
extension. Can be used to choose the right backend
|
|
implementation.
|
|
"""
|
|
|
|
@abc.abstractmethod
|
|
def handle_port(self, context, data):
|
|
"""Handle a port add/update event.
|
|
|
|
This can be called on either create or update, depending on the
|
|
code flow. Thus, it's this function's responsibility to check what
|
|
actually changed.
|
|
|
|
:param context: RPC context.
|
|
:param data: Port data.
|
|
"""
|
|
|
|
@abc.abstractmethod
|
|
def delete_port(self, context, data):
|
|
"""Handle a port delete event.
|
|
|
|
:param context: RPC context.
|
|
:param data: Port data.
|
|
"""
|