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 then 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).  For accessing the data, a data session is created, updated, and terminated for a device. 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) as well, but here we will mention parameters that are sufficient for the understanding of call flow. Once OCS receives the request, it validates 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 allocated data bundle.

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

For the former two cases, GGSN sends the CCR again with consumed octets with CC Request Type diameter AVP value as UPDATE_REQUEST. If still, OCS can allocate date then again CCA comes over Gy interface with newly allocated octets.  This sequence goes on until all data is consumed or PDP is deleted by the network.

If  PDP is deleted by the network 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.