mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
support stream rate in Kbps, Mbps and Gbps
This commit is contained in:
@ -1636,6 +1636,33 @@ json_parse_stream(json_t *stream, bbl_stream_config_s *stream_config)
|
||||
}
|
||||
stream_config->pps = bps / (stream_config->length * 8);
|
||||
}
|
||||
value = json_object_get(stream, "Kbps");
|
||||
if(value) {
|
||||
bps = json_number_value(value);
|
||||
if(!bps) {
|
||||
fprintf(stderr, "JSON config error: Invalid value for stream->Kbps\n");
|
||||
return false;
|
||||
}
|
||||
stream_config->pps = (bps*1000) / (stream_config->length * 8);
|
||||
}
|
||||
value = json_object_get(stream, "Mbps");
|
||||
if(value) {
|
||||
bps = json_number_value(value);
|
||||
if(!bps) {
|
||||
fprintf(stderr, "JSON config error: Invalid value for stream->Mbps\n");
|
||||
return false;
|
||||
}
|
||||
stream_config->pps = (bps*1000000) / (stream_config->length * 8);
|
||||
}
|
||||
value = json_object_get(stream, "Gbps");
|
||||
if(value) {
|
||||
bps = json_number_value(value);
|
||||
if(!bps) {
|
||||
fprintf(stderr, "JSON config error: Invalid value for stream->Gbps\n");
|
||||
return false;
|
||||
}
|
||||
stream_config->pps = (bps*1000000000) / (stream_config->length * 8);
|
||||
}
|
||||
}
|
||||
if(!stream_config->pps) stream_config->pps = 1;
|
||||
|
||||
|
@ -109,7 +109,11 @@ and inner IPv4 header.
|
||||
|
||||
The ``pps`` option supports also float numbers like 0.1, or 2.5 PPS and has
|
||||
priority over ``bps`` where the second is only a helper to calculate the ``pps``
|
||||
based on given ``bps`` and ``length``.
|
||||
based on given ``bps`` and ``length``. The resulting rate in ``bps`` is the
|
||||
layer 3 rate because ``length`` is also the layer 3 length (IP header + payload).
|
||||
It is also supported to put the capital letters ``K`` (Kilo), ``M`` (Mega)
|
||||
or ``G`` (Giga) in front of ``bps`` for better readability.
|
||||
For example ``"Gbps": 1`` which is equal to ``"bps": 1000000000``.
|
||||
|
||||
The options ``access-ipv4-source-address`` and ``access-ipv6-source-address``
|
||||
can be used to test the BNG RPF functionality with traffic sent from source addresses
|
||||
|
Reference in New Issue
Block a user