80 lines
2.0 KiB
Python
80 lines
2.0 KiB
Python
# Copyright 2016 Huawei corp.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from neutronclient.common import extension
|
|
|
|
from wan_qos.common import constants
|
|
|
|
|
|
def args2body(self, parsed_args):
|
|
body = {constants.WAN_TC: {}, }
|
|
return body
|
|
|
|
|
|
class WanTc(extension.NeutronClientExtension):
|
|
resource = constants.WAN_TC
|
|
resource_plural = '%ss' % constants.WAN_TC
|
|
path = constants.WAN_TC_PATH
|
|
object_path = '/%s' % path
|
|
resource_path = '/%s/%%s' % path
|
|
versions = ['2.0']
|
|
|
|
|
|
class WanTcShow(extension.ClientExtensionShow, WanTc):
|
|
|
|
shell_command = 'wan-tc-show'
|
|
|
|
|
|
class WanTcList(extension.ClientExtensionList, WanTc):
|
|
|
|
shell_command = 'wan-tc-list'
|
|
list_columns = ['id', 'name', 'network']
|
|
pagination_support = True
|
|
sorting_support = True
|
|
|
|
|
|
class WanTcCreate(extension.ClientExtensionCreate, WanTc):
|
|
|
|
shell_command = 'wan-tc-create'
|
|
|
|
def add_known_arguments(self, parser):
|
|
pass
|
|
|
|
def args2body(self, parsed_args):
|
|
body = args2body(self, parsed_args)
|
|
if parsed_args.tenant_id:
|
|
body['wan_qos']['tenant_id'] = parsed_args.tenant_id
|
|
return body
|
|
|
|
|
|
class WanTcDelete(extension.ClientExtensionDelete, WanTc):
|
|
|
|
shell_command = 'wan-tc-delete'
|
|
|
|
|
|
class WanTcUpdate(extension.ClientExtensionUpdate, WanTc):
|
|
|
|
shell_command = 'wan-tc-update'
|
|
|
|
def add_known_arguments(self, parser):
|
|
pass
|
|
|
|
def args2body(self, parsed_args):
|
|
body = args2body(self, parsed_args)
|
|
return body
|
|
|
|
|
|
|