1 # Copyright (c) 2015 Intel Research and Development Ireland Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
19 class BenchmarkBaseClass(object):
21 This class represents a Benchmark that we want to run on the platform.
22 One of them will be the calculation of the throughput changing the
23 configuration parameters
26 def __init__(self, name, params):
29 if not isinstance(params, dict):
30 raise ValueError("Parameters need to be provided in a dict")
32 for param in self.get_features()['parameters']:
33 if param not in params.keys():
34 params[param] = self.get_features()['default_values'][param]
36 for param in self.get_features()['parameters']:
37 if params[param] not in \
38 (self.get_features())['allowed_values'][param]:
39 raise ValueError('Value of parameter "' + param +
47 def get_features(self):
49 features['description'] = 'Please implement the method ' \
50 '"get_features" for your benchmark'
51 features['parameters'] = list()
52 features['allowed_values'] = dict()
53 features['default_values'] = dict()
59 Initializes the benchmark
62 raise NotImplementedError("Subclass must implement abstract method")
67 Finalizes the benchmark
70 raise NotImplementedError("Subclass must implement abstract method")
75 This method executes the specific benchmark on the VNF already
77 :return: list of dictionaries (every dictionary contains the results
80 raise NotImplementedError("Subclass must implement abstract method")