Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoprovison only works with the defined defaultResource #1524

Open
fbuedding opened this issue Nov 9, 2023 · 2 comments · May be fixed by #1611
Open

Autoprovison only works with the defined defaultResource #1524

fbuedding opened this issue Nov 9, 2023 · 2 comments · May be fixed by #1611
Assignees

Comments

@fbuedding
Copy link

IoT Agent Node Lib version the issue has been seen with

3.3.0

Bound or port used (API interaction)

Other

NGSI version

NGSIv2

Are you running a container?

Yes, I am using a contaner (Docker, Kubernetes...)

Image type

normal

Expected behaviour you didn't see

When a Service Group is provisioned with an api-key, resource other than the defaultResource and autoprovision is set to true documented here, then no device will be autoprovsioned upon receiving measurements. In my understanding the documentation let it sound like it should autoprovision a Device with the corresponding resource.

Bonus: when posting via http it also uses the default entity_type and not the one defined in the service group

Unexpected behaviour you saw

It did not autoprovision a device, it said it could not find one

Steps to reproduce the problem

# Create Service Group
curl --location 'http://localhost:4061/iot/services' \
--header 'fiware-service: openiot' \
--header 'fiware-servicepath: /' \
--header 'Content-Type: application/json' \
--data '{
 "services": [
   {
     "apikey":      "8b661f3b-6335-40d4-86ee-4d9119fe26e5",
     "cbroker":     "http://orion:1026",
     "entity_type": "House",
     "resource":    "/iot/house",
     "autoprovision":"true"
   }
 ]
}'

# Send mqtt to /ul/8b661f3b-6335-40d4-86ee-4d9119fe26e5/1/attrs
ad|123

Configs

environment:
        - "IOTA_CB_HOST=orion"
        - "IOTA_CB_PORT=1026"
        - "IOTA_NORTH_PORT=4061"
        - "IOTA_REGISTRY_TYPE=mongodb"
        - "IOTA_MONGO_HOST=mongodb"
        - "IOTA_MONGO_PORT=27017"
        - "IOTA_MONGO_DB=iotagent-ul"
        - "IOTA_PROVIDER_URL=http://iot-agent:4061"
        - "IOTA_AUTOCAST=true"
        - "IOTA_MQTT_HOST=mosquitto"
        - "IOTA_MQTT_PORT=1883"

Log output

{"name":"DEVICE_GROUP_NOT_FOUND","message":"Couldn\t find device group for fields: [\"resource\",\"apikey\"] and values: {\"resource\":\"/iot/house\",\"apikey\":\"8b661f3b-6335-40d4-86ee-4d9119fe26e5\"}
@fbuedding fbuedding added the bug label Nov 9, 2023
@github-actions github-actions bot added the NGSIv2 label Nov 9, 2023
@vivekNEC
Copy link

vivekNEC commented May 3, 2024

Hi @fbuedding, @fgalan
I would like to contribute on this issue.

@mapedraza
Copy link
Collaborator

Great to hear this @vivekNEC. I can assign you this issue. @fbuedding documented pretty well this issue, but, if you have any further question, feel free to post here.

Consider to check:

  • If you get errors when using a resource different than the default (this means, defining a resource when creating the service group (POST /iot/services) with a value that differs from the default resource) both for autoprovisioned devices (the error shown in this issue) and also for previously provisioned device (devices created in advance)
  • The behaviour for both IoT Agents: IoT Agent JSON (default resource: /iot/json) and IoT Agent Ultralight (default resource: /iot/d).
  • Test if it works both for HTTP and MQTT transport protocol (for each IoT Agent)

vivekNEC added a commit to vivekNEC/iotagent-node-lib that referenced this issue May 15, 2024
@vivekNEC vivekNEC linked a pull request May 15, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants