Categorygithub.com/hiroyoshii/go-aas-proxy
repository
1.0.2
Repository: https://github.com/hiroyoshii/go-aas-proxy.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

go-aas-proxy

Asset Administration Shell(AAS) proxy for RDBMS backend

Build CodeQL OpenSSF Scorecard Go Report Card OpenSSF Best Practices GitHub go.mod Go version License

About

The go-aas-proxy is asset administration shell(aas) server which is implemented by go and proxy to RDBMS backend. not ready for production.

This implementation is inspired from "aas-proxy" in Representing the Virtual: Using AAS to Expose DigitalAssets paper. aas-proxy

"aas-proxy" means that submodels are configured by referencing the RDB of other applications. Therefore, only the AAS and the AAS-Submodel relationship can be created, updated, or deleted, while submodels are read-only.

Features

  • Open API Endpoints compatible with Basyx API. But only supports following endpoints:
    • :white_check_mark: /shells: GET
    • :white_check_mark: /shells/{aasId}: GET/PUT/DELETE
    • :white_check_mark: /shells/{aasId}/aas/submodels: GET
    • :white_check_mark: /shells/{aasId}/aas/submodels/{submodelIdShort}: GET
    • :white_check_mark: /shells/{aasId}/aas/submodels/{submodelIdShort}/submodel/submodelElements: GET
    • :white_check_mark: /shells/{aasId}/aas/submodels/{submodelIdShort}/submodel/values: GET
    • :warning: /shells/{aasId}/aas/submodels/{submodelIdShort}: PUT(only relation to aas)
  • Support multiple RDBMS locations and types (Postgres, MySQL, Oracle)

Unsuported:

  • :x: create/update/delete submodels and submodel elements
  • :x: Endpoints containing {seIdShortPath}
  • :x: Invocation Endpoints

Implementation Overview

architecture

  • configurablity for submodel
    • reference databases per semanticID of submodel
    • query for databases
    • response json content for submodels

How to run

  1. screate following submodel configuration file. - there are multiple reference database and query templates. - SQL query template has requested path parameter variables: .AasID, .SubmodelIDShort. - response template has query results variables: .<template file name>.Results.<column name> and .<template file name>.Columns.<column name>.
    • for example, template file path is sample/query.sql and column name is sample, variables are .Query.Results.Sample and .Query.Columns.Sample
submodels:
  - semanticID: "<submodel semantic ID>"
    queryTemplates:
      - path: "<SQL query file path (go template)>"
        dbName: "<database name for query execution>"
    responseTemplatePath: "<submodel json template file path>"
databases:
  - name: "<database name referenced by submodels.queryTemplates.dbName>"
    dbType: <type of RDBMS: postgres, mysql or oracle>
    dbConfig:
      host: <database host>
      port: <database port number>
      user: "<database user>"
      password: "<database password>"
      database: "<database name>"
      sslmode: "<sslmode if dbType is postgres>"
      options: "<database connection options>"
  1. set up postgresql database for aas and asset
  2. docker run
docker run \
-e SUBMODEL_CONFIG_PATH=<configuration file path in procedure 1.> \
-e AAS_TABLES_CREATED=true \
-e AAS_DB_HOST=<database host name in procedure 2.> \
hiroyoshii/go-aas-proxy:latest

Example

  • run with sample data (run docker compose and create sample deta)
./e2e/scenario_setup.sh
  • Submodel configurations can be found in the ./e2e/application/configs directory.

Environment Variables

variablesoverviewsamplerequired
SUBMODEL_CONFIG_PATHsubmodel configuration file path.
submodel_config.yamlyes
AAS_TABLES_CREATEDDDL stored AAS data is created or not when go-aas-proxy is started.trueno (default: true)
AAS_DB_HOSTPostgresql database host name for AAS stored127.0.0.1no (default: 127.0.0.1)
AAS_DB_PORTPostgresql database port number for AAS stored5432no (default: 5432)
AAS_DB_USERPostgresql database user for AAS storedpostgresno (default: postgres)
AAS_DB_PASSWORDPostgresql database password for AAS storedpasswordno (default: password)
AAS_DB_DATABASEPostgresql database name for AAS storedsampleno (default: sample)
AAS_DB_SSL_MODEPostgresql database sslmode for AAS storeddisableno (default: disable)

License

Apache License 2.0, see LICENSE.