summaryrefslogtreecommitdiff
path: root/openstackclient/network
diff options
context:
space:
mode:
authorYan Xing'an <yanxingan@cmss.chinamobile.com>2016-11-14 01:23:39 -0800
committerYan Xing'an <yanxingan@cmss.chinamobile.com>2016-12-12 19:23:27 -0800
commit083e155ae52408b1e70da66c8fbc06e3d2fbbf6e (patch)
tree6afe9681ac558d19c7bdd0ee22693903868c1d09 /openstackclient/network
parent29587eaa6661493b7df9357ad818bf058e820730 (diff)
downloadpython-openstackclient-083e155ae52408b1e70da66c8fbc06e3d2fbbf6e.tar.gz
SDK Refactor: Prepare router commands
Prepare the OSC "router" commands for the SDK refactor. See [1] for details. [1] https://etherpad.openstack.org/p/osc-network-command-sdk-support Change-Id: I2fa12943a65e3981b924e6cea9ed041682ec54b2 Partially-Implements: blueprint network-command-sdk-support
Diffstat (limited to 'openstackclient/network')
-rw-r--r--openstackclient/network/v2/router.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py
index cdd634d0..61a005e6 100644
--- a/openstackclient/network/v2/router.py
+++ b/openstackclient/network/v2/router.py
@@ -52,6 +52,7 @@ def _format_routes(routes):
_formatters = {
'admin_state_up': _format_admin_state,
+ 'is_admin_state_up': _format_admin_state,
'external_gateway_info': _format_external_gateway_info,
'availability_zones': utils.format_list,
'availability_zone_hints': utils.format_list,
@@ -62,6 +63,9 @@ _formatters = {
def _get_columns(item):
column_map = {
'tenant_id': 'project_id',
+ 'is_ha': 'ha',
+ 'is_distributed': 'distributed',
+ 'is_admin_state_up': 'admin_state_up',
}
return sdk_utils.get_osc_show_columns_for_sdk_resource(item, column_map)
@@ -150,6 +154,8 @@ class AddSubnetToRouter(command.Command):
subnet_id=subnet.id)
+# TODO(yanxing'an): Use the SDK resource mapped attribute names once the
+# OSC minimum requirements include SDK 1.0.
class CreateRouter(command.ShowOne):
_description = _("Create a new router")
@@ -255,6 +261,8 @@ class DeleteRouter(command.Command):
raise exceptions.CommandError(msg)
+# TODO(yanxing'an): Use the SDK resource mapped attribute names once the
+# OSC minimum requirements include SDK 1.0.
class ListRouter(command.Lister):
_description = _("List routers")
@@ -297,10 +305,10 @@ class ListRouter(command.Lister):
'id',
'name',
'status',
- 'admin_state_up',
- 'distributed',
- 'ha',
- 'tenant_id',
+ 'is_admin_state_up',
+ 'is_distributed',
+ 'is_ha',
+ 'project_id',
)
column_headers = (
'ID',
@@ -319,8 +327,10 @@ class ListRouter(command.Lister):
if parsed_args.enable:
args['admin_state_up'] = True
+ args['is_admin_state_up'] = True
elif parsed_args.disable:
args['admin_state_up'] = False
+ args['is_admin_state_up'] = False
if parsed_args.project:
project_id = identity_common.find_project(
@@ -329,6 +339,7 @@ class ListRouter(command.Lister):
parsed_args.project_domain,
).id
args['tenant_id'] = project_id
+ args['project_id'] = project_id
if parsed_args.long:
columns = columns + (
'routes',
@@ -407,6 +418,8 @@ class RemoveSubnetFromRouter(command.Command):
subnet_id=subnet.id)
+# TODO(yanxing'an): Use the SDK resource mapped attribute names once the
+# OSC minimum requirements include SDK 1.0.
class SetRouter(command.Command):
_description = _("Set router properties")