Diameter Gy Interface explained.

Gy is another diameter interface between PCEF and OCS, having application id 14 for a charging application. So first, we will understand what is PCEF and OCS. PCEF’s full form is Policy and Charging Enforcement Function. This component is located inside GGSN or PGW. Gy interface is for online charging. For policy, there is another interface called Gx, that we will discuss in another tutorial. For charging, PCEF interacts with the OCS, sends the charging events to OCS, and receives events and answers. OCS is an online charging system. This is a node that has a subscriber profile for charging. E.g., if a subscriber is roaming in a country,  he will request data from GGSN. GGSN will query the OCS with IMSI and roaming details over Gy. If the subscriber is allowed for data, OCS will allocate bytes to the IMSI with validity time. The charging application specification is given in diameter standard  4006. The following section describes call flow GTP and Diameter messages for charging over the Gy interface.

Gy interface messages:

Gy uses two messages over the Diameter protocol, Credit control request (CCR) and Credit Control Answer (CCA). A data session is created, updated, and terminated for a device to access the data. The following are the details for Gy’s messages.

Gy Credit control request and answer (CCR/CCA):

GGSN or PGW sends this message to the OCS. The command code for CCR is 271 with the R bit set as this is a request message. When a Create PDP context request arrives at GGSN. GGSN sends a CCR message to the OCS with CC Request Type diameter AVP value as INITIAL_REQUEST with IMSI and a unique session id. There are other parameters (e.g., Requested octets), but here we will mention parameters sufficient for understanding call flow. Once OCS receives the request, it validates it, and if a subscriber is allowed to use data, OCS sends CCA (R bit cleared in command code 272). CCA have octets allocated and validity time for the given data bundle.

After the above step, the device starts consuming data, and now three events are possible. Once all allocated data has been consumed, validity time has expired, or the network has closed the PDP session. 

GGSN sends the CCR again with consumed octets with CC Request Type diameter AVP value as UPDATE_REQUEST for the former two cases. If still, OCS can allocate a date, then again, CCA comes over the Gy interface with newly issued octets. This sequence continues until all data is consumed or the network deletes PDP.

If the network deletes PDP, GGSN sends a CCR with CC Request Type diameter AVP value as TERMINATION_REQUEST with consumed data. So that OCS can update data usage for a subscriber. After this data session is completed.