1 # Copyright 2016 Cisco Systems, Inc. All rights reserved.
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # 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, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
15 from traffic_base import AbstractTrafficGenerator
18 class DummyTG(AbstractTrafficGenerator):
19 """Experimental dummy traffic generator.
21 This traffic generator will pretend to generate traffic and return fake data.
22 Useful for unit testing without actually generating any traffic.
25 def __init__(self, runner):
26 AbstractTrafficGenerator.__init__(self, runner)
30 def get_version(self):
37 ports = list(self.config.generator_config.ports)
38 self.port_handle = ports
40 def is_arp_successful(self):
43 def config_interface(self):
46 def create_traffic(self, l2frame_size, rates, bidirectional, latency=True):
49 def clear_streamblock(self):
54 for ph in self.port_handle:
58 'total_pkt_bytes': 100000,
60 'pkt_bit_rate': 1000000
64 'total_pkt_bytes': 100000,
66 'pkt_bit_rate': 1000000,
70 result[ph]['rx']['max_delay_usec'] = 10.0
71 result[ph]['rx']['min_delay_usec'] = 1.0
72 result[ph]['rx']['avg_delay_usec'] = 2.0
75 def clear_stats(self):
78 def start_traffic(self):
81 def stop_traffic(self):