diff --git a/neutronclient/neutron/v2_0/lb/v2/healthmonitor.py b/neutronclient/neutron/v2_0/lb/v2/healthmonitor.py index 14f9b9ac9..a11b57806 100644 --- a/neutronclient/neutron/v2_0/lb/v2/healthmonitor.py +++ b/neutronclient/neutron/v2_0/lb/v2/healthmonitor.py @@ -24,7 +24,7 @@ class ListHealthMonitor(neutronV20.ListCommand): resource = 'healthmonitor' shadow_resource = 'lbaas_healthmonitor' - list_columns = ['id', 'type', 'admin_state_up'] + list_columns = ['id', 'name', 'type', 'admin_state_up'] pagination_support = True sorting_support = True @@ -43,6 +43,9 @@ class CreateHealthMonitor(neutronV20.CreateCommand): shadow_resource = 'lbaas_healthmonitor' def add_known_arguments(self, parser): + parser.add_argument( + '--name', + help=_('Name of the health monitor to be created.')) parser.add_argument( '--admin-state-down', dest='admin_state', action='store_false', @@ -100,7 +103,7 @@ class CreateHealthMonitor(neutronV20.CreateCommand): 'pool_id': pool_id} neutronV20.update_dict(parsed_args, body, ['expected_codes', 'http_method', 'url_path', - 'tenant_id']) + 'tenant_id', 'name']) return {self.resource: body} @@ -109,7 +112,16 @@ class UpdateHealthMonitor(neutronV20.UpdateCommand): resource = 'healthmonitor' shadow_resource = 'lbaas_healthmonitor' - allow_names = False + + def add_known_arguments(self, parser): + parser.add_argument( + '--name', + help=_('Updated name of the health monitor.')) + + def args2body(self, parsed_args): + body = {} + neutronV20.update_dict(parsed_args, body, ['name']) + return {self.resource: body} class DeleteHealthMonitor(neutronV20.DeleteCommand): diff --git a/neutronclient/neutron/v2_0/lb/v2/member.py b/neutronclient/neutron/v2_0/lb/v2/member.py index c1fb670f5..a5a775173 100644 --- a/neutronclient/neutron/v2_0/lb/v2/member.py +++ b/neutronclient/neutron/v2_0/lb/v2/member.py @@ -43,7 +43,7 @@ class ListMember(LbaasMemberMixin, neutronV20.ListCommand): resource = 'member' shadow_resource = 'lbaas_member' list_columns = [ - 'id', 'address', 'protocol_port', 'weight', + 'id', 'name', 'address', 'protocol_port', 'weight', 'subnet_id', 'admin_state_up', 'status' ] pagination_support = True @@ -76,6 +76,9 @@ class CreateMember(neutronV20.CreateCommand): parser.add_argument( '--weight', help=_('Weight of member in the pool (default:1, [0..256]).')) + parser.add_argument( + '--name', + help=_('Name of the member to be created.')) parser.add_argument( '--subnet', required=True, @@ -102,7 +105,7 @@ class CreateMember(neutronV20.CreateCommand): 'protocol_port': parsed_args.protocol_port, 'address': parsed_args.address} neutronV20.update_dict(parsed_args, body, - ['weight', 'subnet_id', 'tenant_id']) + ['weight', 'subnet_id', 'tenant_id', 'name']) return {self.resource: body} @@ -123,12 +126,15 @@ class UpdateMember(neutronV20.UpdateCommand): parser.add_argument( 'pool', metavar='POOL', help=_('ID or name of the pool that this member belongs to')) + parser.add_argument( + '--name', + help=_('Updated name of the member.')) def args2body(self, parsed_args): self.parent_id = _get_pool_id(self.get_client(), parsed_args.pool) body = {} neutronV20.update_dict(parsed_args, body, - ['admin_state_up', 'weight']) + ['admin_state_up', 'weight', 'name']) return {self.resource: body} diff --git a/neutronclient/tests/unit/lb/v2/test_cli20_healthmonitor.py b/neutronclient/tests/unit/lb/v2/test_cli20_healthmonitor.py index ec07088a0..b585ec3a2 100644 --- a/neutronclient/tests/unit/lb/v2/test_cli20_healthmonitor.py +++ b/neutronclient/tests/unit/lb/v2/test_cli20_healthmonitor.py @@ -57,15 +57,17 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base): expected_codes = '201' url_path = '/somepath' pool = 'pool1' + name = 'healthmonitor1' args = ['--admin-state-down', '--http-method', http_method, '--expected-codes', expected_codes, '--url-path', url_path, '--type', type, '--max-retries', max_retries, - '--delay', delay, '--timeout', timeout, '--pool', pool] + '--delay', delay, '--timeout', timeout, '--pool', pool, + '--name', name] position_names = ['admin_state_up', 'http_method', 'expected_codes', 'url_path', 'type', 'max_retries', 'delay', - 'timeout', 'pool_id'] + 'timeout', 'pool_id', 'name'] position_values = [False, http_method, expected_codes, url_path, - type, max_retries, delay, timeout, pool] + type, max_retries, delay, timeout, pool, name] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource) diff --git a/neutronclient/tests/unit/lb/v2/test_cli20_member.py b/neutronclient/tests/unit/lb/v2/test_cli20_member.py index 3f9bced20..acc663ac5 100644 --- a/neutronclient/tests/unit/lb/v2/test_cli20_member.py +++ b/neutronclient/tests/unit/lb/v2/test_cli20_member.py @@ -53,12 +53,14 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base): pool_id = 'pool-id' subnet_id = 'subnet-id' weight = '100' + name = 'member1' args = ['--address', address, '--protocol-port', protocol_port, '--subnet', subnet_id, pool_id, '--weight', weight, - '--admin-state-down'] + '--admin-state-down', '--name', name] position_names = ['admin_state_up', 'address', 'protocol_port', - 'subnet_id', 'weight'] - position_values = [False, address, protocol_port, subnet_id, weight] + 'subnet_id', 'weight', 'name'] + position_values = [False, address, protocol_port, + subnet_id, weight, name] self._test_create_resource(resource, cmd, '', my_id, args, position_names, position_values, cmd_resource=cmd_resource,