94095665aa3d4579fafdc484b62233c5ee915fbd
[yardstick.git] / yardstick / cmd / commands / plugin.py
1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 """ Handler for yardstick command 'plugin' """
11
12 from yardstick.benchmark.core.plugin import Plugin
13 from yardstick.common.utils import cliargs
14 from yardstick.cmd.commands import change_osloobj_to_paras
15
16
17 class PluginCommands(object):
18     '''Plugin commands.
19
20        Set of commands to manage plugins.
21     '''
22
23     @cliargs("input_file", type=str, help="path to plugin configuration file",
24              nargs=1)
25     def do_install(self, args):
26         '''Install a plugin.'''
27         param = change_osloobj_to_paras(args)
28         Plugin().install(param)
29
30     @cliargs("input_file", type=str, help="path to plugin configuration file",
31              nargs=1)
32     def do_remove(self, args):
33         '''Remove a plugin.'''
34         param = change_osloobj_to_paras(args)
35         Plugin().remove(param)