diff options
Diffstat (limited to 'quantumclient/quantum/v2_0/lb')
| -rw-r--r-- | quantumclient/quantum/v2_0/lb/__init__.py | 16 | ||||
| -rw-r--r-- | quantumclient/quantum/v2_0/lb/healthmonitor.py | 174 | ||||
| -rw-r--r-- | quantumclient/quantum/v2_0/lb/member.py | 99 | ||||
| -rw-r--r-- | quantumclient/quantum/v2_0/lb/pool.py | 124 | ||||
| -rw-r--r-- | quantumclient/quantum/v2_0/lb/vip.py | 115 |
5 files changed, 0 insertions, 528 deletions
diff --git a/quantumclient/quantum/v2_0/lb/__init__.py b/quantumclient/quantum/v2_0/lb/__init__.py deleted file mode 100644 index 1668497..0000000 --- a/quantumclient/quantum/v2_0/lb/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2013 OpenStack LLC. -# 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. -# -# vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/quantumclient/quantum/v2_0/lb/healthmonitor.py b/quantumclient/quantum/v2_0/lb/healthmonitor.py deleted file mode 100644 index f0a828b..0000000 --- a/quantumclient/quantum/v2_0/lb/healthmonitor.py +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright 2013 Mirantis Inc. -# 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: Ilya Shakhat, Mirantis Inc. -# -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -import logging - -from quantumclient.openstack.common.gettextutils import _ -from quantumclient.quantum import v2_0 as quantumv20 - - -class ListHealthMonitor(quantumv20.ListCommand): - """List healthmonitors that belong to a given tenant.""" - - resource = 'health_monitor' - log = logging.getLogger(__name__ + '.ListHealthMonitor') - list_columns = ['id', 'type', 'admin_state_up', 'status'] - pagination_support = True - sorting_support = True - - -class ShowHealthMonitor(quantumv20.ShowCommand): - """Show information of a given healthmonitor.""" - - resource = 'health_monitor' - log = logging.getLogger(__name__ + '.ShowHealthMonitor') - - -class CreateHealthMonitor(quantumv20.CreateCommand): - """Create a healthmonitor.""" - - resource = 'health_monitor' - log = logging.getLogger(__name__ + '.CreateHealthMonitor') - - def add_known_arguments(self, parser): - parser.add_argument( - '--admin-state-down', - dest='admin_state', action='store_false', - help='set admin state up to false') - parser.add_argument( - '--expected-codes', - help='the list of HTTP status codes expected in ' - 'response from the member to declare it healthy. This ' - 'attribute can contain one value, ' - 'or a list of values separated by comma, ' - 'or a range of values (e.g. "200-299"). If this attribute ' - 'is not specified, it defaults to "200". ') - parser.add_argument( - '--http-method', - help='the HTTP method used for requests by the monitor of type ' - 'HTTP.') - parser.add_argument( - '--url-path', - help='the HTTP path used in the HTTP request used by the monitor' - ' to test a member health. This must be a string ' - 'beginning with a / (forward slash)') - parser.add_argument( - '--delay', - required=True, - help='the minimum time in seconds between regular connections ' - 'of the member.') - parser.add_argument( - '--max-retries', - required=True, - help='number of permissible connection failures before changing ' - 'the member status to INACTIVE.') - parser.add_argument( - '--timeout', - required=True, - help='maximum number of seconds for a monitor to wait for a ' - 'connection to be established before it times out. The ' - 'value must be less than the delay value.') - parser.add_argument( - '--type', - required=True, - help='one of predefined health monitor types, e.g. RoundRobin') - - def args2body(self, parsed_args): - body = { - self.resource: { - 'admin_state_up': parsed_args.admin_state, - 'delay': parsed_args.delay, - 'max_retries': parsed_args.max_retries, - 'timeout': parsed_args.timeout, - 'type': parsed_args.type, - }, - } - quantumv20.update_dict(parsed_args, body[self.resource], - ['expected_codes', 'http_method', 'url_path', - 'tenant_id']) - return body - - -class UpdateHealthMonitor(quantumv20.UpdateCommand): - """Update a given healthmonitor.""" - - resource = 'health_monitor' - log = logging.getLogger(__name__ + '.UpdateHealthMonitor') - - -class DeleteHealthMonitor(quantumv20.DeleteCommand): - """Delete a given healthmonitor.""" - - resource = 'health_monitor' - log = logging.getLogger(__name__ + '.DeleteHealthMonitor') - - -class AssociateHealthMonitor(quantumv20.QuantumCommand): - """Create a mapping between a health monitor and a pool.""" - - log = logging.getLogger(__name__ + '.AssociateHealthMonitor') - resource = 'health_monitor' - - def get_parser(self, prog_name): - parser = super(AssociateHealthMonitor, self).get_parser(prog_name) - parser.add_argument( - 'health_monitor_id', - help='Health monitor to associate') - parser.add_argument( - 'pool_id', - help='ID of the pool to be associated with the health monitor') - return parser - - def run(self, parsed_args): - quantum_client = self.get_client() - quantum_client.format = parsed_args.request_format - body = {'health_monitor': {'id': parsed_args.health_monitor_id}} - pool_id = quantumv20.find_resourceid_by_name_or_id( - quantum_client, 'pool', parsed_args.pool_id) - quantum_client.associate_health_monitor(pool_id, body) - print >>self.app.stdout, (_('Associated health monitor ' - '%s') % parsed_args.health_monitor_id) - - -class DisassociateHealthMonitor(quantumv20.QuantumCommand): - """Remove a mapping from a health monitor to a pool.""" - - log = logging.getLogger(__name__ + '.DisassociateHealthMonitor') - resource = 'health_monitor' - - def get_parser(self, prog_name): - parser = super(DisassociateHealthMonitor, self).get_parser(prog_name) - parser.add_argument( - 'health_monitor_id', - help='Health monitor to associate') - parser.add_argument( - 'pool_id', - help='ID of the pool to be associated with the health monitor') - return parser - - def run(self, parsed_args): - quantum_client = self.get_client() - quantum_client.format = parsed_args.request_format - pool_id = quantumv20.find_resourceid_by_name_or_id( - quantum_client, 'pool', parsed_args.pool_id) - quantum_client.disassociate_health_monitor(pool_id, - parsed_args - .health_monitor_id) - print >>self.app.stdout, (_('Disassociated health monitor ' - '%s') % parsed_args.health_monitor_id) diff --git a/quantumclient/quantum/v2_0/lb/member.py b/quantumclient/quantum/v2_0/lb/member.py deleted file mode 100644 index 05fb430..0000000 --- a/quantumclient/quantum/v2_0/lb/member.py +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2013 Mirantis Inc. -# 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: Ilya Shakhat, Mirantis Inc. -# -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -import logging - -from quantumclient.quantum import v2_0 as quantumv20 - - -class ListMember(quantumv20.ListCommand): - """List members that belong to a given tenant.""" - - resource = 'member' - log = logging.getLogger(__name__ + '.ListMember') - list_columns = [ - 'id', 'address', 'protocol_port', 'admin_state_up', 'status' - ] - pagination_support = True - sorting_support = True - - -class ShowMember(quantumv20.ShowCommand): - """Show information of a given member.""" - - resource = 'member' - log = logging.getLogger(__name__ + '.ShowMember') - - -class CreateMember(quantumv20.CreateCommand): - """Create a member.""" - - resource = 'member' - log = logging.getLogger(__name__ + '.CreateMember') - - def add_known_arguments(self, parser): - parser.add_argument( - 'pool_id', metavar='pool', - help='Pool id or name this vip belongs to') - parser.add_argument( - '--admin-state-down', - dest='admin_state', action='store_false', - help='set admin state up to false') - parser.add_argument( - '--weight', - help='weight of pool member in the pool') - parser.add_argument( - '--address', - required=True, - help='IP address of the pool member on the pool network. ') - parser.add_argument( - '--protocol-port', - required=True, - help='port on which the pool member listens for requests or ' - 'connections. ') - - def args2body(self, parsed_args): - _pool_id = quantumv20.find_resourceid_by_name_or_id( - self.get_client(), 'pool', parsed_args.pool_id) - body = { - self.resource: { - 'pool_id': _pool_id, - 'admin_state_up': parsed_args.admin_state, - }, - } - quantumv20.update_dict( - parsed_args, - body[self.resource], - ['address', 'protocol_port', 'weight', 'tenant_id'] - ) - return body - - -class UpdateMember(quantumv20.UpdateCommand): - """Update a given member.""" - - resource = 'member' - log = logging.getLogger(__name__ + '.UpdateMember') - - -class DeleteMember(quantumv20.DeleteCommand): - """Delete a given member.""" - - resource = 'member' - log = logging.getLogger(__name__ + '.DeleteMember') diff --git a/quantumclient/quantum/v2_0/lb/pool.py b/quantumclient/quantum/v2_0/lb/pool.py deleted file mode 100644 index 869cf7a..0000000 --- a/quantumclient/quantum/v2_0/lb/pool.py +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright 2013 Mirantis Inc. -# 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: Ilya Shakhat, Mirantis Inc. -# -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -import logging - -from quantumclient.quantum import v2_0 as quantumv20 - - -class ListPool(quantumv20.ListCommand): - """List pools that belong to a given tenant.""" - - resource = 'pool' - log = logging.getLogger(__name__ + '.ListPool') - list_columns = ['id', 'name', 'lb_method', 'protocol', - 'admin_state_up', 'status'] - pagination_support = True - sorting_support = True - - -class ShowPool(quantumv20.ShowCommand): - """Show information of a given pool.""" - - resource = 'pool' - log = logging.getLogger(__name__ + '.ShowPool') - - -class CreatePool(quantumv20.CreateCommand): - """Create a pool.""" - - resource = 'pool' - log = logging.getLogger(__name__ + '.CreatePool') - - def add_known_arguments(self, parser): - parser.add_argument( - '--admin-state-down', - dest='admin_state', action='store_false', - help='set admin state up to false') - parser.add_argument( - '--description', - help='description of the pool') - parser.add_argument( - '--lb-method', - required=True, - help='the algorithm used to distribute load between the members ' - 'of the pool') - parser.add_argument( - '--name', - required=True, - help='the name of the pool') - parser.add_argument( - '--protocol', - required=True, - help='protocol for balancing') - parser.add_argument( - '--subnet-id', - required=True, - help='the subnet on which the members of the pool will be located') - - def args2body(self, parsed_args): - _subnet_id = quantumv20.find_resourceid_by_name_or_id( - self.get_client(), 'subnet', parsed_args.subnet_id) - body = { - self.resource: { - 'admin_state_up': parsed_args.admin_state, - 'subnet_id': _subnet_id, - }, - } - quantumv20.update_dict(parsed_args, body[self.resource], - ['description', 'lb_method', 'name', - 'protocol', 'tenant_id']) - return body - - -class UpdatePool(quantumv20.UpdateCommand): - """Update a given pool.""" - - resource = 'pool' - log = logging.getLogger(__name__ + '.UpdatePool') - - -class DeletePool(quantumv20.DeleteCommand): - """Delete a given pool.""" - - resource = 'pool' - log = logging.getLogger(__name__ + '.DeletePool') - - -class RetrievePoolStats(quantumv20.ShowCommand): - """Retrieve stats for a given pool.""" - - resource = 'pool' - log = logging.getLogger(__name__ + '.RetrievePoolStats') - - def get_data(self, parsed_args): - self.log.debug('run(%s)' % parsed_args) - quantum_client = self.get_client() - quantum_client.format = parsed_args.request_format - params = {} - if parsed_args.fields: - params = {'fields': parsed_args.fields} - - data = quantum_client.retrieve_pool_stats(parsed_args.id, **params) - self.format_output_data(data) - stats = data['stats'] - if 'stats' in data: - return zip(*sorted(stats.iteritems())) - else: - return None diff --git a/quantumclient/quantum/v2_0/lb/vip.py b/quantumclient/quantum/v2_0/lb/vip.py deleted file mode 100644 index ced5b20..0000000 --- a/quantumclient/quantum/v2_0/lb/vip.py +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright 2013 Mirantis Inc. -# 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: Ilya Shakhat, Mirantis Inc. -# -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -import logging - -from quantumclient.quantum import v2_0 as quantumv20 - - -class ListVip(quantumv20.ListCommand): - """List vips that belong to a given tenant.""" - - resource = 'vip' - log = logging.getLogger(__name__ + '.ListVip') - list_columns = ['id', 'name', 'algorithm', 'address', 'protocol', - 'admin_state_up', 'status'] - pagination_support = True - sorting_support = True - - -class ShowVip(quantumv20.ShowCommand): - """Show information of a given vip.""" - - resource = 'vip' - log = logging.getLogger(__name__ + '.ShowVip') - - -class CreateVip(quantumv20.CreateCommand): - """Create a vip.""" - - resource = 'vip' - log = logging.getLogger(__name__ + '.CreateVip') - - def add_known_arguments(self, parser): - parser.add_argument( - 'pool_id', metavar='pool', - help='Pool id or name this vip belongs to') - parser.add_argument( - '--address', - help='IP address of the vip') - parser.add_argument( - '--admin-state-down', - dest='admin_state', action='store_false', - help='set admin state up to false') - parser.add_argument( - '--connection-limit', - help='the maximum number of connections per second allowed for ' - 'the vip') - parser.add_argument( - '--description', - help='description of the vip') - parser.add_argument( - '--name', - required=True, - help='name of the vip') - parser.add_argument( - '--protocol-port', - required=True, - help='TCP port on which to listen for client traffic that is ' - 'associated with the vip address') - parser.add_argument( - '--protocol', - required=True, - help='protocol for balancing') - parser.add_argument( - '--subnet-id', - required=True, - help='the subnet on which to allocate the vip address') - - def args2body(self, parsed_args): - _pool_id = quantumv20.find_resourceid_by_name_or_id( - self.get_client(), 'pool', parsed_args.pool_id) - _subnet_id = quantumv20.find_resourceid_by_name_or_id( - self.get_client(), 'subnet', parsed_args.subnet_id) - body = { - self.resource: { - 'pool_id': _pool_id, - 'admin_state_up': parsed_args.admin_state, - 'subnet_id': _subnet_id, - }, - } - quantumv20.update_dict(parsed_args, body[self.resource], - ['address', 'connection_limit', 'description', - 'name', 'protocol_port', 'protocol', - 'tenant_id']) - return body - - -class UpdateVip(quantumv20.UpdateCommand): - """Update a given vip.""" - - resource = 'vip' - log = logging.getLogger(__name__ + '.UpdateVip') - - -class DeleteVip(quantumv20.DeleteCommand): - """Delete a given vip.""" - - resource = 'vip' - log = logging.getLogger(__name__ + '.DeleteVip') |
