Debian Codegraph @

networking_l2gw/services/l2gateway/agent/agent_api.py

raw
1 # Copyright (c) 2015 OpenStack Foundation.
2 # All Rights Reserved.
3 #
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
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
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
14 # under the License.
15
16 from neutron_lib import rpc as n_rpc
17
18 import oslo_messaging as messaging
19
20
21 class L2GatewayAgentApi:
22 """Agent side of the Agent to Plugin RPC API."""
23
24 API_VERSION = '1.0'
25
26 def __init__(self, topic, host):
27 self.host = host
28 target = messaging.Target(topic=topic, version=self.API_VERSION)
29 self.client = n_rpc.get_client(target)
30
31 def update_ovsdb_changes(self, context, activity, ovsdb_data):
32 cctxt = self.client.prepare()
33 return cctxt.cast(context,
34 'update_ovsdb_changes',
35 activity=activity,
36 ovsdb_data=ovsdb_data)
37
38 def notify_ovsdb_states(self, context, ovsdb_states):
39 cctxt = self.client.prepare()
40 return cctxt.cast(context,
41 'notify_ovsdb_states',
42 ovsdb_states=ovsdb_states)