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

# Introduction

TPOSS (Travelping Open Subscriber Server) implements a policy and charging
control system. It consists of the following three basic services:

* PCS (Policy Control Server) implements a PCRF (Policy and Charging
Rules Function) following 3GPP standardizations. PCS incorporates the
central service within the TPOSS control plane providing interfaces to a
PCEF (Policy and Charging Enforcement Function, e.g. the data plane) which is
usually the SCS (Session Control Service). The main purpose of PCS is to
hold the state of a user's session and to adjust policies for this session
based on data from the CCS and UDR service.
* CCS (Charging Control Server) is a service for charging and
controlling balances of users.
* UDR (User Data Repository) is a service for controlling user data and
profiles.
* TPOSS API Gateway is a gateway between TPOSS HTTP REST API and the external
consumer of the API.

## Architecture

The PCS, CCS and UDR subsystems are represented as a single application. To expose
functionality of these subsystems and interact with these applications, TPOSS
provides `RADIUS` and `Diameter` endpoints to handle incoming requests from
external functional elements.

`RADIUS` communication is used to establish so called `network` sessions using the
`RADIUS Access-Request` and `RADIUS Accounting` requests from PGW.

`Diameter` communication between TPOSS and SCG is used to apply charging rules
for a given subscriber via `Gx` interface and consume charging information over
`Gy` interface. In addition `NAT` pools and `NAT` ip and port ranges are assigned
via `Diameter NASREQ` endpoint.

All the charging, sessions, and UDR data is stored within the MySQL database.

Intermediate RADIUS and Diameter proxies/agents can be used for communication between TPOSS and external components, but the usual architecture is as follows:

```mermaid
sequenceDiagram

participant APN
participant TPOSS
participant UDR
participant CCS
participant PCS
participant MySQL

APN->>TPOSS:RADIUS Access-Request
TPOSS->>UDR:Subscriber authorization
UDR->>MySQL:Authorization
MySQL->>UDR:Authorization result
UDR->>TPOSS:Authorization result
TPOSS->>APN:Authorization result

APN->>TPOSS:RADIUS Accounting-Request
TPOSS->>PCS:Accounting per session
PCS->>MySQL:Update session
MySQL->>PCS:Updated session
TPOSS->>APN: RADIUS Accounting response

APN->>TPOSS:Nasreq
TPOSS->>PCS:Service session creation
PCS->>MySQL:Service session creation
TPOSS->>UDR:NAT-binding information
UDR->>MySQL: NAT-binding information
UDR->>TPOSS: NAT-binding information
TPOSS->>APN: NAT-binding information

APN->>TPOSS:Gx
TPOSS->>CCS:Fetch charging rules
CCS->>MySQL:Charging rules for a session
MySQL->>CCS:Charging rules for a session
CCS->>TPOSS:Charging rules for a session

APN->>TPOSS:Gy
TPOSS->>CCS:Charging information
CCS->>MySQL:Charging information
MySQL->>CCS:Charging information
CCS->>TPOSS:Charging information
```

The above diagram represents very high level architecture and mostly TPOSS-centric.
For more detailed RADIUS and Diameter interaction, see the TISP AAA documentation.

## TPOSS API Gateway

TPOSS provides a set of HTTP REST APIs to control and fetch data from TPOSS. The
API is usually never accessed directly but using TPOSS API Gateway.

TPOSS provides the following APIs:

- Session API - fetch information about network and service sessions
- Subscriber API - provision and fetch information about subscribers
- CDR API - fetch CDRs
- Charging API - provision charging accounts and balances
- Events API - delete events generated by TPOSS
- Whitelist API - provision/deprovision whitelist IMEISV(s) into TPOSS

## Additional components

There are optional components in addition to the core subsystems:

- Additional networking setup: `travelping/nettools:v1.7.0`
- SFTP CDRs exporter: `registry.cennso.com/tposs/tposs-cdr-exporter-sftp:v1.1.0`
