Ouroboros Tutorial 03

From Ouroboros
Revision as of 17:14, 5 November 2023 by Dimitri (talk | contribs)
Jump to navigation Jump to search
Ouroboros Tutorial 03

Ouroboros can be configured using a config file in TOML format.

Copy/paste the text below and store it as a file, we named it tut03.conf and saved it in /etc/ouroboros/, which is the default used for O7s configurations.

###  Ouroboros configuration file Tutorial 03
[name.oping-server]
prog=["/usr/bin/oping"]
args=["-l"]

[local.local-ipcp]
bootstrap="local-layer" 
reg=["uni-1", "uni-2", "unicast-layer"]

[unicast.uni-1]
bootstrap="unicast-layer"
autobind=true
reg=["oping-server"]

[unicast.uni-2]
enrol="unicast-layer"
conn=["uni-1"]

Instead of logging to standard output, we will use the system log, which is Ouroboros' default. Use your preferred way to view the system log. We use journalctl

$ sudo journalctl -t irmd -f

In a different window, start the irmd reading the config file:

$ sudo irmd --config /etc/ouroboros/tut03.conf

This will load the configuration and will set up the same network that we created in the second tutorial.

Now, we will ping an oping server from the client over that unicast-layer. In the previous two tutorials, we first started the server, but O7s can start a server automatically. This is the auto feature of the irm bind program CLI tool. In the configuration file, this feature is enabled by specifying an args line for a service name. In our configuration example, we defined that the service name oping-server is bound to program /usr/bin/oping and can be automatically started if needed with the argument -l (which is short for --listen).

Just start a client towards oping-server:

$ oping -n oping-server -c 10
Pinging oping-server with 64 bytes of data (10 packets):

64 bytes from oping-server: seq=0 time=1.223 ms
64 bytes from oping-server: seq=1 time=0.885 ms
64 bytes from oping-server: seq=2 time=0.988 ms
<snip>
64 bytes from oping-server: seq=9 time=0.819 ms

--- oping-server ping statistics ---
10 packets transmitted, 10 received, 0 out-of-order, 0% packet loss,  time: 10003.173 ms
rtt min/avg/max/mdev = 0.705/0.877/1.223/0.144 ms

The window where we started the IRMd will log the server output:

Ouroboros ping server started.
New flow 64.
Received 64 bytes on fd 64.
Received 64 bytes on fd 64.
<snip>
Received 64 bytes on fd 64.
Flow 64 timed out.

When the IRMd auto-instantiates a program, it will log the following:

Nov 05 17:58:38 phonetria irmd[3820]: Flow request arrived for oping-server.
Nov 05 17:58:38 phonetria irmd[3820]: Instantiated /usr/bin/oping as process 3961.