Skip to content

Commit

Permalink
feat: simple SiLA toy server running
Browse files Browse the repository at this point in the history
  • Loading branch information
markdoerr committed Aug 14, 2024
1 parent 4d838e5 commit b84f471
Show file tree
Hide file tree
Showing 38 changed files with 3,091 additions and 0 deletions.
455 changes: 455 additions & 0 deletions SiLA_Features/DeviceInfoProvider-v1_1.sila.xml

Large diffs are not rendered by default.

238 changes: 238 additions & 0 deletions SiLA_Features/LoggingService-v0_3.sila.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<Feature xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.sila-standard.org https://gitlab.com/SiLA2/sila_base/raw/master/schema/FeatureDefinition.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SiLA2Version="1.0" FeatureVersion="0.3"
Originator="de.unigreifswald" Category="infrastructure" xmlns="http://www.sila-standard.org">
<Identifier>LoggingService</Identifier>
<DisplayName>Logging Service</DisplayName>
<Description>Provides services for integration of SiLA server logging.
The service is intended to be used by the server to provide logging information to the client.
The client can use the service to listen for log entries from the server.
It is possible to listen for all log entries or only for log entries from a specific Stream.
Error handling: If the server is not able to provide the requested information, it shall return an error message.
</Description>

<!-- Commands -->
<Command>
<Identifier>ListenToLoggingStream</Identifier>
<DisplayName>Listen to logging stream</DisplayName>
<Description>Starts listening to a logging stream from the SiLA server</Description>
<Observable>Yes</Observable>
<Parameter>
<Identifier>LoggingStreamName</Identifier>
<DisplayName>Logging Stream Name (URL)</DisplayName>
<Description>The logging stream name (recommended: in form of a URL) to listen to.</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Parameter>
<IntermediateResponse>
<Identifier>IntermediateLoggingText</Identifier>
<DisplayName>Intermediate Logging Text</DisplayName>
<Description>The current logging text of a certain logging stream as it is created by the server</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</IntermediateResponse>
<DefinedExecutionErrors>
<Identifier>LogginStreamNotAvailable</Identifier>
</DefinedExecutionErrors>
</Command>
<Command>
<Identifier>ListenToAllLogEntries</Identifier>
<DisplayName>Listen to all log entries</DisplayName>
<Description>Starts listening to a stream of all consecutive log entries from the SiLA server</Description>
<Observable>Yes</Observable>
<IntermediateResponse>
<Identifier>IntermediateLoggingEntry</Identifier>
<DisplayName>IntermediateLoggingEntry</DisplayName>
<Description>Intermediate Log Entries as they are created by the server</Description>
<DataType>
<List>
<DataType>
<DataTypeIdentifier>LogEntry</DataTypeIdentifier>
</DataType>
</List>
</DataType>
</IntermediateResponse>
</Command>
<Command>
<Identifier>GetLogFile</Identifier>
<DisplayName>Get Log File</DisplayName>
<Description>Gets the log file from the server.</Description>
<Observable>No</Observable>
<Parameter>
<Identifier>LogFileName</Identifier>
<DisplayName>Log File Name (URL)</DisplayName>
<Description>The name of the log file (recommended: in URL format) to get.</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Parameter>
<Response>
<Identifier>LogFile</Identifier>
<DisplayName>Log File (text)</DisplayName>
<Description>Log File as text</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Response>
<DefinedExecutionErrors>
<Identifier>LogFileNotAvailable</Identifier>
</DefinedExecutionErrors>
</Command>
<Command>
<Identifier>SetLogLevel</Identifier>
<DisplayName>Set Log Level</DisplayName>
<Description>Sets the log level of the server.</Description>
<Observable>No</Observable>
<Parameter>
<Identifier>LogLevel</Identifier>
<DisplayName>Log Level</DisplayName>
<Description>The log level to set.</Description>
<DataType>
<Constrained>
<DataType>
<Basic>String</Basic>
</DataType>
<Constraints>
<Set>
<Value>Notset</Value>
<Value>Debug</Value>
<Value>Info</Value>
<Value>Warning</Value>
<Value>Error</Value>
<Value>Critical</Value>
</Set>
</Constraints>
</Constrained>
</DataType>
</Parameter>
</Command>

<!-- Properties -->
<Property>
<Identifier>LoggingStreamList</Identifier>
<DisplayName>Logging Stream (URL) List</DisplayName>
<Description>Provides a list of URLs of all logging streams that are currently available on the server.</Description>
<Observable>No</Observable>
<DataType>
<List>
<DataType>
<Basic>String</Basic>
</DataType>
</List>
</DataType>
</Property>
<Property>
<Identifier>LogFileList</Identifier>
<DisplayName>Log Files (URL) List</DisplayName>
<Description>Provides a list of URLs of all log files that are currently available on the server.</Description>
<Observable>No</Observable>
<DataType>
<List>
<DataType>
<Basic>String</Basic>
</DataType>
</List>
</DataType>
</Property>
<Property>
<Identifier>LogLevel</Identifier>
<DisplayName>Log Level</DisplayName>
<Description>The current log level of the server.</Description>
<Observable>No</Observable>
<DataType>
<Constrained>
<DataType>
<Basic>String</Basic>
</DataType>
<Constraints>
<Set>
<Value>Notset</Value>
<Value>Debug</Value>
<Value>Info</Value>
<Value>Warning</Value>
<Value>Error</Value>
<Value>Critical</Value>
</Set>
</Constraints>
</Constrained>
</DataType>
</Property>

<!-- Data Type Definitions-->
<DataTypeDefinition>
<Identifier>LogEntry</Identifier>
<DisplayName>Log Entry</DisplayName>
<Description>Describes a log entry</Description>
<DataType>
<Structure>
<Element>
<Identifier>Message</Identifier>
<DisplayName>Message</DisplayName>
<Description>The log message.</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Element>
<Element>
<Identifier>StreamName</Identifier>
<DisplayName>StreamName (URL)</DisplayName>
<Description>The Stream name (recommended: in URL form), including a hint to the software part that is responsible for the log entry.</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Element>
<Element>
<Identifier>Severity</Identifier>
<DisplayName>Severity</DisplayName>
<Description>The severity level.</Description>
<DataType>
<DataTypeIdentifier>Severity</DataTypeIdentifier>
</DataType>
</Element>
<Element>
<Identifier>ExtraInfo</Identifier>
<DisplayName>Extra Information</DisplayName>
<Description>The additional information in JSON-LD format.</Description>
<DataType>
<Basic>String</Basic>
</DataType>
</Element>
</Structure>
</DataType>
</DataTypeDefinition>
<DataTypeDefinition>
<Identifier>Severity</Identifier>
<DisplayName>Severity</DisplayName>
<Description />
<DataType>
<Constrained>
<DataType>
<Basic>String</Basic>
</DataType>
<Constraints>
<Set>
<Value>Debug</Value>
<Value>Info</Value>
<Value>Warning</Value>
<Value>Error</Value>
<Value>Critical</Value>
</Set>
</Constraints>
</Constrained>
</DataType>
</DataTypeDefinition>
<!-- Defined execution Errors -->
<DefinedExecutionError>
<Identifier>LogginStreamNotAvailable</Identifier>
<DisplayName>Loggin Stream Not Available</DisplayName>
<Description>The specified Logging Stream is unavailable. Please check the spelling of the stream URL</Description>
</DefinedExecutionError>
<DefinedExecutionError>
<Identifier>LogFileNotAvailable</Identifier>
<DisplayName>Log File Not Available</DisplayName>
<Description>The specified Log File is unavailable. Please check the spelling of the file URL</Description>
</DefinedExecutionError>
</Feature>
76 changes: 76 additions & 0 deletions SiLA_Features/SimulationController-v1_0.sila.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8" ?>
<Feature SiLA2Version="1.0" FeatureVersion="1.0" MaturityLevel="Verified" Originator="org.silastandard" Category="core"
xmlns="http://www.sila-standard.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sila-standard.org https://gitlab.com/SiLA2/sila_base/raw/master/schema/FeatureDefinition.xsd">
<Identifier>SimulationController</Identifier>
<DisplayName>Simulation Controller</DisplayName>
<Description>
This Feature provides control over the simulation behaviour of a SiLA Server.

A SiLA Server can run in two modes:
(a) Real Mode - with real activities, e.g. addressing or controlling real hardware, e.g. through serial/CANBus commands,
writing to real databases, moving real objects etc.
(b) Simulation Mode - where every command is only simulated and responses are just example returns.

Note that certain commands and properties might not be affected by this feature if they
do not interact with the real world.
</Description>
<Command>
<Identifier>StartSimulationMode</Identifier>
<DisplayName>Start Simulation Mode</DisplayName>
<Description>
Sets the SiLA Server to run in Simulation Mode, i.e. all following commands are executed in simulation mode.

The Simulation Mode can only be entered, if all hardware operations have been safely terminated
or are in a controlled, safe state.

The simulation mode can be stopped by issuing the 'Start Real Mode' command.
</Description>
<Observable>No</Observable>
<DefinedExecutionErrors>
<Identifier>StartSimulationModeFailed</Identifier>
</DefinedExecutionErrors>
</Command>
<Command>
<Identifier>StartRealMode</Identifier>
<DisplayName>Start Real Mode</DisplayName>
<Description>
Sets the SiLA Server to run in real mode, i.e. all following commands are executed with real-world
interactions, like serial port/CAN communication, motor actions etc.

If the server is in Simulation Mode it can be interrupted at any time. A re-initialization of
the hardware might be required. The Real Mode can be stopped by issuing the 'Start Simulation Mode' command.
</Description>
<Observable>No</Observable>
<DefinedExecutionErrors>
<Identifier>StartRealModeFailed</Identifier>
</DefinedExecutionErrors>
</Command>
<Property>
<Identifier>SimulationMode</Identifier>
<DisplayName>SimulationMode</DisplayName>
<Description>Indication whether SiLA Server is in Simulation Mode or not.</Description>
<Observable>No</Observable>
<DataType>
<Basic>Boolean</Basic>
</DataType>
</Property>
<DefinedExecutionError>
<Identifier>StartSimulationModeFailed</Identifier>
<DisplayName>The start of Simulation Mode failed.</DisplayName>
<Description>
The server cannot change to Simulation Mode.
This error can, e.g., be thrown, if a real-world process needs to be ended before switching to simulation
mode.
</Description>
</DefinedExecutionError>
<DefinedExecutionError>
<Identifier>StartRealModeFailed</Identifier>
<DisplayName>The start of Real Mode failed.</DisplayName>
<Description>
The server cannot change to Real Mode.
This error can, e.g., be thrown, if a device is not ready to change into Real Mode.
</Description>
</DefinedExecutionError>
</Feature>
8 changes: 8 additions & 0 deletions plr_sila_bridge/plr_sila_bridge/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated by sila2.code_generator; sila2.__version__: 0.12.2
from .generated import Client
from .server import Server

__all__ = [
"Client",
"Server",
]
Loading

0 comments on commit b84f471

Please sign in to comment.