summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/utils/constants.py
blob: a49420947ce2e02179a9fa6df2bef9250ffa944a (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
from collections import OrderedDict

ON_OFF_DICT = OrderedDict([
    ('on', True),
    ('off', False),
])

UP_DOWN_DICT = OrderedDict([
    ('up', True),
    ('down', False),
])

FLOW_CTRL_DICT = OrderedDict([
    ('none', 0),     # Disable flow control
    ('tx',   1),     # Enable flowctrl on TX side (RX pause frames)
    ('rx',   2),     # Enable flowctrl on RX side (TX pause frames)
    ('full', 3),     # Enable flow control on both sides
])



# generate reverse dicts

for var_name in list(vars().keys()):
    if var_name.endswith('_DICT'):
        exec('{0}_REVERSED = OrderedDict([(val, key) for key, val in {0}.items()])'.format(var_name))