mirror of
https://github.com/rtbrick/bngblaster.git
synced 2024-05-06 15:54:57 +00:00
Fixed #7 VLAN Iterator
Now per default sessions are created by iteration over inner VLAN range first and outer VLAN second. Which can be changed by new configuration option `iterate-vlan-outer` to iterate on outer VLAN first and inner VLAN second.
This commit is contained in:
@@ -280,6 +280,20 @@ Attribute | Description | Default
|
||||
`max-outstanding` | Max outstanding sessions | 800
|
||||
`start-rate` | Setup request rate in sessions per second | 400
|
||||
`stop-rate` | Teardown request rate in sessions per second | 400
|
||||
`iterate-vlan-outer` | Iterate on outer VLAN first | false
|
||||
|
||||
Per default sessions are created by iteration over inner VLAN range first and outer VLAN second.
|
||||
Which can be changed by `iterate-vlan-outer` to iterate on outer VLAN first and inner VLAN second.
|
||||
|
||||
Therefore the following configuration generates the sessions on VLAN (outer:inner) 1:3, 1:4, 2:3, 2:4 per default or alternative 1:3, 2:3, 1:4, 2:4 with `iterate-vlan-outer` enabled.
|
||||
```json
|
||||
{
|
||||
"outer-vlan-min": 1,
|
||||
"outer-vlan-max": 2,
|
||||
"inner-vlan-min": 3,
|
||||
"inner-vlan-max": 4
|
||||
}
|
||||
```
|
||||
|
||||
## IPoE
|
||||
|
||||
|
||||
@@ -756,8 +756,8 @@ bbl_init_sessions (bbl_ctx_s *ctx)
|
||||
access_config = ctx->config.access_config;
|
||||
|
||||
/* For equal distribution of sessions over access configurations
|
||||
* and outer VLAN's, we loop first over all configurations,
|
||||
* second over all outer VLAN's and last over all inner VLAN's. */
|
||||
* and outer VLAN's, we loop first over all configurations and
|
||||
* second over VLAN ranges as per configration. */
|
||||
while(i <= ctx->config.sessions) {
|
||||
if(access_config->exhausted) goto Next;
|
||||
if(access_config->access_outer_vlan == 0) {
|
||||
@@ -765,15 +765,28 @@ bbl_init_sessions (bbl_ctx_s *ctx)
|
||||
access_config->access_outer_vlan = access_config->access_outer_vlan_min;
|
||||
access_config->access_inner_vlan = access_config->access_inner_vlan_min;
|
||||
} else {
|
||||
access_config->access_outer_vlan++;
|
||||
if(access_config->access_outer_vlan > access_config->access_outer_vlan_max) {
|
||||
access_config->access_outer_vlan = access_config->access_outer_vlan_min;
|
||||
if(access_config->access_inner_vlan <= access_config->access_inner_vlan_max) {
|
||||
if(ctx->config.iterate_outer_vlan) {
|
||||
/* Iterate over outer VLAN first and inner VLAN second */
|
||||
access_config->access_outer_vlan++;
|
||||
if(access_config->access_outer_vlan > access_config->access_outer_vlan_max) {
|
||||
access_config->access_outer_vlan = access_config->access_outer_vlan_min;
|
||||
access_config->access_inner_vlan++;
|
||||
}
|
||||
} else {
|
||||
/* Iterate over inner VLAN first and outer VLAN second (default) */
|
||||
access_config->access_inner_vlan++;
|
||||
if(access_config->access_inner_vlan > access_config->access_inner_vlan_max) {
|
||||
access_config->access_inner_vlan = access_config->access_inner_vlan_min;
|
||||
access_config->access_outer_vlan++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(access_config->access_inner_vlan > access_config->access_inner_vlan_max) {
|
||||
if(access_config->access_outer_vlan == 0) {
|
||||
/* This is required to handle untagged interafaces */
|
||||
access_config->exhausted = true;
|
||||
}
|
||||
if(access_config->access_outer_vlan > access_config->access_outer_vlan_max ||
|
||||
access_config->access_inner_vlan > access_config->access_inner_vlan_max) {
|
||||
/* VLAN range exhausted */
|
||||
access_config->exhausted = true;
|
||||
goto Next;
|
||||
|
||||
@@ -408,6 +408,7 @@ typedef struct bbl_ctx_
|
||||
uint32_t sessions_max_outstanding;
|
||||
uint16_t sessions_start_rate;
|
||||
uint16_t sessions_stop_rate;
|
||||
bool iterate_outer_vlan;
|
||||
|
||||
/* Static */
|
||||
uint32_t static_ip;
|
||||
|
||||
@@ -250,6 +250,10 @@ json_parse_config (json_t *root, bbl_ctx_s *ctx) {
|
||||
if (json_is_number(value)) {
|
||||
ctx->config.sessions_stop_rate = json_number_value(value);
|
||||
}
|
||||
value = json_object_get(section, "iterate-vlan-outer");
|
||||
if (json_is_boolean(value)) {
|
||||
ctx->config.iterate_outer_vlan = json_boolean_value(value);
|
||||
}
|
||||
}
|
||||
|
||||
/* IPoE Configuration */
|
||||
|
||||
Reference in New Issue
Block a user