> For the complete documentation index, see [llms.txt](https://docs.cennso.com/test-tools/tpload/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/test-tools/tpload/latest/configuration/cp-emulated-endpoints.md).

# Control Plane configuration

You can configure TPLoad Core to work as a simulator for:

* SGW-c and SGW-u with GTPv2 and GTP-u
* Travelping Open Subscriber Server (TPOSS), as a server for Radius Accounting, Diameter NASREQ, Gx, and Gy
* Package Gateway (PGW) and Service Control Gateway (SCG), as a client for Radius Accounting, Diameter NASREQ, Gx, and Gy
* PGW alone, as a Radius client for TPOSS, with plain IP traffic from the framed IP address
* Session Management Controller (SMC), GTP Proxy, and TDF on the `Sx` interface
* Mobility Management Entity (MME), as an `S6a` Diameter client for testing an HSS
TPLoad can also work in plain mode without the Control Plane session management.

## Core section configuration

The **core** section contains the **session_management** selector and a set of global Control Plane rate settings:

| Parameter | Default | Description |
|:---|:---|:---|
| session_management | `""` | Control plane management type selection. The possible values are: `sgw`, `plain`, `nasreq`, `pfcp`, `lgw-cp`, `pgw-radius`, and `hss`. |
| autorun_test | `""` | Name of the test that starts after TPLoad launching. If omitted, TPLoad asks for test. |
| create_retry_limit | `5` | Number of attemtps to create all sessions TPLoad undertakes during the test initialization |
| cleanup_retry_limit | `5` | Number of attemtps to delete all sessions TPLoad undertakes during the test finalization |
| default_rate_limits.create | `0` | Rate limit for `create` session requests. The default rate limits are used when rate limits are not defined for a specific test. |
| default_rate_limits.delete | `0` | Rate limit for `delete` session requests. The default rate limits are used when rate limits are not defined for a specific test. |
| default_rate_limits.other | `0` | Rate limit for requests other than `create` and `delete`. The default rate limits are used when rate limits are not defined for a specific test. |
| http_server_listen_address | `0.0.0.0:8900` | Address on which TPLoad API server listens |
| provision_duration | `10s` | Time period that TPLoad waits for the new Generators |

See the example of the **core** section configuration:

```yaml
core:
  session_management: sgw 
  autorun_test: steady
  create_retry_limit: 5
  cleanup_retry_limit: 5
  default_rate_limits:
    create: 100
    delete: 100
    other: 100

  http_server_listen_address: 0.0.0.0:8900
  provision_duration: 3s
```

## Device generators configuration

TPLoad configuration should contain a section with device generator parameters.

For cases when the IP address is assigned by an external system, the configuration should have the definition for **imsi**, **mei** and **msisdn**. Each parameter has two options: `first` and `step`. The test assigns values starting from `first` and increasing by `step`.

For cases when TPLoad should assign the IP address by itself, there is the **ipv4** parameter. It is defined by an IP range (from `first` to `last`) and the **pseudorandom** parameter. When **pseudorandom** is set to `false`, the addresses are assigned sequentially. If set to `true`, the addresses are assigned randomly from the range.

See the example of the **device_generator** section configuration:

```yaml
device_generator:
  imsi:   { first: "262016000000000",  step: 1  }
  mei:    { first: "2222222200000000", step: 10 }
  msisdn: { first: "33333300000000",   step: 1  }
  ipv4:   { first: "10.0.0.1", last: "10.63.255.254", pseudorandom: true }
```

## SGW simulation configuration

To configure SGW, set the `sgw` as a value for **core.session_management**. In the **servers.sgw** section, the following parameters are available:

| Parameter | Default | Description |
|:---|:---|:---|
| listen_address | `""` | Local address of the interface on which TPLoad Core listens. A range, such as `198.18.0.1~198.18.0.2`, creates one SGW endpoint per address. |
| pgw_address | `""` | Address of PGW for connection. A range, such as `198.18.0.11~198.18.0.12`, assigns the PGWs to the SGW endpoints round-robin. **listen_address** needs at least as many addresses as there are PGWs. With fewer SGW endpoints than PGWs, TPLoad logs a warning and leaves the extra PGWs unused. |
| ping_interval | `15s` | Interval for GTP echos |
| apn | `""` | Access Point name |
| mcc | `""` | MCC for connection |
| mnc | `""` | MNC for connection |

See the example of the SGW simulation configuration:

```yaml
servers:
  sgw:
    listen_address: 198.18.0.1
    pgw_address: 198.18.0.11
    ping_interval: 15s
    apn: "test.apn.net"
    mcc: "262"
    mnc: "79"
```

## PGW and SCG-C simulation configuration

To configure Radius and Diameter clients to test TPOSS, use the `lgw-cp` value for **core.session_management**. In **servers**, the **lgw-cp** section is responsible for the Control Plane configuration.

| Parameter | Default | Description |
|:---|:---|:---|
| user_name | `""` | Username for Radius Accounting |
| nas_id | `""` | NAS ID for Radius Accounting |
| apn | `""` | Access Point name |
| fake_nas_address | `""` | Value to put in AVPs in requests |
| fake_sgsn_address | `""` | Value to put in AVPs in requests |
| fake_ggsn_address | `""` | Value to put in AVPs in requests |
| plnm.mcc | `""` | MCC for connection |
| plnm.mnc | `""` | MNC for connection |
| radius.coa_listen_address | `""` | Address on which Radius listens for COA requests |
| radius.auth_remote_address | `""` | Address of the Radius Authorization client |
| radius.acct_remote_address | `""` | Address of the Radius Accounting client |
| radius.secret | `""` | Radius secret |
| diameter.local_address | `""` | Local Diameter server address |
| diameter.remote_address | `""` | Remote Diameter client address |
| diameter.origin_host | `""` | Origin host for a Diameter server |
| diameter.origin_realm | `""` | Origin realm for a Diameter server |
| diameter.destination_realm | `""` | Diameter client destination realm |
| rating_groups.online | `{}` | Map with the `name:rating_group` mapping |
| options.keep_network_sessions | `false` | If set to `true`, the network sessions will not be removed by TPLoad when possible |
| options.generate_traffic | `false` | If set to `true`, TPLoad generates plain IP traffic for each created session, from its framed IP address. Traffic starts when the session is created and stops when its deletion starts. Requires the `traffic_generators` section. |
| options.radius-acct-interim_interval | `"1800s"` | Duration between radius interim requests |
| options.service_sessions_proportion | `1` | If set to `0`, the Diameter connection is not created. If set to `50%` (or `0.5`), only half of the session will create Diameter sessions. |
| options.skip_radius-acct-interim | `false` | If set to `true`, TPLoad does not send a corresponding request |
| options.skip_gy-cc-interim | `false` | If set to `true`, TPLoad does not send a corresponding request |
| options.skip_nasreq-accounting-stop | `false` | If set to `true`, TPLoad does not send a corresponding request |
| options.skip_nasreq-session-termination | `false` | If set to `true`, TPLoad does not send a corresponding request |

See the example of the Radius and Diameter client configuration:

```yaml
servers:
  lgw-cp:
    user_name: "proxy"
    nas_id: "test.nas.cennso.net"
    apn: "test.apn.cennso.net"
    fake_nas_address: 172.22.0.1
    fake_sgsn_address: 172.22.0.1
    fake_ggsn_address: 172.22.0.1
    plnm:
      mcc: "262"
      mnc: "01"
    radius:
      coa_listen_address: 172.22.0.1:3799
      auth_remote_address: 172.22.0.100:1812
      acct_remote_address: 172.22.0.100:1813
      secret: "secret"
    diameter:
      local_address: 172.22.0.1:0
      remote_address: "172.22.0.100:3868"
      origin_host: test.diam.cennso.net
      origin_realm: diam.cennso.net
      destination_realm: tpip.net
    rating_groups:
      online:
        "Online": 3220
        "Portal": 3221
        "FactoryTest": 2100
        "UnlimitedStreaming": 3000
        "UnlimitedStreamingPD": 3100
        "OnlineRedirection": 3224
```

## PGW simulation configuration

Use this mode when SCG-C and SCG-U handle Diameter with TPOSS and TPLoad replaces only the PGW. To use it, set the **core.session_management** to `pgw-radius`. TPLoad does not open a Diameter connection in this mode.

For each session, TPLoad sends a Radius Access-Request and takes the framed IP address from the Access-Accept. Then it sends an Accounting-Start request. The session is created only after the Accounting-Response arrives. Because of this, traffic does not reach SCG-U before TPOSS has the framed IP address. With `options.generate_traffic`, TPLoad then sends plain IP traffic from that address. While the session exists, TPLoad sends interim accounting requests. On deletion, it sends an Accounting-Stop request. When TPLoad receives a Disconnect-Request for a session, it deletes the session.

With `apn_mode: hybrid`, TPLoad does not send an Access-Request. It takes the framed IP address from **device_generator.ipv4** and reports it to TPOSS in the Accounting-Start request. TPOSS then creates the session from accounting. With `apn_mode: dual`, which is the default, TPOSS assigns the framed IP address in the Access-Accept.

The mode reads its configuration from the **lgw-cp** section in **servers**. It uses these parameters from the PGW and SCG-C simulation configuration table: `user_name`, `nas_id`, `apn`, `apn_mode`, `fake_nas_address`, `fake_sgsn_address`, `fake_ggsn_address`, `plmn`, `radius`, `options.generate_traffic`, `options.radius-acct-interim_interval`, and `options.skip_radius-acct-interim`. It ignores the other parameters.

See the example of the PGW simulation configuration:

```yaml
core:
  session_management: pgw-radius

servers:
  lgw-cp:
    options:
      generate_traffic: true
      radius-acct-interim_interval: 300s
    user_name: "proxy"
    nas_id: "test.nas.cennso.net"
    apn: "test.apn.cennso.net"
    fake_nas_address: 172.22.0.1
    fake_sgsn_address: 172.22.0.1
    fake_ggsn_address: 172.22.0.1
    plmn:
      mcc: "262"
      mnc: "01"
    radius:
      coa_listen_address: 172.22.0.1:3799
      auth_remote_address: 172.22.0.100:1812
      acct_remote_address: 172.22.0.100:1813
      secret: "secret"
```

## TPOSS simulation configuration

This mode is designed to replace TPOSS with TPLoad to test SCG individually. To use this option, set the **core.session_management** to `nasreq`.

| Parameter | Default | Description |
|:---|:---|:---|
| listen_address | `""` | Local address of the interface on which TPLoad Core listens |
| host | `""` | TPLoad origin host for Diameter responses |
| realm | `""` | TPLoad origin realm for Diameter responses |
| nat_pool_ids | `[]` | List of the NAT pool IDs configured on SCG. Leave empty for no NAT configuration. |
| cc_time | `0` | Credit Control time quota |
| cc_total_octets | `0` | Credit Control volume quota |
| cc_validity_time | `0` | Credit Control quota validity time|

See the example of the TPOSS simulation configuration:

```yaml
servers:
  nasreq:
    listen_address: 198.18.0.1:3868
    host: tpload.test.cennso.net
    realm: test.cennso.net
    nat_pool_ids: ['pool-de']
    cc_time: 3600
    cc_total_octets: 104857600
    cc_validity_time: 7200
```

## SMC Sx simulation configuration

This mode is required for testing UPG individually, without any other components. To use it, set the **core.session_management** to `pfcp`.

| Parameter | Default | Description |
|:---|:---|:---|
| mode | `""` | UPG mode. The possible values are `ip-ip` for TDF/CG-NAT, `gtp-ip` for UPG, and `gtp-gtp` for proxy. |
| control.listen_address | `""` | Local address of the interface on which TPLoad Core listens. Acts like the SMC address. |
| control.node_fqdn | `""` | Fully qualified domain name (FQDN) of the SMC node to simulate |
| control.up_function_address | `""` | UPG Sx address |
| control.response_delay | `0s` | Simulated delay for request handling |
| interfaces.left.up_function_address | `""` | Left UPG interface address |
| interfaces.left.network | `""` | Left UPG interface NWI name |
| interfaces.left.teid_allocation_up | `false` | Enables F-TEID allocation for the left interface |
| interfaces.right.up_function_address | `""` | Right UPG interface address |
| interfaces.right.network | `""` | Right UPG interface NWI name |
| interfaces.right.teid_allocation_up | `false` | Enables F-TEID allocation for the right interface |
| interfaces.right.nat_pools | `{}` | Enables NAT pool selection on session creation. Replaces `network` NWI name with a random selection of NAT pool names and mapped NWI names. Should be provided as a mapping of NAT pool names to NWI names. |
| usage_reporting | {} | This section is deprecated in favor of `advanced` and will be removed in future versions |
| usage_reporting.enabled | `false` | Enables URR for a session, overwrites the `advanced` configuration, if enabled |
| usage_reporting.time_quota | `0` | Time quota for URR, disabled if `0` |
| usage_reporting.time_threshold | `0` | Time threshold for URR, disabled if `0` |
| usage_reporting.volume_quota | `0` | Volume quota for URR, disabled if `0` |
| usage_reporting.volume_threshold | `0` | Volume threshold for URR, disabled if `0` |
| advanced | `{}` | Configuration for pfcp messages fields, empty or zero values mean that this field is not used |
| advanced.urrs | `{}` | Dictionary of URRs to control. URRs recreated on Session Report Request, if received Usage Report Trigger, is one of: VOLTH, TIMTH, QUHTI, VOLQU, TIMQU, MONIT, EVETH, EVEQU, QUVTI, UPINT |
| advanced.urrs.$name.linked_urr | `""` | Name of linked URR from the configuration. The `$name` variable can be any string value and should be configured by the user. |
| advanced.urrs.$name.measurement_method | `[]` | List of measurement period bits. Possible values: DURAT, VOLUM, EVENT. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.measurement_period | `0s` | Measurement time random range time duration. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.reporting_triggers | `[]` | List of reporting triggers bits. Possible values: PERIO, VOLTH, TIMTH, QUHTI, START, STOPT, DROTH, LIUSA, VOLQU, TIMQU, ENVCL, MACAR, EVETH, EVEQU, IPMJL, QUVTI. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.monitoring_time | `{}` | Monitoring time configuration, should be represented by one of `exact` or `relative` fields. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.monitoring_time.exact | `0h0m0s` | Monitoring time as random range time duration relative to 00:00:00 of the current day. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.monitoring_time.relative | `0s` | Monitoring time as random range time duration relative to URR creation time. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.time_quota | `0s` | Time quota as random range time duration. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.time_threshold | `0s` | Time threshold as random range time duration.`$name` variable could be any string value and should be configured by user |
| advanced.urrs.$name.volume_quota.total_volume | `0` | Total volume quota bytes. `$name` variable could be any string value and should be configured by the user. |
| advanced.urrs.$name.volume_threshold.total_volume | `0s` | Total volume threshold bytes. `$name` variable could be any string value and should be configured by the user. |
| advanced.fars | `{}` | Dictionary of FARs to apply on session creation |
| advanced.fars.$name.apply_action | `[]` | List of apply action bits. Possible values: DROP, FORW, BUFF, NOCP, DUPL, IPMA, IPMD, DFRT. `$name` variable could be any string value and should be configured by the user. |
| advanced.fars.$name.forwarding_parameters.destination | `""` | Destination interface to route traffic to. Should be `left` or `right`. `$name` variable could be any string value and should be configured by the user. |
| advanced.pdrs | `{}` | Dictionary of PDRs to apply on session creation. `$name` variable could be any string value and should be configured by the user. |
| advanced.pdrs.$name.far | `""` | Name of FAR from configuration to use for traffic forwarding. `$name` variable could be any string value and should be configured by the user. |
| advanced.pdrs.$name.pdi.source | `""` | Source interface to match traffic on. Should be `left` or `right`. `$name` variable could be any string value and should be configured by the user. |
| advanced.pdrs.$name.pdi.application_id | `""` | Application id name to match traffic with, should be preconfigured on UP side. `$name` variable could be any string value and should be configured by the user. |
| advanced.pdrs.$name.precedence | `0` | Precedence field of PDR. `$name` variable could be any string value and should be configured by the user. |
| advanced.pdrs.$name.urrs | `[]` | Names of URRs from configuration to use with this PDR. `$name` variable could be any string value and should be configured by the user. |

See the example of the SMC Sx simulation configuration:

```yaml
servers:
  pfcp:
    mode: ip-ip
    control:
      listen_address: 198.18.0.1
      node_fqdn: tpload.epc.mnc001.mcc001.3gppnetwork.org
      up_function_address: 198.18.0.21
    interfaces:
      left:
        up_function_address: 198.18.1.21
        network: left.nwi.upf
        teid_allocation_up: false
      right:
        up_function_address: 198.18.2.21
        teid_allocation_up: true
        nat_pools:
          poool-test1: right.nwi.upf
          poool-test2: right.nwi.upf
          poool-test3: de.nwi.upf
advanced:
  urrs:
    urr-small:
      measurement_method: [VOLUM, DURAT]
      measurement_period: 1800s
      reporting_triggers: [PERIO]
    urr-big:
      measurement_method: [VOLUM, DURAT]
      monitoring_time: {relative: "5m~20m"}
      quota_validity_time: 30m~50m
      reporting_triggers: [TIMTH, VOLTH, QUVTI, TIMQU, VOLQU]
      time_quota: 1h~1h30m
      time_threshold: 30m~40m
      volume_quota:
        total_volume: 500000000
      volume_threshold:
        total_volume: 471859200
    urr-mt:
      linked_urr: urr-big
      measurement_method: [VOLUM, DURAT]
      monitoring_time: {exact: "22h00m00s"}
      reporting_triggers: [LIUSA]
  fars:
    far-to-right:
      apply_action: [FORW]
      forwarding_parameters:
        destination: right
    far-to-left:
      apply_action: [FORW]
      forwarding_parameters:
        destination: left
  pdrs:
    pdr-download:
      far: far-to-left
      pdi:
        source: right
      precedence: 100
      urrs: [urr-small, urr-big, urr-mt]
    pdr-upload:
      far: far-to-right
      pdi:
        source: left
        application_id: "r-0001"
      precedence: 10
      urrs: [urr-small, urr-big, urr-mt]
```

## HSS load generation configuration

This mode is designed to load test an HSS server. TPLoad acts as the MME side of the `S6a` Diameter interface. To use it, set the **core.session_management** to `hss`.

Session creation sends an Authentication-Information-Request (AIR) followed by an Update-Location-Request (ULR). Session deletion sends a Purge-UE-Request (PUR). No user plane traffic is generated in this mode.

Peer-initiated Cancel-Location-Requests (CLR) are always answered with success. If the affected device has an established session, TPLoad additionally starts a regular deletion cycle for it, which includes sending a PUR unless **servers.hss.options.skip_purge** is set to `true`. A CLR that arrives while the device session is being created or deleted, or that refers to an IMSI outside of the **device_generator.imsi** range, has no further effect.

The subscriber identities are taken from the **device_generator.imsi** range. The subscribers must be provisioned on the HSS beforehand, otherwise every request fails with the `DIAMETER_ERROR_USER_UNKNOWN` error in the `Result-Code` AVP.

To run a test with a multiple HSS instances, you should specifiy HSS nodes in the **servers.hss.diameter.remote_addresses** configuration option. For example:

```yaml
servers:
  hss:
    diameter:
      network: sctp
      remote_addresses:
        - tposs-hss.cennso.svc.cluster.local:3868
```

TPLoad opens one Diameter connection per node and spreads outgoing requests over them round-robin, so consecutive procedures of one subscriber land on different nodes. This requires every node to serve any request, which holds when they share subscriber state. Since a hostname contributes one node per resolved address, a single Kubernetes headless service name covers every pod behind it.

> [!NOTE]
> The test becomes ready once all nodes have completed the Diameter capabilities exchange. If a node drops afterwards, the load continues on the remaining ones. TPLoad does not reconnect to it, so it stays out for the rest of the run.

The following table provides the information about the configurable parameters:

| Parameter | Required | Default | Description |
|:---|:---|:---|:---|
| servers.hss.diameter.network | optional | `tcp` | Transport for the Diameter connection. The possible values are: `tcp` and `sctp`. |
| servers.hss.diameter.remote_address | required | `""` | HSS Diameter address to connect to. Mutually exclusive with **remote_addresses**. |
| servers.hss.diameter.remote_addresses | optional | `[]` | Several HSS nodes to spread the load over, as `host:port` entries. A host that resolves to more than one address contributes one node per address. Mutually exclusive with **remote_address**. |
| servers.hss.diameter.local_address | optional | `""` | Local Diameter client address. If empty, the local address and port are chosen by the OS. |
| servers.hss.diameter.origin_host | required | `""` | Origin host for the Diameter client |
| servers.hss.diameter.origin_realm | required | `""` | Origin realm for the Diameter client |
| servers.hss.diameter.destination_realm | required | `""` | HSS destination realm |
| servers.hss.diameter.destination_host | optional | `""` | HSS destination host. If empty, the Destination-Host AVP is omitted and realm-based routing applies. Cannot be combined with several nodes, because it would pin every request to one of them. |
| servers.hss.plmn.mcc | required | `""` | MCC used for the Visited-PLMN-Id AVP. Must be 3 digits. |
| servers.hss.plmn.mnc | required | `""` | MNC used for the Visited-PLMN-Id AVP. Must be 2 or 3 digits. |
| servers.hss.options.skip_purge | optional | `false` | If set to `true`, session deletion is local only and no PUR is sent |

See the example of the HSS load generation configuration:

```yaml
core:
  session_management: hss

device_generator:
  imsi: { first: "262016000000000", step: 1 }

servers:
  hss:
    diameter:
      network: tcp
      remote_address: 172.22.0.100:3868
      local_address: 172.22.0.1:0
      origin_host: tpload.mme.cennso.net
      origin_realm: mme.cennso.net
      destination_realm: epc.mnc001.mcc262.3gppnetwork.org
    plmn:
      mcc: "262"
      mnc: "01"
    options:
      skip_purge: false
```

## Plain

The plain mode is designed to load test using User Plane traffic only. Sessions are created and removed immediately. To use the plain mode, set the **core.session_management** parameter to `plain`. No additional configuration is required.
