Merge "bugfix: tc078 fails in some situations"
[yardstick.git] / yardstick / benchmark / core / scenario.py
1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB 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 'scenario' """
11
12 from __future__ import absolute_import
13 from yardstick.benchmark.scenarios.base import Scenario
14 from yardstick.benchmark.core import print_hbar
15
16
17 class Scenarios(object):    # pragma: no cover
18     """Scenario commands.
19
20        Set of commands to discover and display scenario types.
21     """
22
23     def list_all(self, args):
24         """List existing scenario types"""
25         types = Scenario.get_types()
26         print_hbar(78)
27         print("| %-16s | %-60s" % ("Type", "Description"))
28         print_hbar(78)
29         for scenario_class in types:
30             print("| %-16s | %-60s" % (scenario_class.get_scenario_type(),
31                                        scenario_class.get_description()))
32         print_hbar(78)
33
34     def show(self, args):
35         """Show details of a specific scenario type"""
36         stype = Scenario.get_cls(args.type[0])
37         print(stype.__doc__)