Skip to content

Commit 21f89c4

Browse files
committed
Update Registry
1 parent 27d71e8 commit 21f89c4

8 files changed

Lines changed: 49 additions & 39 deletions

File tree

server/app/backend/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .local_file import *

server/app/interfaces/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,19 +264,18 @@ def http_exception_to_response(exception: werkzeug.exceptions.HTTPException, res
264264
class ObjectStoreWSGIApp(BaseWSGIApp):
265265
object_store: AbstractObjectStore
266266

267-
def _get_all_obj_of_type(self, type_: Type[model.provider._IDENTIFIABLE]) -> Iterator[model.provider._IDENTIFIABLE]:
267+
def _get_all_obj_of_type(self, type_: Type[T]) -> Iterator[T]:
268268
for obj in self.object_store:
269269
if isinstance(obj, type_):
270270
yield obj
271271

272-
def _get_obj_ts(self, identifier: model.Identifier, type_: Type[model.provider._IDENTIFIABLE]) \
273-
-> model.provider._IDENTIFIABLE:
272+
def _get_obj_ts(self, identifier: model.Identifier, type_: Type[T]) \
273+
-> T:
274274
identifiable = self.object_store.get(identifier)
275275
if not isinstance(identifiable, type_):
276276
raise NotFound(f"No {type_.__name__} with {identifier} found!")
277277
return identifiable
278278

279-
280279
class HTTPApiDecoder:
281280
# these are the types we can construct (well, only the ones we need)
282281
type_constructables_map = {

server/app/interfaces/registry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
import app.model as server_model
1717
from app.util.converters import IdentifierToBase64URLConverter, base64url_decode
1818
from app.interfaces.base import ObjectStoreWSGIApp, APIResponse, is_stripped_request, HTTPApiDecoder
19+
from app.model import DictDescriptorStore
1920

2021

2122
class RegistryAPI(ObjectStoreWSGIApp):
22-
def __init__(self, object_store: model.AbstractObjectStore, base_path: str = "/api/v3.0"):
23+
def __init__(self, object_store: model.AbstractObjectStore, base_path: str = "/api/v3.1.1"):
2324
self.object_store: model.AbstractObjectStore = object_store
2425
self.url_map = werkzeug.routing.Map([
2526
Submount(base_path, [
@@ -284,7 +285,6 @@ def delete_submodel_descriptor_by_id(self, request: Request, url_args: Dict, res
284285

285286
if __name__ == "__main__":
286287
from werkzeug.serving import run_simple
287-
from basyx.aas.examples.data.example_aas import create_full_example
288288

289-
run_simple("localhost", 8083, RegistryAPI(create_full_example()),
289+
run_simple("localhost", 8083, RegistryAPI(DictDescriptorStore()),
290290
use_debugger=True, use_reloader=True)

server/app/model/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
from .descriptor import *
22
from .endpoint import *
33
from .service_specification import *
4+
from .provider import *

server/docker/registry/Dockerfile

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
FROM python:3.11-alpine
22

3+
LABEL org.label-schema.name="Eclipse BaSyx" \
4+
org.label-schema.version="1.0" \
5+
org.label-schema.description="Docker image for the basyx-python-sdk registry server application" \
6+
org.label-schema.maintainer="Eclipse BaSyx"
7+
38
ENV PYTHONDONTWRITEBYTECODE=1
49
ENV PYTHONUNBUFFERED=1
510

@@ -11,9 +16,12 @@ RUN apk update && \
1116
apk del git bash
1217

1318

14-
COPY registry_server/uwsgi.ini /etc/uwsgi/
15-
COPY registry_server/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
16-
COPY registry_server/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
19+
COPY ./sdk /sdk
20+
COPY ./server/app /server/app
21+
COPY ./server/pyproject.toml /server/pyproject.toml
22+
COPY ./server/docker/registry/uwsgi.ini /etc/uwsgi/
23+
COPY ./server/docker/common/supervisord.ini /etc/supervisor/conf.d/supervisord.ini
24+
COPY ./server/docker/common/stop-supervisor.sh /etc/supervisor/stop-supervisor.sh
1725
RUN chmod +x /etc/supervisor/stop-supervisor.sh
1826

1927
# Makes it possible to use a different configuration
@@ -26,24 +34,25 @@ ENV NGINX_MAX_UPLOAD=1M
2634
ENV NGINX_WORKER_PROCESSES=1
2735
ENV LISTEN_PORT=80
2836
ENV CLIENT_BODY_BUFFER_SIZE=1M
37+
ENV API_BASE_PATH=/api/v3.1.1/
38+
39+
# Default values for the storage envs
40+
ENV INPUT=/input
41+
ENV STORAGE=/storage
42+
ENV STORAGE_PERSISTENCY=False
43+
ENV STORAGE_OVERWRITE=False
44+
VOLUME ["/input", "/storage"]
2945

3046
# Copy the entrypoint that will generate Nginx additional configs
31-
COPY registry_server/entrypoint.sh /entrypoint.sh
47+
COPY server/docker/common/entrypoint.sh /entrypoint.sh
3248
RUN chmod +x /entrypoint.sh
3349

3450
ENTRYPOINT ["/entrypoint.sh"]
3551

3652
ENV SETUPTOOLS_SCM_PRETEND_VERSION=1.0.0
3753

38-
39-
COPY ./registry_server/requirements.txt .
40-
RUN pip install --no-cache-dir -r requirements.txt
41-
42-
COPY ./sdk /sdk
43-
COPY ./server /server
44-
COPY ./registry_server/app /app
45-
46-
WORKDIR /app
47-
RUN pip install ../sdk
54+
WORKDIR /server/app
55+
RUN pip install ../../sdk
56+
RUN pip install ..
4857

4958
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.ini"]

server/docker/registry/uwsgi.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[uwsgi]
2-
wsgi-file = /app/main.py
2+
wsgi-file = /server/app/services/run_registry.py
33
socket = /tmp/uwsgi.sock
44
chown-socket = nginx:nginx
55
chmod-socket = 664

server/example_configurations/discovery_standalone/compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
dockerfile: server/docker/discovery/Dockerfile
77
ports:
88
- "8084:80"
9-
environment:
10-
- storage_path=/discovery_store.json
11-
volumes:
12-
- ./discovery_store.json:/discovery_store.json
9+
#environment:
10+
#- storage_path=/discovery_store.json
11+
#volumes:
12+
# - ./discovery_store.json:/discovery_store.json

server/example_configurations/registry_standalone/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ The Registry Service provides the endpoint for a given AAS-ID or Submodel-ID. Su
1111

1212
## Features
1313
# AAS Registry:
14-
| Function | Description | Example URL |
15-
|--------------------------------------------------|----------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
16-
| **GetAllAssetAdministrationShellDescriptors** | Return all AAS descriptor | `GET http://localhost:8083/api/v3.0/shell-descriptors` |
17-
| **GetAssetAdministrationShellDescriptorById** | Return a specific AAS descriptor | `GET http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}` |
18-
| **PostAssetAdministrationShellDescriptor** | Register/create a new AAS descriptor | `POST http://localhost:8083/api/v3.0/shell-descriptors` |
19-
| **PutAssetAdministrationShellDescriptorById** | Update an existing AAS descriptor | `PUT http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}` |
20-
| **DeleteAssetAdministrationShellDescriptorById** | Delete an AAS descriptor by ID | `DELETE http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}` |
21-
| **GetSubmodelDescriptorsThroughSuperPath** | Return all submodel descriptors under AAS descriptor | `GET http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors` |
22-
| **PostSubmodelDescriptorThroughSuperPath** | Register/create a new submodel descriptor under AAS descriptor | `POST http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors` |
23-
| **GetSubmodelDescriptorThroughSuperPath** | Return a specific submodel descriptor under AAS descriptor | `GET http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}` |
24-
| **PutSubmodelDescriptorThroughSuperPath** | Update a specific submodel descriptor under AAS descriptor | `PUT http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}` |
25-
| **DeleteSubmodelDescriptorThroughSuperPath** | Delete a specific submodel descriptor under AAS descriptor | `DELETE http://localhost:8083/api/v3.0/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}` |
26-
| **GetDescription** | Return the self‑description of the AAS registry service | `GET http://localhost:8083/api/v3.0/description` |
14+
| Function | Description | Example URL |
15+
|--------------------------------------------------|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
16+
| **GetAllAssetAdministrationShellDescriptors** | Return all AAS descriptor | `GET http://localhost:8083/api/v3.1.1/shell-descriptors` |
17+
| **GetAssetAdministrationShellDescriptorById** | Return a specific AAS descriptor | `GET http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}` |
18+
| **PostAssetAdministrationShellDescriptor** | Register/create a new AAS descriptor | `POST http://localhost:8083/api/v3.1.1/shell-descriptors` |
19+
| **PutAssetAdministrationShellDescriptorById** | Update an existing AAS descriptor | `PUT http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}` |
20+
| **DeleteAssetAdministrationShellDescriptorById** | Delete an AAS descriptor by ID | `DELETE http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}` |
21+
| **GetSubmodelDescriptorsThroughSuperPath** | Return all submodel descriptors under AAS descriptor | `GET http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}/submodel-descriptors` |
22+
| **PostSubmodelDescriptorThroughSuperPath** | Register/create a new submodel descriptor under AAS descriptor | `POST http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}/submodel-descriptors` |
23+
| **GetSubmodelDescriptorThroughSuperPath** | Return a specific submodel descriptor under AAS descriptor | `GET http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}` |
24+
| **PutSubmodelDescriptorThroughSuperPath** | Update a specific submodel descriptor under AAS descriptor | `PUT http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}` |
25+
| **DeleteSubmodelDescriptorThroughSuperPath** | Delete a specific submodel descriptor under AAS descriptor | `DELETE http://localhost:8083/api/v3.1.1/shell-descriptors/{aasIdentifier}/submodel-descriptors/{submodelIdentifier}` |
26+
| **GetDescription** | Return the self‑description of the AAS registry service | `GET http://localhost:8083/api/v3.1.1/description` |
2727

2828
# Submodel Registry:
2929
| Function | Description | Example URL |

0 commit comments

Comments
 (0)