Commit graph

30 commits

Author SHA1 Message Date
Felix Walter
229f884a57 python-ud3tn-utils: Introduce JSON configuration format
This introduces a JSON contact configuration format for the
deterministic first-contact forwarding (DFCF) implementation as a modern
alternative to our homebrewn configuration messages. For now, it is only
supported in the external DFCF BDM, but integration into the "router
agent" is planned.

Example JSON configuration string (from our tests):

```
{

    "command": "ADD",
    "node_id": "dtn://ud3tn2.dtn/",
    "cla_addr": "mtcp:127.0.0.1:4223",
    "reachable_eids": [
        "ipn:1.0"
    ],
    "contact_list": [
        {
            "start": 1401519306972,
            "end": 1401519316972,
            "data_rate": 2400,
            "reachable_eids": [
                "dtn://66553/",
                "dtn://89326/"
            ]
        },
        {
            "start": 1401519506972,
            "end": 1401519516972,
            "data_rate": 1200,
            "reachable_eids": [
                "dtn://12349/",
                "dtn://89326/"
            ]
        }
    ]
}
```

Closes: #15

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2025-06-05 17:03:39 +02:00
Felix Walter
2fd0556f6c test: storage: Improve log output and enforce showing memory leaks
This makes the test show *all* logs in a sensible order and also enables
the display of memory leaks plus backtrace in case ASAN with leak checker
is active.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-30 15:54:28 +02:00
Felix Walter
4e40890c57 test: sqlite: Add test for storage persistence across restarts
This restarts µD3TN and the BDM after sending a bundle and triggers
sending it again after restarting both services.

Closes: #222

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-09-27 13:29:01 +02:00
Felix Walter
87be9749af Re-integrate v0.13.0 routing code as "integrated default BDM"
This makes µD3TN behave the same as v0.13.0 when executed without an
additional commandline argument. A new commandline argument `-d` /
`--external-dispatch` is added, which enables the use of external BDMs.
The default forwarding implementation is now again provided using the
v0.13 code, extracted from e1621765a4 and
adapted to the new agent-based forwarding implementation.

Central changes to the old code include:

- A new "Routing Agent" that handles incoming configuration commands,
  FIB updates, and BDM dispatch requests.
- The use of the BDM authorization flag to authorize contact
  configuration commands.
- The Contact Manager now only triggers the creation and removal of
  links / FIB entries; bundle dispatch is triggered through the FIB and
  BDM callback functions of the Routing Agent.
- The fragmentation logic is adapted to store the original bundle along
  with an offset and length value, instead of pre-creating and storing
  the fragments.
- The bundle re-scheduling logic integrated into the Routing Agent is
  simplified and does not support changing the fragmentation parameters.
  A new function is added to the Router that searches for a new route
  for such fragments that were already scheduled at some point,
  considering them as un-fragmentable bundle with overridden fragment
  offset and length.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-07-15 00:46:14 +02:00
Felix Walter
d9da044a01 test: Give uD3TN some time to start before launching BDM
Otherwise it might crash in some rare cases because the socket is not yet
ready.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-07-04 16:03:31 +02:00
Maximilian Nitsch
facd5246b7 test/sqlite_storage: Use run_aap_recv from python-ud3tn-utils package
Use the `run_aap_recv()` function from the python-ud3tn-utils package
instead of copying the code.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-07-01 10:10:56 +02:00
Maximilian Nitsch
3ba8281796 treewide: Use python-ud3tn-utils scripts instead of those from tools/
Changes all occurrences of the old script paths from tools/ to the
scripts installed by python-ud3tn-utils.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-07-01 10:10:56 +02:00
Maximilian Nitsch
fa6d159d10 python-ud3tn-utils: Add AAP + AAP2 tools
- Moves `tools/aap` + `tools/aap2` to `python-ud3tn-utils/aap*/bin/` to
  add the scripts to the python package
- Adds a `main()` function to each script to reference it
- Define `logger` as global variable
- Adds a symbolic link to keep compatibility with existing tooling
- Moves `tools/aap/aap_test.py` to `test/functional/`
- Adds additional dependencies (pyd3tn, cbor) to python-ud3tn-utils and
  the corresponding nix package
- Add scripts to python-ud3tn-utils `pyproject.toml`

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-07-01 10:10:56 +02:00
Felix Walter
63ea25e52a CI: Fix configuration for compat. BDM in integration tests
We must either allow accepting configuration from an external source or
use the AAPv2 method with authentication for the integration tests to
work. This uses one of both approaches in each of the tests, so both are
also validated to work.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-26 13:32:28 +02:00
Maximilian Nitsch
ed6bdcbf96 SQLiteCLA: Support volatile in-memory database
Adds support for a volatile in-memory database by enabling support for
URI-based database file names. Since the in-memory DB can only be
accessed within the process, the integration tests are changed so that
external SQL queries are only performed when a persistent DB file is
used.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-26 09:28:45 +02:00
Felix Walter
e2e7133195 test/storage: Set timeout for Python script to recognize blocking
In rare cases the script blocked until it was killed in CI, preventing
uD3TN logs to be printed. We thus add a reasonable timeout to terminate
it proactively in case of blocking, so we can examine the logs.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-21 11:16:07 +02:00
Felix Walter
52de7a57f8 test: sqlite: Remove unused function
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-21 10:36:30 +02:00
Felix Walter
c5bf1b9fee test/functional: Adapt storage test to new behavior
This makes the storage test operate in conjunction with the AAP 2.0
compatibility BDM:

- A compat. BDM is launched for storage_agent_bundle_id_test.py
- storage_agent_bundle_id_test.py now does not manually push and delete
  bundles but rather checks the database contents at different stages of
  bundle handling through the BDM.
- aap2_storage_agent_metadata_test.sh is adapted such that it uses the
  static dispatcher to move bundles in and out of storage and check the
  DB contents in between

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-21 10:36:30 +02:00
Felix Walter
df07327bef CI: Improve debug output in integration tests
- Make `timeout` verbose: pass `-v` so we see when the operation timed
  out.
- Check for clean exit only *after* printing the logs: We should be able
  to see the logs even if uD3TN crashes.
- Increase log verbosity.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-21 10:36:30 +02:00
Felix Walter
3a905cdbb6 CI: Enable compat. dispatcher in integration tests
This starts the compat. BDM so the tests can work again.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2024-06-21 10:36:30 +02:00
Maximilian Nitsch
c3620663ba test: Add Bundle ID based storage agent test
Test to verify that the identification of bundles based on their unique
bundle ID works within the storage CLA and the agent.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Maximilian Nitsch
85ca529b4d aap2_storage_agent: Add compound-bundle-id argument
To identify a specific bundle, a command line argument is added to
specify the composite bundle ID based on source, destination, creation
timestamp, sequence number, fragment offset and payload length.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Maximilian Nitsch
4fa34c69b3 SQLiteCLA+Agent: Execute select statement in CLA
To eliminate potential race conditions where rows are deleted before the
CLA processes them, the select statement is moved from the agent to the
CLA and everything is wrapped in a transaction to read all or nothing.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Maximilian Nitsch
57c1fe225c test/functional: Add SQLite storage test
Adds a simple test to the CI to check if the SQLite storage is working
properly.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2024-06-03 13:41:58 +02:00
Felix Walter
35c2e77e81 CI, test: Ensure there are no collisions with AAPv2 sockets
This always specifies the AAPv2 socket path so we ensure that no two
instances of uD3TN listen on the same AAPv2 socket in tests.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
01de2f7720 bibe_internal_forwarding_test: Wait for uD3TN to exit
This allows for capturing sanitizer warnings in the test and removes the
need to kill all uD3TN instances (just those launched by the test).

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-11 16:54:50 +02:00
Felix Walter
279ba8463e bibe_internal_forwarding_test: Do not recreate venv
This adapts the BIBE test to the behavior of the other functional tests
(ION interoperability), expecting the dependencies to be present when
run. The CI config is adapted to use the prepared Docker image,
preventing reinstallation of Python dependencies during the CI job.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-11 16:54:50 +02:00
Felix Walter
2fc9c6c03e aap_receive, tests: Print a line feed after every received bundle
This makes the testing logs prettier and may help in decoding the
responses received by aap_receive.py.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-10 14:37:11 +02:00
Felix Walter
8c4ce47724 CI: Remove stdbuf statements from tests
We do not need this anymore due to making logging line-buffered and it
collides with ASAN in some cases.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-10 14:37:11 +02:00
Felix Walter
cc4c79848b CI: Run unit and integration tests with sanitizers
This enables ASAN and UBSAN in our unit and integration tests.
Another integration test using the thread (data race) sanitizer is added
to detect such issues as well.

The tests are extended such that they wait for uD3TN (all instances if
we launch multiple ones) to terminate, to allow for exit checks of
sanitizers to run. For example, ASAN and the thread sanitizer make use
of this and we need to obtain the exit status code to tell whether the
CI job succeeded or not.

Note that memory leak detection is turned off in the unit tests as they
do not properly deallocate temporary variables, see: #104

aap_send and aap_receive are always invoked with `-v` to get more
information on what happens there in the tests.

Fixes: #55

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-10 14:24:31 +02:00
Georg Alexander Murzik
298431c68f Insert SPDX license expression comments into our .c, .h, .py, and .sh code
ud3tn is available under multiple licenses and we want to reflect this in
our source code. But which license information should appear first and how
can we manage this efficiently in the future? The Linux Kernel uses SPDX
expressions instead of boilerplate sections. This seems to be a great
approach, so we do the same here.

Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
2022-02-20 16:24:38 +01:00
Felix Walter
53fdb0d691 test: BIBE: Show logs of all instances at the end
Otherwise debugging of CI errors becomes difficult.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-01-28 10:55:38 +01:00
Felix Walter
7c10d22b32 test: BIBE: Add trailing slashes to dtn EIDs without demux
As per the BPv7 specification.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-01-28 10:55:38 +01:00
Tobias Nöthlich
d61d98d589 Rename µD3TN-only BIBE forwarding test
This commit renames the functional test bibe_forwarding_internally_test
to bibe_internal_forwarding_test. It also adds a short description of
what the test is about at the top of the run.sh file in the test direc-
tory.

Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
2022-01-10 10:22:37 +01:00
Tobias Nöthlich
fd7a4f7ce6 Add functional and unit tests
This commit adds two tests regarding Bundle-in-Bundle Encapsulation.
The first test starts four µD3TN instances and tests whether sending
and receiving BIBE messages works as expected, whereas the second
test specifically checks the encoding of BIBE messages by the
bibe_proto.c file.

Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
2021-12-15 16:18:07 +01:00