Zenoh-Flow for data transcoding.

August 4, 2023 ยท View on GitHub

This document will guide you in building, installing and configuring Zenoh-Flow together with Zenoh for data transcoding.

Note: this guide has been tested on Ubuntu 22.04 LTS

Prerequisites

In order to be able to build and run Zenoh-Flow the following dependencies are needed:

  • build-essentials
  • python3-dev
  • python3-pip
  • python3-venv
  • clang
  • libclang-dev
  • rust
  • pkg-config

Please make sure those dependencies are installed before proceeding.

Build Zenoh and Zenoh-Flow

Clone the repositories and build:

cd ~

git clone https://github.com/eclipse-zenoh/zenoh -b 0.7.2-rc
cd zenoh
cargo build --release --all-targets --features shared-memory

cd ..
git clone https://github.com/eclipse-zenoh/zenoh-flow -b v0.5.0-alpha.1
cd zenoh-flow
cargo build --release --all-targets

cd ..
git clone https://github.com/eclipse-zenoh/zenoh-flow-python -b v0.5.0-alpha.1
cd zenoh-flow-python
cargo build --release --all-targets

cd zenoh-flow-python

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements-dev.txt
maturin build --release
deactivate

Install

Install Zenoh and Zenoh-Flow

cd ~

sudo mkdir -p /etc/zenoh/
sudo mkdir -p /var/zenoh-flow/python
sudo mkdir -p /var/zenoh-flow/flows
sudo mkdir -p /etc/zenoh-flow/extensions.d

sudo cp zenoh/target/release/zenohd /usr/bin/
sudo cp zenoh/target/release/libzenoh_plugin_*.so /usr/lib/

sudo cp zenoh-flow/target/release/libzenoh_plugin_zenoh_flow.so /usr/lib/
sudo cp zenoh-flow/target/release/zfctl /usr/bin/
sudo cp zenoh-flow-python/target/release/libzenoh_flow_python_*_wrapper.so /var/zenoh-flow/python
sudo cp zenoh-flow-python/01-python.zfext /etc/zenoh-flow/extensions.d/
sudo cp zenoh-flow/zfctl/.config/zfctl-zenoh.json /etc/zenoh-flow/

pip3 install ./zenoh-flow-python/target/wheels/eclipse_zenoh_flow-0.5.0a1-cp37-abi3-manylinux_2_34_x86_64.whl

Start Runtime

Copy the zenoh-config.json from this folder to /etc/zenoh/zenoh.json.

Now you can start the Zenoh router with the Zenoh-Flow plugin. Open a terminal and run: RUST_LOG=debug zenohd -c /etc/zenoh/zenoh.json

Then on another terminal run: zfctl list runtimes

You should get an output similar to this:

+----------------------------------+--------------------+--------+
| UUID                             | Name               | Status |
+----------------------------------+--------------------+--------+
| bb4a456d6c0948bfae21a6e8c9051d6b | protoc-client-test | Ready  |
+----------------------------------+--------------------+--------+

This means that the zenoh-flow runtime is was loaded and it is ready.

The transcoding application.

Copy the content of this folder in: /var/zenoh-flow/flows and run pip3 install -r /var/zenoh-flow/flows/requirements.txt.

On a terminal start the publisher side: cd /var/zenoh-flow/flows && python3 pub-proto.py On a new terminal start the subscriber side: cd /var/zenoh-flow/flows && python3 pub-cdr.py

The subscriber will not receive any data as the transcoding is not yet deployed.

On a 3rd terminal instruct zenoh-flow to launch the transcoding flow: zfctl launch /var/zenoh-flow/flows/dataflow.yml it will return the instance id.

Now you should see the data being transcoded and received by your subscriber.

Once you are done you can list the current running flow instances: zfctl list instances and delete the running one with zfctl destroy <instance uuid>.

Once the instance is delete you will see that the subscriber is not going to receive any data.