Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BaSys4Forestry - Projektmanagement
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informations- und Automatisierungssysteme
BaSys4Forestry - Projektmanagement
Commits
65180cf1
Commit
65180cf1
authored
1 year ago
by
Ahmed Osman
Browse files
Options
Downloads
Patches
Plain Diff
update demo2
parent
f47c020a
No related branches found
No related tags found
No related merge requests found
Pipeline
#309177
passed
1 year ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
demos/demo2/broker_api.py
+2
-4
2 additions, 4 deletions
demos/demo2/broker_api.py
demos/demo2/demo2_forestmanager.py
+5
-5
5 additions, 5 deletions
demos/demo2/demo2_forestmanager.py
with
7 additions
and
9 deletions
demos/demo2/broker_api.py
+
2
−
4
View file @
65180cf1
...
...
@@ -42,14 +42,14 @@ s3ib_to_rest = {"getValueRequest": "READ", "setValueRequest": "WRITE", "createAt
class
S3IBServer
:
def
__init__
(
self
,
access_token
:
str
,
provider
:
api
.
ModelProvider
,
id
:
str
,
loop
,
security_id
:
str
=
None
,
security_enabled
=
False
,
opa_server_url
=
"
http://localhost:8181
"
):
loop
,
security_id
:
str
=
None
,
security_enabled
=
False
):
self
.
id
=
id
self
.
provider
=
provider
self
.
loop
=
loop
self
.
broker
=
BrokerAMQP
(
access_token
,
"
s3ibs://
"
+
self
.
id
,
self
.
callback
,
loop
)
self
.
serializer
=
AASToJsonEncoder
()
self
.
deserializer
=
AASFromJsonDecoder
()
self
.
opa
=
opa_api
.
Opa
(
opa_server_url
)
self
.
opa
=
opa_api
.
Opa
()
self
.
security_id
=
base64
.
urlsafe_b64encode
(
security_id
.
encode
()).
decode
()
self
.
security_enabled
=
security_enabled
self
.
callables
:
dict
[
str
,
Callable
]
=
{}
...
...
@@ -72,8 +72,6 @@ class S3IBServer:
event
:
BasicEventElement
=
event
obs_path
=
helpers
.
id_short_path_from_ref
(
event
.
observed
)
req_path
=
helpers
.
id_short_path_from_path
(
path
)
print
(
obs_path
)
print
(
req_path
)
if
obs_path
==
req_path
:
triggered_events
.
append
(
event
)
logger
.
info
(
f
"
[Event] [
{
event
.
message_topic
}
]
{
event
.
id_short
}
was triggered
"
)
...
...
This diff is collapsed.
Click to expand it.
demos/demo2/demo2_forestmanager.py
+
5
−
5
View file @
65180cf1
...
...
@@ -45,11 +45,11 @@ async def main():
access_token
=
idp
.
get_token
(
TokenType
.
ACCESS_TOKEN
)
# obtain dzwald's endpoint by checking its entry within the S3I-Directory
#
s3i_dir = Directory("https://dir.s3i.vswf.dev/api/2/", access_token)
#
dzwald_dir_entry = s3i_dir.queryThingIDBased(dzwald_id)
#
s3ib_endpoints = [i for i in dzwald_dir_entry["attributes"]["allEndpoints"] if
#
i.startswith('s3ib')]
dzwald_endpoint
=
"
s3ib
://s3i:bc30c279-02c5-4918-a2ad-761e927214dd
"
s3i_dir
=
Directory
(
"
https://dir.s3i.vswf.dev/api/2/
"
,
access_token
)
dzwald_dir_entry
=
s3i_dir
.
queryThingIDBased
(
dzwald_id
)
s3ib_endpoints
=
[
i
for
i
in
dzwald_dir_entry
[
"
attributes
"
][
"
allEndpoints
"
]
if
i
.
startswith
(
'
s3ib
'
)]
dzwald_endpoint
=
s3ib
_endpoints
[
0
]
# use async client to access AAS and its submodels through their REST API asynchronously
client
=
broker_api
.
S3IBAsyncClient
(
access_token
,
forestmanager_hmi_id
,
loop
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment