> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/upg/3.2/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/components/upg/3.2/releases/2.3.0.md).

# User Plane Gateway 2.3.0

The new release of User Plane Gateway (UPG) provides the following features and improvements:

- New logging of NAT-related events was introduced
- New NAT-related metrics were added
- PFCP Session Report Request rate limiter for new sessions only
- NAT port range was extended
- NAT flow timeout is now configurable
- `nat.maxsessions` renamed to `nat.maxNatFlows`
- Usage Report for removed URR is triggered

UPG Manager uses FPP Manager in version `1.3.0` and UPG VPP in version `1.7.0`.
To see UPG's key performance indicators (KPIs), go to the [Performance document](https://docs.cennso.com/components/upg/3.2/performance.md).

There are no breaking changes in UPG CRD between 2.2.0 and 2.3.0.

## Features

### New NAT-related metrics

New NAT metrics were introduced for better observability of the VPP NAT mechanism:

- `vpp_nat_max_flows_exceeded` - indicates that NAT translation cannot be created because the maximum number of port allocations is reached
- `vpp_nat_out_of_ports` - indicates that NAT translation cannot be created because of the port allocation failure

These metrics are exposed as error counters. Each occurrence of NAT port allocation issue increases the counter. When the VPP NAT
plugin cannot make a translation, traffic is not forwarded. You can find more details about the failures in the UPG logs.

What's more, NAT flows metrics per UPG were introduced:

- `vpp_nat_flow_count` - currently used NAT flows
- `vpp_max_nat_flows` - maximum NAT flows allocated at startup

All the above metrics are added to the **UPG Overview** dashboard in the `NAT info` section.

### New logging of NAT-related events

UPG 2.3.0 brings a new event log entry that appears when the NAT plugin cannot allocate a port for existing binding to make a translation.
Also, an event is logged when the NAT flow table is full and there is no possibility to create a new NAT translation. These logs are rate
limited to 1 per second.

See the logs example:

```
/usr/bin/vpp[17]: nat: maximum sessions exceeded
/usr/bin/vpp[17]: nat: Out of ports for binding 198.19.8.1:1024-1028
```

### PFCP Session Report Request rate limiter for new sessions only

The feature of rate limiting the PFCP Session Report Request was introduced in UPG v2.0.0 to control the number of new sessions
that can be created in the TDF mode. However, PFCP Session Report Request is performed for all sessions that are present on the UPG instance.
That's why the initial implementation limited not only new session creation but also reporting for existing sessions.

In UPG v2.3.0, we introduced enhancement for this feature to rate limit only new sessions. PFCP rate limiter is applied only for newly
created sessions, when reporting trigger is `StartOfTraffic` and user equipment's IP is present in PFCP Session Report Request.

### NAT port range was extended

Up to UPG v2.2.0, the CG-NAT plugin allocated NAT ports from `10128` to `64000` per external IP.
To extend the number of available NAT translations, the port range was extended to `1024-65535`.

You can configure this number in the UPG chart, for example:

```yaml
nat:
...
  # -- Minimal port for NAT translation
  minNatPort: 1024
  # -- Maximal port for NAT translation
  maxNatPort: 65535
```

### NAT flow timeout is now configurable

The new configuration option to set NAT flows timeout for different protocols was added in UPG v2.3.0.
In the previous UPG versions, the default, hardcoded values were used. In the new UPG chart, you can configure these values:

```yaml
nat:
...
  timeouts:
    # -- ICMP NAT flow timeout, in seconds
    icmp: 60
    # -- TCP established NAT flow timeout, in seconds
    tcpEstablished: 7440
    # -- TCP transitory NAT flow timeout, in seconds
    tcpTransitory: 240
    # -- UDP NAT flow timeout, in seconds
    udp: 300
```

### `nat.maxsessions` renamed to `nat.maxNatFlows`

For better alignment between UPG terminology, in UPG v2.3.0 the `maxsessions` parameter was renamed to `maxNatFlows`. 
This VPP NAT session term is closer to the UPF flow concept. The support for the old setting is now removed. 
By default, `maxNatFlows` has the same default value (`1M`), which allows for handling a large number of UPF sessions and flows.

You can change the default value using this configuration option:

```yaml
nat:
...
  # -- Maximum number of NAT flows
  maxNatFlows: 1000000
```

## Fixes

### Trigger a Usage Report for the removed URR

In previous releases, the Usage Report was missing after Usage Reporting Rule (URR) was deleted.
In UPG 2.3.0, if the PFCP Session Modification Request calls for URR deletion, 
UPG includes the Usage Report in PFCP Session Modification Response or in a separate Session Usage Report.

## Known issues

### PFCP encoder crash due to heap corruption

In some rare cases, UPG crashes while sending PFCP Association Setup Response for the SMC request to establish an association. It happens during the encoding of the User Equipment `IP Address Pool` IE, and the problem is likely caused by heap corruption in the UPG VPP PFCP encoder code.

## Migration guide

### 2.2.0 -> 2.3.0

> **Warning**
>
> Updating the UPG Helm chart will restart the currently running UPG instance causing all active sessions to be dropped.

> **Warning**
>
> UPG 2.3.0 requires FPP CRD in version 1.2.0 or higher installed on the Kubernetes cluster.

> **Warning**
>
> In the UPG 2.3.0 chart, the `nat.maxsessions` parameter was renamed to `nat.maxNatflows`. Therefore, the `maxsessions` parameter is no longer supported.
> `maxNatflows` is by default set to `1M`, which should be sufficient for large deployments.

Follow these steps to upgrade UPG to version 2.3.0:

1. Install the `upg-crd` Helm chart in version 2.3.0.
1. Ensure that the FPP CRD in version 1.2.0 or higher is installed on the Kubernetes cluster.
1. Remove the `upg-support` Helm chart in version 2.2.0. This also removes the `UPG Overview` Grafana dashboard.
1. Install the `upg-support` Helm chart in version 2.3.0 with the enabled dashboard.
1. If you use UPG in the TDF mode, configure `nat.maxNatFlows` using the same value as in the old `nat.maxsessions`
  configuration option.
1. Install the `upg` Helm chart in version 2.3.0.
