The latest version of the demo consists mainly of three communication partners: demo2_dzwald.py, demo2_forestmanager.py (which represents the Dienstleister) and demo2_forestmanager_waldbesitzer.py (which as the name implies represents the forest owner).
demo2_dzwald.py uses the S3IBServer Component from broker_api.py to expose an underlying AAS through the AAS-Interface.
Interaction becomes possible using the S3IBAsyncClient Component and its get-, setValue and invokeOperation methods. Specific elements of the AAS are addressed through a path which has the following form:
Set the last boolean to True to enable authorization. This requires a running opa server. The .exe within /demo2/opa can be used. Simply open cmd and run `opa run --server policy.rego`. "https://www.company.com/security" corresponds here to the id of the security Submodel, which the S3IServer uses to update the opa server's data regularily (used to make permission grant decisions in accordance with the policy). Check /demo2/model/security.py for more information.
Events can be subscribed to and awaited using S3IBAsyncClient's awaitEvent method. This will block until the event has been triggered (and the event message received).
To await specific messages, S3IBAsyncClient's awaitMessage method can be used. This takes the message's attributes as parameter. In the following, demo2_forestmanager.py awaits a UserMessage with text "Authorized" that signals that access has been granted before proceeding with rest of the code.