summaryrefslogtreecommitdiffstats
path: root/scripts/stl/hlt/hlt_framesize_vm.py
blob: 54ac41a00ab03d3b5842bdcfa60f5542019b7b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from trex_stl_lib.trex_stl_hltapi import STLHltStream


class STLS1(object):
    '''
    Two Eth/IP/UDP streams with VM to get different size of packet by frame_size
    '''

    def get_streams (self, direction = 0, **kwargs):
        return [STLHltStream(length_mode = 'increment',
                             frame_size_min = 100,
                             frame_size_max = 3000,
                             l3_protocol = 'ipv4',
                             l4_protocol = 'udp',
                             rate_bps = 1000000,
                             direction = direction,
                             ),
                STLHltStream(length_mode = 'decrement',
                             frame_size_min = 100,
                             frame_size_max = 3000,
                             l3_protocol = 'ipv4',
                             l4_protocol = 'udp',
                             rate_bps = 100000,
                             direction = direction,
                             )
               ]

# dynamic load - used for trex console or simulator
def register():
    return STLS1()
ap_file, duration = d, dual = dual, delay = delay, ipv6 = ipv6, times = times, interfaces = interfaces) except AppError as err: self.__handle_AppError_exception(err.args[0]) except ProtocolError: raise finally: self.prompt_verbose_data() def stop_quick_trex(self): try: return self.server.stop_quick_trex() except AppError as err: self.__handle_AppError_exception(err.args[0]) except ProtocolError: raise finally: self.prompt_verbose_data() # def is_running(self): # pass def get_running_stats(self): try: return self.server.get_running_stats() except AppError as err: self.__handle_AppError_exception(err.args[0]) except ProtocolError: raise finally: self.prompt_verbose_data() def clear_counters(self): try: return self.server.clear_counters() except AppError as err: self.__handle_AppError_exception(err.args[0]) except ProtocolError: raise finally: self.prompt_verbose_data() if __name__ == "__main__": trex = CTRexAdvClient('trex-dan', trex_daemon_port = 8383, verbose = True) print trex.start_quick_trex(delay = 10, dual = True, d = 20, interfaces = ["gig0/0/1", "gig0/0/2"], ipv6 = False, pcap_file="avl/http_browsing.pcap", times=3) print trex.stop_quick_trex() print trex.get_running_stats() print trex.clear_counters() pass