Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: syaakov <[email protected]>
  • Loading branch information
syaakov committed Mar 9, 2022
1 parent 76548ae commit 8dc7f84
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
43 changes: 43 additions & 0 deletions scripts/astf/shared_port_dif_caps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import os
from trex.astf.api import *
import argparse


class Prof1():
def __init__(self):
pass # tunables

def create_profile(self):

assoc_by_l7_1 = ASTFAssociationRule(ip_start="48.0.0.1", ip_end="48.0.255.255", port=443)
assoc_by_l7_2 = ASTFAssociationRule(ip_start="20.0.0.1", ip_end="20.0.255.255", port=443)

ip_gen_c1 = ASTFIPGenDist(ip_range=["16.0.0.1", "16.0.0.255"], distribution="seq")
ip_gen_s1 = ASTFIPGenDist(ip_range=["48.0.0.1", "48.0.255.255"], distribution="seq")
ip_gen1 = ASTFIPGen(glob=ASTFIPGenGlobal(ip_offset="1.0.0.0"),
dist_client=ip_gen_c1,
dist_server=ip_gen_s1)

ip_gen_c2 = ASTFIPGenDist(ip_range=["10.0.0.1", "10.0.0.255"], distribution="seq")
ip_gen_s2 = ASTFIPGenDist(ip_range=["20.0.0.1", "20.0.255.255"], distribution="seq")
ip_gen2 = ASTFIPGen(glob=ASTFIPGenGlobal(ip_offset="1.0.0.0"),
dist_client=ip_gen_c2,
dist_server=ip_gen_s2)

profile = ASTFProfile(default_ip_gen=ip_gen1, cap_list=[
ASTFCapInfo(file="../avl/delay_10_http_browsing_0.pcap", assoc=assoc_by_l7_1),
ASTFCapInfo(file="../cap2/http_get.pcap", ip_gen=ip_gen2, assoc=assoc_by_l7_2)
])

return profile

def get_profile(self, tunables, **kwargs):
parser = argparse.ArgumentParser(description='Argparser for {}'.format(os.path.basename(__file__)),
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

args = parser.parse_args(tunables)
return self.create_profile()


def register():
return Prof1()
Original file line number Diff line number Diff line change
Expand Up @@ -1815,9 +1815,13 @@ def __init__(self, default_ip_gen, default_c_glob_info=None, default_s_glob_info
else:
d_port = cap.assoc.port
my_assoc = cap.assoc
if d_port in d_ports:
if not my_assoc.is_port_only():
# if assoc is limited by ip range or L7 mapping, it would be checked by server.
pass
elif d_port in d_ports:
raise ASTFError("More than one cap use dest port %s. This is currently not supported. Files with same port: %s, %s" % (d_port, d_ports[d_port], cap_file))
d_ports[d_port] = cap_file
else:
d_ports[d_port] = cap_file

all_cap_info.append({"ip_gen": ip_gen, "prog_c": prog_c, "prog_s": prog_s, "glob_c": glob_c, "glob_s": glob_s,
"cps": cps, "d_port": d_port, "my_assoc": my_assoc,"limit":cap.limit, "cont":cap.cont, "tg_name": cap.tg_name})
Expand Down

0 comments on commit 8dc7f84

Please sign in to comment.