# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 Cloudbase Solutions SRL # All Rights Reserved. # # 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. # @author: Alessandro Pilotti, Cloudbase Solutions Srl from quantum.api.v2 import attributes from quantum.common import constants as q_const from quantum.common import exceptions as q_exc from quantum.common import rpc as q_rpc from quantum.common import topics from quantum.db import db_base_plugin_v2 from quantum.db import dhcp_rpc_base from quantum.db import l3_db from quantum.db import l3_rpc_base from quantum.extensions import portbindings from quantum.extensions import providernet as provider from quantum.openstack.common import cfg from quantum.openstack.common import log as logging from quantum.openstack.common import rpc from quantum.openstack.common.rpc import proxy from quantum.plugins.hyperv.common import constants from quantum import policy LOG = logging.getLogger(__name__) class AgentNotifierApi(proxy.RpcProxy): '''Agent side of the openvswitch rpc API. API version history: 1.0 - Initial version. ''' BASE_RPC_API_VERSION = '1.0' def __init__(self, topic): super(AgentNotifierApi, self).__init__( topic=topic, default_version=self.BASE_RPC_API_VERSION) self.topic_network_delete = topics.get_topic_name(topic, topics.NETWORK, topics.DELETE) self.topic_port_update = topics.get_topic_name(topic, topics.PORT, topics.UPDATE) self.topic_port_delete = topics.get_topic_name(topic, topics.PORT, topics.DELETE) self.topic_tunnel_update = topics.get_topic_name(topic, constants.TUNNEL, topics.UPDATE) def network_delete(self, context, network_id): self.fanout_cast(context, self.make_msg('network_delete', network_id=network_id), topic=self.topic_network_delete) def port_update(self, context, port, network_type, segmentation_id, physical_network): self.fanout_cast(context, self.make_msg('port_update', port=port, network_type=network_type, segmentation_id=segmentation_id, physical_network=physical_network), topic=self.topic_port_update) def port_delete(self, context, port_id): self.fanout_cast(context, self.make_msg('port_delete', port_id=port_id), topic=self.topic_port_delete) def tunnel_update(self, context, tunnel_ip, tunnel_id): self.fanout_cast(context, self.make_msg('tunnel_update', tunnel_ip=tunnel_ip, tunnel_id=tunnel_id), topic=self.topic_tunnel_update)