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

# NWI configuration

User Plane Gateway (UPG) Helm chart automatically creates Network Instances (NWIs). NWI is a logical representation of a network interface that connects UPG to various networks (like Access, Control, and Data Networks). Based on the `values.yaml` configuration and the `upgconfig.yaml` template from the UPG chart, Helm creates the [UPGConfig](https://docs.cennso.com/components/upg/2.17/crs.md#upgconfig) Custom Resource (CR). UPG then creates NWIs based on this CR.

You can configure the Helm chart to create NWIs in two ways:

- Set the **type** parameter to `pgw` or `tdf` to use preconfigured values for these use cases (PGW or TDF).
- Configure the **nwis** section to manually specify NWI names and types.

After applying the configuration, you can verify the NWI setup either on your Kubernetes cluster or by using the VPP CLI. Run the following command:

```bash
vppctl sh upf nwi
```

This is the output example that shows the NWI setup:

```
epc, ip4-table-id 100, ip6-table-id 100, ipfix-policy none, ipfix-collector-ip 0.0.0.0
sgi, ip4-table-id 200, ip6-table-id 200, ipfix-policy none, ipfix-collector-ip 0.0.0.0
cp, ip4-table-id 0, ip6-table-id 0, ipfix-policy none, ipfix-collector-ip 0.0.0.0
```

## Use case examples

You can configure the UPG Helm chart to create NWIs for these use cases:

- Packet Gateway (PGW)
- Traffic Detection Function (TDF)
- GTP Proxy

### PGW

You can create NWIs for the PGW use case by setting the **type** value to `pgw`. In this case, these default NWIs are created:

- `epc`
- `cp`
- `sgi`

You can also configure these NWIs by manually setting the name and type of NWI in the **nwis** section:

```yaml
nwis:
  access:
    name: epc     # The Access Network NWI name. Use `epc` for PGW mode or `access` for TDF mode.
    type: gtpu    # The Access Network NWI type. Use `gtpu` for PGW mode or `tdf` for TDF mode.
  control:
    name: cp      # The Control Network NWI name. Use `cp` for all modes.
    type: gtpu    # The Control Network NWI type. Always use `gtpu` for all modes.
  data:
    name: sgi     # The Data Network NWI name. Use `sgi` for PGW mode. Not used in TDF mode.
    type: ip      # The Data Network NWI type. Use `ip` for PGW mode. Not used in TDF mode.
```

This configuration results in the following UPGConfig CR:

```yaml
apiVersion: upg-manager.cennso.com/v1alpha1
kind: UPGConfig
metadata:
  labels:
    fpp-manager.cennso.com/plumbing-instance: upg-fpp-inst01
  name: upg-fpp-inst01
  namespace: upg-fpp
spec:
  nwis:
  - ipv4TableID: 0
    ipv6TableID: 0
    name: cp
  - ipv4TableID: 100
    ipv6TableID: 100
    name: epc
  - ipv4TableID: 200
    ipv6TableID: 200
    name: sgi
```

### TDF

To create NWIs for the TDF use case, set the **type** parameter to `tdf`. For the TDF use case, these default NWIs are created:

- `access`
- `cp`
- multiple `sgi`s (one for each destination NAT pool)

>**CAUTION:** Do not use the **nwis** section to configure NWIs manually.

Data Networks are configured one per NAT pool, based on `instances.nat.pools` . If `nat.enabled: true` and `nat.type: cgnat` are configured, the chart also adds an `sgi` NWI.

See the NWI configuration example for TDF-U:

```yaml
nwis:
  access:
    name: access
    type: tdf

nat:
  enabled: true
  type: cgnat
instances:
  inst01:
    networking:
      (...)
    nat:
      pools:
        pool-de:
          networking:
            interface: de1
        (...)
        pool-at:
          networking:
            interface: at1
        (...)
```

This configuration results in the following UPGConfig CR:

```yaml
apiVersion: upg-manager.cennso.com/v1alpha1
kind: UPGConfig
metadata:
  labels:
    fpp-manager.cennso.com/plumbing-instance: upg-fpp-inst01
  name: upg-fpp-inst01
  namespace: upg-fpp
spec:
  nwis:
  - ipv4TableID: 0
    ipv6TableID: 0
    name: cp
  - ipv4TableID: 100
    ipv6TableID: 100
    name: access
  - ipv4TableID: 200
    ipv6TableID: 200
    name: at1
  - ipv4TableID: 300
    ipv6TableID: 300
    name: de1
```

### GTP Proxy

To create NWIs for the GTP Proxy use case, specify the **nwis** configuration. See the NWI configuration example for the GTP Proxy use case, where Access and Data Networks use only GTP endpoints:

```yaml
nwis:
  access:
    name: access
    type: gtpu
  data:
    name: core
    type: gtpu
```

This configuration results in the following UPGConfig CR:

```yaml
apiVersion: upg-manager.cennso.com/v1alpha1
kind: UPGConfig
metadata:
  labels:
    fpp-manager.cennso.com/plumbing-instance: upg-fpp-inst01
  name: upg-fpp-inst01
  namespace: upg-fpp
spec:
  pfcp:
    heartbeat:
      timeout: 10
      retries: 3
  nwis:
  - ipv4TableID: 0
    ipv6TableID: 0
    name: cp
  - ipv4TableID: 100
    ipv6TableID: 100
    name: access
  - ipv4TableID: 200
    ipv6TableID: 200
    name: core
```
