diff --git a/.freyja/managed_subscribe_sample/config/mock_mapping_config.json b/.freyja/managed_subscribe_sample/config/mock_mapping_config.json new file mode 100644 index 0000000..4357a1d --- /dev/null +++ b/.freyja/managed_subscribe_sample/config/mock_mapping_config.json @@ -0,0 +1,22 @@ +{ + "values": [ + { + "begin": 2, + "end": null, + "value": { + "source": "dtmi:sdv:HVAC:AmbientAirTemperature;1", + "target": { + "model_id": "dtmi:sdv:Cloud:Vehicle:Cabin:HVAC:AmbientAirTemperature;1", + "instance_id": "hvac", + "instance_property_path": "/AmbientAirTemperature" + }, + "interval_ms": 3000, + "conversion": { + "mul": 0.5556, + "offset": -17.7778 + }, + "emit_on_change": false + } + } + ] +} \ No newline at end of file diff --git a/.freyja/config/grpc_proxy_config.json b/.freyja/mixed_sample/config/grpc_proxy_config.json similarity index 100% rename from .freyja/config/grpc_proxy_config.json rename to .freyja/mixed_sample/config/grpc_proxy_config.json diff --git a/.freyja/config/mock_mapping_config.json b/.freyja/mixed_sample/config/mock_mapping_config.json similarity index 100% rename from .freyja/config/mock_mapping_config.json rename to .freyja/mixed_sample/config/mock_mapping_config.json diff --git a/.freyja/property_sample/config/mock_mapping_config.json b/.freyja/property_sample/config/mock_mapping_config.json new file mode 100644 index 0000000..4357a1d --- /dev/null +++ b/.freyja/property_sample/config/mock_mapping_config.json @@ -0,0 +1,22 @@ +{ + "values": [ + { + "begin": 2, + "end": null, + "value": { + "source": "dtmi:sdv:HVAC:AmbientAirTemperature;1", + "target": { + "model_id": "dtmi:sdv:Cloud:Vehicle:Cabin:HVAC:AmbientAirTemperature;1", + "instance_id": "hvac", + "instance_property_path": "/AmbientAirTemperature" + }, + "interval_ms": 3000, + "conversion": { + "mul": 0.5556, + "offset": -17.7778 + }, + "emit_on_change": false + } + } + ] +} \ No newline at end of file diff --git a/.freyja/smart_trailer/config/mock_mapping_config.json b/.freyja/smart_trailer/config/mock_mapping_config.json new file mode 100644 index 0000000..9895055 --- /dev/null +++ b/.freyja/smart_trailer/config/mock_mapping_config.json @@ -0,0 +1,19 @@ +{ + "values": [ + { + "begin": 2, + "end": null, + "value": { + "source": "dtmi:sdv:Trailer:Weight;1", + "target": { + "model_id": "dtmi:sdv:Cloud:Trailer:Weight;1", + "instance_id": "trailer", + "instance_property_path": "/Weight" + }, + "interval_ms": 3000, + "conversion": null, + "emit_on_change": false + } + } + ] +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 02ef76d..35fae34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,9 +255,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.84" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -333,7 +333,7 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-protobuf-data-access" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/ibeji#56ddbafaf73bde471d23d2680c01e818008068cf" +source = "git+https://github.com/eclipse-ibeji/ibeji#6cb95ae6b58f7733a12c44d8af8dbf5dcf1786b1" dependencies = [ "prost", "prost-types", @@ -490,9 +490,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys", @@ -549,13 +549,18 @@ dependencies = [ [[package]] name = "freyja" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "crossbeam", "env_logger", "freyja-common", "freyja-contracts", + "grpc-provider-proxy-v1", + "http-mock-provider-proxy", + "in-memory-mock-provider-proxy", "log", + "managed-subscribe-provider-proxy", + "mqtt-provider-proxy", "proc-macros", "provider-proxy-selector", "time", @@ -565,30 +570,33 @@ dependencies = [ [[package]] name = "freyja-build-common" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" [[package]] name = "freyja-common" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "config", "freyja-contracts", "home", "log", "serde", + "serde_json", "tokio", ] [[package]] name = "freyja-contracts" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "crossbeam", "proc-macros", "serde", + "strum", + "strum_macros", ] [[package]] @@ -749,7 +757,7 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "grpc-provider-proxy-v1" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "crossbeam", @@ -760,17 +768,17 @@ dependencies = [ "log", "samples-protobuf-data-access", "serde", - "serde_json", "tempfile", + "tokio", "tonic", "tower", ] [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", @@ -778,7 +786,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", @@ -846,7 +854,7 @@ dependencies = [ [[package]] name = "http-mock-provider-proxy" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "axum", @@ -857,6 +865,7 @@ dependencies = [ "log", "reqwest", "serde", + "tokio", ] [[package]] @@ -963,7 +972,7 @@ dependencies = [ [[package]] name = "in-memory-mock-cloud-adapter" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "freyja-contracts", @@ -975,7 +984,7 @@ dependencies = [ [[package]] name = "in-memory-mock-digital-twin-adapter" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "freyja-build-common", @@ -988,7 +997,7 @@ dependencies = [ [[package]] name = "in-memory-mock-mapping-client" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "freyja-build-common", @@ -1001,7 +1010,7 @@ dependencies = [ [[package]] name = "in-memory-mock-provider-proxy" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "crossbeam", @@ -1115,6 +1124,26 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "managed-subscribe-provider-proxy" +version = "0.1.0" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" +dependencies = [ + "async-trait", + "core-protobuf-data-access", + "crossbeam", + "freyja-build-common", + "freyja-common", + "freyja-contracts", + "futures", + "log", + "paho-mqtt", + "serde", + "tokio", + "tonic", + "uuid", +] + [[package]] name = "matchit" version = "0.7.3" @@ -1168,6 +1197,23 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "mqtt-provider-proxy" +version = "0.1.0" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" +dependencies = [ + "async-trait", + "crossbeam", + "freyja-build-common", + "freyja-common", + "freyja-contracts", + "log", + "paho-mqtt", + "serde", + "tokio", + "uuid", +] + [[package]] name = "multimap" version = "0.8.3" @@ -1446,7 +1492,7 @@ dependencies = [ [[package]] name = "proc-macros" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "convert_case", "proc-macro2", @@ -1456,9 +1502,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" +checksum = "5a5a410fc7882af66deb8d01d01737353cf3ad6204c408177ba494291a626312" dependencies = [ "bytes", "prost-derive", @@ -1466,9 +1512,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" +checksum = "1fa3d084c8704911bfefb2771be2f9b6c5c0da7343a71e0021ee3c665cada738" dependencies = [ "bytes", "heck", @@ -1488,9 +1534,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" +checksum = "065717a5dfaca4a83d2fe57db3487b311365200000551d7a364e715dbf4346bc" dependencies = [ "anyhow", "itertools", @@ -1501,9 +1547,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" +checksum = "8339f32236f590281e2f6368276441394fcd1b2133b549cc895d0ae80f2f9a52" dependencies = [ "prost", ] @@ -1511,14 +1557,11 @@ dependencies = [ [[package]] name = "provider-proxy-selector" version = "0.1.0" -source = "git+https://github.com/eclipse-ibeji/freyja#a163a0bc4e109d117e40817303e32409c9b63d80" +source = "git+https://github.com/eclipse-ibeji/freyja#71668508800bf1f576d871d74085c146b6cbf7b7" dependencies = [ "async-trait", "crossbeam", "freyja-contracts", - "grpc-provider-proxy-v1", - "http-mock-provider-proxy", - "in-memory-mock-provider-proxy", "log", "tokio", ] @@ -1667,9 +1710,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" dependencies = [ "bitflags 2.4.1", "errno", @@ -1693,7 +1736,7 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "samples-protobuf-data-access" version = "1.0.0" -source = "git+https://github.com/eclipse-ibeji/ibeji#56ddbafaf73bde471d23d2680c01e818008068cf" +source = "git+https://github.com/eclipse-ibeji/ibeji#6cb95ae6b58f7733a12c44d8af8dbf5dcf1786b1" dependencies = [ "prost", "prost-types", @@ -1917,9 +1960,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -2219,6 +2262,15 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +dependencies = [ + "getrandom", +] + [[package]] name = "vcpkg" version = "0.2.15" diff --git a/cloud_connectors/azure/README.md b/cloud_connectors/azure/README.md index 4a97387..94132c5 100644 --- a/cloud_connectors/azure/README.md +++ b/cloud_connectors/azure/README.md @@ -16,6 +16,8 @@ The [Digital Twins Connector](./digital_twins_connector/README.md) updates an Az The deployment scripts in the `{freyja-root-dir}/cloud_connectors/azure/scripts` directory will automate the deployment of necessary Azure resources depending on which Azure Cloud Connector sample you wish to use. +>NOTE: The deployment scripts are compatible with the [`mixed` sample for Ibeji](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/mixed). Modification of the Cloud Digital Twin may be required for other scenarios. + To run the deployment scripts, you will need to complete each prerequisite section specified below. Alternatively, you can create Azure resources via the Azure portal. Please see [Manual Azure Digital Twins Setup](./digital_twins_connector/README.md#manual-azure-digital-twins-setup) for the Digital Twins Connector sample, and [Manual Deployment of Azure Key Vault, Event Grid, and Azure Function App](./mqtt_connector/README.md#manual-deployment-of-azure-key-vault-event-grid-and-azure-function-app) for the MQTT Connector sample. diff --git a/freyja_adapters/digital_twin/ibeji_adapter/src/ibeji_adapter.rs b/freyja_adapters/digital_twin/ibeji_adapter/src/ibeji_adapter.rs index 0acc734..65f5844 100644 --- a/freyja_adapters/digital_twin/ibeji_adapter/src/ibeji_adapter.rs +++ b/freyja_adapters/digital_twin/ibeji_adapter/src/ibeji_adapter.rs @@ -175,6 +175,7 @@ impl DigitalTwinAdapter for IbejiAdapter { protocol: e.protocol, operations: e.operations, uri: e.uri, + context: e.context, }) .collect(), }, diff --git a/freyja_apps/e2e/README.md b/freyja_apps/e2e/README.md index a9952c7..1f5397f 100644 --- a/freyja_apps/e2e/README.md +++ b/freyja_apps/e2e/README.md @@ -6,11 +6,11 @@ This Freyja Example Application utilizes the [Ibeji Digital Twin Adapter](../../ To build and run the application, follow these steps: -1. (Optional) If necessary, author configuration overrides for the [`InMemoryMockMappingClient`](https://github.com/eclipse-ibeji/freyja/tree/main/mapping_clients/in_memory_mock_mapping_client). Refer to the adapter README files for instructions on how to do this. This repository provides overrides in the [`.freyja`](../../.freyja/) directory that can be used with the [`mixed` sample provided by Ibeji](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/mixed). +1. (Optional) If necessary, author configuration overrides for the [`InMemoryMockMappingClient`](https://github.com/eclipse-ibeji/freyja/tree/main/mapping_clients/in_memory_mock_mapping_client). Refer to the adapter README files for instructions on how to do this. This repository provides overrides for the samples listed under [Supported Samples](../ibeji_adapter/README.md#supported-samples). -1. Set the `$FREYJA_HOME` environment variable. If you are using the provided overrides, you can run the following command to set the variable: +1. Set the `$FREYJA_HOME` environment variable. For example, to use the provided overrides for the [Ibeji mixed sample](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/mixed), you can run the command below. - export FREYJA_HOME={path-to-repo-root}/.freyja + export FREYJA_HOME={path-to-repo-root}/.freyja/mixed_sample Alternatively, you can set the variable in a [Cargo configuration file](https://doc.rust-lang.org/cargo/reference/config.html) to only enable the variable while running a Cargo command. diff --git a/freyja_apps/ibeji_adapter/README.md b/freyja_apps/ibeji_adapter/README.md index f43aa85..b058eef 100644 --- a/freyja_apps/ibeji_adapter/README.md +++ b/freyja_apps/ibeji_adapter/README.md @@ -6,11 +6,11 @@ This Freyja Example Application utilizes the [Ibeji Digital Twin Adapter](../../ To build and run the application, follow these steps: -1. (Optional) If necessary, author configuration overrides for the [`InMemoryMockMappingClient`](https://github.com/eclipse-ibeji/freyja/tree/main/mapping_clients/in_memory_mock_mapping_client). Refer to the adapter README files for instructions on how to do this. This repository provides overrides in the [`.freyja`](../../.freyja/) directory that can be used with the [`mixed` sample provided by Ibeji](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/mixed). +1. (Optional) If necessary, author configuration overrides for the [`InMemoryMockMappingClient`](https://github.com/eclipse-ibeji/freyja/tree/main/mapping_clients/in_memory_mock_mapping_client). Refer to the adapter README files for instructions on how to do this. This repository provides overrides for the samples listed under [Supported Samples](#supported-samples). -1. Set the `$FREYJA_HOME` environment variable. If you are using the provided overrides, you can run the following command to set the variable: +1. Set the `$FREYJA_HOME` environment variable. For example, to use the provided overrides for the [Ibeji mixed sample](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/mixed), you can run the command below. - export FREYJA_HOME={path-to-repo-root}/.freyja + export FREYJA_HOME={path-to-repo-root}/.freyja/mixed_sample Alternatively, you can set the variable in a [Cargo configuration file](https://doc.rust-lang.org/cargo/reference/config.html) to only enable the variable while running a Cargo command. @@ -20,6 +20,14 @@ To build and run the application, follow these steps: This will rebuild the `freyja-ibeji-adapter-app` application as necessary and then run it. +## Supported Samples + +This repository provides overrides in the [`.freyja`](../../.freyja/) directory that support the following Ibeji samples: + +- [managed subscribe](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/managed_subscribe) +- [mixed](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/mixed) +- [property](https://github.com/eclipse-ibeji/ibeji/tree/main/samples/property) + ## Containerize the Ibeji Adapter Freyja Example Application To build and run the application in a container, follow the steps under [Docker](#docker) or