diff options
author | Vratko Polak <vrpolak@cisco.com> | 2022-04-25 10:22:05 +0200 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2022-05-03 15:23:47 +0000 |
commit | 1daa6fdc0bae284dee1b61f34534e59b60b7526a (patch) | |
tree | 6314e011a8f029c4332586d5fd05b51d1a69a89c /GPL/traffic_profiles/trex/profile_trex_astf_base_class.py | |
parent | cd417be7f836eb9346fad4f87bd4f75dc1d9a429 (diff) |
feat(astf): Support framesizes for ASTF
- No support for IMIX.
+ Fix a bad bug in padding (most ASTF profiles had wrong frame sizes).
+ Fix a big typo in TCP PPS profiles (s->c was not data, just RST).
+ Control transaction size via ASTF_N_DATA_FRAMES env variable.
- Default value 5 leads to transactions smaller than before.
+ It ensures transaction is one burst (per direction) even for jumbo.
+ Edit autogen to set supported frame sizes based on suite id.
+ Both TCP and UDP use the same values:
+ 64B for CPS (exact for UDP, nominal for TCP).
+ 100B, 1518B and 9000B for TPUT and PPS.
- TCP TPUT achievable minimum is 70B.
+ Used 100B to leave room for possible IPv6 ASTF tests.
+ Separate function for code reused by vpp and trex tests.
- I do not really like the new "copy and edit" approach added here.
+ But it is a quick edit, better autogen refactor is low priority.
+ Consider both established and transitory sessions as valid.
- Mostly for compatibility with 2202 behavior and to avoid ramp-ups.
- Assuming both session states have similar enough VPP CPU overhead.
+ Added a TODO to investigate and maybe reconsider later.
+ Update the state timeout value to 240s.
+ That is the default for TCP (for transitory state).
- UDP could keep using 300s.
+ But I prefer UDP and TCP to behave as similarly as possible.
+ Use TRex tunables to get the exact frame size (for data packets).
- It is not clear why the recipe for MSS has to be this complicated.
+ Move code away from profile init, as frame size is not known there.
+ Change internal profile API, so values related to MSS are passed.
+ Lower ramp-up rate for TCP TPUT tests.
+ Because without lower rate, jumbo fails on packet loss in ramp-up.
+ UDP TPUT ramp-up rate also lowered (just to keep suites more similar).
+ Distinguish one-direction and aggregated average frame size.
+ Update keyword documentation where the distiction matters.
+ One-direction is needed for turning bandwidth limit to TPS limit.
+ Aggregated is needed for correct NDRPDR bandwidth result value.
- TCP TPUT will always be few percent below bidirectional maximum.
+ That is unavoidable, as one direction sends more control packets.
+ Add runtime consistency checks so future refactors are safer.
+ Fail if padding requested would be negative.
+ Fail if suite claims unexpected values for packets per transaction.
+ Edit the 4 types of ASTF profiles to keep them similar to each other.
+ Move UDP TPUT limit value from a field back to direct argument.
+ Stop pretending first UDP packet is not data.
+ Apply small improvements where convenient.
+ Replace "aggregate" with "aggregated" where possible.
+ To lower probability of any future typos in variable names.
+ Avoid calling Set Numeric Frame Sizes twice.
+ Code formatting, keyword documentation, code comments, ...
+ Add TODOs for less important code quality improvements.
- Postpone updating of methodology pages to a subsequent change.
Change-Id: I4b381e5210e69669f972326202fdcc5a2c9c923b
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'GPL/traffic_profiles/trex/profile_trex_astf_base_class.py')
-rw-r--r-- | GPL/traffic_profiles/trex/profile_trex_astf_base_class.py | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py b/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py index e36e52c2c1..cb8fd763e6 100644 --- a/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py +++ b/GPL/traffic_profiles/trex/profile_trex_astf_base_class.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Cisco and/or its affiliates. +# Copyright (c) 2022 Cisco and/or its affiliates. # # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # @@ -46,13 +46,9 @@ class TrafficProfileBaseClass: ] } - def __init__(self): - # Default values of required parameters; can be overwritten in - # "get_profile" method. - self.framesize = 64 - self._pcap_dir = u"" - - # If needed, add your own parameters. + # TODO: Declare and document fields in a contructor to make pylint happier. + # TODO: Consider passing the values to define_profile(), + # instead of keeping (and documenting) them as instance fields here. @property def pcap_dir(self): @@ -72,7 +68,7 @@ class TrafficProfileBaseClass: :param current_length: Current length of the packet. :param required_length: Required length of the packet. If set to 0 then - self.framesize value is used. + self.framesize value is used. :type current_length: int :type required_length: int :returns: The generated padding. @@ -82,20 +78,25 @@ class TrafficProfileBaseClass: # use random.randrange(0, len(self.STREAM_TABLE[self.framesize])) ? if not required_length: required_length = self.framesize - - return str(choices(ascii_letters, k=required_length - current_length)) + missing = required_length - current_length + if missing < 0: + msg = f"Cannot to pad from {current_length} to {required_length}." + raise RuntimeError(msg) + padding = u"".join(choices(ascii_letters, k=missing)) + return padding def define_profile(self): """Define profile to be used by T-Rex astf traffic generator. This method MUST return: - return ip_gen, templates, cap_list + return ip_gen, templates, kwargs - templates or cap_list CAN be None. + templates or kwargs CAN be None. + Kwargs can be used to define PCAP file, set MSS, ... :returns: IP generator and profile templates or list of pcap files for - traffic generator. + traffic generator. :rtype: tuple """ raise NotImplementedError @@ -108,15 +109,14 @@ class TrafficProfileBaseClass: :returns: Traffic profile. :rtype: trex.astf.trex_astf_profile.ASTFProfile """ - ip_gen, templates, cap_list = self.define_profile() - - # In most cases you will not have to change the code below: + ip_gen, templates, kwargs = self.define_profile() + if kwargs is None: + kwargs = dict() - # profile profile = ASTFProfile( default_ip_gen=ip_gen, templates=templates, - cap_list=cap_list + **kwargs ) return profile @@ -127,11 +127,13 @@ class TrafficProfileBaseClass: If needed, add your own parameters. :param kwargs: Key-value pairs used by "create_profile" method while - creating the profile. + creating the profile. + :type kwargs: dict :returns: Traffic profile. :rtype: trex.astf.trex_astf_profile.ASTFProfile """ self.framesize = kwargs[u"framesize"] + self.n_data_frames = kwargs[u"n_data_frames"] self._pcap_dir = kwargs.get( u"pcap_dir", u"/opt/trex-core-2.88/scripts/avl" ) |