Skip to content
Snippets Groups Projects
Commit 65180cf1 authored by Ahmed Osman's avatar Ahmed Osman
Browse files

update demo2

parent f47c020a
No related branches found
No related tags found
No related merge requests found
Pipeline #309177 passed
......@@ -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")
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment