summaryrefslogtreecommitdiff
path: root/neutronclient/neutron
diff options
context:
space:
mode:
authorKevin Benton <kevin@benton.pub>2016-08-28 10:14:12 -0700
committerKevin Benton <kevin@benton.pub>2016-08-28 10:44:17 -0700
commitafe3c8389df7a413c8290ea1c574c077f956cc1b (patch)
treef3977f452cd25c77c3abd9eaa534b6b73f64625a /neutronclient/neutron
parentfdf7e770b621cb8c8d0c5aa3742371f3c63fbdd3 (diff)
downloadpython-neutronclient-afe3c8389df7a413c8290ea1c574c077f956cc1b.tar.gz
Add flavor argument to router
This allows the router to take a flavor argument that can be either the ID or the name of a flavor to use when creating a router. Partially-Implements: blueprint multi-l3-backends Change-Id: I100fc75de6d41900f6452f356f0b7b741cd177ce
Diffstat (limited to 'neutronclient/neutron')
-rw-r--r--neutronclient/neutron/v2_0/router.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/neutronclient/neutron/v2_0/router.py b/neutronclient/neutron/v2_0/router.py
index 200feee..b431daa 100644
--- a/neutronclient/neutron/v2_0/router.py
+++ b/neutronclient/neutron/v2_0/router.py
@@ -71,6 +71,9 @@ class CreateRouter(neutronV20.CreateCommand):
parser.add_argument(
'--description',
help=_('Description of router.'))
+ parser.add_argument(
+ '--flavor',
+ help=_('ID or name of flavor.'))
utils.add_boolean_argument(
parser, '--distributed', dest='distributed',
help=_('Create a distributed router.'))
@@ -82,6 +85,10 @@ class CreateRouter(neutronV20.CreateCommand):
def args2body(self, parsed_args):
body = {'admin_state_up': parsed_args.admin_state}
+ if parsed_args.flavor:
+ _flavor_id = neutronV20.find_resourceid_by_name_or_id(
+ self.get_client(), 'flavor', parsed_args.flavor)
+ body['flavor_id'] = _flavor_id
neutronV20.update_dict(parsed_args, body,
['name', 'tenant_id', 'distributed', 'ha',
'description'])