"neutron help router-update" help info updated

Initially we were unable to see complete help
info for "neutron router-update" command.
Now, with this patch complete help info is
displayed to the user. Apart from the existing
information, the following information will
also be displayed:-
    --name
    --admin-state-up
    --distributed

Change-Id: I149855e86a2d874c10f1ff315a2627e0f0f306c7
Closes-Bug: #1401030
This commit is contained in:
watsalya 2015-02-14 00:58:00 +05:30
parent 3e5c6baa43
commit ada1568809
2 changed files with 67 additions and 0 deletions
neutronclient
neutron/v2_0
tests/unit

@ -92,6 +92,31 @@ class UpdateRouter(neutronV20.UpdateCommand):
resource = 'router'
def add_known_arguments(self, parser):
parser.add_argument(
'--name',
help=_('Name of this router.'))
utils.add_boolean_argument(
parser, '--admin-state-up', dest='admin_state',
help=_('Specify the administrative state of the router'
' (True meaning "Up")'))
utils.add_boolean_argument(
parser, '--admin_state_up', dest='admin_state',
help=argparse.SUPPRESS)
utils.add_boolean_argument(
parser, '--distributed', dest='distributed',
help=_('True means this router should operate in'
' distributed mode.'))
def args2body(self, parsed_args):
body = {self.resource: {}}
if hasattr(parsed_args, 'admin_state'):
body[self.resource].update(
{'admin_state_up': parsed_args.admin_state})
neutronV20.update_dict(parsed_args, body[self.resource],
['name', 'distributed'])
return body
class RouterInterfaceCommand(neutronV20.NeutronCommand):
"""Based class to Add/Remove router interface."""

@ -154,6 +154,48 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
{'name': 'myname'}
)
def test_update_router_admin_state(self):
"""Update router: myid --admin-state-up <True|False>."""
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--admin-state-up', 'True'],
{'admin_state_up': 'True'}
)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--admin-state-up', 'true'],
{'admin_state_up': 'true'}
)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--admin-state-up', 'False'],
{'admin_state_up': 'False'}
)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--admin-state-up', 'false'],
{'admin_state_up': 'false'}
)
def test_update_router_distributed(self):
"""Update router: myid --distributed <True|False>."""
resource = 'router'
cmd = router.UpdateRouter(test_cli20.MyApp(sys.stdout), None)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--distributed', 'True'],
{'distributed': 'True'}
)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--distributed', 'true'],
{'distributed': 'true'}
)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--distributed', 'False'],
{'distributed': 'False'}
)
self._test_update_resource(resource, cmd, 'myid',
['myid', '--distributed', 'false'],
{'distributed': 'false'}
)
def test_delete_router(self):
"""Delete router: myid."""
resource = 'router'