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

# UPGConfig CR

`UPGConfig` Custom Resource (CR) configures basic UPF plugin functionality in the Core Cluster.
This CR is targeted by means of
`fpp-manager.cennso.com/plumbing-instance` label, that needs to match
`FPP_INSTANCE_NAME` environment variable value passed to the
User Plane Gateway (UPG) pod.

```yaml
labels:
  fpp-manager.cennso.com/plumbing-instance: my-upg
```

Below is an example of UPGConfig CR with comments.

```yaml
apiVersion: upg-manager.cennso.com/v1alpha1
kind: UPGConfig
metadata:
  name: sample-upg-config
  namespace: upg-sample
  labels:
    # target particular UPG instance
    fpp-manager.cennso.com/plumbing-instance: vpp-my-upg
    fpp-manager.cennso.com/created-for: upg-operator
spec:
  # priority specifies the priority of this particular config when merging multiple
  # UPGConfig objects. The higher is priority value, the higher precedence this config
  # takes.
  priority: 100
  pfcp:                                # section defines parameters for PFCP Server (optional)
    heartbeat:                         # PFCP Heartbeat parameters (optional)
      retries: 10                      # Number of retries
      timeout: 5                       # Timeout between heartbeat requests in seconds
  nwis:
  - name: cp                           # when defining only NWI name
                                       # IPv4 and IPv6 table IDs will be set to 0
  - name: epc                          # name of the NWI
    ipv4TableID: 100                   # IPv4 table (VRF) ID
    ipv6TableID: 100                   # IPv6 table (VRF) ID
  - name: sgi
    ipv4TableID: 200                   # when only IPv4 is defined, IPv6 table is
                                       # configured for the same number that IPv4
    ipfixPolicy: FlowUsage             # IPFIX policy to use (optional)
    ipfixCollectorAddress: 10.20.30.40 # IPFIX collector address to use (optional)
    ipfixReportInterval: 7             # IPFIX report interval, 0 means the intermediate report is not sent, defaults to 0 (optional)
    observationDomainID: 42            # IPFIX ObservationDomainID field value (optional)
    observationDomainName: test        # IPFIX ObservationDomainName field value (optional)
    observationPointID: 4242           # IPFIX ObservationPointID field value (optional)
  ueip:
    nsExport:                          # Section that defines parameters used to export UE IPs
      enabled: true                    # Enables exporting UE IPs
      netnsPath: /var/vpptools/netns   # Filepath to the network namespace that contains both the interface and table
      ifName: lo                       # Name of the interface for routes
      tableID: 200                     # Linux kernel routing table ID
```

Note that IPFIX settings can be added regardless of whether
`ipfixPolicy` is set for the NWI. Both the policy and the settings
apply based on the egress NWI of the initial packet of the flow.

To activate IPFix per NWI, `ipfixPolicy` and `ipfixCollectorAddress`
should be configured. Then all the traffic will be reported in
IPFIX data packets.

For per flow IPFix activation, only `ipfixCollectorAddress` needs
to be defined in NWI configuration. Then IPFIX is enabled per session
using PFCP IE.

When multiple UPGConfig objects match this particular UPG
instance, they're merged together according to their `priority` value,
appending together the `nwis` section. The resulting config is called
"effective config".

There's special handling for the case when the same instance is also
targeted by `VPPConfig` instances some of them have `AfterCommands`
section. In this case, When effective `UPGConfig` changes for the
UPG instance, the UPG instance restarts.

## UE IP export

User Plane Gateway allows you to export user equipment (UE) IP addresses to the Linux kernel for use in other software.
You can export both IPv4 and IPv6. Configure the `ueip.nsExport` section in the `UPGConfig` object in the Core Cluster to enable this option.

See the configuration example:

```yaml
  ueip:
    nsExport:                          # Section that defines parameters used to export UE IPs
      enabled: true                    # Enables exporting UE IPs
      netnsPath: /var/vpptools/netns   # Filepath to the network namespace that contains both the interface and table
      ifName: lo                       # Name of the interface for routes
      tableID: 200                     # Linux kernel routing table ID
```

All parameters are required. Network namespace and interface must already exist, and the interface must be up.
Do not use an interface that has a Linux Control Plane (LCP) pair, such as `lcp0`. The LCP plugin imports the exported routes into VPP, and VPP then sends an Address Resolution Protocol (ARP) request for every UE IP address.

The Border Gateway Protocol (BGP) daemon can announce the exported UE IP addresses to neighboring gateways. For more information, see the [Enable BGP support](https://docs.cennso.com/components/upg/latest/deployment-guides/bgp.md) deployment guide.
