Debian Codegraph @

neutron_lib/agent/extension.py

raw
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12
13 import abc
14
15
16 class AgentExtension(metaclass=abc.ABCMeta):
17 """Define stable abstract interface for agent extensions.
18
19 An agent extension extends the agent core functionality.
20 """
21
22 @abc.abstractmethod
23 def initialize(self, connection, driver_type):
24 """Perform agent core resource extension initialization.
25
26 :param connection: RPC connection that can be reused by the extension
27 to define its RPC endpoints
28 :param driver_type: String that defines the agent type to the
29 extension. Can be used to choose the right backend
30 implementation.
31
32 Called after all extensions have been loaded.
33 No resource (port, policy, router, etc.) handling will be called before
34 this method.
35 """
36
37 def consume_api(self, agent_api):
38 """Consume the AgentAPI instance from the AgentExtensionsManager.
39
40 Allows an extension to gain access to resources internal to the
41 neutron agent and otherwise unavailable to the extension. Examples of
42 such resources include bridges, ports, and routers.
43
44 :param agent_api: An instance of an agent-specific API.
45 """