> 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/use-cases/testing-scg.md).

# Test SCG

In the use case when TPLoad simulates SCG with CG-NAT, the test case consists of Session Management Controller (SMC), User Plane Gateway (UPG), and some possible connectivity components, or Diameter Proxy. In this case, TPLoad Core simulates TPOSS, acting as the Gx/Gy/NARESQ interface. TPLoad Generator simulates User Plane traffic.

The main features of the SCG case are:

- User traffic is not encapsulated in GTP. It is plain IP traffic.
- There is no specific SUT component that creates sessions.
- At the moment, when user traffic arrives at the Access interface the corresponding control function, TPLoad Core in our case should already know the session/ue ip address/configured nat pool.

To have SCG ready for benchmark testing, make sure that:

- There is a proper routing between TPLoad Core and SMC/DPR
- There is a proper routing between TPLoad Generator-left and the Access side of UPG
- There is a proper routing between TPLoad Generator-right and the SGi side of UPG

![TPLoad and generators scheme](https://docs.cennso.com/api/assets/test-tools/tpload/latest/assets/test-scg.svg "Test SCG scenario")

For this use case, SCG has the following configuration

| Component | Interface | Address |
|:---|:---|:---|
| SMC/SCG-C | ctrl | 172.21.0.16 |
| SMC/SCG-C | Sx | 172.20.0.16 |
| UPG/SCG-U/CG-NAT | Access | 198.18.0.1 |
| UPG/SCG-U/CG-NAT | Sx | 172.20.0.1 |
| UPG/SCG-U/CG-NAT | DN | 198.19.0.1 |

TPLoad has the following addresses:

| Component | Interface | Address | Gateway |
|:---|:---|:---|:---|
| TPLoad Core | ctrl | 172.21.0.128 | - |
| TPLoad Generator-left | Access | 198.18.0.129+ | 198.18.0.1 |
| TPLoad Generator-right | DN | 198.19.0.129+ | 198.19.0.1 |

## TPLoad configuration steps

Follow these steps to configure TPLoad so that it performs benchmark testing for SCG:

1. Configure the **core** and **servers** sections. In this use case, set **session management** to `nasreq`. Other parameters are not required. In **servers**, configure the `nasreq` instance.

    >**NOTE:** When using DPR, tpload-core realm must be properly configured there. `nat_pool_ids` must be the same as in UPG. If multiple instances are configured, a random one would respond.

    ```yaml
    core:
      session_management: nasreq

      autorun_test: default
      create_retry_limit: 5
      cleanup_retry_limit: 5
      default_rate_limits:
        create: 10
        delete: 10
        other: 10

      http_server_listen_address: 0.0.0.0:8900
      provision_duration: 120s

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

2. Set the desired UE IP range for **device_generator**.

    ```yaml
    device_generator:
      imsi:
        first: "001010100000000"
        step: 1
      mei:
        first: "2222900000000"
        step: 10
      msisdn:
        first: "444440000000"
        step: 1
      ipv4:
        first: "10.32.0.1"
        last: "10.63.255.254"
        pseudorandom: true
    ```

3. Use the `StabilityLoop` testing function for the purpose of this test case:

    ```yaml
    tests:
      - name: default
        function: StabilityLoop
        parameters:
          sessions_count: 275000
          sessions_loop_count: 250000
          test_duration: 12h
        load_left:
          speed: 1 mpps
          traffic_profile: imix
          burst_profile: minimal
        load_right:
          speed: 1 mpps
          traffic_profile: imix
          burst_profile: user_common
        rate_limits:
          create: 250
          delete: 250
    ```

4. Align network configuration with the overall network setup:

    ```yaml
    traffic_generators:
      options:
        match_right_to_left: false

      left:
        address: "198.18.0.129+"
        gateway: "198.18.0.1"
        queue_count: 1
        ring_size: 16384
        buffer_size: 2048

        tap_interface_name: macvtap-left
        tap_virtio: false

        scripts:
          init_script: |
            ip link set up ${tap_interface_name}
          cleanup_script: |
            ip link set down ${tap_interface_name}

      right:
        address: "198.19.0.129+"
        gateway: "198.19.0.1"
        incoming_network: "198.18.0.0/16"
        queue_count: 1
        ring_size: 16384
        buffer_size: 2048
        tap_interface_name: macvtap-right
        tap_virtio: false

        scripts:
          init_script: |
            ip link set up ${tap_interface_name}
          cleanup_script: |
            ip link set down ${tap_interface_name}

    traffic_profiles:
      - name: default
        size_from_range: { min: 50, max: 1500 }

      - name: imix
        weighted_selection_of_sizes:
        - { chance: 58, size: 40 }
        - { chance: 33, size: 576 }
        - { chance: 9,  size: 1400 }

    burst_profiles:
      - name: minimal
        count_from_range: { min: 1, max: 3 }

      - name: user_common
        weighted_selection_of_lengths:
          - { chance: 10, length: 1  }
          - { chance: 2,  length: 3  }
          - { chance: 1,  length: 5  }
          - { chance: 2,  length: 7  }
          - { chance: 5,  length: 10 }
    ```

5. After applying the configuration, the connectivity should work as expected.
