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

# Interface configuration

User Plane Gateway (UPG) uses the **VPPInterface** Custom Resource (CR) to create and manage network interfaces. For VPP-based workloads, the recommended interface type is memif (in-memory interface), which connects the underlying VPP switch to UPG.

You can create a VPPInterface CR in the following ways:

- [Manually](https://docs.cennso.com/components/fpp/main/crs.md#vppinterface-objects)
- Through the higher-level Cennso Operator
- Using a NetworkAttachmentDefinition (NAD) with `fpp-cni` specified as the interface type

## Create interfaces using NAD

The UPG Helm chart simplifies the creation of NetworkAttachmentDefinitions (NADs) for key interfaces. To create NADs, you only need to fill in the corresponding fields in the `values.yaml` file. The Helm chart includes a preconfigured template that automatically detects these fields, generates the required NADs, and applies them to the cluster. This way, you can make the NADs for these interfaces appear in the cluster without creating them manually:

- GRX - for the Access Network interface
- Sx - for Control Plane communication
- SGI - for the Data Network connectivity

See the example of creating a GRX interface using Helm chart configuration:

```yaml
instances:
  inst01:
    networking:
      grx:
        type: memif
        vni: 90
        mtu: 9000
        interface: grx
        ipv4:
          addresses:
           - 198.18.0.20/24
          routes:
            - to: 0.0.0.0/0
              via: 198.18.0.1
```

The resulting NAD looks like this:

```yaml
apiVersion: k8s.cni.cncf.io/v1
kind: NetworkAttachmentDefinition
metadata:
  name: upg-inst01-grx
  namespace: upg-fpp
spec:
  config: |-
    {
      "cniVersion": "0.3.0",
      "ipam": {
        "addresses":
        [
          {
            "address": "198.18.0.20/24"
          }
        ],
        "type": "static"
      },
      "mtu": 9000,
      "name": "grx",
      "table": 100,
      "type": "fpp-cni",
      "vni": 90,
      "vppIfaceType": "memif"
    }
```

In the cluster, each NAD is automatically converted into a VPPInterface CR. In this example, static IP address assignment is used, so the resulting VPPInterface looks like this:

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPInterface
metadata:
  finalizers:
  - fpp-manager.cennso.com/vpp-interface-finalizer
  labels:
    fpp-manager.cennso.com/plumbing-container-id: a65e91ee578185d4e822fcb8be3c8ccc31b775b5
    fpp-manager.cennso.com/plumbing-ifname: grx
    fpp-manager.cennso.com/plumbing-instance-uid: 64f8b1a1-2373-4dcd-8801-539cdec505d2
    fpp-manager.cennso.com/plumbing-memif-role: slave
    fpp-manager.cennso.com/plumbing-pod-name: upg-inst01-7fc97c76bb-s5vq5
    fpp-manager.cennso.com/plumbing-type: memif
    fpp-manager.cennso.com/plumbing-vni: "90"
  name: upg-inst01-7fc97c76bb-s5vq5-memif-client-90-j4fbw
  namespace: upg-fpp
spec:
  hardwareAddress: 02:67:03:0f:84:bf
  ifName: grx
  ips:
  - 198.18.0.20/24
  memif:
    id: 103
    role: slave
  mtu: 9000
  table: 100
status:
  memberCount: 0
  ready: true
  swIfIndex: 4
  vppName: grx
```

As a result of creating this VPPInterface CR, the interface name in VPP CLI and in UPG metrics is set to `grx`.
Also, the Helm chart automatically adds Network Attachment Definitions for GRX, Sx, and SGI to the UPG Deployment:

```yaml
apiVersion: apps/v1
kind: Deployment
...
spec:
  template:
    metadata:
      annotations:
        k8s.v1.cni.cncf.io/networks: upg-fpp-upg-inst01-grx@grx,upg-fpp-upg-inst01-sxb@sxb,upg-fpp-upg-inst01-sgi@sgi
```

The VPPInterface is targeted against UPG deployment using the label `fpp-manager.cennso.com/plumbing-instance-uid`, which is managed by FPP-CNI.

## Create interfaces without CNI

You can create memif interfaces directly with VPPInterface without using FPP-CNI. To do this, set **useCNILessMemifs** to `true` and add a valid FPPNetwork name to **networkName** in the UPG chart configuration. All other configuration steps remain the same.

>**NOTE:** This feature requires Fast Path Provider (FPP) 2.2.0 (Operator and VPPSwitch) deployed on the cluster.

These are the benefits of creating CNI-less memifs:

- The UPG pod starts immediately without waiting for CNI, which is helpful when connecting over 40 interfaces.
- You can change interface settings (IP, MAC, MTU, FPP Network) at runtime. The table below outlines the effects of these changes:

| Changed parameter | UPG reaction |
|---|---|
| IP | IP updated instantly in VPP. If used in VPPConfig (for example Control/SX or Access/GRX IPs), UPG restarts. |
| MAC | MAC updated at runtime with no restart |
| FPPNetwork | Changes recreate the affected interface, causing temporary connectivity downtime. |
| MTU | MTU updated at runtime with no restart |
| Interface name | Changing the name deletes the memif interface. If referenced in VPPConfig (`ifName`), UPG restarts. |

>**CAUTION:** Before modifying Rx/Tx queues or buffer/queue sizes, check the [Known issues](https://docs.cennso.com/components/upg/2.16/releases/2.6.0.md#known-issues).

See the configuration example of a memif without CNI:

```yaml
instances:
  inst01:
    networking:
      grx:
        ipv4: (...)
        interface: an0
        type: memif
        networkName: access-net
      sx:
        type: memif
        networkName: sx-net
        ipv4: (...)
        interface: sx
    nat:
      pools:
        pool-1:
          networking:
            type: memif
            networkName: pool-1
            interface: pool-1
            mtu: 1500
            ipv4: (...)
...

useCNILessMemifs: true
```

## Create additional interfaces

You can connect additional interfaces (other than GRX, SGI, and Sx) to UPG by creating NADs and referencing their names in the network annotations. Use the chart configuration to specify extra NAD names in the **additionalNetworks** field per UPG deployment or under **instances.{INSTANCE_NAME}.networking** per UPG instance. See the example:

```yaml
additionalNetworks:
  - upg-inst01-vpn@vpn
(...)
instances:
  inst01:
    networking:
      (...)
      additionalNetworks:
        - test-network-1-inst01
        - test-network-2-inst01
```

>**NOTE:** To create additional interfaces, you must create NADs separately, outside of the main Helm chart.
