a7e73f15c1
On one hand, we sync router data (including routers, their gw ports, interfaces and floatingips) from l3_agent to quantum server periodically if needed. On the other hand, we notify l3 agent from quantum server when we delete or update a router's stuff, such as floating IP, interface and gwport and router itself. blueprint rpc-for-l3-agent bug #1080286 Change-Id: I60f3081975fc7164b22f9e9fa941e702a3f4c663
51 lines
1.7 KiB
Python
51 lines
1.7 KiB
Python
# Copyright (c) 2012 OpenStack, LLC.
|
|
#
|
|
# 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.
|
|
|
|
from quantum.common import topics
|
|
from quantum.openstack.common import jsonutils
|
|
from quantum.openstack.common import log as logging
|
|
from quantum.openstack.common.rpc import proxy
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
class L3AgentNotifyAPI(proxy.RpcProxy):
|
|
"""API for plugin to notify L3 agent."""
|
|
BASE_RPC_API_VERSION = '1.0'
|
|
|
|
def __init__(self, topic=topics.L3_AGENT):
|
|
super(L3AgentNotifyAPI, self).__init__(
|
|
topic=topic, default_version=self.BASE_RPC_API_VERSION)
|
|
|
|
def router_deleted(self, context, router_id):
|
|
LOG.debug(_('Nofity agent the router %s is deleted'), router_id)
|
|
self.cast(context,
|
|
self.make_msg('router_deleted',
|
|
router_id=router_id),
|
|
topic=self.topic)
|
|
|
|
def routers_updated(self, context, routers):
|
|
if routers:
|
|
LOG.debug(_('Nofity agent routers were updated:\n %s'),
|
|
jsonutils.dumps(routers, indent=5))
|
|
self.cast(context,
|
|
self.make_msg('routers_updated',
|
|
routers=routers),
|
|
topic=self.topic)
|
|
|
|
|
|
L3AgentNofity = L3AgentNotifyAPI()
|