Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
To get started quickly, a Vagrant Installation Guide has been created and a guide for Manual Installation.
The goal of the installation manual is to control a simulated OSLP device through the Platform. Below, is a summary of all steps involved. See the next chapters for a detailed guide with screenshots. Please follow the steps carefully.
A summary of the steps involved:
Creating a virtual machine using Vagrant and Virtual Box
Run the puppet script (part of the Vagrant installation), or complete the steps manually (Manual installation)
Importing Maven Projects into Eclipse
Creating an Apache Tomcat9 Server
Setting Up Apache Tomcat9 Server Context
Deploying all open smart grid platform components to an Apache Tomcat9 Server
Starting Apache ActiveMQ
Starting Apache Tomcat9 Server
Creating the 'test-org' organization in the Database
Setting up SoapUI
First SOAP Requests to add a device to the open smart grid platform
Opening Device Simulator to add a device
Registering a device
Using 'SetLight' SOAP Request to switch the light on
In order to use git correctly you need to execute the following commands in a terminal if you haven't done so already:
GXF is covered by LFE's CLA. You have to sign/agree to it in order to commit changes. Most likely you will have to sign the individual agreement, unless you work for a licensed company.
Your pull request will detect if you haven't signed it yet and instructions are given on how to continue.
GXF uses GitHub's DCO application, so you need to sign-off your commits.
Your pull request will detect if you haven't signed-off your commits and instructions are given on how to continue.
Just add -s
to git commit ...
.
Note this is the lower case -s
(short for --signoff
).
With git merge ...
you can add --signoff
as the shorter -s
is used to set the merge strategy.
In some versions of Eclipse you can click the button to "Add Signed-off-by" in the Git Staging view:
In the commit toolwindow, click the settings icon and check the 'Sign-off commit' checkbox:
To install the platform you can use one of the following procedures.
The Vagrant Installation. This procedure creates and installs a complete image with the Open Smart Grid Platform pre-installed, including all the tools such as Maven, Eclipse, SoapUI, etc.
The Manual Installation. Follow this guide if you want to install the Open Smart Grid Platform yourself.
This chapter describes the steps for a manual installation (eg. not using the vagrant script and puppet scripts). This chapter is for developers who would like to have more control over the installation procedure.
With the increased control come increased risks of things not working with the versions or configuration of the software involved with the OSGP environment. If you run into issues, you may find clues in the puppet scripts about versions and modifications to the configuration of installed software.
Skip this chapter if you followed the Vagrant installation! You can continue with next chapter: Setup the Open Smart grid Platform
The Open Smart Grid Platform runs on a Linux environment. It is recommended to set up a machine running Ubuntu.
The Open Smart Grid platform needs the following software and tools installed/downloaded:
Java 8 openjdk-8
PostgreSQL and pgAdmin 3
Git
Maven
ActiveMQ
Tomcat
Apache HTTPD
SoapUi
Eclipse IDE for Java EE Developers
Google Protocol Buffers: protobuf-compiler, libprotoc7 and libprotobuf7
It is recommended to create a 'dev' user, because some scripts contain hard coded references to this 'dev' user. It is possible to skip this step, but then some of the scripts will have to be adjusted manually.
Place the PostgreSQL JDBC driver jar in the Tomcat lib directory.
Change permissions of Tomcat Config files to 644 in the Tomcat conf directory.
Enable mod_ssl by running the following command:
Enable proxy_ajp by running the following command:
Make sure the JAVA_HOME var is set, and points to openjdk-8.
Clone the following repo's, it is recommended to create a Sources/OSGP
directory in /home/dev/
since some scripts contain hard coded references to those folders.
Make sure you are on the development branch (default).
Create the following directories:
/var/log/osp/logs
/etc/osp/
Make the dev user (or equivalent) the owner of the log directory with rwx permission. Give the other users read and execute permission.
Execute the script /home/dev/Sources/OSGP/Config/scripts/create-symlinks.sh
Note This script uses hard coded references to /home/dev/Sources/OSGP/*
, if you used a different user, please edit the script before executing it.
The script will make symlinks to certificates, to Apache HTTP server configuration and copy configuration settings as samples to locations where these properties may be overridden.
To create the database run the following command (Change /home/dev/ in case of no dev user)
And create a backup of the pg_hba.conf file (modify if your version of PostgreSQL is different)
Finally, reload the postgresql service:
Continue with setting up the Open Smart Grid Platform by following the Set up the Open Smart Grid Platform Guide
There are two procedures for testing the Open Smart Grid Platform.
SoapUI. Create and send Soap requests to the Platform to manage a (simulated) light.
PublicLighting Demo App. Use the Demo App to send requests to the Platform to manage a (simulated) device.
This chapter describes all the steps needed to finalize the open smart grid platform development environment.
The platform uses Lombok annotations to generate extra Java methods. Without Lombok the project is not imported correctly by Maven and will not run. If you used the Vagrant installation method it should already be installed. To check if Lombok is properly installed to go Help > About Eclipse IDE
and scroll down. Here you will see: Lombok <version> "<version name>" is installed. https://projectlombok.org/
. If not follow this guide to install Lombok.
Open Eclipse by clicking the shortcut on the Desktop and import the projects.
Go to File -> Import -> Existing Maven Projects, browse to folder /home/dev/Sources/OSGP
Import the projects from location /home/dev/Sources/OSGP/open-smart-grid-platform
.
In Eclipse go to Window -> Open Perspective -> Debug
In the 'Debug' perspective, go to the 'Servers' view and add a new Apache Tomcat server, Tomcat is available in the folder /home/dev/Tools/tomcat
(or in another location if you didn't set up a VM using Vagrant, the latest version usually works fine).
Click on Next
Click on Finish
Make sure that Tomcat is using the correct Java Runtime Environment:
Click on 'Runtime Environment', 'Installed JREs' and click 'Add'. Choose 'next' with 'Standard VM' highlighted. Click 'Directory' and in the folder browser that is shown, use the key combination 'Ctrl + h' to show hidden files. Choose '.sdkman/candidates/java/current' and select 'Open' and 'Finish'. In the 'Installed JREs' screen, unselect the default JVM (which will be an Eclipse hotspot JVM) and select '/home/dev/.sdkman/candidates/java/current' then close the screen by clicking 'Apply and Close'. The last step is to choose the new JRE which was just added in the dropdown of the 'Runtime Environment' screen by selecting '17.0.5'. Click 'Finish' to apply.
All modules contain their own context.xml. In the module specific context.xml are the environment variables defined where the global and module specific configuration files are located. Default they will point to a location in /etc/osp/.
Continue with starting Apache ActiveMQ. If you installed an environment as described with Vagrant, you can double click the ActiveMQ shortcut on the desktop.
Alternatively you can open a terminal and run the executable manually by using the following command: (the executable can be found in the folder /home/dev/Tools/activemq/bin
)
With ActiveMQ running, the Tomcat server can be started. Go to Eclipse, go to the Servers tab in the Debug view, and right click on the Tomcat server and select 'Start'.
note: In case of an error starting up for the very first time, try and start up only the module: 'osgp.core' first. This makes sure the database scripts are executed.
This is an optional program that shows the status of the Tomcat resources in real time. To install Probe you can follow this guide. Note that you need to add the Tomcat users in the guide's Security part in the tomcat-users.xml in your Eclipse environment. To download the war file go to: https://github.com/psi-probe/psi-probe/releases. You need to copy the war file to: /home/dev/<your Eclipse workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps
.
Open pgAdminIII and configure a connection: choose the 'Add a connection to a server.' and fill out the fields using
Host: localhost
Port: 5432
Username: osp_admin
Password: 1234
Run the script in /home/dev/Sources/OSGP/Config/sql/create-test-org.sql
to insert 'test-org' organization into the organisation table of the osgp_core database.
If asked for a password, enter 1234
Go back to PgAdmin III, expand servers, select localhost -> databases -> osgp_core -> Schemas -> public -> Tables. Right click the organisation table and select to view data for the top 100 rows. Confirm that the test-org organisation has been added to the Database.
Now that everything has been set up, continue to the next chapter to start testing the Platform by sending it some requests.
This document describes the automatic installation procedure for your Open Smart Grid Platform development environment.
If you would like to follow the manual installation procedure, please proceed to the .
Creating a Virtual Machine using Virtual Box and Vagrant
To improve the usability of the Installation process, a Vagrant file and some puppet scripts are used to automatically set-up an virtual Open Smart Grid Platform development environment. The following steps will describe how to install VirtualBox, Vagrant and kick off the procedure by running the vagrant up
command.
The following system requirements are recommended:
Core i5/i7 ~2.5GHz Dual Core, Quad Core recommended
At least 16 GB RAM, 32 GB RAM recommended
At least 20 GB free space, 50 GB free space recommended
The installation procedure has been tested on Windows 10.
note: If you already have VirtualBox, make sure it is at least version 6.1.38
note: Check whether Virtualbox stores the images on a drive with enough free space. (Open Oracle VM VirtualBox Manager -> Preferences -> General -> Default Machine Folder).
note: If you already have Vagrant, make sure it is at least version 2.3.0 Complete the installation and restart your PC.
note: If you did a fresh install of Vagrant and already had a command prompt open, make sure you close this command prompt and open it again.
Remember to enable Virtualization in your system BIOS.
Also disable Hyper-V in Windows (can be found in Windows Features)
First create a new directory (for example: D:\My Vagrant Images\OSGP Development\
)
Make sure that the file is named like this: Vagrantfile
without an extension!
If the file has an extension (for example .txt) you can rename the file using the following console command.
MacOS/Linux:
Windows:
Now open a Command Prompt and navigate to the newly created directory where you just put the files. Make sure that you run the Command Prompt using administrator rights.
note: When you open the Vagrantfile you see that default the image is configured to run in virtualbox with 2 cpu cores and 8192 MB of RAM. If you need to you can change this to more or less cpu cores and RAM, but it is recommended to use the provided settings.
Run the following command: vagrant up
note: In case of error bad uri Images/OSGP Development/hashicorp/itc/itc-ubuntu-mate-20.04-amd64 then use the following command;
vagrant destroy
vagrant box add itc/itc-ubuntu-mate-20.04-amd64
vagrant up
note: In case of an error complaining about not being able to resolve a URL (for instance to github.com) then try using a different internet connection not behind a proxy.
Vagrant will now automatically download an Ubuntu image (+- 2.6 Gb), create a virtualbox image from it and run the installation puppet script when finished. This might take a while, depending on your internet speed. After some time (while the script is still running) you will notice that a window with an Ubuntu Virtual Machine pops-up. Don't log in yet, wait until the script in the Console is finished.
If the script fails for some reason (eg. Errors in the console such as time outs during downloading), you can retry the procedure by running the following command vagrant destroy && vagrant up
Now that the script has ran its course, it will automatically log in on the Ubuntu virtual machine as user dev.
note: For some actions, like
sudo
, you will have to enter the password of user dev. The password for user dev is dev.
At this point you also can adjust the virtualbox settings like cpus and memory size. If you don't want to adjust this proceed to Chapter 2.1.2. Platform Setup.
If you do want to update the virtualbox settings for this image, shut down the image first:
Once the machine has been Shut Down, open VirtualBox and right click on the new virtual machine (called "OSGP Development") and select Settings. Go to System and increase the Base Memory of the system to at least 6144 MB (6 GB) (or the maximum recommended (in green) amount for your system).
Now go to the Processor Tab and increase the amount of Processors to the maximum recommended (in green) amount.
Close the Settings window and Start the Virtual Machine again. Once it is booted, you should be automatically logged in as the 'dev' user.
In order to use git correctly you need to execute the following commands in a terminal:
After adding the server, double click on the Tomcat server in the 'Servers' view and set the following configuration: under 'Timeouts' set 'Start' to 600 and 'Stop' to 30.
Click on 'Open launch configuration', click on the 'Arguments' tab and add the following at the end of the 'VM arguments': -Xms512m -Xmx2048m -Xss512k -XX:MaxMetaspaceSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -Dcom.sun.management.jmxremote=true
If you want to deviate from this, you might set up the context.xml in Tomcat to be able to redirect in one file to different locations. This is optional and not required. In order to use a custom context.xml, copy the entries in /home/dev/Sources/OSGP/Config/tomcat/context.xml.sample
to the Tomcat context.xml in the eclipse Servers folder, to map configuration file names to file paths.
Continue by adding the Maven Projects to the Tomcat server by right clicking on the Tomcat server and choosing 'Add and Remove'. Select all available resources, except for osgp-protocol-simulator-61850 (which is for advanced use and requires additional configuration), then click the 'Add' button. At this point, eclipse's auto-build should have built the projects, and the Tomcat server has been setup.
This starts ActiveMQ as a terminal process (this way, ActiveMQ doesn't detach from the terminal and starts running as a daemon).
Start by downloading VirtualBox by going to And follow the installation steps.
Now download and install Vagrant. Vagrant is available at the following URL:
Browse to and save the png image and Vagrantfile files in your newly created directory.
You just created a virtual machine running Ubuntu with pre-installed tooling. Proceed with of the guide describing how to set-up the open smart grid platform.
This chapter will describe the steps needed to test the Open Smart Grid Platform.
Start SoapUI by double clicking the shortcut on the Desktop or run it manually by typing the following command in a terminal:
Go to File -> Preferences -> SSL Settings, and browse for the KeyStore to /home/dev/Sources/OSGP/Config/certificates/osgp-ca/certs/test-org.pfx
and fill out the password (the password is 1234)
Go to WSDL Settings and check 'Generate Example Values in New Requests' and 'Generate Comments with Type Information in New Requests'
There are several SoapUI project prepared, see /home/dev/Sources/OSGP/Config/soapui/
. Import all SoapUI projects present in the folder mentioned above. Below, 2 projects are shown as examples.
Import the 'admin' project by clicking File -> Import project. Browse to /home/dev/Sources/OSGP/Config/soapui/
, select 'admin-soapui-project.xml' and click open.
Alternatively you can create the 'admin' project yourself by following the steps below:
Create a new SOAP Project and call it 'admin'
Open the Project View by double-clicking on the 'admin' project. Go to 'WS-Security Configurations' and select the 'Keystores' Tab. Click on the '+' to add the test-org.pfx
in /home/dev/Sources/OSGP/Config/certificates/osgp-ca/certs/
Fill out the password (1234) and click Ok and close the Project View window.
Right click the 'admin' project and choose 'Add WSDL'. Enter the following URL in the WSDL Location field:
Make sure the box 'Create sample requests for all operations' is checked, and click OK.
Import the 'public-lighting' project by clicking File -> Import project. Browse to /home/dev/Sources/OSGP/Config/soapui/
, select 'public-lighting-soapui-project.xml' and click open.
Alternatively you can create the 'public-lighting' project yourself by following the steps below:
Open the Project View by double-clicking on the 'public-lighting' project. Go to 'WS-Security Configurations' and select the 'Keystores' Tab. Click on the '+' to add the test-org.pfx
in /home/dev/Sources/OSGP/Config/certificates/osgp-ca/certs/
Right click the 'public-lighting' project and choose 'Add WSDL'. Enter the following URL in the WSDL Location field:
Before sending the request, the test-org.pfx should be added as SSL Keystore: Go to the properties interface for the request (bottom left of the screen, after selecting 'Request 1' under UpdateKey in the 'admin' project'), and choose test-org.pfx
from the drop-down box.
This has to be done for each request!
An SSLD needs to be added to the platform, as well as a manufacturer and a public key for the SSLD. A couple of steps need to be performed to realize this.
1 Add manufacturer 2 Add device model 3 Add SSLD 4 Setup a protocol for the SSLD to use 5 Set the public key for the SSLD (in case of OSLP)
The AddManufacturer function adds a new manufacturer to OSGP. All devices are coupled to a manufacturer.
The AddDeviceModel function adds a new device model to OSGP. All devices are coupled to a device model.
The AddDevice function adds a new SSLD to OSGP. The device is coupled to a device model and a manufacturer.
The function UpdateDeviceProtocol sets a protocol for a device.
The UpdateKey function of the admin webservice sets a public key for a device. Double click 'Request 1' under UpdateKey in the 'admin' project. Add the following request:
After the SSLD has been added, let's see if the function FindAllDevices shows the SSLD. Continue with the FindAllDevices request from the public-lighting project. Since this is not the same project, we have to change the endpoint; in this case in https://localhost:443/osgp-adapter-ws-publiclighting/publiclighting/adHocManagementService/. Do not forget to set the SSL keystore in the Request Properties. Use the following parameters in the request:
In order to be able to use the SSLD-000-00-01 Device, the device needs to be simulated in the Device Simulator. To do this we have to create it. In the Firefox Browser, open the Device Simulator by going to the following URL:
Fill out the fields like this:
Device Identification: SSLD_000-00-01
IP Address: 127.0.0.1
Device Type: SSLD
Protocol: OSLP ELSTER
Now that the Device is known in the platform, and simulated in the Device-Simulator, the device can be used. Let's switch on the Light. Using SoapUI, click on Request 1 under SetLight at the public-lighting project. Set the following parameters in the request (And do not forget to set the Keystore in the request properties):
The last request concerns the response from the previous SetLight request. In SoapUi open Request 1 under 'GetSetLightResponse' in the 'public-lighting' project. Set the following parameters in the request (And the keystore in the request properties). Make sure to replace the CorrelationUid with the value from the respons from the SetLight request.
Do not forget to set the CorrelationUid to value in the response you received from the setLight request.
The server replied Ok, indicicating that the SetLight request has been processed succesfully.
This step also concludes the installation manual.
This chapter will describe the steps needed to test the Open Smart Grid Platform using the Web Demo Application.
If you followed the steps from the 'Platform Setup' then you can skip the following installation steps, because the Web Demo will already be available.
Open Eclipse and import the following folder as Maven project /home/dev/Sources/OSGP/open-smart-grid-platform/public-lighting-demo-app/
Add the PublicLightingDemoApp components to the Tomcat Server.
(Re)Start the Tomcat Server.
To access the Demo App go to the following URL: https://localhost/web-demo-app/
If you encounter an Untrusted Connection page, go to 'I Understand the Risks' -> Add Exception.. -> Confirm Security Exception
Click the Add a Device button in the Menu bar, and enter SSLD_000-00-01
at the Device Identification field and press Submit.
The following screen will appear, it shows that the device has been successfully added to the Platform.
In order to be able to use the SSLD-000-00-01 Device, the device needs to be simulated in the Device Simulator. To do this we have to create it. In the Firefox Browser, open the Device Simulator by going to the following URL:
Fill out the fields like this:
Device Identification: SSLD_000-00-01
IP Address: 127.0.0.1
Device Type: SSLD
Protocol: OSLP_ELSTER
You should return to the Devices screen and see the message "Device with identification SSLD_000-00-01 was created."
Then click the 'Confirm Registration' button. The message should read: "Device with identification SSLD_000-00-01 was confirmed to be registered."
Now that the Device is known in the platform, and simulated in the Device-Simulator, the device can be used. Let's switch on the Light. Go to the Demo App and press the List button in the Menu. A list should appear, showing the device that has just been added using the Add Device button.
Click on the Manage button to access the Device Details.
Switch on the Light by setting the Light Value to 100 and by checking the 'LightOn' checkbox (as shown in the screenshot below)
Hit submit to submit the request to the Platform. The following screen should appear:
In the home screen of the OSLP device simulator, the lightbulb should light up for SSLD_000-00-01. This means that the request succeeded.
This step also concludes the installation manual.
Create another new SOAP Project and call it 'public-lighting'
Fill out the password (1234) and click Ok and close the Project View window.
Make sure the box 'Create sample requests for all operations' is checked, and click OK.
Click the 'play' button to submit the request to the endpoint. You should receive similar response as shown in the screenshot below:
After the request has been submitted, the response should include the SSLD device with ID SSLD_000_00_01
If you encounter an Untrusted Connection page, go to 'I Understand the Risks' -> Add Exception.. -> Confirm Security Exception
Click Add Device
Click Create Device
You should return to the Devices screen and see the message "Device with identification SSLD_000-00-01 was created."
Now click on the newly created device and click the 'Register Device' button. After a while the message "Device identification with identification SSLD_000-00-01 was registered at XXXXXXXX" appears.
Then click the 'Confirm Registration' button. The message should read: "Device with identification SSLD_000-00-01 was confirmed to be registered."
Submit the request. Take note of the CorrelationUid in the response. You can use this Id in another request to ask the server for the status of this request.
In the home screen of the OSLP device simulator, the lightbulb should light up for SSLD_000-00-01. This means that the request succeeded.
Click Add Device
Click Create Device
Now click on the newly created device and click the 'Register Device' button. After a while the message "Device identification with identification SSLD_000-00-01 was registered at XXXXXXXX" appears.