> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/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/fpp/3.2/deployment-guides/multinode-sriov.md).

# Deploy Fast Path Provider on multiple nodes using SRIOV networks as FPP uplinks

This document describes the prerequisites and steps for a multi-node deployment of Fast Path Provider (FPP) using SRIOV networks as FPP uplinks. This guide uses the **fpp-dpdk** composition.

For alternative configurations, please refer to the tutorials on [a direct NIC assignment](https://docs.cennso.com/components/fpp/3.2/deployment-guides/multinode-direct-nic.md) and the [**AF_XDP** driver](https://docs.cennso.com/components/fpp/3.2/deployment-guides/multinode-xdp.md).

## Prerequisites

- [Requirements](https://docs.cennso.com/components/fpp/3.2/requirements.md)
- [VPP Operator deployed](https://docs.cennso.com/components/fpp/3.2/deployment-guides/vppoperator-deployment.md)
- [SR-IOV Network Operator](https://github.com/k8snetworkplumbingwg/sriov-network-operator) installed in the Core Cluster

Terminology used in the installation document:

- FPP node - FPP pod in the `node` mode, which acts as a virtual switch on each Data Plane node
- Uplink - network interface, virtual or physical, which is used by FPP node to communicate inside the cluster and create a VXLAN mesh to interconnect workload CNFs between nodes

### Supported NICs

The following Network Interface Cards are supported using this installation guide:

- **Intel X710**, vendor ID: **8086**, device ID: **1572**, model: Ethernet Controller X710 for 10GbE SFP+
- **Intel XL710**, vendor ID: **8086**, device ID: **1583**, model: Ethernet Controller XL710 for 40GbE QSFP+
- **Intel X710**, vendor ID: **8086**, device ID: **1589**, model: Ethernet Controller X710/X557-AT 10GBASE-T
- **Intel XXV710**, vendor ID: **8086**, device ID: **158b**, model: Ethernet Controller XXV710 for 25GbE SFP28

### Uplinks using SRIOV VFs

FPP requires the SR-IOV Network Operator to set `PCIDEVICE_` as environment variables with a PCI device ID, for example:

```sh
declare -x PCIDEVICE_OPENSHIFT_IO_UPLINK0="0000:06:0a.4"
declare -x PCIDEVICE_OPENSHIFT_IO_UPLINK1="0000:06:02.6"
```

The above variable is set by SRIOV Network Device Plugin, which can be installed independently or by SRIOV Operator.

FPP was tested with the following versions of SRIOV Operator:

- [origin-sriov-operator](https://quay.io/repository/openshift/origin-sriov-network-operator?tab=tags) `4.3.0`
- [openshift/sriov-network operator](https://github.com/openshift/sriov-network-operator) commit `104db73503782b16900ebc1ce14f809bde2f1086`, based on release 4.9

## Steps

1. **Configure the SR-IOV Operator** to generate the required Network Attachment Definitions for Uplinks as described [here](#configure-the-sriov-operator).
1. **Create FPPDeployment object** for a multi-node SRIOV deployment and [configure the basic options](#basic-configuration).
1. **Configure the uplinks** as described in the [corresponding section](#configure-uplinks).
1. **Optionally**, [configure external networks](#external-network-interfaces) to meet your specific networking requirements.
1. **Verify the FPPDeployment status** to ensure it is [working correctly](#verification).

### Configuration example

The following FPPDeployment configuration example demonstrates the use of SR-IOV Virtual Functions (VFs). This specified resource allocation is optimized to ensure best performance.

```yaml
apiVersion: fpp.cennso.com/v1alpha1
kind: FPPDeployment
metadata:
  name: multi-node-sriov-fpp-node
  namespace: cennso-infra
spec:
  compositionRef:
    name: fpp-dpdk
  version: <version>
  connectionSecretRef:
    name: example-core-cluster
    namespace: cennso-infra
  operatorRef:
    name: node-operator
    namespace: cennso-infra

  dpdkComposition:
    uplink0ResourceName: openshift.io/uplink0
    uplink0Network: fpp/uplink0-vfio
    uplink1ResourceName: openshift.io/uplink1
    uplink1Network: fpp/uplink1-vfio
    bondMode: XOR

  repository: oci://registry.cennso.com/cennso/charts
  targetNamespace: fpp

  useHugepages: true
  heapSize: "3G"
  resources:
    cpu: "10"
    memory: "2Gi"
    hugepages-2Mi: "5Gi"

  nodeSelector:
    node-role.cennso.net/worker: dataplane

  tolerations:
    - effect: NoSchedule
      key: node-role.cennso.net/dataplane
      value: "true"

  vppConfigs:
    - nodeName: ""
      spec:
        afterCommands:
          - set ip neighbor-config ip4 age 5

  logLevel: info
  updateStrategy:
    type: OnDelete
```

### Configuration options

#### Basic configuration

For basic FPPDeployment option, see [Single Node deployment guide](https://docs.cennso.com/components/fpp/3.2/deployment-guides/single-node.md#basic-configuration-options).

For a need of this guide, we will use these SRIOV networks:
- `fpp/uplink0-vfio`
- `fpp/uplink1-vfio`

#### Configure uplinks

The **fpp-dpdk** composition defines the **spec.dpdkComposition** field, allowing you to specify the SR-IOV Operator resource name and associated networks:

```yaml
dpdkComposition:
  uplink0ResourceName: openshift.io/uplink0   # this is the Kubernetes resource name, based on SriovNetworkNodePolicy.spec.resourceName
  uplink0Network: fpp/uplink0-vfio            # this is SriovNetwork or Network Attachment Definition name with namespace,
                                              # based on SriovNetwork.metadata.name and SriovNetwork.spec.networkNamespace
  uplink1ResourceName: openshift.io/uplink1
  uplink1Network: fpp/uplink1-vfio
  bondMode: XOR                               # Available options: XOR, ActiveBackup
```

The configuration above ensures the proper setup of the SR-IOV Virtual Functions as VPP uplink interfaces.

When using the **fpp-generic** composition, you need to explicitly configure the **spec.uplinkResources** and **spec.vppConfigs**:

```yaml
uplinkResources:
  openshift.io/uplink0:           # this is the Kubernetes resource name, based on SriovNetworkNodePolicy.spec.resourceName
      network: fpp/uplink0-vfio   # this is SriovNetwork or Network Attachment Definition name with namespace,
                                  # based on SriovNetwork.metadata.name and SriovNetwork.spec.networkNamespace
      interfacePrefix: uplink0    # prefix used for interface name in VPP's `startup.conf`
      numRxQueues: 4              # number of RX queues, defaults to 1, should be set to number of worker threads (4 when resources.cpu is set to 10)
      numTxQueues: 4              # number of TX queues, defaults to 1, should be set to number of worker threads
      numRxDesc: 4096             # number of RX descriptors
      numTxDesc: 4096             # number of TX descriptors
      count: 1                    # number of VFs to use from `openshift.io/uplink0` resource

    openshift.io/uplink1:
      network: fpp/uplink1-vfio
      interfacePrefix: uplink1
      numRxQueues: 4
      numTxQueues: 4
      numRxDesc: 4096
      numTxDesc: 4096
      count: 1
```

The uplink interfaces are configured in **spec.vppConfigs[].spec.uplinkConfig**. Set **spec.vppConfigs[].nodeName** to `""` and this will apply configuration to all FPP node pods. Configuration example:

```yaml
vppConfigs:
- nodeName: ""
  spec:
    afterCommands:
    - set ip neighbor-config ip4 age 5
    uplinkConfig:
      # bond mode, one of LACP / Broadcast / XOR / ActiveBackup / RoundRobin
      bondMode: ActiveBackup
      # bond lb algorithm, one of L2 / L34 / L23 / RR / BC (Broadcast) / AB (ActiveBackup)
      bondLbAlgo: AB
      # IP prefix len for IPv4 subnet, it is added to uplink IP
      prefixLen4: 24
      # IP prefix len for IPv6 subnet, it is added to uplink IP
      prefixLen6: 64
      # MTU for the uplink interface
      MTU: 9000
```

#### External network interfaces

The **fpp-dpdk** composition does not automatically configure external networking. To set up external network interfaces using Virtual Functions (VFs), you must define the **spec.externalNetworks** field:

```yaml
externalNetworks:
  ext-net:                  # this name is used as interface name prefix in startup.conf
    openshift.io/extnet:    # this is the Kubernetes resource name, based on SriovNetworkNodePolicy.spec.resourceName
      network: fpp/extnet0  # this is SriovNetwork or Network Attachment Definition name with namespace,
                            # based on SriovNetwork.metadata.name and and SriovNetwork.spec.networkNamespace

  anotherExtNet:
    dummy.io/external-2:
      network: external-2-nad
      numRxQueues: 10
      numTxQueues: 8
      numRxDesc: 1024
      numTxDesc: 512
```

To configure an external network interface with a specific IP address, MTU, or FPPNetwork name, use the **spec.vppConfigs** setting as shown in the following example:

```yaml
vppConfigs:
- nodeName: wk-node1.eu.cennso.net
  spec:
    externalNetworkConfig:
    - networkName: fpp-ext-net
      ifacePrefix: ext-net
      ips:
      - 10.100.0.1/24
      mtu: 8930
```

**vppConfigs[].spec.externalNetworkConfig.ifacePrefix** must match **spec.externalNetworks** key name (`ext-net` or `anotherExtNet` from above example).

The **vppConfigs[].spec.externalNetworkConfig.networkName** must reference existing FPPNetwork object on the Core Cluster. FPP-based workloads (CGW, UPG) which are connected to this FPPNetwork (`fpp-ext-net`) can use defined IP (`10.100.0.1/24`) as a routing gateway.

For more information on other available settings in **spec.vppConfigs**, refer to the [VPPConfig documentation](https://docs.cennso.com/components/fpp/3.2/concepts/vppconfig.md).

#### Enable FPP Overlay Network monitoring

FPP 3.0.5 introduces node-to-node monitoring using an `FPPNetwork` with VXLAN VNI 1 over the Uplink interface. You can enable this feature (disabled by default) by setting **spec.enableUplinkMonitoring** to `true` within the `FPPDeployment`, and then monitor the network state on the `FPP Overview` Grafana dashboard. For more details, [see the docs](https://docs.cennso.com/components/fpp/3.2/observability/network-monitoring.md).

## Detailed configuration

### Configure the SRIOV Operator

You need to configure `SriovNetworkNodePolicy` objects for uplinks. The configuration includes the NIC selector, node selector and resource name.

Set **spec.resourceName** to `uplink0`, `uplink1` and so on, which together with `RESOURCE_NAME` of `openshift.io` specified for SR-IOV Network Operator results in Kubernetes resource names like `openshift.io/uplink0`, `openshift.io/uplink1` and so on.

The following is an example of `SriovNetworkNodePolicy` for Intel XL710 VFs:

```yaml
---
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetworkNodePolicy
metadata:
   name: uplink0-vfio
   namespace: sriov-network-operator
spec:
   deviceType: vfio-pci
   mtu: 9000
   nicSelector:
      deviceID: "1583"
      pfNames:
      - eth0
      rootDevices:
      - "0000:04:00.3"
      vendor: "8086"
   nodeSelector:
      feature.node.kubernetes.io/network-sriov.capable: "true"
   numVfs: 4
   priority: 99
   resourceName: uplink0
```

The above example creates 4 VFs on eth0 NIC on nodes that match `nodeSelector`. If the hardware is different across different nodes of the cluster (different NICs or their PCI configurations), there should be multiple `SriovNetworkNodePolicy` objects created with different `nodeSelector` values. This also requires creating multiple FPP node deployments with different networks attached to it through NetworkAttachmentDefinitions.

If multiple uplinks are used, VPP Operator creates a bond that is comprised of these uplinks.

You also need to create `SriovNetwork` objects for the uplinks. For uplinks that are used without bonding, you need to specify IP address in the `ipam` section.  In the case of bonded interfaces, the first interface among bonded must have an IP address. You can use [Whereabouts CNI IPAM plugin](https://github.com/k8snetworkplumbingwg/whereabouts) to facilitate this task. A `SriovNetwork` with an assigned IP address may look like this:

```yaml
apiVersion: sriovnetwork.openshift.io/v1
kind: SriovNetwork
metadata:
  name: uplink0-vfio
  namespace: sriov-network-operator
spec:
  ipam: |-
    {
      "type":"whereabouts",
      "ipRanges": [{
        "range": "10.40.1.0/24"
      }]
    }
  networkNamespace: fpp
  resourceName: uplink0
  spoofChk: "off"
  trust: "on"
```

## Verification

First, check if FPPDeployment was [setup correctly](https://docs.cennso.com/components/fpp/3.2/deployment-guides/single-node.md#verification).

Next, verify the [SR-IOV setup](https://docs.cennso.com/components/fpp/3.2/troubleshooting/sriov.md) and perform a [connectivity check](https://docs.cennso.com/components/fpp/3.2/troubleshooting/connectivity.md) to ensure everything is functioning correctly.

Once enabled in the `FPPDeployment`, you can verify node-to-node connectivity by viewing the [FPP Overlay Network status on the FPP Overview Grafana dashboard](https://docs.cennso.com/components/fpp/3.2/observability/dashboard-fpp.md#fpp-overlay-network-status).
