diff --git a/.github/workflows/acceptance.yaml b/.github/workflows/acceptance.yaml index a1b1fd7..c925821 100644 --- a/.github/workflows/acceptance.yaml +++ b/.github/workflows/acceptance.yaml @@ -67,13 +67,13 @@ jobs: cp examples/model-source.yaml "$RUNNER_TEMP/catalog-acceptance/examples/" cd "$RUNNER_TEMP/catalog-acceptance" "$RUNNER_TEMP/modsim/bin/python" tools/fetch-models.py --output "$RUNNER_TEMP/catalog-acceptance/inputs" - "$RUNNER_TEMP/modsim/bin/python" tools/catalog-interop.py --vectors "$RUNNER_TEMP/catalog-acceptance/inputs/devices/advantech/adam-5017uh/models/adam-5017uh.vectors.json" --modpoll-python "$RUNNER_TEMP/modpoll/bin/python" --node-reader "$GITHUB_WORKSPACE/.interop/modpoll/tools/wot-interop/read-write.cjs" --output "$RUNNER_TEMP/catalog-interop.json" + "$RUNNER_TEMP/modsim/bin/python" tools/catalog-interop.py --vectors "$RUNNER_TEMP/catalog-acceptance/inputs/products/advantech/adam-5017uh/models/adam-5017uh.vectors.json" --modpoll-python "$RUNNER_TEMP/modpoll/bin/python" --node-reader "$GITHUB_WORKSPACE/.interop/modpoll/tools/wot-interop/read-write.cjs" --output "$RUNNER_TEMP/catalog-interop.json" - name: Verify the released runtime against the catalog model run: | uv venv "$RUNNER_TEMP/released-modsim" uv pip install --python "$RUNNER_TEMP/released-modsim/bin/python" 'modsim==2.0.0a2' cd "$RUNNER_TEMP/catalog-acceptance" - "$RUNNER_TEMP/released-modsim/bin/python" tools/catalog-interop.py --vectors "$RUNNER_TEMP/catalog-acceptance/inputs/devices/advantech/adam-5017uh/models/adam-5017uh.vectors.json" --modpoll-python "$RUNNER_TEMP/modpoll/bin/python" --node-reader "$GITHUB_WORKSPACE/.interop/modpoll/tools/wot-interop/read-write.cjs" --output "$RUNNER_TEMP/catalog-interop-released.json" + "$RUNNER_TEMP/released-modsim/bin/python" tools/catalog-interop.py --vectors "$RUNNER_TEMP/catalog-acceptance/inputs/products/advantech/adam-5017uh/models/adam-5017uh.vectors.json" --modpoll-python "$RUNNER_TEMP/modpoll/bin/python" --node-reader "$GITHUB_WORKSPACE/.interop/modpoll/tools/wot-interop/read-write.cjs" --output "$RUNNER_TEMP/catalog-interop-released.json" - uses: actions/upload-artifact@v4 with: name: catalog-interop diff --git a/README.md b/README.md index 822e69a..224df1d 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ Compose deployment with `docker compose down`. A deployment has a stable ID per device, a TM path, instance parameters and an optional scenario. TD IDs and Modbus Unit IDs must be unique. Scenarios define initial values, seeded generators and bindings; local Python behavior requires -`--allow-scripts`. They do not duplicate the model's register mapping. See +`--allow-scripts`. They do not duplicate the Thing Model's point mappings. See [model configuration](docs/site/model-validation.md) for the supported profile, codecs, constraints and behavior hooks. @@ -175,9 +175,9 @@ For a single device without a managed deployment: ```bash uv run python tools/fetch-models.py -uv run modsim --config examples/models/devices/advantech/adam-5017uh/models/adam-5017uh.tm.json \ +uv run modsim --config examples/models/products/advantech/adam-5017uh/models/adam-5017uh.tm.json \ --unit-id 1 --port 5020 \ - --scenario examples/models/devices/advantech/adam-5017uh/simulation/adam-5017uh.sim.json + --scenario examples/models/products/advantech/adam-5017uh/simulation/adam-5017uh.sim.json ``` The single-device model runtime currently supports TCP. The unconfigured demo diff --git a/examples/deployment.yaml b/examples/deployment.yaml index 0a04672..8be89d8 100644 --- a/examples/deployment.yaml +++ b/examples/deployment.yaml @@ -5,12 +5,12 @@ server: port: 5020 devices: - id: adam-5017uh - model: examples/models/devices/advantech/adam-5017uh/models/adam-5017uh.tm.json + model: examples/models/products/advantech/adam-5017uh/models/adam-5017uh.tm.json parameters: THING_ID: urn:modsim:device:advantech:adam-5017uh UNIT_ID: 1 HOST: 127.0.0.1 - scenario: examples/models/devices/advantech/adam-5017uh/simulation/adam-5017uh.sim.json + scenario: examples/models/products/advantech/adam-5017uh/simulation/adam-5017uh.sim.json - id: adam-6024 model: tests/fixtures/io-module/adam-6024.tm.json parameters: diff --git a/examples/model-source.yaml b/examples/model-source.yaml index 802ff67..8cff47e 100644 --- a/examples/model-source.yaml +++ b/examples/model-source.yaml @@ -1,6 +1,6 @@ repository: top-maker/open-modbus-catalog -revision: f4e1f9cdb39d886e11e1f9aa5345828128b3aaca +revision: 3359d13e008cebfbb1c79646a4083cf5e39e0609 files: - devices/advantech/adam-5017uh/models/adam-5017uh.tm.json: 9e1d6e38dbb4e2db2f30f8dfd3d9df90a349b2e9aeb60a168ae4d60ee709ead7 - devices/advantech/adam-5017uh/models/adam-5017uh.vectors.json: a76f365ae333b78e8113227940e15cc52e527962d676d62754d6211b184e22eb - devices/advantech/adam-5017uh/simulation/adam-5017uh.sim.json: 246e0eaf9234aaec6c85c63497a27bbd89c132e436345636c9cdba8969fd3c9f + products/advantech/adam-5017uh/models/adam-5017uh.tm.json: 9e1d6e38dbb4e2db2f30f8dfd3d9df90a349b2e9aeb60a168ae4d60ee709ead7 + products/advantech/adam-5017uh/models/adam-5017uh.vectors.json: a76f365ae333b78e8113227940e15cc52e527962d676d62754d6211b184e22eb + products/advantech/adam-5017uh/simulation/adam-5017uh.sim.json: 246e0eaf9234aaec6c85c63497a27bbd89c132e436345636c9cdba8969fd3c9f diff --git a/tests/test_catalog_platform.py b/tests/test_catalog_platform.py index f90fad4..384e4ed 100644 --- a/tests/test_catalog_platform.py +++ b/tests/test_catalog_platform.py @@ -22,7 +22,7 @@ def test_remote_model_single_device_read_and_stop(tmp_path): lock = yaml.safe_load( (Path(__file__).resolve().parents[1] / "examples/model-source.yaml").read_text() ) - url = f"https://raw.githubusercontent.com/{lock['repository']}/{lock['revision']}/devices/advantech/adam-5017uh/models/adam-5017uh.tm.json" + url = f"https://raw.githubusercontent.com/{lock['repository']}/{lock['revision']}/products/advantech/adam-5017uh/models/adam-5017uh.tm.json" scenario = tmp_path / "initial.sim.json" values = [0x1234, 0x8001, 0xABCD, 0, 65535, 42, 0x0102, 0xFE01] scenario.write_text( diff --git a/tools/catalog-interop.py b/tools/catalog-interop.py index 4f2474b..4232555 100644 --- a/tools/catalog-interop.py +++ b/tools/catalog-interop.py @@ -20,7 +20,7 @@ import yaml ROOT = Path(__file__).resolve().parents[1] -MODEL = "devices/advantech/adam-5017uh/models/adam-5017uh.tm.json" +TM_PATH = "products/advantech/adam-5017uh/models/adam-5017uh.tm.json" VALUES = [0x1234, 0x8001, 0xABCD, 0, 65535, 42, 0x0102, 0xFE01] EXPECTED = {f"AI{i}_RAW": value for i, value in enumerate(VALUES)} @@ -54,11 +54,11 @@ def run(args): revision = lock["revision"] if len(revision) != 40 or any(c not in "0123456789abcdef" for c in revision): raise ValueError("Full immutable data commit required") - url = f"https://raw.githubusercontent.com/{lock['repository']}/{revision}/{MODEL}" + url = f"https://raw.githubusercontent.com/{lock['repository']}/{revision}/{TM_PATH}" with urlopen(url, timeout=20) as response: payload = response.read(2 * 1024 * 1024 + 1) digest = hashlib.sha256(payload).hexdigest() - if digest != lock["files"][MODEL]: + if digest != lock["files"][TM_PATH]: raise ValueError("Catalog TM hash mismatch") reader = args.node_reader.resolve() node_versions = {