> 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/operation-guides/interface.md).

# Create and manage interfaces

User Plane Gateway (UPG) uses the **VPPInterface** Custom Resource (CR) in the Core Cluster 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:

- Using UPGDeployment CR
- [Manually](https://docs.cennso.com/components/fpp/main/crs.md#vppinterface-objects)
- Through the [NetworkAttachment Resource](https://docs.cennso.com/cennso/main/concepts/network-attachment.md)

## Create interfaces using UPGDeployment CR

The UPGDeployment CR, applied to the Management Cluster, simplifies the creation of VPPInterface for key interfaces. You only need to fill in the corresponding fields in the **spec.instances** section of the CR. The UPGDeployment CR automatically detects these fields, generates the required VPPInterfaces, and applies them to the Core Cluster. The supported interfaces are:

- GRX - for the Access Network interface
- Sx - for Control Plane communication
- SGI - for the Data Network connectivity
- NAT pool interfaces - for Carrier Grade NAT in the Traffic Detection Function use-case

To create VPPInterface, you must first create proper FPPNetwork objects in the Core Cluster before deploying UPG. To do so, set the valid name per interface using the **spec.instances.{name}.networking.{interface}.networkName** argument. This approach is called CNI-Less. These are the benefits of creating memifs without FPP-CNI:

- 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/3.2/releases/2.6.0.md#known-issues).

See the example of creating a GRX interface using UPGDeployment CR configuration:

```yaml
spec:
  instances:
    inst01:
      networking:
        grx:
          networkName: grx-net
          mtu: 9000
          interface: grx
          ipv4:
            addresses:
             - 198.18.0.20/24
            routes:
              - to: 0.0.0.0/0
                via: 198.18.0.1
```

In UPG configuration, static IP address assignment is used, so the resulting VPPInterface looks like this:

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPInterface
metadata:
  name: upg-pgw-inst01-grx
  labels:
    apn: pgw-ocs.test.cennso
    helm.sh/chart: upg-3.0.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/version: 3.0.0
    app.kubernetes.io/name: upg
    app.kubernetes.io/instance: upg-pgw
    fpp-manager.cennso.com/created-for: upg-operator
    release: upg-pgw
    cennso.net/cnf: upg
    fpp-manager.cennso.com/plumbing-instance: upg-pgw-inst01
spec:
  ifName: grx
  attachToNetwork: grx-net
  table: 100
  memif:
    role: slave
  ips:
  - 198.18.0.20/24
  mtu: 9000
```

As a result of creating this VPPInterface CR, the interface name in VPP CLI and in UPG metrics is set to `grx`.

The VPPInterface is targeted against UPG deployment using the label `fpp-manager.cennso.com/plumbing-instance`.

## Create additional interfaces

You can connect additional interfaces (other than GRX, SGI, and Sx) to UPG by creating VPPInterface in the Core Cluster with `fpp-manager.cennso.com/plumbing-instance` set to the UPG VPPDeployment name.

>**NOTE:** The VPPInterfaces must be created outside of the UPGDeployment CR. 

See the example:

```yaml
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPInterface
metadata:
  name: upg-pgw-inst01-vpn
  labels:
    fpp-manager.cennso.com/created-for: upg-operator
    cennso.net/cnf: upg
    fpp-manager.cennso.com/plumbing-instance: upg-pgw-inst01
spec:
  ifName: vpn
  attachToNetwork: vpn-net
  table: 250
  memif:
    role: slave
  ips:
  - 10.10.0.20/24
  mtu: 9000
```

## Verification

To verify the VPPInterface status in the Core Cluster, run the following command:

```bash
kubectl get vppinterface upg-pgw-inst01-grx -o yaml
```

See the output example:

```yaml
(...)
status:
  memberCount: 0
  ready: true
  swIfIndex: 3
  vppName: grx
```

For more detailed verification and VPP CLI commands, see [Check VPP Interfaces](https://docs.cennso.com/components/upg/3.2/troubleshooting/verification.md#check-vpp-interfaces).
