Merge "Migrate neutron agent extensions to neutron-lib"
This commit is contained in:
commit
a93a5c9761
0
neutron_lib/agent/__init__.py
Normal file
0
neutron_lib/agent/__init__.py
Normal file
23
neutron_lib/agent/constants.py
Normal file
23
neutron_lib/agent/constants.py
Normal file
@ -0,0 +1,23 @@
|
||||
# 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.
|
||||
|
||||
###################################
|
||||
# Agent extension related constants
|
||||
###################################
|
||||
# Extension driver type for Open vSwitch mech driver
|
||||
OVS_EXTENSION_DRIVER = 'ovs'
|
||||
# Extension driver type for Linux Bridge mech driver
|
||||
LB_EXTENSION_DRIVER = 'linuxbridge'
|
||||
# Extension driver type for macvtap mech driver
|
||||
MACVTAP_EXTENSION_DRIVER = 'macvtap'
|
||||
# Extension driver type for SR-IOV mech driver
|
||||
SRIOV_EXTENSION_DRIVER = 'sriov'
|
48
neutron_lib/agent/extension.py
Normal file
48
neutron_lib/agent/extension.py
Normal file
@ -0,0 +1,48 @@
|
||||
# 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
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class AgentExtension(object):
|
||||
"""Define stable abstract interface for agent extensions.
|
||||
|
||||
An agent extension extends the agent core functionality.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def initialize(self, connection, driver_type):
|
||||
"""Perform agent core resource extension initialization.
|
||||
|
||||
: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.
|
||||
|
||||
Called after all extensions have been loaded.
|
||||
No resource (port, policy, router, etc.) handling will be called before
|
||||
this method.
|
||||
"""
|
||||
|
||||
def consume_api(self, agent_api):
|
||||
"""Consume the AgentAPI instance from the AgentExtensionsManager.
|
||||
|
||||
Allows an extension to gain access to resources internal to the
|
||||
neutron agent and otherwise unavailable to the extension. Examples of
|
||||
such resources include bridges, ports, and routers.
|
||||
|
||||
:param agent_api: An instance of an agent-specific API.
|
||||
"""
|
55
neutron_lib/agent/l2_extension.py
Normal file
55
neutron_lib/agent/l2_extension.py
Normal file
@ -0,0 +1,55 @@
|
||||
# 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.
|
||||
"""
|
53
neutron_lib/agent/l3_extension.py
Normal file
53
neutron_lib/agent/l3_extension.py
Normal file
@ -0,0 +1,53 @@
|
||||
# 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 L3AgentExtension(extension.AgentExtension):
|
||||
"""Define stable abstract interface for l3 agent extensions.
|
||||
|
||||
An agent extension extends the agent core functionality.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def add_router(self, context, data):
|
||||
"""Handle a router add event.
|
||||
|
||||
Called on router create.
|
||||
|
||||
:param context: RPC context.
|
||||
:param data: Router data.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def update_router(self, context, data):
|
||||
"""Handle a router update event.
|
||||
|
||||
Called on router update.
|
||||
|
||||
:param context: RPC context.
|
||||
:param data: Router data.
|
||||
"""
|
||||
|
||||
@abc.abstractmethod
|
||||
def delete_router(self, context, data):
|
||||
"""Handle a router delete event.
|
||||
|
||||
:param context: RPC context.
|
||||
:param data: Router data.
|
||||
"""
|
@ -0,0 +1,3 @@
|
||||
---
|
||||
features:
|
||||
- Neutron agent extension abstract classes are moved from ``neutron.agent`` to ``neutron_lib.agent``
|
Loading…
Reference in New Issue
Block a user