1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
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 ##############################################################################
10 """ Scenario base class
13 import yardstick.common.utils as utils
16 class Scenario(object):
19 ''' default impl for scenario setup '''
23 ''' catcher for not implemented run methods in subclasses '''
24 raise RuntimeError("run method not implemented")
27 ''' default impl for scenario teardown '''
31 def get(scenario_type):
32 """Returns instance of a scenario runner for execution type.
34 for scenario in utils.itersubclasses(Scenario):
35 if scenario_type == scenario.__scenario_type__:
36 return scenario.__module__ + "." + scenario.__name__
38 raise RuntimeError("No such scenario type %s" % scenario_type)