juniconnlib-core
This python library serves as core library (hence the name juniconnlib-core)
towards connecting all different kinds of components to a FIWARE based
infrastructure. For an overview of related projects, that are build on top
of juniconnlib-core, take a look at related projects.
The library is built ontop of the framework
AgentLib developed by the EBC
and RWTH Aachen and extends the functionality for interacting with the
FIWARE platform components. The main components allow for:
- Device provisioning at the IoT-Agent (JSON)
- Entity provisioning at the Orion Context Broker
- Sending and receiving messages from the IoT-Agent (JSON) using MQTT
- Posting subscriptions to the Orion Context Broker, with HTTP, MQTT or Kafka notifications
- Sending (HTTP) and receiving data (from subscriptions with MQTT notification) from the Orion Context Broker
- Working around JSON-Schema data models and creating devices and context entities from these
It contains various modules for device provisioning to FIWARE and data transfer between field devices and FIWARE.
Related Projects
juniconnlib-core serves as a base library for a multitude of other libraries. Most of the other projects work around the integration of different protocols and physical devices into the FIWARE architecture. Bundling everything that is necessary to communicate with FIWARE felt like a natural step, so related projects just need to implement use case specific functionality.
Notable related projects are:
- OPC UA Agent: A generalized protocol Adapter between OPC UA and FIWARE NGSIv2
- LoRaWAN Agent: A generalized protocol Adapter between LoRaWAN and FIWARE NGSIv2
- Messdas Agent: A protocol adapter, that integrates data from the commercial MESSDAS software into FIWARE NGSIv2
- And multiple other protocol converters (e.g. integration of different MODBUS devices into the FIWARE platform)
- FiLiP: A python API wrapper based on pydantic and requests for easy data validation a interaction with the FIWARE components
- FiDERe:
A library for parsing JSON schema data models that represent entities in
NGSIv2 normalized format, validating data and creating FiLiP compatible
ContextEntityandDeviceobjects.
Documentation
Documentation is available at
https://apps.fz-juelich.de/ice-1/ict-platform/juniconnlib-core and is
up-to-date with the most recent release. Building and publishing of the
documentation is done via CI/CD upon tag creation and commits to the main
branch.
In addition, you can find a complete demonstration of the intended usage of juniconnlib-core here
Installation
The package is named juniconnlib-core and is imported in Python as
juniconnlib_core.
There are multiple ways to install it:
- From PyPI (releases):
pip install juniconnlib-core
- From the GitLab package registry
(releases and development versions built from every branch):
pip install juniconnlib-core \ --extra-index-url https://jugit.fz-juelich.de/api/v4/projects/13185/packages/pypi/simple
Development versions (e.g.x.x.x.dev...) are pre-releases and can be installed either with--preto install the latest one or selected explicitly withjuniconnlib-core==<version>. - From the source code:
git clone https://jugit.fz-juelich.de/iek-10/public/ict-platform/fiware-applications/juniconnlib-core.git cd juniconnlib-core pip install .
Subscriptions with Kafka notifications need the according models of
FiLiP, which are only available from
version 0.7.6 onwards. That version is therefore a mandatory requirement of
juniconnlib-core, so no extra has to be installed for the Kafka
subscription handler to be available.
Note that Kafka notifications also impose a requirement on the server side:
the kafkaCustom notification is resolved by the Orion Context Broker
itself, which supports it only from version 4.3.0 onwards. Against an
older broker the Kafka subscription handler cannot be used, while all other
notification transports remain unaffected.
Tests
Testing is done automatically on commit using CI/CD, including integration tests for most things. A dedicated FIWARE cluster is instantiated inside the pipeline for that.
If you want to run tests locally install the optional dependencies
pip install .[test]
and make sure the ENV variables are set correctly. You can find an example
in ./tests/.env-example. Finally, run using pytest
pytest test_*.py
A bit more special is Keycloak. The FIWARE cluster running during each
pipeline does not include a Keycloak for authentication (as it takes too
long to start up). Yet still integration tests for Keycloak are available,
besides the obvious mocked ones.
The integration tests for Keycloak are marked with keycloakintegrationtest
and if you don't have keycloak credentials or are not using authentication
at all you can skip these tests by just executing pytest without the
marker:
pytest -m "not keycloakintegrationtest"
As an alternative if you don't set a value for the environment variable
KEYCLOAK_URL the integration tests are skipped by default.
Below you can see an overview of the environment variables used for all the
integration test.
| Name | Default Value | Description |
|---|---|---|
OCB_NOAUTH_URL |
http://orion:1026 |
Orion Context Broker (unauthenticated) URL |
OCB_AUTH_URL |
http://orion:1026 |
Orion Context Broker (authenticated) URL |
IOTA_NOAUTH_URL |
http://iot-agent-json:4041 |
IoT Agent (unauthenticated) URL |
IOTA_AUTH_URL |
http://iot-agent-json:4041 |
IoT Agent (authenticated) URL |
NOAUTH_FIWARE_SERVICE |
test_service |
FIWARE service header for unauthenticated requests |
NOAUTH_FIWARE_SERVICEPATH |
/ |
FIWARE service path for unauthenticated requests |
AUTH_FIWARE_SERVICE |
test_auth_service |
FIWARE service header for authenticated requests |
AUTH_FIWARE_SERVICEPATH |
/ |
FIWARE service path for authenticated requests |
KEYCLOAK_URL |
None |
Keycloak server URL, if not defined keycloakintegrationtests are skipped |
KEYCLOAK_CREDENTIALS_FILE |
<repo-root>/tests/configs/credentials_file.json |
Path to Keycloak credentials JSON file (must contain "username" and "password") |
BROKER_CREDENTIALS_FILE |
<repo-root>/tests/configs/credentials_file.json |
Path to broker credentials JSON file (must contain "username" and "password") |
OCB_CLIENT_ID |
orion |
Keycloak client ID for Orion Context Broker |
IOTA_CLIENT_ID |
iot-agent |
Keycloak client ID for IoT Agent |
KAFKA_URL |
None |
Kafka broker URL, if not defined the Kafka integration tests are skipped |
An example for how the content of a credentials file should look is found in
./tests/configs/credentials_file.json. That single file serves as the
default for both KEYCLOAK_CREDENTIALS_FILE and BROKER_CREDENTIALS_FILE;
point the respective variable somewhere else to use separate credentials.
Linting and Formatting
Linting runs as part of CI/CD and is not allowed to fail. The tools are
bundled in the optional lint extra:
pip install .[lint]
Contributing
Contributing to juniconnlib-core, and its related projects is highly appreciated. Contributions can take all kinds of forms, but in general everything should be done via this Repository or by contacting ice-1-fiware-admin@fz-juelich.de. If you are interested in using juniconnlib-core or its related project, feel free to reach out. In case of bugs or problems, don't be shy on raising issues or asking questions.
Metadata
Release files for juniconnlib-core 1.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| juniconnlib_core-1.4.2.tar.gz | 56.3 kB | Without provenance | Details for juniconnlib_core-1.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| juniconnlib_core-1.4.2-py3-none-any.whl | Python 3 | none | any | Details for juniconnlib_core-1.4.2-py3-none-any.whl |
Total release size: 118.0 kB
Release files / juniconnlib_core-1.4.2.tar.gz
| Download URL | juniconnlib_core-1.4.2.tar.gz |
|---|---|
| Size | 56.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63cb8124c199d0d5f4b46b2dc656a4cf2c793615cb4a8a8c58b94363ab8cf16b
|
|
BLAKE2b-256 checksum How to use checksums |
c57c518c8b3fa1d8870a92a0909f216f3091e4371ddd5aa50710528d0496abef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.15.2
|
Release files / juniconnlib_core-1.4.2-py3-none-any.whl
| Download URL | juniconnlib_core-1.4.2-py3-none-any.whl |
|---|---|
| Size | 61.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9aaa010dbd7c9f81f30be798829b6c11c48c9e3e3adcf1aa578460249161e8b7
|
|
BLAKE2b-256 checksum How to use checksums |
0d77ef69d3534f8a49433e5cc39193cc929b78fd9e563da603ee9f9dc05b8883
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.15.2
|
Security for juniconnlib-core 1.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.