Merge "Support for Name field in Members and HMs"
This commit is contained in:
@@ -24,7 +24,7 @@ class ListHealthMonitor(neutronV20.ListCommand):
|
|||||||
|
|
||||||
resource = 'healthmonitor'
|
resource = 'healthmonitor'
|
||||||
shadow_resource = 'lbaas_healthmonitor'
|
shadow_resource = 'lbaas_healthmonitor'
|
||||||
list_columns = ['id', 'type', 'admin_state_up']
|
list_columns = ['id', 'name', 'type', 'admin_state_up']
|
||||||
pagination_support = True
|
pagination_support = True
|
||||||
sorting_support = True
|
sorting_support = True
|
||||||
|
|
||||||
@@ -43,6 +43,9 @@ class CreateHealthMonitor(neutronV20.CreateCommand):
|
|||||||
shadow_resource = 'lbaas_healthmonitor'
|
shadow_resource = 'lbaas_healthmonitor'
|
||||||
|
|
||||||
def add_known_arguments(self, parser):
|
def add_known_arguments(self, parser):
|
||||||
|
parser.add_argument(
|
||||||
|
'--name',
|
||||||
|
help=_('Name of the health monitor to be created.'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--admin-state-down',
|
'--admin-state-down',
|
||||||
dest='admin_state', action='store_false',
|
dest='admin_state', action='store_false',
|
||||||
@@ -100,7 +103,7 @@ class CreateHealthMonitor(neutronV20.CreateCommand):
|
|||||||
'pool_id': pool_id}
|
'pool_id': pool_id}
|
||||||
neutronV20.update_dict(parsed_args, body,
|
neutronV20.update_dict(parsed_args, body,
|
||||||
['expected_codes', 'http_method', 'url_path',
|
['expected_codes', 'http_method', 'url_path',
|
||||||
'tenant_id'])
|
'tenant_id', 'name'])
|
||||||
return {self.resource: body}
|
return {self.resource: body}
|
||||||
|
|
||||||
|
|
||||||
@@ -109,7 +112,16 @@ class UpdateHealthMonitor(neutronV20.UpdateCommand):
|
|||||||
|
|
||||||
resource = 'healthmonitor'
|
resource = 'healthmonitor'
|
||||||
shadow_resource = 'lbaas_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):
|
class DeleteHealthMonitor(neutronV20.DeleteCommand):
|
||||||
|
@@ -43,7 +43,7 @@ class ListMember(LbaasMemberMixin, neutronV20.ListCommand):
|
|||||||
resource = 'member'
|
resource = 'member'
|
||||||
shadow_resource = 'lbaas_member'
|
shadow_resource = 'lbaas_member'
|
||||||
list_columns = [
|
list_columns = [
|
||||||
'id', 'address', 'protocol_port', 'weight',
|
'id', 'name', 'address', 'protocol_port', 'weight',
|
||||||
'subnet_id', 'admin_state_up', 'status'
|
'subnet_id', 'admin_state_up', 'status'
|
||||||
]
|
]
|
||||||
pagination_support = True
|
pagination_support = True
|
||||||
@@ -76,6 +76,9 @@ class CreateMember(neutronV20.CreateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--weight',
|
'--weight',
|
||||||
help=_('Weight of member in the pool (default:1, [0..256]).'))
|
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(
|
parser.add_argument(
|
||||||
'--subnet',
|
'--subnet',
|
||||||
required=True,
|
required=True,
|
||||||
@@ -102,7 +105,7 @@ class CreateMember(neutronV20.CreateCommand):
|
|||||||
'protocol_port': parsed_args.protocol_port,
|
'protocol_port': parsed_args.protocol_port,
|
||||||
'address': parsed_args.address}
|
'address': parsed_args.address}
|
||||||
neutronV20.update_dict(parsed_args, body,
|
neutronV20.update_dict(parsed_args, body,
|
||||||
['weight', 'subnet_id', 'tenant_id'])
|
['weight', 'subnet_id', 'tenant_id', 'name'])
|
||||||
return {self.resource: body}
|
return {self.resource: body}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,12 +126,15 @@ class UpdateMember(neutronV20.UpdateCommand):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'pool', metavar='POOL',
|
'pool', metavar='POOL',
|
||||||
help=_('ID or name of the pool that this member belongs to'))
|
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):
|
def args2body(self, parsed_args):
|
||||||
self.parent_id = _get_pool_id(self.get_client(), parsed_args.pool)
|
self.parent_id = _get_pool_id(self.get_client(), parsed_args.pool)
|
||||||
body = {}
|
body = {}
|
||||||
neutronV20.update_dict(parsed_args, body,
|
neutronV20.update_dict(parsed_args, body,
|
||||||
['admin_state_up', 'weight'])
|
['admin_state_up', 'weight', 'name'])
|
||||||
return {self.resource: body}
|
return {self.resource: body}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -57,15 +57,17 @@ class CLITestV20LbHealthMonitorJSON(test_cli20.CLITestV20Base):
|
|||||||
expected_codes = '201'
|
expected_codes = '201'
|
||||||
url_path = '/somepath'
|
url_path = '/somepath'
|
||||||
pool = 'pool1'
|
pool = 'pool1'
|
||||||
|
name = 'healthmonitor1'
|
||||||
args = ['--admin-state-down', '--http-method', http_method,
|
args = ['--admin-state-down', '--http-method', http_method,
|
||||||
'--expected-codes', expected_codes, '--url-path', url_path,
|
'--expected-codes', expected_codes, '--url-path', url_path,
|
||||||
'--type', type, '--max-retries', max_retries,
|
'--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',
|
position_names = ['admin_state_up', 'http_method', 'expected_codes',
|
||||||
'url_path', 'type', 'max_retries', 'delay',
|
'url_path', 'type', 'max_retries', 'delay',
|
||||||
'timeout', 'pool_id']
|
'timeout', 'pool_id', 'name']
|
||||||
position_values = [False, http_method, expected_codes, url_path,
|
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,
|
self._test_create_resource(resource, cmd, '', my_id, args,
|
||||||
position_names, position_values,
|
position_names, position_values,
|
||||||
cmd_resource=cmd_resource)
|
cmd_resource=cmd_resource)
|
||||||
|
@@ -53,12 +53,14 @@ class CLITestV20LbMemberJSON(test_cli20.CLITestV20Base):
|
|||||||
pool_id = 'pool-id'
|
pool_id = 'pool-id'
|
||||||
subnet_id = 'subnet-id'
|
subnet_id = 'subnet-id'
|
||||||
weight = '100'
|
weight = '100'
|
||||||
|
name = 'member1'
|
||||||
args = ['--address', address, '--protocol-port', protocol_port,
|
args = ['--address', address, '--protocol-port', protocol_port,
|
||||||
'--subnet', subnet_id, pool_id, '--weight', weight,
|
'--subnet', subnet_id, pool_id, '--weight', weight,
|
||||||
'--admin-state-down']
|
'--admin-state-down', '--name', name]
|
||||||
position_names = ['admin_state_up', 'address', 'protocol_port',
|
position_names = ['admin_state_up', 'address', 'protocol_port',
|
||||||
'subnet_id', 'weight']
|
'subnet_id', 'weight', 'name']
|
||||||
position_values = [False, address, protocol_port, subnet_id, weight]
|
position_values = [False, address, protocol_port,
|
||||||
|
subnet_id, weight, name]
|
||||||
self._test_create_resource(resource, cmd, '', my_id, args,
|
self._test_create_resource(resource, cmd, '', my_id, args,
|
||||||
position_names, position_values,
|
position_names, position_values,
|
||||||
cmd_resource=cmd_resource,
|
cmd_resource=cmd_resource,
|
||||||
|
Reference in New Issue
Block a user