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

Possible problem with "operations" in registrations #1479

Closed
kzangeli opened this issue Nov 21, 2023 · 1 comment
Closed

Possible problem with "operations" in registrations #1479

kzangeli opened this issue Nov 21, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@kzangeli
Copy link
Collaborator

According to Jason Fox:

I have no entities within the ContextBroker, but have created a Registration as shown:

{
  "id": "urn:ngsi-ld:csourceregistration:-1996384433",
  "type": "ContextSourceRegistration",
  "contextSourceInfo": {
    "key": "jsonldContext",
    "value": "http://context/ngsi-context.jsonld"
  },
  "endpoint": "http://iot-agent:4041",
  "information": [
    {
      "entities": [
        {
          "id": "urn:ngsi-ld:Device:filling002",
          "type": "FillingLevelSensor"
        }
      ],
      "propertyNames": [
        "add",
        "remove",
        "refill"
      ]
    }
  ],
  "mode": "exclusive",
  "operations": "updateOps"
}

updateOps - i.e. PUSH Data to IoT Agent
I then make a request for the device urn:ngsi-ld:Device:filling002:

curl -L 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:Device:filling002' \
-H 'Link: <https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/ld+json' \
-H 'NGSILD-Tenant: openiot'

ORION-LD is returning:

{
    "@context": "https://fiware.github.io/tutorials.Step-by-Step/tutorials-context.jsonld",
    "type": "https://uri.fiware.org/ns/dataModels#Device",
    "id": "urn:ngsi-ld:Device:filling002",
    "add": {
        "type": "Property",
        "value": ""
    },
    "remove": {
        "type": "Property",
        "value": ""
    },
    "refill": {
        "type": "Property",
        "value": ""
    }
}

It must be getting those values in communication with the IoT Agent somehow, because if I stop the IoT Agent then I get:

{
    "type": "https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound",
    "title": "Entity not found",
    "detail": "urn:ngsi-ld:Device:filling002"
}

But updateOps indicates that the add, remove and refill attribute are a WRITE ONLY.

@kzangeli kzangeli mentioned this issue Nov 21, 2023
@kzangeli kzangeli added bug Something isn't working and removed Possible bug labels Nov 24, 2023
@kzangeli
Copy link
Collaborator Author

Error reproduced, very easy fix - a continue (start a loop from its beginning, with the next item) is missing.
This is what the logfile says:

regMatchForEntityGet.cpp[105]:regMatchForEntityGet : urn:R1: No Reg Match due to Operation (operation == 21: 'retrieveEntity')
regMatchForEntityGet.cpp[129]:regMatchForEntityGet : urn:R1: Reg Match !

First the "no match" due to "operations" is detected, then, as a continue is missing, it slips through and marks the registration as a match!!!
Stupid, stupid bug!

kzangeli added a commit that referenced this issue Nov 27, 2023
#1479 - Fixed problem with operations in registrations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants