Adds protobuf Python language bindings and a build target to create them
to the python-ud3tn-utils package.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
This makes AAP2Client.send() write everything to the socket at once to
better leverage OS optimizations (e.g. if Nagle is disabled we would
send 2 packets otherwise). Also it prevents our tests for the connection
closing behavior of AAP 2.0 for failing randomly because of a race
between the two send() operations and cloding the AAP socket from uD3TN
side.
See: #188Fixes: #188
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- pyd3tn: Fix pinned cbor version
- python-ud3tn-utils: Update protobuf to version 2.24.4
- tools: Update flake8 to version 6.1.0
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
On some platforms, notably macOS, the `shutdown()` methos will return an
error when the socket is not connected anymore. This raises an exception
if we use an `AAP2Client` in a `with` block and the connection is
terminated before the end of the block, e.g., because the peer closed
it. This commit changes the behavior such that any `OSError` raised by
the `shutdown` method is ignored (it is just there to cleanly signal
termination to the other end anyway and if this is not possible it is
unnecessary).
Fixes: #174
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
protobuf==4.21.12 requires python>=3.7[^1]. To resolve the version
conflict between μD3TN and the protobuf package, the required minimum
Python version is set to >=3.7.
[^1]: https://pypi.org/project/protobuf/4.21.12/Closes: #153
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
Since protobuf==4.24.4 is not (currently) part of nixpkgs, but
protobuf==4.21.12, the pinned version is changed to reduce the effort
for packaging version 4.24.4 itself.
The protobuf Python language bindings have been regenerated to
incorporate the changes from the modified version.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
This adds proper docstrings including documenting return values and
exceptions for the `aap2_client` module.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
- remove comments on "callback-style" serialization (not needed)
- define magic number in Python AAP 2.0 client via descriptive var
- make `secret` in Python AAP 2.0 client a private variable (used
nowhere else and should not be a class property)
- add missing Python docstrings
- add some comments explaining behavior
- language enhancements and fixes in docs and comments
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
There might be incompatible changes in those messages before their
public release. As we only support basic send/receive functionality over
AAPv2, we do not need to include the definitions of other messages.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This defines exception classes for specific types of errors that may
occur within the AAPv2 client, so we can drop the assert statements and
the user of the client can handle errors appropriately.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
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>
If there is already an agent registered for the other direction of
communication, registration will fail as long as the provided secrets do
not match.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
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>
This adds a DispatchRequest message containing a DispatchReason in
extension to the bundle headers. By that we can pass more information to
the BDM about why the dispatch request was triggered and have it
extensible in the future.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
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>
See the added description in the AAP documentation - this adds an
internal format to the 64 bit integer value returned as "bundle ID" in
the `SENDCONFIRM` AAP message to uniquely identify the created bundle in
conformance to RFC 9171.
Closes: #60
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This provides two new Dockerfiles for testing, one just containing ION
and one with an additional Python3 virtual environment for
interoperability testing.
Additionally, two scripts are provided:
* build_docker_images.sh: build images that can be pushed to the
registry and then used by the CI toolchain
* prepare_for_test.sh: a script to be run inside a newly created Docker
container based on the provided `ion-interop` image, to build uD3TN
and add the Python modules from the uD3TN source tree efficiently
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
The AAP client class prints some log messages, but we do not want them
to be printed by default if we turn on INFO logging. This uses
`logger.debug` instead.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
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>
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>
-> https://datatracker.ietf.org/doc/html/draft-ietf-dtn-bpbis-31#section-4.2.5
The previous validation methods were not sufficient to check validity of
dtn as well as ipn EIDs. This adds further functions to easily detect
the EID scheme and validate dtn plus ipn EIDs. Tests for the most common
cases where validity checks should be successful and where they might
fail are added as well.
Due to this change the default EID of uD3TN gets a slash appended, as
dtn EIDs always have to contain the name delimiter '/'.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
Previously uD3TN implicitly assumed string EID in many places such as
the agent manager. This adds proper handling for ipn-scheme EIDs,
using numerical service numbers as agent IDs in case uD3TN is started
with an ipn-scheme EID. If the ipn scheme is used, uD3TN always has to
be configured with the service number 0. The config and management agent
IDs can be configured in config.h and are 9000 and 9001, respectively,
to keep the lower range of service numbers free. It is intentional that
agents can register with a service number of zero - uD3TN does not
provide specific functionality under this service number.
Signed-off-by: Felix Walter <felix.walter@d3tn.com>
This commit fixes typos and indentation issues and simplifies parts
of the bundle7.py, aap_message.py and aap_receive.py files.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
This commit remedies code smells introduced to pyd3tn and the python
tools while implementing the BIBE CLA.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
This commit modifies aap_send.py, aap_receive.py and aap_client.py to
allow for sending SENDBIBE messages using the Python uD3TN utils.
The clear distinction between regular SENDBUNDLE messages and SENDBIBE
messages allows for a rework of the crude check of the message type
performed in aap_receive.py, which is also implemented by this commit.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
To facilitate testing of AAP BIBE reception in uD3TN, this commit adds
the functionality for sending SENDBIBE messages using aap_client.py.
Signed-off-by: Tobias Nöthlich <tobias.noethlich@d3tn.com>
By changing the default UNIX socket path to PWD in !11, the default
parameters for the AAP tools are adapted accordingly.
Closes: #51
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
All additional spaces for aligning assignments to equals signs are
removed because they are not PEP8 compliant.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
To distribute the pyD3TN DTN protocol implementations as well as the
uD3TN python utilities on PyPi, the Python code is organized in separate
directories and the PyPi packaging guideline is applied. The
restructuring also requires an adjustment of the imports in the scripts
in tools/ and test/.
Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>