This time I am using the following version of the OS.
|pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux
Note 2: It may be possible to get this to work on Raspberry PIs with less than 2GB of memory by using various parameters and memory-related packages that are added later.
Connect your Raspberry PI to the network and log in using a terminal or SSH.
|pi@raspberrypi:~ $ sudo apt-get update|
|pi@raspberrypi:~ $ sudo apt-get install openjdk-8-jre|
Of course you can also install the JDK as ‘openjdk-8-jdk’.
Verify that the installation was successful.
pi@raspberrypi:~ $ java -version
openjdk version “1.8.0_212”
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1+rpi1-b01)
OpenJDK Client VM (build 25.212-b01, mixed mode)
Setup Edge gateway
In this section,I will try to set up a REST Edge gateway.
First, transfer IOTCHCPXX_X-XXXXXXXX.ZIP to your Raspberry PI and extract it. The one I used is IOTCHCP69_0-70002561.ZIP.
I created a directory called IOTCHCP and extracted it there.
pi@raspberrypi:~ $ mkdir IOTCHCP
pi@raspberrypi:~ $ cd IOTCHCP
pi@raspberrypi:~/IOTCHCP $ unzip ../IOTCHCP69_0-70002561.ZIP
Under this directory, create a folder named ‘gateway’ and extract gateway-4.69.0.zip into it.
|pi@raspberrypi:~/IOTCHCP $ mkdir gateway
pi@raspberrypi:~/IOTCHCP $ cd gateway
pi@raspberrypi:~/IOTCHCP/gateway $ unzip ../gateway-4.69.0.zip
pi@raspberrypi:~/IOTCHCP/gateway $ ls
adapters gateway-upgrade.jar plugins
build.bat merge.bat upgrade.bat
build.sh merge.sh upgrade.sh
config migrate.bat version.json
Then Build. Since we will be using the REST gateway, we will use the following
pi@raspberrypi:~/IOTCHCP/gateway $ ./build.sh REST
Build script … starting
Merge script … starting
WARN: Custombundles dir is NOT present in system
Plugin configuration … starting
Removing unnecessary files … starting
Specify ‘REST’ as the argument of build.sh to build.
The next step is to edit config_gateway_rest.xml under the config directory.
This is always a bit complicated, but you just have to learn it.
First, access the IoT cockpit and write down the necessary information. Log in and select the tenant you want to use.
The parts that are colored above should be <HOSTNAME>,<INSTANCENAME>,<TENANTNAME>.
<HOSTNAME> ＝ xxxxxxx-xxxx-xxxxx-xxxx-xxxxxx.xxxx.cp.iot.sap
<INSTANCENAME> ＝ yyyyy-yyyyyy-yyyyyy-yyyyyy-yyyyyyyyy
<TENANTNAME> ＝ zzzzzzzzzz
First, replace 127.0.0.1 in the cnf:connectionString part of line 9 with <HOSTNAME>.
Next, near line 23, change the description of the <cnf:address> tag inside the <cnf:coreconnetion> tag.
Finally, line 56.
pi@raspberrypi:~/IOTCHCP/gateway/config/services $ vi sap.NettyConfiguration.cfg
# Enables a Netty server
enabled = true
# Host name or IP address to identify a specific network interface on which to listen
host = localhost
# TCP/IP port on which the server listens for connections
port = 8699
# Expose service on https
enableSSL = false
Also, edit sap.RestAdapterConfiguration.cfg.
pi@raspberrypi:~/IOTCHCP/gateway/config/services $ vi sap.RestAdapterConfiguration.cfg
# Enable/Disable the device authorization checks
useDeviceAuth = false
This setting is for communication without encryption, so be careful when using it in practice.
Finally, download and deploy the Onboarding Certificate.
You can download the Onboarding Certificate from the Cockpit page.
This file should be placed in the config/certificates directory under the gateway directory.
If the ‘certificates’ directory does not exist, create it as shown below, and then place the Onboarding Certificate in it.
pi@raspberrypi:~/IOTCHCP/gateway/config $ mkdir certificates
pi@raspberrypi:~/IOTCHCP/gateway/config/certificates $ cd certificates
pi@raspberrypi:~/IOTCHCP/gateway/config/certificates $ mv $HOME/gateway-registration-certificate.json ./
Execute Edge gateway
pi@raspberrypi:~/IOTCHCP/gateway $ ./gateway.sh
234 18:12:43,986 [Start Level: Equinox Container: 073cb859-f660-4e54-bafe-1bb28ccef272] INFO (KeepAliveStarter:64) – *** BUNDLE 2 EVENT for com.sap.iotservices.gateway.command-cache-service_4.69.0 – ID=239
234 18:12:44,279 [DiscoveryManager] INFO (DiscoveryManager:62) – Initialization successfully finished, start loading API endpoint
234 18:12:44,280 [DiscoveryManager] INFO (DiscoveryManager:71) – API endpoint loaded, start network configuration
234 18:12:44,280 [DiscoveryManager] INFO (DiscoveryManager:75) – Network configuration performed, retrieving the network nodes
234 18:12:44,280 [DiscoveryManager] INFO (DiscoveryManager:78) – Nodes successfully retrieved, start node configuration
234 18:12:44,280 [DiscoveryManager] INFO (DiscoveryManager:642) – +————– Gateway Initialization Complete ———————+
Option:Autostart setting for edge gateway
Unlike enterprise systems, most of the systems at this end do not have an administrator nearby at all times. I used to be an embedded systems engineer. I used to be an embedded system engineer, which is now called an edge system. What was required for systems in this environment was that when a problem occurred, a less computer-savvy person on site could handle it.
There are several ways to make the Raspberry PI start automatically, but this time we will use systemd.
Description=SAP IoT Edge Gateway(REST)
WantedBy = multi-user.target
according to the environment.
Copy this file to /etc/systemd/system. This needs to be done with sudo.
Then reload the service list and start it manually first. ( sudo systemctl start iotedgegateway)
pi@raspberrypi:~ $ sudo mv iotedgegateway.service /etc/systemd/system
pi@raspberrypi:~ $ sudo systemctl daemon-reload
pi@raspberrypi:~ $ sudo systemctl start iotedgegateway
pi@raspberrypi:~ $ sudo systemctl status iotedgegateway
2021-05-13 16:55:57 raspberrypi systemd: Started SAP IoT Edge Gateway(R
pi@raspberrypi:~ $ sudo systemctl stop iotedgegateway
You can use sudo systemctl status iotedgegateway to check if it has started successfully.
Once it is confirmed that it is working, stop it. This can be done by “sudo systemctl stop iotedgegateway”.
Now the service has been created, but it is not set to start automatically. To set it to auto-start
|pi@raspberrypi:~ $ sudo systemctl enable iotedgegateway|
Reboot the Raspberry PI and run sudo systemctl status iotedgegateway to check if it is active.
Summary and point
I have set up REST’s Edge gateway on my Raspberry PI and got it working.
Here are some points to consider when choosing a gateway.
The REST and MQTT gateways are also available on the Cloud side. The same MQTT and REST gateways are also available on the Edge side.
The difference is that all gateways on the Cloud require authentication with a client certificate. All gateways on the Cloud require authentication with a client certificate, while gateways on the Edge side allow you to choose the authentication method, and you can even choose no authentication.
This is because Edge gateways are supposed to be accessed by devices that exist on the same network with a certain level of security. Cloud gateways, on the other hand, are accessed over the Internet and require some mechanism to ensure security, which is why they require access with client certificates.
Edge gateways are useful when the sensors and devices to be connected have communication capabilities, but are not functionally capable of communicating using certificates. It is the Edge gateway that actually connects to the IoT service, and it is the Edge gateway that authenticates the device with the Onboarding Certificate.
In some cases, a private wireless LAN network is sufficient, and whether to use client certificate authentication there as well depends on the requirements and specifications of the devices.
In the next article, I will try to send data from “IchigoJam” a simple small computer that I happened to touch, to SAP IoT services for SAP BTP for the Cloud Foundry Environment via REST gateway on this RaspberryPI.
Stay home now for great feature.