NFVBENCH-153 Add support for python3
[nfvbench.git] / nfvbench / chain_workers.py
1 #!/usr/bin/env python
2 # Copyright 2017 Cisco Systems, Inc.  All rights reserved.
3 #
4 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
5 #    not use this file except in compliance with the License. You may obtain
6 #    a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #    Unless required by applicable law or agreed to in writing, software
11 #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 #    License for the specific language governing permissions and limitations
14 #    under the License.
15 #
16
17
18 class BasicWorker(object):
19
20     def __init__(self, stats_manager):
21         self.stats_manager = stats_manager
22         self.chain_manager = stats_manager.chain_runner.chain_manager
23         self.config = stats_manager.config
24         self.specs = stats_manager.specs
25
26     def get_compute_nodes_bios(self):
27         return {}
28
29     def get_version(self):
30         return {}
31
32     def config_interfaces(self):
33         return {}
34
35     def close(self):
36         pass
37
38     def insert_interface_stats(self, pps_list):
39         """Insert interface stats to a list of packet path stats.
40
41         pps_list: a list of packet path stats instances indexed by chain index
42
43         Specialized workers can insert their own interface stats inside each existing packet path
44         stats for every chain.
45         """
46
47     def update_interface_stats(self, diff=False):
48         """Update all interface stats.
49
50         diff: if False, simply refresh the interface stats values with latest values
51               if True, diff the interface stats with the latest values
52         Make sure that the interface stats inserted in insert_interface_stats() are updated
53         with proper values
54         """