2 # Copyright 2017 Cisco Systems, Inc. All rights reserved.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
18 class BasicWorker(object):
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
26 def get_compute_nodes_bios(self):
29 def get_version(self):
32 def config_interfaces(self):
38 def insert_interface_stats(self, pps_list):
39 """Insert interface stats to a list of packet path stats.
41 pps_list: a list of packet path stats instances indexed by chain index
43 Specialized workers can insert their own interface stats inside each existing packet path
44 stats for every chain.
48 def update_interface_stats(self, diff=False):
49 """Update all interface stats.
51 diff: if False, simply refresh the interface stats values with latest values
52 if True, diff the interface stats with the latest values
53 Make sure that the interface stats inserted in insert_interface_stats() are updated