Merge "Add the flavor-id option to router create"
This commit is contained in:
		| @@ -139,6 +139,9 @@ def _get_attrs(client_manager, parsed_args): | |||||||
|                 ips.append(ip_spec) |                 ips.append(ip_spec) | ||||||
|             gateway_info['external_fixed_ips'] = ips |             gateway_info['external_fixed_ips'] = ips | ||||||
|         attrs['external_gateway_info'] = gateway_info |         attrs['external_gateway_info'] = gateway_info | ||||||
|  |     # "router set" command doesn't support setting flavor_id. | ||||||
|  |     if 'flavor_id' in parsed_args and parsed_args.flavor_id is not None: | ||||||
|  |         attrs['flavor_id'] = parsed_args.flavor_id | ||||||
|  |  | ||||||
|     return attrs |     return attrs | ||||||
|  |  | ||||||
| @@ -399,6 +402,11 @@ class CreateRouter(command.ShowOne, common.NeutronCommandWithExtraArgs): | |||||||
|             action='store_false', |             action='store_false', | ||||||
|             help=_("Disable IPv6 NDP proxy on external gateway"), |             help=_("Disable IPv6 NDP proxy on external gateway"), | ||||||
|         ) |         ) | ||||||
|  |         parser.add_argument( | ||||||
|  |             '--flavor-id', | ||||||
|  |             metavar='<flavor-id>', | ||||||
|  |             help=_("Associate the router to a flavor by ID"), | ||||||
|  |         ) | ||||||
|  |  | ||||||
|         return parser |         return parser | ||||||
|  |  | ||||||
|   | |||||||
| @@ -379,6 +379,32 @@ class TestCreateRouter(TestRouter): | |||||||
|     def test_create_with_no_tag(self): |     def test_create_with_no_tag(self): | ||||||
|         self._test_create_with_tag(add_tags=False) |         self._test_create_with_tag(add_tags=False) | ||||||
|  |  | ||||||
|  |     def test_create_with_flavor_id(self): | ||||||
|  |         _flavor = network_fakes.create_one_network_flavor() | ||||||
|  |         arglist = [ | ||||||
|  |             self.new_router.name, | ||||||
|  |             '--flavor-id', | ||||||
|  |             _flavor.id, | ||||||
|  |         ] | ||||||
|  |         verifylist = [ | ||||||
|  |             ('name', self.new_router.name), | ||||||
|  |             ('enable', True), | ||||||
|  |             ('distributed', False), | ||||||
|  |             ('ha', False), | ||||||
|  |             ('flavor_id', _flavor.id), | ||||||
|  |         ] | ||||||
|  |         parsed_args = self.check_parser(self.cmd, arglist, verifylist) | ||||||
|  |         columns, data = self.cmd.take_action(parsed_args) | ||||||
|  |         self.network.create_router.assert_called_once_with( | ||||||
|  |             **{ | ||||||
|  |                 'admin_state_up': True, | ||||||
|  |                 'name': self.new_router.name, | ||||||
|  |                 'flavor_id': _flavor.id, | ||||||
|  |             } | ||||||
|  |         ) | ||||||
|  |         self.assertEqual(self.columns, columns) | ||||||
|  |         self.assertCountEqual(self.data, data) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TestDeleteRouter(TestRouter): | class TestDeleteRouter(TestRouter): | ||||||
|     # The routers to delete. |     # The routers to delete. | ||||||
|   | |||||||
| @@ -0,0 +1,4 @@ | |||||||
|  | --- | ||||||
|  | features: | ||||||
|  |   - | | ||||||
|  |     Add the ``--flavor-id`` option to the ``router create`` command. | ||||||
		Reference in New Issue
	
	Block a user
	 Zuul
					Zuul