Diameter Message Processing

For deep under standing of this section please read following at least once more
1)Diameter Message Structure and Message Flow
2)Peer Table
3)Realm Routing Table

In diameter a message can be a request or an answer message, here we will see how these messages are sent to there destinations with the help of Peer Routing table and Realm Routing table. Diameter message reaches to final destination with proper combination of Destination-Host and Destination-Realm.

Here first we look for how request message is routed to its destination.

There are three valid combination that are supported by diameter, by which message shall reach to destination in given scenario.

1) Neither Destination Realm nor Destination host is required.
The request that shall not be proxied MUST NOT contain Destination-Host and Destination-Realm AVPs. Only request message comes in this scenario is CER message. Destination-Host and Destination-Realm AVPs are not in CER ABNF.

 <CER> ::= < Diameter Header: 257, REQ >
                { Origin-Host }
                { Origin-Realm }
             1* { Host-IP-Address }
                { Vendor-Id }
                { Product-Name }
                [ Origin-State-Id ]
              * [ Supported-Vendor-Id ]
              * [ Auth-Application-Id ]
              * [ Inband-Security-Id ]
              * [ Acct-Application-Id ]
              * [ Vendor-Specific-Application-Id ]
                [ Firmware-Revision ]
              * [ AVP ]

Why it is so? Because CER is the first message exchange between any two nodes as soon as transport connection is established that's why there no need of Destination-Host and Destination-Realm AVPs. It is exchanged between nodes that have direct connection, Suppose there is relay in between client and server then there shall be two CER messages (Instance Client to relay, another is relay to server).

2)Contains Destination Realm MUST Not Destination-Host
When request is sent to a server of an application serving a complete realm. Because Destination-Host can easily identified by checking application identifier in Realm-Routing Table of intermediate nodes.

3)Must contain both Destination-Host and Destination-Realm
When there are more than one server is serving a realm then to which server request to be send is identified by Destination-Host AVP. When server wants to send request to a specific client then server should add Destination-Host and Destination-Realm AVPs. 

Diameter Load Balancing 
The Destination-Realm AVP MUST be present if the message is   proxiable.  Request messages that may be forwarded by Diameter agents(proxies, redirects or relays) MUST also contain an Acct-Application-Id AVP, an Auth-Application-Id AVP or a Vendor-Specific-Application-Id AVP. Because Application Identifier is act as secondary key in Realm Routing Table, shall be use to find next node/hop for request.

A message that MUST NOT be forwarded by Diameter agents (proxies, redirects or relays) MUST not include the Destination-Realm in its ABNF. Because without realm diameter agents can't search realm routing table.

The value of the Destination-Realm  AVP MAY be extracted from the User-Name AVP, or other application-specific methods. This strategy can be used for load balancing, by sending the request to one or more servers on the basis of avp values.

For instance: User-Name AVP  contains a unique identification number for a user then we have an option to divide the load on the basis of value. I.e. 1 to 1000 shall go to server1 1000-2000 shall go to server to etc.

If none of the above is the case then,answer is returned with the Result-Code set to DIAMETER_UNABLE_TO_DELIVER, with the E-bit set.

Processing of request 
1)Request reaches to server
a) If Destination-Host Identity matches which Local Identity (Node URI). It means that this message is destined to this node only and it has reached its destination.
b) If Destination-Host is not persent then it check that Destination-Realm persent matches with its own Realm and In Realm Routing Table it is mentioned  (LOCAL )that to be consumed locally for given application Identifier.
c)If both Destination-Host and Destination-Realm is not persent then it should be consumed locally by every node including servers because it's CER message received from peer.

2)Request Forwarding
When a node checks that Destination-Host received in request is present in PEER Table then node shall forward the request to its peer.

3)Request Routing
When Destination-Host present in request in not perent PEER table or Destination-Host AVP is not persent in request then decission where to send request shall be done using application Identifier and Realm routing table.

24 comments:

  1. Hi,
    In Request Routing it is said that if Destination Host is not present, then the decision of where to send shall be done using application Identifier and Realm routing table. My doubt is in previous pages (Realm Based Routing Table), it was shown that Realm table has entries and has a relationship between Peer Table and Realm Table entries. Both statements seems to be contradicting each other.

    ReplyDelete
  2. Hi,
    My Query is related to ABNF notation. In above cer messaage 1* { Host-IP-Address } mean atleast/min one occurence of Host-IP-Address. What is the meaning of * w.r.t optional AVP like Supported-Vendor-Id.

    What is the difference between * [ Vendor-Specific-Application-Id ] and [ Firmware-Revision ]?

    ReplyDelete
    Replies
    1. Hi,

      In CER/CEA of 3GPP Gx process, the auth application id is 16777238. should it be present in the CER/CEA auth-application-id AVP or in the CER/CEA vendor-specific-application-Id?

      Thanks,

      Adrian

      Delete
    2. Hi Adrian

      Application Id 16777238 should be in vendor-specific-application-Id along with vendor id 10415 i.e. 3GPP vendor id.


      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
    3. Hi Mahendar

      As CER with { Vendor-Id } set to zero "Base DIAMETER" message is sent once at time of diameter connection initiation now a node shall tell all the application-ID supported by it (say Node is RELAY).

      Vendor-Specific-Application-Id is grouped and can be multiple, if node supports 3 application ID then 3 Vendor-Specific-Application-Id shall be there in CER

      ::= < AVP Header: 260 >
      { Vendor-Id } --10415(say 3gpp)
      [ Auth-Application-Id ] --90 (app-X)
      [ Acct-Application-Id ]

      ::= < AVP Header: 260 >
      { Vendor-Id } --20400(say Operator-A)
      [ Auth-Application-Id ] --93 (app-Y)
      [ Acct-Application-Id ]

      Exactly one instance of either Auth-Application-Id or Acct-pplication-Id AVP MUST be present.

      With Best of my knowledge
      Firmware-Revision AVP shall be used to communicate one of the two things 1) Firmware Version (Firmware=system platform)of device or 2) Diameter Application Software Release version to other node (if other node requires 'NOde is compatible with version-1 not with version-2')

      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
    4. Hi,

      How you came down to this conclusion?

      "Application Id 16777238 should be in vendor-specific-application-Id along with vendor id 10415 i.e. 3GPP vendor id."

      Is it assumed? Or explained somewhere in the RFC? I'm currently dealing with a similar situation.

      Thanks a lot.

      Delete
    5. Hi Josue Tovar,

      Details are given in 3gpp Document 3GPP TS29.212.

      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
    6. Thank you so much. I can't believe I hadn't seen it :)

      Delete
  3. Dear Tech Team,

    I would like to know how can we balance the load between two Diameter Nodes? Can you give some real time example. Say for an instance I have four Diameter Server and many clients talking to me. How can I balance the load(Requests from these clients to equally distribute between 4 servers)? Your response to this is highly appreciated.

    ReplyDelete
    Replies
    1. Hi,

      Load balancing is totally dependent on the way you deploy for network. But generally DRA is used to balance load. All clients would connect to DRA, and then DRA would route the message depending upon policies such as Round-Robin or Range Based etc. Generally User-Name avp (Unique-ID) is used in range based load sharing.

      Thanks for your query.

      Happy to help you again.
      Team-Diameter

      Delete
  4. Thanks for sharing this very nice discussion. While choosing a good web hosting services for your business lots of things to consider and this blog very well explained it. You must Continue posting such great information about web hosting and related stuffs. best web hosting

    ReplyDelete
  5. GREAT WORK !!! I HAVE been searching for a portal/blog/forum/site for diameter from months that could explain me in a extensive way. This blog has given me what i was search for. Good job team!!!
    expecting from you to elaborate ind same way on any event of Diameter.
    CCT!!!

    ReplyDelete
    Replies
    1. Hi Antriksh Mathur

      Thanks for being so gracious.
      Team-Diameter

      Delete
  6. what is the basic difference between Origin Host vs origin realm ??

    Thanks!!
    Puneet

    ReplyDelete
    Replies
    1. Hi Puneet,

      Realm is logical set of hosts.
      Like states and cities relationship.


      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
  7. Great post. You share good information and really impressive.
    Thanks for sharing.
    host a website.

    ReplyDelete
  8. This is nice post with informative thanks for sharing...!
    seo services bangalore

    ReplyDelete
  9. Hi,
    I am a new to diameter protocol. I am trying to implement a client that will send messages/ request to a diameter server, I used an online java api to make connection to the server, I managed to send a CER and Receive a CEA. The next step is to send CCR that I unable to achieve. Is there anyone that did something similar? I really need help on this. Thanks

    ReplyDelete
    Replies
    1. Hi Cuniah,

      kindly share the configuration. and elaborate your issue. Are you unable to receive response or unable to send from your client.

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. can we send Vendor-specific-id also in CCR. Will it be of any importance?

    ReplyDelete
  12. Without a successful CER , can a CCR be successful?

    ReplyDelete
    Replies
    1. It is not correct/possible to exchange any message, without successful CER-CEA handshake.

      Delete