Skip to content

Commit

Permalink
Create an OperationDelegation feature example (eclipse-basyx#303)
Browse files Browse the repository at this point in the history
* Refactors example Folder

Signed-off-by: FriedJannik <[email protected]>
Co-authored-by: Aaron Zielstorff <[email protected]>

* Adds Operation Delegation Example

Signed-off-by: FriedJannik <[email protected]>

* Update docker-compose.yml

---------

Signed-off-by: FriedJannik <[email protected]>
Co-authored-by: Aaron Zielstorff <[email protected]>
  • Loading branch information
FriedJannik and aaronzi authored Jun 13, 2024
1 parent 1517e77 commit d2b9bb2
Show file tree
Hide file tree
Showing 32 changed files with 968 additions and 32 deletions.
2 changes: 1 addition & 1 deletion ci/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ services:

keycloak:
build:
context: ./../examples/keycloak
context: ./../examples/BaSyxSecured/keycloak
volumes:
- ./:/opt/jboss/keycloak/imports
ports:
Expand Down
19 changes: 19 additions & 0 deletions examples/BaSyxMinimal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# BaSyx Infrastructure Setup

After executing

```bash
docker-compose up -d
```

the following components are started:
* AAS Repository (http://localhost:8081/shells)
* Submodel Repository (http://localhost:8081/submodels)
* ConceptDescription Repository (http://localhost:8081/concept-descriptions)
* AAS Registry (http://localhost:8082/shell-descriptors)
* Submodel Registry (http://localhost:8083/submodel-descriptors)
* AAS Discovery (http://localhost:8084/lookup/shells)
* AAS Web UI (http://localhost:3000)

By leveraging the registry integration features of AAS Repository and Submodel Repository, the preconfigured AAS Environment serializations are loaded and automatically registered.

File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added examples/BaSyxOperationDelegation/AASWebGUI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions examples/BaSyxOperationDelegation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# BaSyx Operation Delegation Example Setup
To run the example containers, you need to have Docker installed on your device.

## How to start the example containers
1. Open a terminal in this folder
2. Run the following command to start the BaSyx containers:
```
docker-compose up -d
```

## Access the BaSyx containers
- AAS Environment: [http://localhost:8081](http://localhost:8081)
- AAS Registry: [http://localhost:8082](http://localhost:8082)
- Submodel Registry: [http://localhost:8083](http://localhost:8083)
- AAS Web GUI: [http://localhost:3000](http://localhost:3000)
- Delegated Operation Service [http://localhost:8087](http://localhost:8087)

## How to use
1. Open the AAS Web GUI
![Screenshot of the AAS Web GUI showcasing the Operation](AASWebGUI.png)
2. Open the Operation
3. Enter a value and execute
83 changes: 83 additions & 0 deletions examples/BaSyxOperationDelegation/aas/operationDelegationAAS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"assetAdministrationShells": [
{
"idShort": "delegationAAS",
"displayName": [
{
"language": "en",
"text": "Example Operation Delegation AAS"
}
],
"id": "https://example.com/ids/sm/3232_7030_6042_8042",
"assetInformation": {
"assetKind": "Instance",
"globalAssetId": "https://example.com/ids/asset/4122_7030_6042_5649"
},
"submodels": [
{
"type": "ModelReference",
"keys": [
{
"type": "Submodel",
"value": "https://example.com/ids/sm/3232_7030_6042_2542"
}
]
}
],
"modelType": "AssetAdministrationShell"
}
],
"submodels": [
{
"idShort": "delegationSubmodel",
"displayName": [
{
"language": "en",
"text": "Example Operation Delegation Submodel"
}
],
"id": "https://example.com/ids/sm/3232_7030_6042_2542",
"kind": "Instance",
"submodelElements": [
{
"idShort": "exampleOperation",
"displayName": [
{
"language": "en",
"text": "Example Operation"
}
],
"qualifiers": [
{
"kind": "ConceptQualifier",
"type": "invocationDelegation",
"valueType": "xs:string",
"value": "http://example-operation-service:8080/operation-invocation"
}
],
"inputVariables": [
{
"value": {
"idShort": "input",
"valueType": "xs:int",
"modelType": "Property"
}
}
],
"outputVariables": [
{
"value": {
"idShort": "result",
"valueType": "xs:int",
"modelType": "Property"
}
}
],
"modelType": "Operation"
}
],
"modelType": "Submodel"
}
],
"conceptDescriptions": []
}
8 changes: 8 additions & 0 deletions examples/BaSyxOperationDelegation/basyx/aas-env.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server.port=8081
basyx.backend=InMemory
basyx.environment=file:aas
basyx.cors.allowed-origins=*
basyx.cors.allowed-methods=GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
basyx.aasrepository.feature.registryintegration=http://aas-registry:8080
basyx.submodelrepository.feature.registryintegration=http://sm-registry:8080
basyx.externalurl=http://localhost:8081
4 changes: 4 additions & 0 deletions examples/BaSyxOperationDelegation/basyx/aas-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
basyx:
cors:
allowed-origins: '*'
allowed-methods: GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
4 changes: 4 additions & 0 deletions examples/BaSyxOperationDelegation/basyx/sm-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
basyx:
cors:
allowed-origins: '*'
allowed-methods: GET,POST,PATCH,DELETE,PUT,OPTIONS,HEAD
55 changes: 55 additions & 0 deletions examples/BaSyxOperationDelegation/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '3'
services:
aas-env:
image: eclipsebasyx/aas-environment:2.0.0-milestone-02
container_name: aas-env
volumes:
- ./aas:/application/aas
- ./basyx/aas-env.properties:/application/application.properties
ports:
- '8081:8081'
restart: always
depends_on:
aas-registry:
condition: service_healthy
sm-registry:
condition: service_healthy
aas-registry:
image: eclipsebasyx/aas-registry-log-mem:2.0.0-milestone-02
container_name: aas-registry
ports:
- '8082:8080'
volumes:
- ./basyx/aas-registry.yml:/workspace/config/application.yml
restart: always
sm-registry:
image: eclipsebasyx/submodel-registry-log-mem:2.0.0-milestone-02
container_name: sm-registry
ports:
- '8083:8080'
volumes:
- ./basyx/sm-registry.yml:/workspace/config/application.yml
restart: always
aas-web-ui:
image: eclipsebasyx/aas-gui:v2-240515
container_name: aas-ui
ports:
- '3000:3000'
environment:
AAS_REGISTRY_PATH: http://localhost:8082/shell-descriptors
SUBMODEL_REGISTRY_PATH: http://localhost:8083/submodel-descriptors
AAS_REPO_PATH: http://localhost:8081/shells
SUBMODEL_REPO_PATH: http://localhost:8081/submodels
CD_REPO_PATH: http://localhost:8081/concept-descriptions
restart: always
depends_on:
aas-env:
condition: service_healthy
example-operation-service:
build:
context: ./exampleOperationService
dockerfile: Dockerfile
container_name: example-operation
ports:
- '8087:8080'
restart: always
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Stage 1: Build Stage
FROM maven:3.8.1-openjdk-17 AS build
WORKDIR /app
# Kopiere die pom.xml und lade die Abhängigkeiten herunter
COPY pom.xml .
RUN mvn dependency:go-offline
# Kopiere den restlichen Quellcode
COPY src src
# Baue das Projekt
RUN mvn clean package -DskipTests

# Stage 2: Runtime Stage
FROM openjdk:17
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
# Starte die Anwendung
ENTRYPOINT ["java", "-jar", "app.jar"]
19 changes: 19 additions & 0 deletions examples/BaSyxOperationDelegation/exampleOperationService/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Getting Started

### Reference Documentation
For further reference, please consider the following sections:

* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.4/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.4/maven-plugin/reference/html/#build-image)
* [Spring Web](https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/index.html#web)
* [Spring Boot Actuator](https://docs.spring.io/spring-boot/docs/3.2.4/reference/htmlsingle/index.html#actuator)

### Guides
The following guides illustrate how to use some features concretely:

* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
* [Building a RESTful Web Service with Spring Boot Actuator](https://spring.io/guides/gs/actuator-service/)

Loading

0 comments on commit d2b9bb2

Please sign in to comment.