Skip to content

Commit 2f08160

Browse files
committed
formatting fixes for blogpost; change date to today
1 parent 889c1ca commit 2f08160

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

documentation/src/main/resources/_posts/2024-02-15-integrating-ditto-aas-basyx.md documentation/src/main/resources/_posts/2024-02-27-integrating-ditto-aas-basyx.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Access Ditto Things from an Asset Administration Shell"
33
published: true
4-
permalink: 2024-02-15-integrating-ditto-aas-basyx.html
4+
permalink: 2024-02-27-integrating-ditto-aas-basyx.html
55
layout: post
66
author: johannes_kristan
77
tags: [blog]
@@ -68,7 +68,7 @@ We see three approaches to achieve this:
6868

6969
* BaSyx AAS SM server *pulls* the current state from Eclipse Ditto via a *wrapper* around Eclipse Ditto.
7070
This approach requires the creation of a custom AAS infrastructure around Eclipse Ditto without the chance of reusing existing components of the Eclipse Basyx project.
71-
The Eclipse Ditto project followed a comparable approach to support [Web of Things](https://eclipse.dev/ditto/2022-03-03-wot-integration.html) (WoT) definitions, which is another specification to integrate IoT devices from different contexts and align their utilized data model.
71+
The Eclipse Ditto project followed a comparable approach to support [Web of Things](2022-03-03-wot-integration.html) (WoT) definitions, which is another specification to integrate IoT devices from different contexts and align their utilized data model.
7272
Ditto now allows the generation of new Things based on a WoT Thing Description.
7373
* BaSyx AAS SM server *pulls* the current state from Eclipse Ditto via a *bridge* component, which Eclipse Basyx already provides.
7474
To integrate the bridge, the BaSyx SM-server component has a delegation feature, where the user can configure an SME with an endpoint to which the server delegates incoming requests.
@@ -95,8 +95,8 @@ Eclipse Ditto and Eclipse Basyx work with different data structures and conceptu
9595

9696
*Table 1: Concept mapping from Eclipse Ditto to the AAS*
9797

98-
We map a Ditto [`Namespace`](https://eclipse.dev/ditto/basic-namespaces-and-names.html#namespace) to a single AAS. An AAS holds multiple SMs, and not all of these SMs necessarily have counterparts in Ditto. We thus treat a `Thing` as an opaque concept and do not define an explicit mapping for a `Thing` but map each [`feature`](https://eclipse.dev/ditto/basic-feature.html) to one SM.
99-
[`property`](https://eclipse.dev/ditto/basic-feature.html#feature-properties) and [`Attribute`](https://eclipse.dev/ditto/basic-thing.html#attributes) are mapped to SMEs.
98+
We map a Ditto [`Namespace`](basic-namespaces-and-names.html#namespace) to a single AAS. An AAS holds multiple SMs, and not all of these SMs necessarily have counterparts in Ditto. We thus treat a `Thing` as an opaque concept and do not define an explicit mapping for a `Thing` but map each [`feature`](basic-feature.html) to one SM.
99+
[`property`](basic-feature.html#feature-properties) and [`Attribute`](basic-thing.html#attributes) are mapped to SMEs.
100100

101101
By that, it is possible to have more than one Thing organized in one AAS.
102102
This can especially be useful if an AAS organizes complex equipment with different sensors and actuators, which belong together but are organized in multiple Things.
@@ -123,7 +123,7 @@ Please note that the Ditto demo instance, does not work for the described setup
123123
### Payload Mappers from Ditto to BaSyx
124124

125125
Let us assume a device with a sensor named `machine:sensor` that is capable of measuring temperature values.
126-
This device may send sensor data to an Eclipse Ditto instance as a Ditto Protocol message [Ditto Protocol message](https://eclipse.dev/ditto/1.3/protocol-overview.html):
126+
This device may send sensor data to an Eclipse Ditto instance as a Ditto Protocol message [Ditto Protocol message](protocol-overview.html):
127127

128128
```json
129129
{
@@ -136,10 +136,10 @@ This device may send sensor data to an Eclipse Ditto instance as a Ditto Protoco
136136

137137
*Listing 1: Ditto Protocol message for the Thing `machine:senor`*
138138

139-
If the device uses another message format, you can find more details on [how to map it](https://eclipse.dev/ditto/connectivity-mapping.html) to a Ditto Protocol message.
139+
If the device uses another message format, you can find more details on [how to map it](connectivity-mapping.html) to a Ditto Protocol message.
140140

141141
After an update to a Thing, we want Ditto to map the information to an AAS-conforming representation and forward this via an outbound connection to an AAS server.
142-
The task in Eclipse Ditto is to define [payload mappers](https://eclipse.dev/ditto/connectivity-mapping.html) for these transformations in accordance with the mapping from [Mapping of Data Models](#mapping-of-data-models). Ditto allows the usage of JavaScript to create the mappers. We thus configure connections in Ditto to the BaSyx components, where we filter for the relevant changes to a Thing and then trigger the respective mapper.
142+
The task in Eclipse Ditto is to define [payload mappers](connectivity-mapping.html) for these transformations in accordance with the mapping from [Mapping of Data Models](#mapping-of-data-models). Ditto allows the usage of JavaScript to create the mappers. We thus configure connections in Ditto to the BaSyx components, where we filter for the relevant changes to a Thing and then trigger the respective mapper.
143143

144144
We need to implement the following mappers:
145145

@@ -380,15 +380,15 @@ With our approach, we preserve the existing properties and only modify the updat
380380

381381
#### Create a Connection to the BaSyx AAS Server
382382

383-
To apply the introduced mappers, we configure a new [Ditto connection](https://eclipse.dev/ditto/basic-connections.html) to a BaSyx AAS server.
383+
To apply the introduced mappers, we configure a new [Ditto connection](basic-connections.html) to a BaSyx AAS server.
384384
The listings below show the respective HTTP calls using curl to configure this connection.
385385

386386
The JavaScript mappers from above are part of `piggybackCommand.connection.mappingDefinitions` in `mappingforShell`, `mappingforSubmodel` and `mappingforSubmodelElement`.
387387

388388
In the example, we use the placeholder `<ditto-instance-url>` for the used Ditto instance. You need to adjust to the valid URL of your environment.
389-
We assume you have access rights to the Ditto [Devops Commands](https://eclipse.dev/ditto/installation-operating.html#devops-commands) credentials in the used instance (username: `devops`, password: `foobar is the default).
389+
We assume you have access rights to the Ditto [Devops Commands](installation-operating.html#devops-commands) credentials in the used instance (username: `devops`, password: `foobar is the default).
390390

391-
You can change the password by setting the environment variable *DEVOPS_PASSWORD* in the [gateway service](https://eclipse.dev/ditto/architecture-services-gateway.html).
391+
You can change the password by setting the environment variable *DEVOPS_PASSWORD* in the [gateway service](architecture-services-gateway.html).
392392

393393
Alternatively, an already existing password can be obtained and stored as an environment variable using the following command:
394394

@@ -440,9 +440,9 @@ curl -X POST -u devops:foobar -H 'Content-Type: application/json' --data-binary
440440
"sources": [],
441441
"targets": [
442442
{
443-
"address": "PUT:/aasServer/shells/{{ thing:namespace }}",
443+
"address": "PUT:/aasServer/shells/{%raw%}{{ thing:namespace }}{%endraw%}",
444444
"headerMapping": {
445-
"content-type": "{{ header:content-type }}"
445+
"content-type": "{%raw%}{{ header:content-type }}{%endraw%}"
446446
},
447447
"authorizationContext": ["nginx:ditto"],
448448
"topics": [
@@ -453,9 +453,9 @@ curl -X POST -u devops:foobar -H 'Content-Type: application/json' --data-binary
453453
]
454454
},
455455
{
456-
"address": "PUT:/aasServer/shells/{{ thing:namespace }}/aas/submodels/{{ thing:name }}_{{ resource:path | fn:substring-after('"'/features/'"') }}",
456+
"address": "PUT:/aasServer/shells/{%raw%}{{ thing:namespace }}{%endraw%}/aas/submodels/{%raw%}{{ thing:name }}{%endraw%}_{%raw%}{{ resource:path | fn:substring-after('"'/features/'"') }}{%endraw%}",
457457
"headerMapping": {
458-
"content-type": "{{ header:content-type }}"
458+
"content-type": "{%raw%}{{ header:content-type }}{%endraw%}"
459459
},
460460
"authorizationContext": ["nginx:ditto"],
461461
"topics": [
@@ -466,9 +466,9 @@ curl -X POST -u devops:foobar -H 'Content-Type: application/json' --data-binary
466466
]
467467
},
468468
{
469-
"address": "PUT:/aasServer/shells/{{ thing:namespace }}/aas/submodels/{{ thing:name }}_{{ resource:path | fn:substring-after('"'/features/'"') | fn:substring-before('"'/properties'"') }}/submodel/submodelElements/properties_{{ resource:path | fn:substring-after('"'/properties/'"') | fn:replace('"'/'"','"'_'"') }}",
469+
"address": "PUT:/aasServer/shells/{%raw%}{{ thing:namespace }}{%endraw%}/aas/submodels/{%raw%}{{ thing:name }}{%endraw%}_{%raw%}{{ resource:path | fn:substring-after('"'/features/'"') | fn:substring-before('"'/properties'"') }}{%endraw%}/submodel/submodelElements/properties_{%raw%}{{ resource:path | fn:substring-after('"'/properties/'"') | fn:replace('"'/'"','"'_'"') }}{%endraw%}",
470470
"headerMapping": {
471-
"content-type": "{{ header:content-type }}"
471+
"content-type": "{%raw%}{{ header:content-type }}{%endraw%}"
472472
},
473473
"authorizationContext": ["nginx:ditto"],
474474
"topics": [
@@ -489,7 +489,7 @@ curl -X POST -u devops:foobar -H 'Content-Type: application/json' --data-binary
489489
When Ditto established the connection and our payload mappings work, it returns a successful HTTP response and otherwise an error message.
490490

491491
Without any further means, the payload mappings defined in `piggybackCommand.mappingDefinition` and set in `piggybackCommand.targets` would get executed for all changes to a Thing.
492-
To prevent this, we use [filtering](https://eclipse.dev/ditto/basic-changenotifications.html#filtering) with [RQL expressions](https://eclipse.dev/ditto/basic-rql.html) to make sure that our payload mappings are only executed for the correct messages.
492+
To prevent this, we use [filtering](basic-changenotifications.html#filtering) with [RQL expressions](basic-rql.html) to make sure that our payload mappings are only executed for the correct messages.
493493
For example, the filter:
494494

495495
```json
@@ -598,9 +598,9 @@ curl -X POST -u devops:foobar -H 'Content-Type: application/json' --data-binary
598598
"sources": [],
599599
"targets": [
600600
{
601-
"address": "PUT:/registry/api/v1/registry/{{ thing:namespace }}",
601+
"address": "PUT:/registry/api/v1/registry/{%raw%}{{ thing:namespace }}{%endraw%}",
602602
"headerMapping": {
603-
"content-type": "{{ header:content-type }}"
603+
"content-type": "{%raw%}{{ header:content-type }}{%endraw%}"
604604
},
605605
"authorizationContext": ["nginx:ditto"],
606606
"topics": [
@@ -642,7 +642,7 @@ which you need to adapt to the URL of your Ditto instance.
642642
##### Setup a common policy
643643

644644
To define authorization information to be used by the Things,
645-
we first create a [policy](https://eclipse.dev/ditto/basic-policy.html) with the policy-id `machine:my-policy`.
645+
we first create a [policy](basic-policy.html) with the policy-id `machine:my-policy`.
646646

647647
```bash
648648
POLICY_ID=machine:my-policy
@@ -651,7 +651,7 @@ curl -i -X PUT -u ditto:ditto -H 'Content-Type: application/json' --data '{
651651
"entries": {
652652
"DEFAULT": {
653653
"subjects": {
654-
"{{ request:subjectId }}": {
654+
"{%raw%}{{ request:subjectId }}{%endraw%}": {
655655
"type": "Ditto user authenticated via nginx"
656656
}
657657
},

0 commit comments

Comments
 (0)