Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "BaSyx / Documentation / Components / AAS Server"

Line 53: Line 53:
 
  These features are documented on their own page:
 
  These features are documented on their own page:
 
[[BaSyx_/_Documentation_/_Components_/_AAS_Server_/_Features | Features]]
 
[[BaSyx_/_Documentation_/_Components_/_AAS_Server_/_Features | Features]]
 
=== Authorization ===
 
 
Authorization is disabled by default. Basic authorization can be configured in the aas.properties:
 
 
aas.authorization=Enabled
 
aas.authorization=Disabled
 
 
== Authorization ==
 
 
The authorization is a basic implementation to enable only authorized requests for <code>WRITE</code> and <code>READ</code> operations for both the AAS and the submodels.
 
This implementation uses OAuth2 tokens and scopes, with the scopes being defined [[https://github.com/eclipse-basyx/basyx-java-sdk/blob/development/src/main/java/org/eclipse/basyx/extensions/submodel/aggregator/authorization/SubmodelAggregatorScopes.java#L10-L11 for submodels]] and [[https://github.com/eclipse-basyx/basyx-java-sdk/blob/development/src/main/java/org/eclipse/basyx/extensions/aas/aggregator/authorization/AASAggregatorScopes.java#L20-L21 for the AAS]].
 
As long as the token includes the respective scopes, an operation can be performed if the authorization is enabled.
 
 
An example for the authorization can be found in the [[BaSyx_/_Scenarios_/_Authorization | scenario with Keycloak]].
 
 
== Operation Delegation ==
 
An operation is a specific type of submodel element that is capable of performing server-side functions. However, in certain environments this is not possible. Therefore, the operation can be delegated to an independent destination URL to be executed.
 
The operation invocation request is defined on [https://app.swaggerhub.com/apis/BaSyx/basyx_submodel_http_rest_api/v1#/Submodel/InvokeOperationByIdShort swaggerhub]. The type and the number of the in and output variables is defined within the operation itself. An example request body is given below. The strong and italic formatted attribute(s) <code>value</code> is/are the value(s) to be processed by the operation.
 
{
 
    "requestId": "1",
 
    "timeout": 60,
 
    "inputArguments": [{
 
      "value": {
 
          "idShort": "in",
 
          "valueType": "integer",
 
          '''''"value": 1''''',
 
          "modelType": {
 
            "name": "Property"
 
          }
 
      }
 
    }]
 
}
 
Alternatively to the full request body above, the raw data can simply be passed as an array of values to be processed by the operation. In this case, the response would also consist of raw data instead of a structured body.
 
 
# To create an operation delegation, an AAS with a Submodel that has a Operation(-SubmodelElement) must be present.
 
## The Operation has neither input, output nor inout variables
 
## To achieve the Delegation functionality, a Qualifier of type "invocationDelegation" is added to the operation.
 
##* As value, the url to the desired operation must be given.
 
##* The url follows the pattern
 
:::: <code>http://{server}:{port}/{contextPath}/{idShortPathToOperation}/invoke</code>
 
::::resp. it is the url for direct operation invocation.
 
::::* Knowledge about the operation to be delegated to, with regard to the number and type of input and output parameters is assumed.
 
 
This achieves that operations can be delegated to endpoints of the same server as well as to external servers. For the frontend it remains completely transparent whether an operation was called directly or delegated.
 
  
 
== Java Implementation ==
 
== Java Implementation ==

Revision as of 15:53, 26 November 2022

Overview | Interface | Implementation | Component | Features

AAS Server Component

The AAS server component provides an empty AAS server that can be used to host several AAS and Submodels. For its API usage see Aggregator API. Additionally, there's a video illustrating the configuration and usage in 5 minutes: YouTube.

For a complete deployment of the AAS infrastructure, additionally to this server a registry is needed. For this registry, the Registry Component can be used.

For illustration on how to create an AAS on the server provided by the component and how to retrieve it see the snippet in the repository.

Download

The AAS Server image is made available via Docker Hub and can be pulled by:

docker pull eclipsebasyx/aas-server:1.2.0

Alternatively, the command described in Startup section will download the image.

Startup

To easily start the AAS server component, you can use the following command:

docker run --name=aas -p 8081:4001 eclipsebasyx/aas-server:1.2.0

Next, the HTTP/REST endpoint of the server with its AAS is accessible via

http://localhost:8081/aasServer/shells/

If there's no AAS configured during startup, an empty JSON list "[]" will be returned.

And the container can be stopped, started and removed using its name (see --name):

docker stop aas
docker start aas
docker rm aas

Context Configuration

As with the other components, the server's context can be customized using the context configuration.

AAS Configuration

For the AAS server component, a multitude of features can be configured via the aas.properties file. By default, this configuration file is assumed to be located at "/usr/share/config/aas.properties" within the container.

Thus, another configuration file can be set by mounting a local configuration file into the container during startup. As an example, a local folder containing the configuration files can be mounted using:

docker run --name=aas -p 8081:4001 -v C:/tmp:/usr/share/config eclipsebasyx/aas-server:1.2.0

In this example, the aas.properties file is located in C:/tmp/. Similarly, the AAS source file also needs to be mounted into the docker container.

These features are documented on their own page:

Features

Java Implementation

Within the project, the component can be found in the Java repository at Java. In this project, the executable can take the parameter BASYX_AAS to configure the path of the aas configuration file. For example, you can specify the path of the aas configuration file via

java -jar -DBASYX_AAS="C:/tmp/aas.properties" aas.jar

Back to the top