summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwaminathan Vasudevan <swaminathan.vasudevan@hp.com>2014-09-12 13:16:29 -0700
committerSwaminathan Vasudevan <swaminathan.vasudevan@hp.com>2014-12-04 13:06:27 -0800
commit66612c9de835bd080a9f43d91aa65e5e8639fd26 (patch)
treec777cc79f3bcd67f8226c3ec5922ea06966d4300
parent19de15dd60af1c233ee6478a78141389bea15151 (diff)
downloadpython-neutronclient-66612c9de835bd080a9f43d91aa65e5e8639fd26.tar.gz
Router create distributed accepts lower case
Neutron router-create optional argument distributed does not accept "true/false" anymore. It only accepts value with Camel case "True/False". This patch will allow the users to provide both True/true or False/false. Change-Id: I79577bd70a796543b9dea53b4839512eb8944d7c Closes-bug: #1368934
-rw-r--r--neutronclient/neutron/v2_0/router.py4
-rw-r--r--neutronclient/tests/unit/test_cli20_router.py17
2 files changed, 17 insertions, 4 deletions
diff --git a/neutronclient/neutron/v2_0/router.py b/neutronclient/neutron/v2_0/router.py
index 6973218..0a6cc2f 100644
--- a/neutronclient/neutron/v2_0/router.py
+++ b/neutronclient/neutron/v2_0/router.py
@@ -68,8 +68,8 @@ class CreateRouter(neutronV20.CreateCommand):
help=_('Name of router to create.'))
parser.add_argument(
'--distributed',
- dest='distributed',
- choices=['True', 'False'],
+ dest='distributed', metavar='{True,False}',
+ choices=['True', 'true', 'False', 'false'],
default=argparse.SUPPRESS,
help=_('Create a distributed router.'))
parser.add_argument(
diff --git a/neutronclient/tests/unit/test_cli20_router.py b/neutronclient/tests/unit/test_cli20_router.py
index 6320750..33e22d5 100644
--- a/neutronclient/tests/unit/test_cli20_router.py
+++ b/neutronclient/tests/unit/test_cli20_router.py
@@ -83,12 +83,25 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
position_names, position_values,
**expected)
- def test_create_router_distributed(self):
- self._create_router_distributed_or_ha(distributed=True)
+ def test_create_router_distributed_True(self):
+ """Create router: --distributed=True."""
+ self._create_router_distributed_or_ha(distributed='True')
def test_create_router_ha(self):
self._create_router_distributed_or_ha(ha=True)
+ def test_create_router_distributed_False(self):
+ """Create router: --distributed=False."""
+ self._create_router_distributed_or_ha(distributed='False')
+
+ def test_create_router_distributed_true(self):
+ """Create router: --distributed=true."""
+ self._create_router_distributed_or_ha(distributed='true')
+
+ def test_create_router_distributed_false(self):
+ """Create router: --distributed=false."""
+ self._create_router_distributed_or_ha(distributed='false')
+
def test_list_routers_detail(self):
"""list routers: -D."""
resources = "routers"