| 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 |
from neutron_lib.agent import extension |
| 16 |
|
| 17 |
|
| 18 |
class L3AgentExtension(extension.AgentExtension, metaclass=abc.ABCMeta): |
| 19 |
"""Define stable abstract interface for l3 agent extensions. |
| 20 |
|
| 21 |
An agent extension extends the agent core functionality. |
| 22 |
""" |
| 23 |
|
| 24 |
@abc.abstractmethod |
| 25 |
def add_router(self, context, data): |
| 26 |
"""Handle a router add event. |
| 27 |
|
| 28 |
Called on router create. |
| 29 |
|
| 30 |
:param context: RPC context. |
| 31 |
:param data: Router data. |
| 32 |
""" |
| 33 |
|
| 34 |
@abc.abstractmethod |
| 35 |
def update_router(self, context, data): |
| 36 |
"""Handle a router update event. |
| 37 |
|
| 38 |
Called on router update. |
| 39 |
|
| 40 |
:param context: RPC context. |
| 41 |
:param data: Router data. |
| 42 |
""" |
| 43 |
|
| 44 |
@abc.abstractmethod |
| 45 |
def delete_router(self, context, data): |
| 46 |
"""Handle a router delete event. |
| 47 |
|
| 48 |
:param context: RPC context. |
| 49 |
:param data: Router data. |
| 50 |
""" |
| 51 |
|
| 52 |
@abc.abstractmethod |
| 53 |
def ha_state_change(self, context, data): |
| 54 |
"""Change router state from agent extension. |
| 55 |
|
| 56 |
Called on HA router state change. |
| 57 |
|
| 58 |
:param context: rpc context |
| 59 |
:param data: dict of router_id and new state |
| 60 |
""" |
| 61 |
|
| 62 |
@abc.abstractmethod |
| 63 |
def update_network(self, context, data): |
| 64 |
"""Handle a network update event. |
| 65 |
|
| 66 |
Called on network update. |
| 67 |
|
| 68 |
:param context: RPC context. |
| 69 |
:param data: dict of network data. |
| 70 |
""" |