iotagent-node-lib 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +134 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +16 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.yml +55 -0
  4. package/.github/advanced-issue-labeler.yml +30 -0
  5. package/.github/workflows/issue-labeler.yml +43 -0
  6. package/doc/api.md +23 -80
  7. package/doc/deprecated.md +4 -0
  8. package/doc/howto.md +58 -62
  9. package/doc/installationguide.md +0 -5
  10. package/doc/requirements.txt +1 -1
  11. package/docker/Mosquitto/Dockerfile +1 -1
  12. package/lib/model/Device.js +0 -1
  13. package/lib/model/Group.js +0 -1
  14. package/lib/model/dbConn.js +1 -7
  15. package/lib/plugins/jexlParser.js +1 -1
  16. package/lib/services/common/iotManagerService.js +0 -1
  17. package/lib/services/devices/deviceRegistryMongoDB.js +10 -10
  18. package/lib/services/devices/deviceService.js +14 -19
  19. package/lib/services/devices/devices-NGSI-v2.js +2 -5
  20. package/lib/services/ngsi/entities-NGSI-LD.js +3 -3
  21. package/lib/services/ngsi/entities-NGSI-v2.js +34 -11
  22. package/lib/services/northBound/deviceProvisioningServer.js +0 -3
  23. package/lib/templates/createDevice.json +0 -4
  24. package/lib/templates/createDeviceLax.json +0 -4
  25. package/lib/templates/deviceGroup.json +1 -5
  26. package/lib/templates/updateDevice.json +4 -0
  27. package/lib/templates/updateDeviceLax.json +11 -0
  28. package/package.json +1 -1
  29. package/scripts/legacy_expression_tool/README.md +262 -0
  30. package/scripts/legacy_expression_tool/legacy_expression_tool.py +423 -0
  31. package/scripts/legacy_expression_tool/requirements.txt +3 -0
  32. package/test/unit/examples/deviceProvisioningRequests/provisionMinimumDevice4.json +0 -1
  33. package/test/unit/general/contextBrokerKeystoneSecurityAccess-test.js +3 -13
  34. package/test/unit/ngsi-ld/lazyAndCommands/merge-patch-test.js +31 -30
  35. package/test/unit/ngsi-mixed/provisioning/ngsi-versioning-test.js +33 -37
  36. package/test/unit/ngsiv2/examples/contextRequests/updateContext.json +2 -0
  37. package/test/unit/ngsiv2/examples/contextRequests/updateContext1.json +3 -1
  38. package/test/unit/ngsiv2/examples/contextRequests/updateContext3WithStatic.json +2 -0
  39. package/test/unit/ngsiv2/examples/contextRequests/updateContext4.json +4 -1
  40. package/test/unit/ngsiv2/examples/contextRequests/updateContext5.json +12 -0
  41. package/test/unit/ngsiv2/examples/contextRequests/updateContext6.json +10 -0
  42. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin1.json +2 -0
  43. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin2.json +3 -1
  44. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin3.json +3 -1
  45. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin4.json +3 -1
  46. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin5.json +3 -1
  47. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin6.json +3 -1
  48. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin7.json +3 -1
  49. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin8.json +3 -1
  50. package/test/unit/ngsiv2/examples/contextRequests/updateContextAliasPlugin9.json +3 -1
  51. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast1.json +2 -0
  52. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast2.json +2 -0
  53. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast3.json +3 -1
  54. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast4.json +3 -1
  55. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast5.json +3 -1
  56. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast6.json +3 -1
  57. package/test/unit/ngsiv2/examples/contextRequests/updateContextAutocast7.json +3 -1
  58. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandError.json +3 -1
  59. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandExpired.json +3 -1
  60. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandFinish.json +3 -1
  61. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus.json +2 -0
  62. package/test/unit/ngsiv2/examples/contextRequests/updateContextCommandStatus2.json +2 -0
  63. package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp1.json +3 -1
  64. package/test/unit/ngsiv2/examples/contextRequests/updateContextCompressTimestamp2.json +3 -1
  65. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin1.json +2 -0
  66. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin11.json +2 -0
  67. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin12.json +2 -0
  68. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin13.json +3 -1
  69. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin2.json +2 -0
  70. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin29.json +2 -0
  71. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin3.json +2 -0
  72. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin30.json +2 -0
  73. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin31.json +2 -0
  74. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin32.json +2 -0
  75. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin33.json +2 -0
  76. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin34.json +2 -0
  77. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin35.json +2 -0
  78. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin36.json +1 -0
  79. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin4.json +2 -0
  80. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin40.json +1 -1
  81. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin41.json +1 -0
  82. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin5.json +2 -0
  83. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin6.json +2 -0
  84. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin7.json +2 -0
  85. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin8.json +2 -0
  86. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionPlugin9.json +2 -0
  87. package/test/unit/ngsiv2/examples/contextRequests/updateContextExpressionSkip.json +12 -0
  88. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityJexlExpressionPlugin1.json +1 -1
  89. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin1.json +1 -1
  90. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin10.json +1 -1
  91. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin11.json +1 -1
  92. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin12.json +1 -1
  93. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin13.json +1 -1
  94. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin14.json +1 -1
  95. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin15.json +1 -1
  96. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin16.json +1 -1
  97. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin17.json +1 -1
  98. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin2.json +1 -1
  99. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin25.json +1 -1
  100. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin3.json +1 -1
  101. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin4.json +1 -1
  102. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin5.json +1 -1
  103. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin6.json +1 -1
  104. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin7.json +1 -1
  105. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin8.json +1 -1
  106. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityPlugin9.json +1 -1
  107. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin1.json +1 -1
  108. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin2.json +1 -1
  109. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin3.json +1 -1
  110. package/test/unit/ngsiv2/examples/contextRequests/updateContextMultientityTimestampPlugin4.json +2 -0
  111. package/test/unit/ngsiv2/examples/contextRequests/updateContextProcessTimestamp.json +2 -0
  112. package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json +2 -0
  113. package/test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributesMetadata.json +3 -1
  114. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestamp.json +3 -1
  115. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalse.json +12 -0
  116. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampFalseTimeInstant.json +12 -0
  117. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverride.json +2 -0
  118. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampOverrideWithoutMilis.json +2 -0
  119. package/test/unit/ngsiv2/examples/contextRequests/updateContextTimestampTimezone.json +3 -1
  120. package/test/unit/ngsiv2/expressions/jexlBasedTransformations-test.js +133 -75
  121. package/test/unit/ngsiv2/general/contextBrokerOAuthSecurityAccess-test.js +18 -51
  122. package/test/unit/ngsiv2/general/https-support-test.js +1 -5
  123. package/test/unit/ngsiv2/lazyAndCommands/command-test.js +4 -10
  124. package/test/unit/ngsiv2/lazyAndCommands/polling-commands-test.js +8 -24
  125. package/test/unit/ngsiv2/ngsiService/active-devices-test.js +143 -57
  126. package/test/unit/ngsiv2/ngsiService/autocast-test.js +14 -21
  127. package/test/unit/ngsiv2/ngsiService/staticAttributes-test.js +3 -5
  128. package/test/unit/ngsiv2/ngsiService/subscriptions-test.js +1 -10
  129. package/test/unit/ngsiv2/plugins/alias-plugin_test.js +20 -30
  130. package/test/unit/ngsiv2/plugins/bidirectional-plugin_test.js +0 -63
  131. package/test/unit/ngsiv2/plugins/compress-timestamp-plugin_test.js +4 -6
  132. package/test/unit/ngsiv2/plugins/custom-plugin_test.js +1 -2
  133. package/test/unit/ngsiv2/plugins/multientity-plugin_test.js +3 -5
  134. package/test/unit/ngsiv2/plugins/timestamp-processing-plugin_test.js +2 -3
  135. package/test/unit/ngsiv2/provisioning/device-group-api-test.js +2 -3
  136. package/test/unit/ngsiv2/provisioning/device-provisioning-api_test.js +5 -53
  137. package/test/unit/ngsiv2/provisioning/device-registration_test.js +1 -7
  138. package/test/unit/ngsiv2/provisioning/device-update-registration_test.js +2 -9
  139. package/test/unit/ngsiv2/provisioning/singleConfigurationMode-test.js +0 -11
  140. package/test/unit/ngsiv2/provisioning/updateProvisionedDevices-test.js +0 -7
  141. package/test/unit/plugins/capture-provision-inPlugins_test.js +0 -6
@@ -0,0 +1,134 @@
1
+ name: 'Bug report'
2
+ description: Create a report to help us improve
3
+ labels: ['bug']
4
+
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: Thanks for taking the time to fill out this bug report!
9
+
10
+ - type: input
11
+ id: version
12
+ attributes:
13
+ label: IoT Agent Node Lib version the issue has been seen with
14
+ description: |
15
+ Do not submit bug reports about anything but the two most recently released *major* systemd versions upstream!
16
+ If there have been multiple stable releases for that major version, please consider updating to a recent one before reporting an issue.
17
+ See https://github.com/telefonicaid/iotagent-node-lib/releases/ for the list of most recent releases.
18
+ placeholder: '3.2.0'
19
+ validations:
20
+ required: true
21
+
22
+ - type: dropdown
23
+ id: port
24
+ attributes:
25
+ label: Bound or port used (API interaction)
26
+ description: Select with part of the API is motivating this issue creation.
27
+ multiple: true
28
+ options:
29
+ - 'Southbound (Devices data API)'
30
+ - 'Northbound (Provision API and NGSI Interactions)'
31
+ - 'Other'
32
+ validations:
33
+ required: true
34
+
35
+ - type: dropdown
36
+ id: ngsi-version
37
+ attributes:
38
+ label: NGSI version
39
+ description: Please chose the NGSI version configured
40
+ multiple: true
41
+ options:
42
+ - 'NGSIv2'
43
+ - 'NGSI-LD'
44
+ - 'Mixed Mode'
45
+ - 'Other'
46
+ validations:
47
+ required: true
48
+
49
+ - type: dropdown
50
+ id: containerized
51
+ attributes:
52
+ label: Are you running a container?
53
+ description: In case you are using a container, please select the image type the issue was seen on
54
+ options:
55
+ - 'Yes, I am using a contaner (Docker, Kubernetes...)'
56
+ - 'No, I am running it natively'
57
+ validations:
58
+ required: false
59
+
60
+ - type: dropdown
61
+ id: image-type
62
+ attributes:
63
+ label: Image type
64
+ description: In case you are using a container, please select the image type the issue was seen on
65
+ options:
66
+ - normal
67
+ - pm2
68
+ - distroless
69
+ validations:
70
+ required: false
71
+
72
+ - type: textarea
73
+ id: expected-behaviour
74
+ attributes:
75
+ label: Expected behaviour you didn't see
76
+ validations:
77
+ required: false
78
+
79
+ - type: textarea
80
+ id: unexpected-behaviour
81
+ attributes:
82
+ label: Unexpected behaviour you saw
83
+ validations:
84
+ required: false
85
+
86
+ - type: textarea
87
+ id: steps-to-reproduce
88
+ attributes:
89
+ label: Steps to reproduce the problem
90
+ description: Please fill this field with all the required information and steps to reproduce the issue described above.
91
+ Consider including curl requests if required
92
+ placeholder: |
93
+ ```sh
94
+ # Get IoTA version
95
+ `curl -iX GET 'http://localhost:4041/iot/about'`
96
+ ```
97
+ validations:
98
+ required: false
99
+
100
+ - type: textarea
101
+ id: config
102
+ attributes:
103
+ label: Configs
104
+ description: |
105
+ Please provide details about your environment vars or config file by copying and pasting the enviroments variables
106
+ or the config.js file.
107
+ value: |
108
+ ```yaml
109
+ environment:
110
+ - "IOTA_CB_HOST=orion"
111
+ - "IOTA_CB_PORT=1026"
112
+ - "IOTA_NORTH_PORT=4041"
113
+ - "IOTA_REGISTRY_TYPE=mongodb"
114
+ - "IOTA_MONGO_HOST=mongodb"
115
+ - "IOTA_MONGO_PORT=27017"
116
+ - "IOTA_MONGO_DB=iotagent-json"
117
+ - "IOTA_HTTP_PORT=7896"
118
+ - "IOTA_PROVIDER_URL=http://iot-agent:4041"
119
+ ```
120
+
121
+ validations:
122
+ required: false
123
+
124
+ - type: textarea
125
+ id: additional-information
126
+ attributes:
127
+ label: Log output
128
+ description: |
129
+ Please paste the output log here, ideally when generated in debug mode (try setting the `IOTA_LOG_LEVEL=debug` environment variable).
130
+ For very long copy/pasted data consider using a service like https://gist.github.com/. Where copy/paste is not possible, a photo of the screen might do too, but text is always much preferred.
131
+ placeholder: Paste your log here
132
+ render: sh
133
+ validations:
134
+ required: false
@@ -0,0 +1,16 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: IoT Agent documentation
4
+ url: https://iotagent-node-lib.readthedocs.io/en/latest/
5
+ about: check the documentation before asking help or reporting a bug.
6
+ - name: Community Support
7
+ url: https://stackoverflow.com/questions/ask?tags=iot-agent+fiware
8
+ about: |
9
+ Volunteers from the Open Source FIWARE community monitor the 𝚏𝚒𝚠𝚊𝚛𝚎 tag
10
+ and related tags over on Stack Overflow. For 𝗱𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 𝗼𝗻𝗹𝘆 you can ask questions
11
+ over on Stack Overflow provided you follow their rules and guidance on posting and respond to any feedback given.
12
+
13
+ Stack Overflow is a crowd-sourced question and answer website for professional and enthusiast programmers. It is not affliated with this
14
+ software and 𝗱𝗼𝗲𝘀 𝗻𝗼𝘁 𝗮𝗻𝘀𝘄𝗲𝗿 𝗰𝘂𝘀𝘁𝗼𝗺𝗲𝗿 𝘀𝗲𝗿𝘃𝗶𝗰𝗲 𝗿𝗲𝗹𝗮𝘁𝗲𝗱 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀.
15
+
16
+ Do not raise a Stack Overflow question for bug reports or feature requests, stick with opening an issue directly within this repository.
@@ -0,0 +1,55 @@
1
+ name: Feature request
2
+ description: Suggest an improvement
3
+ labels: ["Feature Request"]
4
+
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: Thanks for taking the time to fill out this feature request!
9
+
10
+ - type: dropdown
11
+ id: type
12
+ attributes:
13
+ label: Component
14
+ description: Please chose components related to this feature request.
15
+ multiple: true
16
+ options:
17
+ - 'New feature'
18
+ - 'Feature enhancement'
19
+ - 'Techdeb'
20
+ - 'Other'
21
+ validations:
22
+ required: false
23
+
24
+ - type: textarea
25
+ id: description
26
+ attributes:
27
+ label: Is your feature request related to a problem? Please describe
28
+ description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
29
+ validations:
30
+ required: false
31
+
32
+ - type: textarea
33
+ id: solution
34
+ attributes:
35
+ label: Describe the solution you'd like
36
+ description: A clear and concise description of what you want to happen.
37
+ validations:
38
+ required: false
39
+
40
+ - type: textarea
41
+ id: alternatives
42
+ attributes:
43
+ label: Describe alternatives you've considered
44
+ description: A clear and concise description of any alternative solutions or features you've considered.
45
+ validations:
46
+ required: false
47
+
48
+ - type: input
49
+ id: version
50
+ attributes:
51
+ label: The systemd version you checked that didn't have the feature you are asking for
52
+ description: If this is not the most recently released upstream version, then please check first if it has that feature already.
53
+ placeholder: '3.2.0'
54
+ validations:
55
+ required: false
@@ -0,0 +1,30 @@
1
+ #
2
+ # This file is used by .github/workflows/issue-labeler.yml
3
+ # Here, you can configure which dropdown fields are used
4
+ # to assing a label (keys) to the issue and the name of the label (name)
5
+ #
6
+ # More info: https://github.com/marketplace/actions/advanced-issue-labeler
7
+ #
8
+
9
+ policy:
10
+ - template: [bug_report.yml]
11
+ section:
12
+ - id: [ngsi-version]
13
+ block-list: ['None', 'Other', 'Mixed Mode']
14
+ label:
15
+ - name: 'NGSIv2'
16
+ keys: ['NGSIv2']
17
+ - name: 'NGSI-LD'
18
+ keys: ['NGSI-LD']
19
+
20
+ - template: [feature_request.yml]
21
+ section:
22
+ - id: [type]
23
+ block-list: ['None', 'Other']
24
+ label:
25
+ - name: 'Feature request'
26
+ keys: ['New feature']
27
+ - name: 'Enhancement'
28
+ keys: ['Feature enhancement']
29
+ - name: 'Techdeb'
30
+ keys: ['Techdeb']
@@ -0,0 +1,43 @@
1
+ #
2
+ # This workflow is used to asign labels to issues created through the templates.
3
+ # There is another file associated that maps a issue label name to each field on the
4
+ # issue template. You can find that file in /.github/advanced-issue-labeler.yml
5
+ #
6
+ # More info: https://github.com/marketplace/actions/advanced-issue-labeler
7
+ #
8
+
9
+ name: Issue labeler
10
+ on:
11
+ issues:
12
+ types: [ opened ]
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ label-component:
19
+ runs-on: ubuntu-latest
20
+
21
+ permissions:
22
+ # required for all workflows
23
+ issues: write
24
+
25
+ strategy:
26
+ matrix:
27
+ template: [ bug_report.yml, feature_request.yml ]
28
+
29
+ steps:
30
+ - uses: actions/checkout@v3
31
+
32
+ - name: Parse issue form
33
+ uses: stefanbuck/github-issue-parser@v3
34
+ id: issue-parser
35
+ with:
36
+ template-path: .github/ISSUE_TEMPLATE/${{ matrix.template }}
37
+
38
+ - name: Set labels based on policy
39
+ uses: redhat-plumbers-in-action/advanced-issue-labeler@v2
40
+ with:
41
+ issue-form: ${{ steps.issue-parser.outputs.jsonString }}
42
+ template: ${{ matrix.template }}
43
+ token: ${{ secrets.GITHUB_TOKEN }}
package/doc/api.md CHANGED
@@ -19,8 +19,7 @@
19
19
  - [Measurement persistence options](#measurement-persistence-options)
20
20
  - [Autoprovision configuration (autoprovision)](#autoprovision-configuration-autoprovision)
21
21
  - [Explicitly defined attributes (explicitAttrs)](#explicitly-defined-attributes-explicitattrs)
22
- - [Configuring operation to persist the data in Context Broker (appendMode)](#configuring-operation-to-persist-the-data-in-context-broker-appendmode)
23
- - [Differences between `autoprovision`, `explicitAttrs` and `appendMode`](#differences-between-autoprovision-explicitattrs-and-appendmode)
22
+ - [Differences between `autoprovision`, `explicitAttrs`](#differences-between-autoprovision-explicitattrs)
24
23
  - [Expression language support](#expression-language-support)
25
24
  - [Examples of JEXL expressions](#examples-of-jexl-expressions)
26
25
  - [Available functions](#available-functions)
@@ -31,7 +30,6 @@
31
30
  - [Multientity measurement transformation support (`object_id`)](#multientity-measurement-transformation-support-object_id)
32
31
  - [Timestamp Compression](#timestamp-compression)
33
32
  - [Timestamp Processing](#timestamp-processing)
34
- - [Bidirectionality plugin (bidirectional)](#bidirectionality-plugin-bidirectional)
35
33
  - [Overriding global Context Broker host](#overriding-global-context-broker-host)
36
34
  - [Multitenancy, FIWARE Service and FIWARE ServicePath](#multitenancy-fiware-service-and-fiware-servicepath)
37
35
  - [Secured access to the Context Broker](#secured-access-to-the-context-broker)
@@ -141,6 +139,16 @@ subservice mapping, security information and attribute configuration can be spec
141
139
  relaying on the config group configuration. The specific parameters that can be configured for a given device are
142
140
  described in the [Device datamodel](#device-datamodel) section.
143
141
 
142
+ If devices are not pre-registered, they will be automatically created when a measure arrives to the IoT Agent - this
143
+ process is known as autoprovisioning. The IoT Agent will create an empty device with the group `apiKey` and `type` - the
144
+ associated document created in database doesn't include config group parameters (in particular, `timestamp`,
145
+ `explicitAttrs`, `active` or `attributes`, `static` and `lazy` attributes and commands). The IoT Agent will also create
146
+ the entity in the Context Broker if it does not exist yet.
147
+
148
+ This behavior allows that autoprovisioned parameters can freely established modifying the device information after
149
+ creation using the provisioning API. However, note that if a device (autoprovisioned or not) doesn't have these
150
+ parameters defined at device level in database, the parameters are inherit from config group parameters.
151
+
144
152
  ## Entity attributes
145
153
 
146
154
  In the config group/device model there are four list of attributes with different purpose to configure how the
@@ -180,17 +188,16 @@ Some transformation plugins also allow the use of the following optional fields:
180
188
  - **expression**: indicates that the value of the target attribute will not be the plain value or the measurement, but
181
189
  an expression based on a combination of the reported values. See the
182
190
  [Expression Language definition](#expression-language-support) for details
183
- - **skipValue**: indicates that if the result of applying `expression` to a measure is equal to the value of `skipValue` then
184
- the attribute corresponding to the measure is not sent to CB. By default if `skipValue` is not defined then is
185
- considered as `null` (i.e. if the result of apply `expression` results in `null` then corresponding attribute is not
186
- sent to CB). It is only used if `expression` is provided (otherwise is ignored).
191
+ - **skipValue**: indicates that if the result of applying `expression` to a measure is equal to the value of
192
+ `skipValue` then the attribute corresponding to the measure is not sent to CB. In other words, this field **is not
193
+ an expression**, it is a value that is compared with the result of applying `expression` to a measure. By default if
194
+ `skipValue` is not defined then is considered as `null` (i.e. if the result of apply `expression` results in `null`
195
+ then corresponding attribute is not sent to CB). It is only used if `expression` is provided (otherwise is ignored).
187
196
  - **entity_name**: the presence of this attribute indicates that the value will not be stored in the original device
188
197
  entity but in a new entity with an ID given by this attribute. The type of this additional entity can be configured
189
198
  with the `entity_type` attribute. If no type is configured, the device entity type is used instead. Entity names can
190
199
  be defined as expressions, using the [Expression Language definition](#expression-language-support).
191
200
  - **entity_type**: configures the type of an alternative entity.
192
- - **reverse**: add bidirectionality expressions to the attribute. See the **bidirectionality** transformation plugin
193
- in the [Data Mapping Plugins section](development.md#bidirectionality-plugin-bidirectional) for details.
194
201
 
195
202
  Additionally for commands (which are attributes of type `command`) the following fields are optional:
196
203
 
@@ -360,15 +367,13 @@ used should be taken from those defined by
360
367
 
361
368
  ## Measurement persistence options
362
369
 
363
- There are 3 different options to configure how the IoTAgent stores the measures received from the devices, depending on
370
+ There are 2 different options to configure how the IoTAgent stores the measures received from the devices, depending on
364
371
  the following parameters:
365
372
 
366
373
  - `autoprovision`: If the device is not provisioned, the IoTAgent will create a new device and entity for it.
367
374
  - `explicitAttrs`: If the measure element (object_id) is not defined in the mappings of the device or config group
368
375
  provision, the measure is stored in the Context Broker by adding a new attribute to the entity with the same name of
369
376
  the undefined measure element.
370
- - `appendMode`: It configures the request to the Context Broker to update the entity every time a new measure arrives.
371
- It have implications depending if the entity is already created or not in the Context Broker.
372
377
 
373
378
  ### Autoprovision configuration (autoprovision)
374
379
 
@@ -376,7 +381,8 @@ By default, when a measure arrives to the IoTAgent, if the `device_id` does not
376
381
  IoTA creates a new device and a new entity according to the config group. Defining the field `autoprovision` to `false`
377
382
  when provisioning the config group, the IoTA to reject the measure at the southbound, allowing only to persist the data
378
383
  to devices that are already provisioned. It makes no sense to use this field in device provisioning since it is intended
379
- to avoid provisioning devices (and for it to be effective, it would have to be provisional).
384
+ to avoid provisioning devices (and for it to be effective, it would have to be provisional). Further information can be
385
+ found in section [Devices](#devices)
380
386
 
381
387
  ### Explicitly defined attributes (explicitAttrs)
382
388
 
@@ -440,15 +446,7 @@ depending on the JEXL expression evaluation:
440
446
  - If it evaluates to an array just measures defined in the array (identified by their attribute names, not by their
441
447
  object_id) will be will be propagated to NGSI interface (as in case 3)
442
448
 
443
- ### Configuring operation to persist the data in Context Broker (appendMode)
444
-
445
- This is a flag that can be enabled by activating the parameter `appendMode` in the configuration file or by using the
446
- `IOTA_APPEND_MODE` environment variable (more info
447
- [here](https://github.com/telefonicaid/iotagent-node-lib/blob/master/doc/installationguide.md)). If this flag is
448
- activated, the update requests to the Context Broker will be performed always with APPEND type, instead of the default
449
- UPDATE. This have implications in the use of attributes with Context Providers, so this flag should be used with care.
450
-
451
- ### Differences between `autoprovision`, `explicitAttrs` and `appendMode`
449
+ ### Differences between `autoprovision`, `explicitAttrs`
452
450
 
453
451
  Since those configuration parameters are quite similar, this section is intended to clarify the relation between them.
454
452
 
@@ -460,16 +458,6 @@ related to the **southbound**.
460
458
  What `explicitAttrs` does is to filter from the southbound the parameters that are not explicitly defined in the device
461
459
  provision or config group. That also would avoid propagating the measures to the Context Broker.
462
460
 
463
- The default way the agent updates the information into the Context Broker is by using an update request. If
464
- `appendMode=true`, the IoTA will use an append request instead of an update one. This means it will store the attributes
465
- even if they are not present in the entity. This seems the same functionality that the one provided by `autoprovision`,
466
- but it is a different concept since the scope of this config is to setup how the IoT interacts with the context broker,
467
- this is something related to the **northbound**.
468
-
469
- Note that, even creating a config group with `autoprovision=true` and `explicitAttrs=true`, if you do not provision
470
- previously the entity in the Context Broker (having all attributes to be updated), it would fail if `appendMode=false`.
471
- For further information check the issue [#1301](https://github.com/telefonicaid/iotagent-node-lib/issues/1301).
472
-
473
461
  ## Expression language support
474
462
 
475
463
  The IoTAgent Library provides an expression language for measurement transformation and other purposes. This expression
@@ -495,6 +483,9 @@ expression. In all cases the following data is available to all expressions:
495
483
  - `subservice`: device subservice
496
484
  - `staticAttributes`: static attributes defined in the device or config group
497
485
 
486
+ Additionally, for attribute expressions (`expression`, `entity_name`) and `entityNameExp` measures are avaiable in the
487
+ **context** used to evaluate them.
488
+
498
489
  ### Examples of JEXL expressions
499
490
 
500
491
  The following table shows expressions and their expected outcomes taking into account the following measures at
@@ -858,54 +849,6 @@ The IOTA processes the entity attributes looking for a `TimeInstant` attribute.
858
849
  adds a `TimeInstant` attribute as metadata for every other attribute in the same request. With NGSI-LD, the Standard
859
850
  `observedAt` property-of-a-property is used instead.
860
851
 
861
- ## Bidirectionality plugin (bidirectional)
862
-
863
- This plugin allows the devices with composite values an expression to update the original values in the devices when the
864
- composite expressions are updated in the Context Broker. This behavior is achieved through the use of subscriptions.
865
-
866
- IoTAs using this plugins should also define a notification handler to handle incoming values. This handler will be
867
- intercepted by the plugin, so the mapped values are included in the updated notification.
868
-
869
- When a device is provisioned with bidirectional attributes, the IoTAgent subscribes to changes in that attribute. When a
870
- change notification for that attribute arrives to the IoTA, it applies the transformation defined in the device
871
- provisioning payload to the notification, and calls the underlying notification handler with the transformed entity
872
- including the `value` along with any `metadata`, and in the case of an NGSI-LD bidirectional attribute a `datasetId` if
873
- provided.
874
-
875
- The following `attributes` section shows an example of the plugin configuration (using `IOTA_AUTOCAST=false` to avoid
876
- translation from geo:point to geo:json)
877
-
878
- ```json
879
- "attributes": [
880
- {
881
- "name":"location",
882
- "type":"geo:point",
883
- "expression": "latitude, longitude",
884
- "reverse": [
885
- {
886
- "object_id":"longitude",
887
- "type": "Number",
888
- "expression": "location | split(', ')[0] | parsefloat()"
889
- },
890
- {
891
- "object_id":"latitude",
892
- "type": "Number",
893
- "expression": "location | split(', ')[1] | parsefloat()"
894
- }
895
- ]
896
- }
897
- ],
898
- ```
899
-
900
- For each attribute that would have bidirectionality, a new field `reverse` must be configured. This field will contain
901
- an array of fields that will be created based on the notifications content. The expression notification can contain any
902
- attribute of the same entity as the bidirectional attribute; declaring them in the expressions will add them to the
903
- subscription payload.
904
-
905
- For each attribute in the `reverse` array, an expression must be defined to calculate its value based on the
906
- notification attributes. This value will be passed to the underlying protocol with the `object_id` name. Details about
907
- how the value is then progressed to the device are protocol-specific.
908
-
909
852
  ## Overriding global Context Broker host
910
853
 
911
854
  **cbHost**: Context Broker host URL. This option can be used to override the global CB configuration for specific types
package/doc/deprecated.md CHANGED
@@ -22,6 +22,8 @@ A list of deprecated features and the version in which they were deprecated foll
22
22
  - Support groups (provision) statically defined by configuration
23
23
  - Support to in-memory registry (i.e.`deviceRegistry.type=memory`)
24
24
  - Support to legacy expressions (finally removed in 3.2.0)
25
+ - Bidirectinal pluging (to be removed in 3.4.0)
26
+ - appendMode (to be removed in 3.4.0)
25
27
 
26
28
  The use of Node.js v14 is highly recommended.
27
29
 
@@ -51,3 +53,5 @@ The following table provides information about the last iotagent-node-lib versio
51
53
  | Support to Node.js v12 | 2.24.0 | September 2nd, 2022 |
52
54
  | Support to NGSI-LD 1.3 | 2.25.0 | January 24th, 2023 |
53
55
  | Support to Legacy Expressions | 3.1.0 | April 25th, 2023 |
56
+ | bidirrectional plugin | 3.3.0 | August 24th, 2023 |
57
+ | appendMode | 3.3.0 | August 24th, 2023 |