Skip to content

Commit

Permalink
showcases/voip: split omnetpp.ini into voipsender.ini and voipreceive…
Browse files Browse the repository at this point in the history
…r.ini
  • Loading branch information
avarga committed Feb 26, 2024
1 parent 8177381 commit 3309caf
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 61 deletions.
29 changes: 20 additions & 9 deletions showcases/emulation/voip/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,15 @@ First, run the following command on the receiver side:

.. code-block:: bash
$ inet -u Cmdenv -c VoipReceiver
$ inet -u Cmdenv voipreceiver.ini
Once the receiver is running, enter the following command on the sender side
(replace ``10.0.0.8`` with the IP address of the host the receiver side is
running on):

.. code-block:: bash
$ inet -u Cmdenv -c VoipSender '--*.app.destAddress="10.0.0.8"'
$ inet -u Cmdenv voipsender.ini '--*.app.destAddress="10.0.0.8"'
That's all. When the receiver-side simulation exits, you'll find the received
audio file in ``results/received.wav``. You may need to raise the CPU time limit
Expand All @@ -193,8 +193,8 @@ You can run this scenario in the same way as the previous one, just specify

.. code-block:: bash
$ inet -u Cmdenv -c VoipReceiver &
$ inet -u Cmdenv -c VoipSender '--*.app.destAddress="127.0.0.1"'
$ inet -u Cmdenv voipreceiver.ini &
$ inet -u Cmdenv voipsender.ini '--*.app.destAddress="127.0.0.1"'
Loopback Interface with Realistic Network Conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -256,17 +256,26 @@ In the simulation configurations, we need to tell the :ned:`ExtLowerUdp` modules
to use the ``net0`` / ``net1`` namespaces, and set the sender's ``destAddress``
parameter to ``192.168.2.2``.

.. literalinclude:: ../omnetpp.ini
In ``voipsender.ini``:

.. literalinclude:: ../voipsender.ini
:language: ini
:start-at: VirtualEth
:end-at: net0

In ``voipreceiver.ini``:

.. literalinclude:: ../voipreceiver.ini
:language: ini
:start-at: VoipSenderVirtualEth
:start-at: VirtualEth
:end-at: net1

You can run the simulations with the following commands:

.. code-block:: bash
$ inet -s -u Cmdenv -c VoipReceiverVirtualEth &
$ inet -s -u Cmdenv -c VoipSenderVirtualEth
$ inet -s -u Cmdenv voipreceiver.ini -c VirtualEth &
$ inet -s -u Cmdenv voipsender.ini -c VirtualEth
When you are finished, you can remove the virtual Ethernet interfaces by
deleting the namespaces with the following commands (also to be run as *root*):
Expand Down Expand Up @@ -317,7 +326,9 @@ The quality would be nearly as good as the original file. (To reduce burstiness
and keep the packet order, a data rate can be specified in the ``netem`` command,
e.g. ``rate 1000kbps``. This eliminates reordering in this scenario.)

Sources: :download:`omnetpp.ini <../omnetpp.ini>`, :download:`AppContainer.ned <../AppContainer.ned>`,
Sources: :download:`voipsender.ini <../voipsender.ini>`,
:download:`voipreceiver.ini <../voipreceiver.ini>`,
:download:`AppContainer.ned <../AppContainer.ned>`,
:download:`run_loopback <../run_loopback>`, :download:`run_veth <../run_veth>`,
:download:`veth_setup <../veth_setup>`, :download:`veth_teardown <../veth_teardown>`

Expand Down
4 changes: 3 additions & 1 deletion showcases/emulation/voip/doc/mininet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ Here is the received audio file:

The quality of the received sound is degraded compared to the original, due to the loss and jitter of the link.

Sources: :download:`omnetpp.ini <../omnetpp.ini>`, :download:`AppContainer.ned <../AppContainer.ned>`,
Sources: :download:`voipsender.ini <../voipsender.ini>`,
:download:`voipreceiver.ini <../voipreceiver.ini>`,
:download:`AppContainer.ned <../AppContainer.ned>`,
:download:`run_mininet.py <../run_mininet.sh>`

Discussion
Expand Down
4 changes: 2 additions & 2 deletions showcases/emulation/voip/mininet-veth.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
info('*** Starting INET simulations\n')
# Note: sudo is needed because Mininet runs as root, but we want to run the simulation as the normal user.
# We also need to restore the original PATH which is overwritten by 'sudo'.
h1.cmd('sudo -E -u $SAVED_USER bash -c "export PATH=$SAVED_PATH && inet -s -c VoipSenderMininet &"')
h2.cmd('sudo -E -u $SAVED_USER bash -c "export PATH=$SAVED_PATH && inet -s -c VoipReceiverMininet &"')
h1.cmd('sudo -E -u $SAVED_USER bash -c "export PATH=$SAVED_PATH && inet -s voipsender.ini -c Mininet &"')
h2.cmd('sudo -E -u $SAVED_USER bash -c "export PATH=$SAVED_PATH && inet -s voipreceiver.ini -c Mininet &"')

info('*** Running CLI\n')
CLI(net)
Expand Down
45 changes: 0 additions & 45 deletions showcases/emulation/voip/omnetpp.ini

This file was deleted.

4 changes: 2 additions & 2 deletions showcases/emulation/voip/run_loopback
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ cleanup 2>/dev/null
sudo tc qdisc add dev lo root netem loss 1% corrupt 5% delay 10ms 1ms || exit 1

# run the simulations
inet -s -u Cmdenv -c VoipReceiverLoopback &
inet -s -u Cmdenv voipreceiver.ini -c Loopback &
sleep 1
inet -s -u Cmdenv -c VoipSenderLoopback || exit 1
inet -s -u Cmdenv voipsender.ini -c Loopback || exit 1
wait


4 changes: 2 additions & 2 deletions showcases/emulation/voip/run_veth
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ cleanup 2>/dev/null
sudo ./veth_setup || exit 1

# run both simulations
inet -s -u Cmdenv -c VoipReceiverVirtualEth &
inet -s -u Cmdenv -c voipreceiver.ini -c VirtualEth &
sleep 1
inet -s -u Cmdenv -c VoipSenderVirtualEth || exit 1
inet -s -u Cmdenv -c voipsender.ini -c VirtualEth || exit 1
wait

16 changes: 16 additions & 0 deletions showcases/emulation/voip/voipreceiver.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[General]
network = AppContainer
scheduler-class = "inet::RealTimeScheduler"
sim-time-limit = 50s
*.app.typename = "VoipStreamReceiver"
*.app.localPort = 60001
*.app.resultFile = "results/received.wav"

[Config Loopback]
# unchanged

[Config VirtualEth]
*.udp.namespace = "net1"

[Config Mininet]
# unchanged
24 changes: 24 additions & 0 deletions showcases/emulation/voip/voipsender.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[General]
network = AppContainer
scheduler-class = "inet::RealTimeScheduler"
sim-time-limit = 47s
*.app.typename = "VoipStreamSender"
*.app.packetTimeLength = 20ms
*.app.codec = "pcm_s16le"
*.app.sampleRate = 32000Hz
*.app.voipHeaderSize = 40B
*.app.voipSilenceThreshold = 100
*.app.repeatCount = 2
*.app.soundFile = "Beatify_Dabei_cut.mp3"
*.app.localPort = -1
*.app.destPort = 60001

[Config Loopback]
*.app.destAddress = "127.0.0.1"

[Config VirtualEth]
*.app.destAddress = "192.168.2.2"
*.udp.namespace = "net0"

[Config Mininet]
*.app.destAddress = "192.168.2.2"

0 comments on commit 3309caf

Please sign in to comment.