You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom mappings for assets and sensors are general so they will be loaded in every tenant collections.
If I have 2 kinds of tenants: air-quality and water-management, they will have different metadata for sensors and assets since it's two different kind of use case.
With the current implementation, every tenant kind will share the mappings of the two use cases.
We need a way to register custom mappings only for a particular tenant kind. And if no kind is specified then the mappings is applied to every tenant kind.
Possible API:
// only for "water-management" tenants
deviceManager.registerAssetsMappings(pipesMappings, 'water-management');
deviceManager.registerAssetsMappings(valvesMappings, 'water-management');
// only for "air-quality" tenants
deviceManager.registerAssetsMappings(classroomsMappings, 'air-quality');
// for all tenants
deviceManager.registerAssetsMappings(reportsMappings);
The text was updated successfully, but these errors were encountered:
Leodau
changed the title
Allows to define custom mappings for sensors and assets for a tenant kind only
Allows to define custom mappings for sensors and assets for a tenant group only
Mar 16, 2021
Leodau
changed the title
Allows to define custom mappings for sensors and assets for a tenant group only
Allows to define custom mappings for devices and assets for a tenant group only
Mar 17, 2021
### What this PR does
This PR allows to have custom mapping for each tenant group for the `assets` and `devices` collections
#28
They are meant to be loaded at application startup
For `devices` collection, only `qos`, `measures`, and `metadata` fields are meant to be customized.
For `assets` collection, only `metadata` field is meant to be customized.
### How to test
1) Functional tests.
2) Clone KIoTP repo on branch `add-custom-mappings`
Install plugins and switch to the `add-custom-mappings` branch on the `device-plugin-manager`
Define your own mappings in `lib/plugins/device-manager/mappings/`
Register it in `lib/plugins/device-manager/index.ts` with the provided methods
Run KIoTP
Create and engine `kourou device-manager/engine:create -a group="groupTest" index="test"`
Verify the mappings are correctly added.
```ts
deviceManagerPlugin.devices.registerQos
deviceManagerPlugin.devices.registerMetadata
deviceManagerPlugin.devices.registerMeasure
deviceManagerPlugin.assets.registerMetadata
```
Description
Custom mappings for assets and sensors are general so they will be loaded in every tenant collections.
If I have 2 kinds of tenants:
air-quality
andwater-management
, they will have different metadata for sensors and assets since it's two different kind of use case.With the current implementation, every tenant kind will share the mappings of the two use cases.
We need a way to register custom mappings only for a particular tenant kind. And if no kind is specified then the mappings is applied to every tenant kind.
Possible API:
The text was updated successfully, but these errors were encountered: