> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/tposs/6.19/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/tposs/6.19/configuration/nats-services/cdmp.md).

# CDMP service

> [!IMPORTANT]
> The [SBI API](https://docs.cennso.com/components/tposs/6.19/configuration/sbi.md) and [Diameter](https://docs.cennso.com/components/tposs/6.19/configuration/diameter.md) must be disabled if CDMP is enabled. You can disable them using the **sbi.enabled** and **scg.diameter.enabled** configuration options.

In addition to Diameter and SBI, TPOSS allows you to communicate with SMF over Cennso Proxy using the Cennso Data Mesh protocol (CDMP) to manage service sessions. The procedures are similar to Diameter or SBI requests; however, `Nnas`, `Npcf`, and `Nchf` requests are transmitted over NATS-based Cennso Proxy through CDMP instead.

TPOSS supports the following APIs:

- Npcf API ([TS 29.512](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3352)) - to allocate PCC rules. For more information, see the [Npcf API](https://docs.cennso.com/components/tposs/6.19/api-reference/sbi/npcf.md) document.
- Nchf API ([TS 32.291](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=3398)) - to execute charging operations. For more information, see the [Nchf API](https://docs.cennso.com/components/tposs/6.19/api-reference/sbi/nchf.md) document.
- Internal Nnas API for authorization and NAT binding. For more information, see the [Nnas API](https://docs.cennso.com/components/tposs/6.19/api-reference/sbi/nnas.md) document.

To receive the incoming CDMP requests from SMF/TDF, use these configuration options:

```yaml
cdmp:
  # Enables CDMP support in TPOSS.
  enabled: true
  # Returns user data (like IMSI, Calling-Station-Id, and optional IMEISV) from TPOSS on CDMP Nnas requests.
  userdata_on_nnas: true
  # Service name launched by TPOSS to handle CDMP connections.
  service: "cdmp"
  # Timeout in milliseconds for CDMP RAR requests.
  rar_timeout: 3000
  # Timeout in milliseconds for CDMP ASR requests.
  asr_timeout: 3000
```

When the **cdmp.enabled** configuration option is set to `true`, the Diameter or SBI transports are not used anymore. Instead, all the operations, such as applying policy rules, NAT binding and charging operations, are executed based on CDMP requests. The whole flow, including the session creation, handling charging procedures, and session termination, is still the same. Only protocols and requests are changed. To learn more about the general TPOSS architecture and the flows of requests, read the [General architecture](https://docs.cennso.com/components/tposs/6.19/architecture/architecture.md) document.

The **cdmp.service** must specify the `SERVICE_NAME` that matches one of the NATS services defined in the **nats-services.{SERVICE_NAME}** configuration.

In addition to the incoming CDMP messages, TPOSS may send the outgoing requests. The maximum time for which TPOSS expects to receive a response for such requests is controlled by the **cdmp.rar_timeout** and **cdmp.asr_timeout** configuration options. If the response is not received within the given period of time, TPOSS terminates the service session associated with the request.

The following sections describe how to configure a NATS service responsible for communication over Cennso Proxy.

## NATS service configuration

To configure a NATS service that TPOSS should use to communicate with SMF over Cennso Proxy, you must enable it first by setting the following parameters:

- **cdmp.enabled** - Enables support for CDMP in TPOSS.
- **cdmp.service** - CDMP service name. The value of the **cdmp.service** must point to the `SERVICE_NAME` that matches one of the NATS services defined in the `nats-services`.
- **nats-services.{SERVICE_NAME}.enabled** - Enables a NATS service for communication over Cennso Proxy.

For example:

```yaml
cdmp:
  enabled: true
  service: "tposs-cdmp-service"

nats-services:
  tposs-cdmp-service:
    enabled: true
```

In this example, TPOSS starts CDMP services to communicate with Cennso Proxy. To specify the address of Cennso Proxy, use the **nats-services.{SERVICE_NAME}.server** configuration parameter.

A NATS service responsible for communication over Cennso Proxy is a usual NATS service to which all the [generic configuration](https://docs.cennso.com/components/tposs/6.19/configuration/nats-services/nats-service.md) options are applicable. In addition, there are three configuration options specific only to communication with Cennso Proxy:

- **nats-services.{SERVICE_NAME}.service_uri** - CDMP service URI registered by TPOSS.
- **nats-services.{SERVICE_NAME}.cluster_name** - CDMP cluster name.
- **nats-services.{SERVICE_NAME}.service_name** - CDMP service name registered by TPOSS.

> [!IMPORTANT]
> The **nats-services.{SERVICE_NAME}.service_name** must be a valid URI ending with `/`.

See the example of the full NATS service configuration that TPOSS uses to communicate over Cennso Proxy:

```yaml
cdmp:
  enabled: true
  service: "tposs-cdmp-service"

nats-services:
  tposs-cdmp-service:
    # Enables support for communication with SMF over Cennso Proxy.
    enabled: true
    # Endpoint of the CDMP server.
    server: "localhost:4222"
    # Number of the client connections established to the CDMP server.
    # TPOSS uses three types of CDMP clients, so the total number of connections is this
    # number multiplied by 3.
    pool_size: 10
    # Maximum number of connections established to the CDMP server.
    # Initially, TPOSS creates the number of connections specified in
    # **nats-services.cdmp.pool_size**. If this number is not sufficient for the given load, TPOSS
    max_connections: 10
    # Timeout in milliseconds that specifies the maximum wait time for a response from the NATS server.
    recv_timeout: 3000
    # Timeout in milliseconds that specifies the maximum wait time for the underlying TCP stack to accept a send operation.
    send_timeout: 3000
    # Timeout in milliseconds to wait for the establishment of the connection to a NATS server.
    connection_timeout: 3000
    # Timeout in milliseconds to reconnect to a NATS server in case the connection is lost.
    backoff_period: 1000
    # CDMP service URI registered by TPOSS.
    service_uri: "http://cdmp.tposs.cennso.com/"
    # CDMP cluster name.
    cluster_name: "cdmp"
    # CDMP service name registered by TPOSS.
    service_name: "TPOSS CDMP service"
```
