1 # Copyright (c) 2015 Mellanox Technologies, Ltd
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
21 @six.add_metaclass(abc.ABCMeta)
22 class AgentCoreResourceExtension(object):
23 """Define stable abstract interface for agent extensions.
25 An agent extension extends the agent core functionality.
28 def initialize(self, connection, driver_type):
29 """Perform agent core resource extension initialization.
31 :param connection: RPC connection that can be reused by the extension
32 to define its RPC endpoints
33 :param driver_type: a string that defines the agent type to the
34 extension. Can be used to choose the right backend
37 Called after all extensions have been loaded.
38 No port handling will be called before this method.
42 def handle_port(self, context, data):
43 """Handle agent extension for port.
45 This can be called on either create or update, depending on the
46 code flow. Thus, it's this function's responsibility to check what
49 :param context: rpc context
50 :param data: port data
54 def delete_port(self, context, data):
55 """Delete port from agent extension.
57 :param context: rpc context
58 :param data: port data