aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_bihash.py
diff options
context:
space:
mode:
authorwanghanlin <wanghanlin@corp.netease.com>2021-07-06 15:01:48 +0800
committerFlorin Coras <florin.coras@gmail.com>2021-07-06 14:23:42 +0000
commit97c6e0d4d1fe634fac198e5de1757a24b9063767 (patch)
tree497a62aafb767bcf5e6cd6ff6e191834b41ebcf8 /test/test_bihash.py
parent8cc66b55ae8b783aac9c780baddaead686d7df8f (diff)
vcl: fix return value check for ldp_fd_to_vlsh
Type: fix Signed-off-by: wanghanlin <wanghanlin@corp.netease.com> Change-Id: Iaad4022e84f4979016bb46c2ff5cfc5d43d6ff50
Diffstat (limited to 'test/test_bihash.py')
0 files changed, 0 insertions, 0 deletions
o */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
from trex_stl_lib.api import *


# step is not 1. 
class STLS1(object):

    def __init__ (self):
        self.fsize  =64; # the size of the packet 

    def create_stream (self):

        # Create base packet and pad it to size
        size = self.fsize - 4; # HW will add 4 bytes ethernet FCS
        base_pkt =  Ether()/IP(src="16.0.0.1",dst="48.0.0.1")/UDP(dport=12,sport=1025)
        pad = max(0, size - len(base_pkt)) * 'x'

        vm = STLScVmRaw( [ STLVmFlowVar(name="mac_src", min_value=1, max_value=100, size=1,step=2, op="inc"), 
                           STLVmWrFlowVar(fv_name="mac_src", pkt_offset= 11)                                 # write it to LSB of SRC offset it 11
                          ]
                       )

        return STLStream(packet = STLPktBuilder(pkt = base_pkt/pad,vm = vm),
                         mode = STLTXCont( pps=10 ))

    def get_streams (self, direction = 0, **kwargs):
        # create 1 stream 
        return [ self.create_stream() ]


# dynamic load - used for trex console or simulator
def register():
    return STLS1()