blob: bcf2257f124f2e119d3f627bbdb760b98e20da78 (
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
|
import os
from trex_stl_lib.api import *
# PCAP profile
class STLPcap(object):
def __init__ (self, pcap_file):
self.pcap_file = pcap_file
def get_streams (self, direction = 0, **kwargs):
profile = STLProfile.load_pcap(self.pcap_file, ipg_usec = kwargs.get('ipg_usec', 10.0), loop_count = kwargs.get('loop_count', 1))
return profile.get_streams()
# dynamic load - used for trex console or simulator
def register():
# get file relative to profile dir
return STLPcap(os.path.join(os.path.dirname(__file__), 'sample.pcap'))
|