Skip to content
This repository was archived by the owner on Aug 1, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 8 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,123 +1,11 @@
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
# GEISA API Mockup

# GEISA API Mockup - a GEISA Application Programming Interface mockup implementation
This project has moved to the
[GEISA Community repository](https://github.com/geisa/community/tree/main/example-implementations/api/api-mockup).

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](https://github.com/geisa/specification).
The Community repository contains the maintained project, its imported history,
build instructions, dependency setup, and CI configuration.

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.

## Getting started

To get started with the GEISA API Mockup application, you need to clone the repository and initialize the submodules.

```bash
git submodule update --init --recursive
```

## Building the application

### Requirements

To 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](https://github.com/savoirfairelinux/cqfd?tab=readme-ov-file#requirements) and [installation](https://github.com/savoirfairelinux/cqfd?tab=readme-ov-file#installingremoving-cqfd) steps on github)

### Build using make
To build the GEISA API Mockup application using make, run the following command in the root directory of the project:

```bash
make
```

### Build using cqfd
To build the GEISA API Mockup application using cqfd, run the following command in the root directory of the project:

```bash
cqfd run
```

## Build the application for arm64
To 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:

```bash
cqfd -b build_arm64 init
cqfd -b build_arm64
```

## Launch the application

To launch the GEISA API Mockup application, simply run the following command:

```bash
./gapi
```

## Linting and formatting

Linting is done using `clang-tidy` and formatting using `clang-format`.
To lint and format the GEISA API Mockup application code, run the following
command:

```bash
make lint
```

or with cqfd:

```bash
cqfd -b lint
```

## Testing

To 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:

```bash
mosquitto_pub -u testapp -P testapp -h localhost -t geisa/api/platform/discovery/req/testapp -f /tmp/discovery.binpb
```

* To test the manifest API:

```bash
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:

```bash
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:

```bash
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:

```bash
usage: /tmp/test_app_actuator --get <actuator> | --set <actuator> <on|off> [position]
```

* To test the sensor API, there is a dedicated test application that can sends API requests:

```bash
usage: /tmp/test_app_sensor [sensor_id ...]
```
When not providing any sensor_id, the application will send a request to get all the sensors available. Otherwise, it will send a request to get the specified sensors.

The response will be printed by the test_app application
This standalone repository is retained to preserve existing links and project
history. New development and issue discussion should take place in
[`geisa/community`](https://github.com/geisa/community).
Loading