Skip to content

Commit 6f8b76b

Browse files
committed
ft-orchestration pass cache-size from scenario config to probe
1 parent bbb742c commit 6f8b76b

5 files changed

Lines changed: 20 additions & 2 deletions

File tree

testing/simulation/one_packet_flows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ default:
2525
# individual tests for general simulation scenario
2626
sim_general:
2727
- id: one_packet_precise
28+
speed_multiplier: 1.0
2829
marks: [precise]
2930
analysis:
3031
model: "precise"
3132
use_statistic_counter: true
3233

3334
- id: one_packet_statistical
3435
marks: []
36+
mbps: 748
3537
analysis:
3638
model: "statistical"
3739
use_statistic_counter: true

tools/ft-orchestration/src/config/scenario.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class ProbeCfg(YAMLWizard):
4545
connectors: list[dict] = field(default_factory=list)
4646
active_timeout: Optional[int] = None
4747
inactive_timeout: Optional[int] = None
48+
cache_size: Optional[int] = None
4849

4950
def get_args(self, probe_type: str) -> dict:
5051
"""Get arguments which can be passed directly to the probe builder.
@@ -68,6 +69,8 @@ def get_args(self, probe_type: str) -> dict:
6869
ret["active_timeout"] = self.active_timeout
6970
if self.inactive_timeout:
7071
ret["inactive_timeout"] = self.inactive_timeout
72+
if self.cache_size:
73+
ret["cache_size"] = self.cache_size
7174
for connector in self.connectors:
7275
if connector.get("type", "") == probe_type:
7376
del connector["type"]

tools/ft-orchestration/src/probe/cento.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ def __init__(
118118
interfaces_names = [ifc.name for ifc in interfaces]
119119
self._interfaces = interfaces_names
120120
self._zero_copy = any(ifc.startswith("zc:") for ifc in self._interfaces)
121+
122+
if "max_hash_size" not in kwargs and cache_size:
123+
kwargs["hash_size"] = min(
124+
2**cache_size, kwargs.get("hash_size", float("inf"))
125+
)
126+
kwargs["max_hash_size"] = 2**cache_size
127+
121128
settings: CentoSettings = CentoSettings(
122129
interfaces=interfaces_names,
123130
verbose=verbose,

tools/ft-orchestration/src/probe/nprobe.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,12 @@ def __init__(
127127
interfaces_names = [ifc.name for ifc in interfaces]
128128
self._interfaces = interfaces_names
129129
self._zero_copy = any(ifc.startswith("zc:") for ifc in self._interfaces)
130+
131+
if "max_num_flows" not in kwargs and cache_size:
132+
kwargs["max_num_flows"] = 2**cache_size
133+
130134
settings: NProbeSettings = NProbeSettings(
131135
interface=interfaces_names[0],
132-
max_num_flows=2**cache_size if cache_size else None,
133136
**kwargs,
134137
)
135138
self._executor = executor

tools/ft-orchestration/src/probe/yaf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,12 @@ def __init__(
207207
kwargs["pcap"] = YafSettings.PCAPOptions(**(kwargs.get("pcap", {})))
208208
kwargs["tls"] = YafSettings.TLSOptions(**(kwargs.get("tls", {})))
209209
kwargs["log"] = YafSettings.LoggingOptions(**(kwargs.get("log", {})))
210+
211+
if "maxflows" not in kwargs and cache_size:
212+
kwargs["maxflows"] = 2**cache_size
213+
210214
self._settings = YafSettings(
211215
idle_timeout=inactive_timeout,
212-
maxflows=2**cache_size if cache_size else None,
213216
**kwargs,
214217
)
215218
self._executor = executor

0 commit comments

Comments
 (0)