Smart Farm Tutorials

Documentation License: MIT Support badge Docker
Documentation CI

This is a collection of tutorials for the FIWARE ecosystem designed for NGSI-LD developers. Each tutorial consists of a series of exercises to demonstrate the correct use of individual FIWARE components and shows the flow of context data within a simple Smart Solution either by connecting to a series of dummy IoT devices or manipulating the context directly or programmatically.

:books:
NGSI-LD
Documentation

Postman
Collections
Docker Hub
Artifact Hub

developer.​fiware.org

Data models

The tutorials define a series of data-models to be used within the @context. More information about the classes and attributes used can be found in the following:

Install

To download the full set of tutorials, simply clone this repository:

git clone https://github.com/FIWARE/tutorials.NGSI-LD.git
cd tutorials.NGSI-LD/
git submodule update --init --recursive

Swagger

The OpenAPI Specification (commonly known as Swagger) is an API description format for REST APIs. A Swagger spec allows you to describe an entire API (such as NGSI-LD itself) however in this tutorial we shall be concentrating on using Swagger to define data models.

API specifications can be written in YAML or JSON. The format is easy to learn and readable to both humans and machines. The complete OpenAPI Specification can be found on GitHub: OpenAPI 3.0 Specification. This is important since we will need a well-defined structure to be able to generate @context files.

Docker and Docker Compose

Each tutorial runs all components using Docker. Docker is a container technology which allows to different components isolated into their respective environments.

Docker Compose is a tool for defining and running multi-container Docker applications. A series of *.yaml files are used configure the required services for the application. This means all container services can be brought up in a single command. Docker Compose is installed by default as part of Docker for Windows and Docker for Mac, however Linux users will need to follow the instructions found here.

You can check your current Docker and Docker Compose versions using the following commands:

docker-compose -v
docker version

Please ensure that you are using Docker version 20.10 or higher and Docker Compose 1.29 or higher and upgrade if necessary.

Although not officially supported, older versions of docker without an integrated docker-compose can be run by adding legacy to all bash script commands:

./services start legacy

Postman

The tutorials which use HTTP requests supply a collection for use with the Postman utility. Postman is a testing framework for REST APIs. The tool can be downloaded from www.postman.com. All the FIWARE Postman collections can be downloaded directly from the Postman API network.

Cygwin for Windows

We will start up our services using a simple Bash script. Windows users should download cygwin to provide a command-line functionality similar to a Linux distribution on Windows.

Tutorials List

Core Context Management: NGSI-LD Fundamentals

  101. Understanding @context
  102. Working with @context
  103. CRUD Operations
  104. Entity Relationships
  106. Subscriptions
  107. Temporal Operations

Internet of Things, Robots and third-party systems

  201. Introduction to IoT Sensors
  202. Provisioning the Ultralight IoT Agent
  203. Provisioning the JSON IoT Agent

Core Context Management: Manipulating Context Data and Persisting Historic Data

  304. Querying Time Series Data (QuantumLeap)
  305. Big Data Analysis (Flink)
  306. Big Data Analysis (Spark)

Security: Identity Management

  401. Managing Users and Organizations
  402. Roles and Permissions

Processing, Analysis and Visualization

  507. Cloud-Edge Computing

Usage

Most tutorials supply a services script to start the containers:

cd <tutorial-name>
git checkout NGSI-LD
./services start

Following the tutorial exercises via Postman

Each tutorial submodule contains one or more docker-compose.yml files, along with a Postman collection containing the necessary HTTP requests: import the collection into Postman and follow the instructions.

Following the tutorial exercises from the command-line

Each submodule contains full instructions in README which details the appropriate bash commands (cUrl and Docker Compose) to run.

Full instructions can be found within the documentation


License

MIT © 2020-2021 FIWARE Foundation e.V.