Commit graph

73 commits

Author SHA1 Message Date
Felix Walter
dfbec5d175 tools/analysis: Pin Python package versions
See also: #145

This ensures that the analysis jobs will not break in the future.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-09 14:33:48 +01:00
Felix Walter
5e6cfb5f7e tools/aap2: Move keepalive argparse argument to common helpers
We now perform the range check via argparse and provide a function to
add the parser argument like with other common parser arguments.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:53 +01:00
Felix Walter
aef2b668c6 style: Fix style of typedef usage in aap2_client.c
This adds the AAP 2.0 typedefs to the checkpatch list, so it will not
complain about style when declaring a variable or function argument as
`<typedef> *const <name>`.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:53 +01:00
Felix Walter
036545f0d9 aap2: Implement keepalive for receiving bundles in Python tooling
This adds the option to enable keepalive messages for AAPv2 in the
aap_receive and aap_ping tooling, so that the AAPv2 connections stay
alive until bundles are received.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
b7461b6a01 tools/aap2: Remove code redundancy in aap2_receive.py
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
a0b2fe8909 aap2: Receive response from bundle subscribers
We specify AAP 2.0 to be an RPC protocol whereas the direction of calls
can be switched during configuration. Each call needs to be answered.
This change adds the answer for bundle reception by a client.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
346387eb7e tools/analysis: Adapt checks to new files and directories
- We have files generated from Protobuf in the codebase, which do not
  contain the license header.
- We have a new component directory (`aap2`).
- The license header check is extended to the `proto` and `options`
  files.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
a81f481e22 python-ud3tn-utils, tools: Add basic AAP2 tooling (send, receive, ping)
This adds adapted versions of `aap_send.py`, `aap_receive.py`, and
`aap_ping.py` for AAP2 and implements the required client classes in
the `ud3tn_utils` module.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
1dd5961bc4 Add AAP 2.0 component stub with Protobuf support via Nanopb
This adds the Nanopb library as submodule under `external/` and adds
corresponding build configuration to the Makefiles. Additionally, a
Protobuf stub for AAP 2.0 is included along with a `make` target to
build the corresponding C language files (`aap2-proto-headers`).

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-11-08 15:11:52 +01:00
Felix Walter
2a10d81b37 stylecheck: Enable strict mode partially
This enables a set of "strict" diagnostics from `checkpatch.pl` but
disables some that would cause excessive refactoring or do only apply to
the Kernel.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-07-25 13:15:05 +02:00
Felix Walter
92a5e7f680 stylecheck: Update line length and ignored checks
This...
- sets the line length limit to 100 chars in accordance with the new
  Linux kernel line length limit
- ignores things we have no control or which do not apply to us: camel
  case (used via TinyCBOR, simplequeue, and FreeRTOS), and macros and types
  we have not implemented (things only part of the Linux kernel)

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-07-25 13:15:05 +02:00
Felix Walter
f2fc65c33f
Merge branch 'feature/fuzzer-binary'
See !91
2023-07-14 10:09:47 +02:00
Oleksandr Nazymko
e859d16c47 Terminate after sending all bundles, edit description
The program waits only if timeout parameter is specified otherwise it terminates right after sending all ping bundles. Also edits argument description.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2023-06-02 13:00:07 +02:00
Oleksandr Nazymko
38e6bbcc02 Add timeout argument for aap_ping.py
This adds a timeout argument for `aap_ping.py`. If specified the program will
wait the defined time after sending all bundles and then stop.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2023-05-17 17:13:58 +02:00
Felix Walter
e16ec4c579 Enable building a BPv7 decoder binary
This adds a target `data-decoder` which builds a binary to decode a
specified binary file using uD3TN's parsing logic (based on the CLA RX
subsystem) and print details about it. In this first version only the
decoding of BPv7 bundles is implemented.

This binary can be used, e.g., for fuzz testing.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-16 11:34:14 +02:00
Oleksandr Nazymko
06b937452c Add code coverage report
This integrates code coverage report into gitlab CI. Also adds an option for generating code coverage
report after running unit tests to the Makefile.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2023-05-12 11:30:27 +02:00
Felix Walter
afb91e562c tools/analysis: Exclude clang-analyzer-valist checks in clang-tidy
There is a false positive in clang-tidy that keeps happening in various
places. I checked all usages of valist and they are properly allocated,
used, and freed anytime. This disables the broken checks.

Note the removed single quotes around the extra arguments to clang-tidy:
bash somehow double-quoted the arguments when adding these and
clang-tidy did not process the filter consequently (checked via set -x).

See: https://github.com/llvm/llvm-project/issues/40656
See: https://github.com/llvm/llvm-project/issues/55009
See: https://reviews.llvm.org/D124239

Fixes: #117

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-11 17:08:39 +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
71fb7e2b24 Make Clang check script more flexible and fix clang-tidy job
This allows the user to specify the checker binary and fixes the
"clang-tidy" CI job by using a newer version and directly invoking the
script.

Fixes: #43

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-10 11:22:51 +02:00
Felix Walter
3d619b126a Add sane behavior in release build where debug triggers assertion
This will gracefully handle cases where a debug build would abort the
program.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-05-10 11:22:51 +02:00
Felix Walter
113968a4d6 aap_test.py: Pass aap_client variable explicitly
This is much cleaner than implicit operation via the global variable
inside the `with` statement.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-02-23 17:19:22 +01:00
Felix Walter
9c1a437dd7 pyd3tn: Do not specify the event loop in the async TCPCLv3 client
The argument has been deprecated in newer Python versions.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2023-01-30 18:00:17 +01:00
Felix Walter
729338ba73
Merge branch 'hotfix/aap-send-bibe'
See !73
2022-11-23 12:22:39 +01:00
Felix Walter
f0ba0b086e tools: aap_send: Reduce code duplication
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-14 10:42:51 +01:00
Felix Walter
62dffc0af6 tools: aap_send: Fix generation of BIBE bundles
Previously we were sending the whole outer bundle binary data, however,
the AppAgent expects only the BPDU binary data.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-14 10:41:24 +01:00
Felix Walter
0251abfa14 Replace usage of deprecated Logger.warn method
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-11 11:28:47 +01:00
Felix Walter
86bc28c205 aap_ping: Make log message about unknown bundle a warning
We register an own endpoint for the ping, so can expect only ping
bundles to come back. If we receive anything else, it should be a warning.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-11 10:15:03 +01:00
Felix Walter
476422f9ff tools/aap: Allow aap_send and aap_receive to work with bytes
Sometimes we may send around data that are not UTF-8 encoded. These
previously led to a crash of aap_receive. Also, we could not easily
inject such data via aap_send, even when reading from stdin.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-09 12:33:01 +01:00
Felix Walter
ec196d8f76 tools/aap: Add tool to send and receive via the same AAP registration
We sometimes want to send a "request" bundle and receive a "response".
For this purpose, a combination of aap_send.py and aap_receive.py is not
always suitable, because the reception process can only be started with
a delay after the sending process.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-09 10:19:03 +01:00
Felix Walter
26abaaef9e tools/aap: Use proper logging facilities in tools
This adds a common function to initialize a logger from the Python
`logging` module and uses it in all tools (except aap_test.py, which is
deliberately kept minimal). Each tool chooses in its initialization
routine whether WARN or INFO is the default log level, simply by either
adding 1 to the verbosity parameter or not.

Messages that were previously printed to the terminal using print() are
changed into log statements.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-11-09 10:12:17 +01:00
Felix Walter
bf7b6c3fce
Merge branch 'feature/aap-contact-plan-reader'
See !59
2022-05-24 14:24:56 +02:00
Oleksandr Nazymko
d3c5de957b Add node number format check
Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2022-05-18 17:12:33 +02:00
Oleksandr Nazymko
46f07b6745 Change to ipn EID scheme form and edit readme
This changes the supported EID schemes format of uD3TN nodes
from `dtn` to `ipn' form according to the ION format. It also adds
small fixes and edits `readme_contact_plan_reader.md` file.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2022-05-15 12:14:05 +02:00
Oleksandr Nazymko
a2f4b9484e Simplify time parsing
This removes `parse_contact_time_span` and adds `create_contact` functions.
The last one converts time input in DTN timestamps for the ConfigMessage.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2022-05-13 11:35:08 +02:00
Oleksandr Nazymko
6eab5f9706 tools: Implement aap_contact_plan_reader and add readme.md for it
This implements the `aap_contact_plan_reader.py` Python tool that reads
contact plans in ION format and which configures the uD3TN nodes by
scheduling contacts between them. It also adds a small documentation on
how it can be used.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2022-05-12 10:30:41 +02:00
Felix Walter
3b18be70d5 tools: aap_test: Support socket options
Previously we only supported uD3TN's default settings (UNIX socket with
default name). This adds the same socket options as used by the other
AAP tools to aap_test.py.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-05-02 10:19:31 +02:00
Felix Walter
d41bab7f77 tools: Use getaddrinfo() for establishing TCP connections
This allows us to support IPv6 properly. A slight re-structuring was
necessary as we have to attempt multiple connections with different
sockets one after another. Thus, the socket instance is created in
connect() instead of __init__ and we use abc.ABC to prevent
instantiating the AAPClient without overriding the connect() method.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-05-02 10:19:31 +02:00
Felix Walter
76b3cabe9d
Merge branch 'feature/79-aap-ping'
See !54
2022-05-02 09:04:33 +02:00
Felix Walter
e5e7bb2810 tools: aap_ping: Fix displayed "expected" count when running with -c 0
When invoking aap_ping with the defaults (`--count 0`) the calculation
added in the previous commit is faulty as the minimum will always be
zero.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-04-26 10:59:08 +02:00
Oleksandr Nazymko
57a55f4623 Fix two typos and simplify the exception handling
Correct two typographical errors. Remove try ... except construct
to not drop all the details about the errors that may occur.

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2022-04-20 18:35:09 +02:00
Felix Walter
ec20046304 tools: Add a "count" argument to aap_ping
Like the well-known "ping" utility this gives aap_ping the capability to
stop operation after a specified number of bundles and report success or
failure (i.e., whether all sent bundles have been received) with its
exit status.

Note that the utility terminates latest after (count * (interval+1))
seconds - we cannot know until when a response is expected and, thus,
assume that the interval is chosen appropriately by the user.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-04-20 18:15:38 +02:00
Felix Walter
3739298f96 tools: Fix race condition in aap_ping
aap_ping did only handle SIGINT (KeyboardInterrupt) in case it was raised
during a receive operation. This moves the handler outside of the while
loop and moves the receiving code into a dedicated function.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-04-20 17:54:55 +02:00
Felix Walter
fe042358ac tools: Gracefully terminate aap_ping.py on errors
This prints an appropriate error message in case the connection to uD3TN
breaks and, additionally, gracefully terminates the sending thread which
would otherwise access an invalid file descriptor.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-04-20 17:22:31 +02:00
Oleksandr Nazymko
0de5650206 Implemented aap_echo function
It implements a simple AAP application that connects to a DTN-node and sends
an "echo" of the received bundles back to the sender. This tool works well with
a companion aap_ping function "ping" receiving "ping bundles" and sending
them back(like in the ICMP echos).

Resolves: #80
See also: #79

Signed-off-by: Oleksandr Nazymko <oleksandr.nazymko@d3tn.com>
2022-04-20 16:47:55 +02:00
Felix Walter
c18609b236 tools: Add a "ping" utility
This provides aap_ping.py, a simple tool to send bundles containing just
some information about when they were sent plus a sequence number.
The contained information is printed as soon as the bundles are received
back, similar to the "ping" utility for IP networks. This can be used to
check connectivity and proper operation of an AAP-capable bundle agent
(like uD3TN) and, in combination with a "bundle echo" tool, connectivity
to some arbitrary destination node.

Closes: #79

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-04-14 12:00:10 +02:00
Marius Feldmann
691b7c3172 Remove STM32/FreeRTOS support from uD3TN
Former releases of uD3TN have included support for STM32/FreeRTOS.
Having this support from the first moment on was a good thing in
order to optimize for platforms with limited resources. As this
platform is not used in current uD3TN setups and as it results in quite
some maintenance work, it is removed with this commit. The removed parts
cover the implementation itself, tests, tools, documentation, parts of
the build/make scripts as well as licensing information.

Signed-off-by: Marius Feldmann <marius.feldmann@d3tn.com>
2022-03-22 00:05:13 +01:00
Georg Alexander Murzik
e114bfcf84 Add license-check script and CI job
The script checks that the SPDX expression in LICENSE is present in
most of our source code files.

Signed-off-by: Georg Alexander Murzik <georg.murzik@d3tn.com>
2022-02-20 16:24:38 +01: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
56a97d0d24 tools: Use a more robust approach to determine the config endpoint ID
Previously we always used simple string concatenation. This change first
obtains the EID prefix representing the bundle node and, then, adds the
config endpoint to it.

Signed-off-by: Felix Walter <felix.walter@d3tn.com>
2022-02-01 12:51:18 +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