Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 2.51 KB

README.md

File metadata and controls

49 lines (33 loc) · 2.51 KB

How to run a simple Diameter class example

Trace

This folder has two Python modules. The first one implements a HSS with the Diameter class and the second one implements a MME with the Diameter class as well.

As you may see, the MME module has been implemented as Client whereas HSS module has been implemented as Server. That's true for the CEX procedure point of view.

That means HSS module must be ran first in order to listen to connections on 3870.

$ python3 examples/diameter-app1/diameter_hss.py
  * Running Diameter app (3GPP S6a) on 127.0.0.1:3870 as TCP SERVER mode (CEX)

Then MME module may be ran to start the CEX procedure and exchange capabilities.

$ python3 examples/diameter-app1/diameter_mme.py
  * Running Diameter app (3GPP S6a) on 127.0.0.1:3868 as TCP CLIENT mode (CEX)

You will notice the CLI will print a new output informing both network elements have been connected to each other. Few seconds later a new output informing both network elements have finally disconnected then - that is, a Disconnecting Peer Connection procedure has been issued by the MME.

HSS module output

$ python3 examples/diameter-app1/diameter_hss.py
  * Running Diameter app (3GPP S6a) on 127.0.0.1:3870 as TCP SERVER mode (CEX)
  * Diameter connection on 127.0.0.1:3870 is now up
  * Diameter connection on 127.0.0.1:3870 is now down

MME module output

$ python3 examples/diameter-app1/diameter_mme.py
  * Running Diameter app (3GPP S6a) on 127.0.0.1:3868 as TCP CLIENT mode (CEX)
  * Diameter connection on 127.0.0.1:3868 is now up
  * Diameter connection on 127.0.0.1:3868 is now down

Between the two last outputs in both CLI, a Update-Location-Request message has been sent from MME to HSS, which in turns replied with a successful Update-Location-Answer.

Try to capture your localhost network interface or open up the trace.pcap file. Take a look at both diameter_hss.py and diameter_mme files to understand the bromelia dynamics and figure out how to use it for your own project.

Moreover, bromelia supports both TCP and SCTP transport protocols. By default, TCP is set as the primary option. However, you have the flexibility to switch to SCTP by configuring the TRANSPORT_TYPE key. Check it out the examples.

By the way, the How to build your Diameter application: The 1st way (Not that good) is also a good source of knowledge.