1
# Copyright 2013 New Dream Network, LLC (DreamHost)
2
# Copyright 2015 Rackspace
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
16
from neutron.common import rpc as n_rpc
20
class LbaasAgentApi(object):
21
"""Agent side of the Agent to Plugin RPC API."""
26
def __init__(self, topic, context, host):
27
self.context = context
29
target = oslo_messaging.Target(topic=topic, version='1.0')
30
self.client = n_rpc.get_client(target)
32
def get_ready_devices(self):
33
cctxt = self.client.prepare()
34
return cctxt.call(self.context, 'get_ready_devices', host=self.host)
36
def get_loadbalancer(self, loadbalancer_id):
37
cctxt = self.client.prepare()
38
return cctxt.call(self.context, 'get_loadbalancer',
39
loadbalancer_id=loadbalancer_id)
41
def loadbalancer_deployed(self, loadbalancer_id):
42
cctxt = self.client.prepare()
43
return cctxt.call(self.context, 'loadbalancer_deployed',
44
loadbalancer_id=loadbalancer_id)
46
def update_status(self, obj_type, obj_id, provisioning_status=None,
47
operating_status=None):
48
cctxt = self.client.prepare()
49
return cctxt.call(self.context, 'update_status', obj_type=obj_type,
51
provisioning_status=provisioning_status,
52
operating_status=operating_status)
54
def loadbalancer_destroyed(self, loadbalancer_id):
55
cctxt = self.client.prepare()
56
return cctxt.call(self.context, 'loadbalancer_destroyed',
57
loadbalancer_id=loadbalancer_id)
59
def plug_vip_port(self, port_id):
60
cctxt = self.client.prepare()
61
return cctxt.call(self.context, 'plug_vip_port', port_id=port_id,
64
def unplug_vip_port(self, port_id):
65
cctxt = self.client.prepare()
66
return cctxt.call(self.context, 'unplug_vip_port', port_id=port_id,
69
def update_loadbalancer_stats(self, loadbalancer_id, stats):
70
cctxt = self.client.prepare()
71
return cctxt.call(self.context, 'update_loadbalancer_stats',
72
loadbalancer_id=loadbalancer_id, stats=stats)