GEISA API Mockup is designed to be able to run conformance tests. It aims to provide a mockup implementation of the GEISA Application Programming Interface as defined in the GEISA Specification.
The GEISA Specification is an effort by the Grid Edge Interoperability and Security Alliance to define a consistent, secure, and interoperable computing environment for embedded devices at the very edge of the electric utility grid, like electric meters and distribution automation devices, for the benefit of utilities, platform vendors, and software vendors. If you would like to get involved, please head over to our Wiki page for details on participation (https://lfenergy.org/projects/geisa/). Follow the onboarding link for details about participating in our community process.
To get started with the GEISA API Mockup application, you need to clone the repository and initialize the submodules.
git submodule update --init --recursiveTo build the GEISA API Mockup application, you need to have the following tools installed on your system:
- make
- pkg-config
- protobuf-compiler
- libmosquitto-dev
- libnanopb-dev
- nanopb (python package: pip3 install --break-system-packages nanopb)
A docker support is also available to launch the compilation, it requires:
- cqfd (See requirements and installation steps on github)
To build the GEISA API Mockup application using make, run the following command in the root directory of the project:
makeTo build the GEISA API Mockup application using cqfd, run the following command in the root directory of the project:
cqfd runTo be able to build the application for arm64 architecture, so that you can test directly on an arm64 device, you can use the following commands:
cqfd -b build_arm64 init
cqfd -b build_arm64To launch the GEISA API Mockup application, simply run the following command:
./gapiLinting is done using clang-tidy and formatting using clang-format.
To lint and format the GEISA API Mockup application code, run the following
command:
make lintor with cqfd:
cqfd -b lintTo validate the GEISA API Mockup application easily, a test script has been done to print some of the informations received. The test script is compiled at the same time as the application and is available in the build directory. After launching the test application, you can run the following command to trigger API calls:
- To test the discovery API:
mosquitto_pub -u testapp -P testapp -h localhost -t geisa/api/platform/discovery/req/testapp -f /tmp/discovery.binpb- To test the manifest API:
mosquitto_pub -u testapp -P testapp -h localhost -t geisa/api/app/manifest/req/testapp -f /tmp/manifest.binpb- To test the waveform API:
- First, you need to create the binpb file with the information you want, for example:
printf 'stream_id: "api-mockup-waveform"\nrequest_type: 1\n' | protoc --encode=GeisaWaveform_Req waveform.proto > waveform.binpb- Then, you can trigger the API call with the following command:
mosquitto_pub -u testapp -P testapp -h localhost -t geisa/api/waveform/req/testapp -f /tmp/waveform.binpb- To test the actuator API, there is a dedicated test application that can sends API requests:
usage: /tmp/test_app_actuator --get <actuator> | --set <actuator> <on|off> [position]The response will be printed by the test_app application