Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-13267

[fiware-stackoverflow] Orion CB doesn't update lazy attributes on IoT Agent

    Details

      Description

      Created question in FIWARE Q/A platform on 09-01-2018 at 09:01
      Please, ANSWER this question AT https://stackoverflow.com/questions/48163972/orion-cb-doesnt-update-lazy-attributes-on-iot-agent

      Question:
      Orion CB doesn't update lazy attributes on IoT Agent

      Description:
      I'm trying to use Orion CB as Contex Provider for an IoT Agent in which I have registred a device with lazy attributes only.

      On the IoT Agent I need to handle updateContext requests so I did a handler for these requests like this:

      iotAgentLib.setDataUpdateHandler(updateContextHandler);

      And in the updateContextHandler function I have only one instruction:

      console.log(attributes);

      In order to see if all the values I want to update have been received correctly.

      Now if I do an update on one of the attributes of the entity represented by the device:

      curl -i -X POST \
      -H "fiware-service:service1" \
      -H "fiware-servicepath:/subservice1" \
      -H "X-Auth-Token:wNRwDwqYlLoLD8U9sFkTAEE6PfYMbQ" \
      -H "Content-Type:application/json" \
      -d \
      '{
      "contextElements": [
      {
      "id": "ncc_estimate",
      "attributes": [

      { "name": "arrival", "type": "string", "value": "some_value" }

      ]
      }
      ],
      "updateAction": "UPDATE"
      } ' \
      'http://

      {orion_address}

      /v1/updateContext'

      What I see on the IoT Agent output console is:

      time=2018-01-09T08:14:59.539Z | lvl=DEBUG | corr=2f4fdb0c-f515-11e7-86b2-0242ac110003 | trans=6ac5c35d-d7bf-419c-8f64-bc843b991d47 | op=IoTAgentNGSI.GenericMiddlewares | srv=service1 | subsrv=/subservice1 | msg=Body:

      {
      "contextElements": [
      {
      "type": "nccestimate",
      "isPattern": "false",
      "id": "ncc_estimate",
      "attributes": [

      { "name": "arrival", "type": "string", "value": "" }

      ]
      }
      ],
      "updateAction": "UPDATE"
      }

      Where as you can see the value field is empty, as I can also see from the console.log() output in the UpdateHandler function that is:

      [

      { name: 'arrival', type: 'string', value: '' }

      ]

      It seems that Orion is deleting the value before sending it to the IoT Agent. What could be the problem? Am I wrong doing something?

      edit:

      Here is the response for the call to: /v1/registry/contextEntities/ncc_estimate

      {"contextRegistrationResponses":[
      {"contextRegistration":
      {"entities":[

      { "type":"nccestimate", "isPattern":"false", "id":"ncc_estimate" }

      ],
      "attributes":[

      { "name":"transport_type", "type":"string", "isDomain":"false" }

      ,

      { "name":"arrival", "type":"string", "isDomain":"false" }

      ],
      "providingApplication":"http://192.168.199.151:4044"}
      }
      ]}

      edit2:

      This is what Orion is sending to the iot agent when performing the updateContext operation described before:

      POST //updateContext HTTP/1.1
      User-Agent: orion/1.10.0-next libcurl/7.19.7
      Host: 192.168.199.151:4044
      fiware-service: service1
      Fiware-ServicePath: /subservice1
      X-Auth-Token: M62UkJc7yKX5aQwaHrsODfIrV4Ou85
      Accept: application/json
      Content-length: 169
      Content-type: application/json; charset=utf-8
      Fiware-Correlator: 42561e9a-f615-11e7-8610-0242ac110003

      {"contextElements":[{"type":"nccestimate","isPattern":"false","id":"ncc_estimate","attributes":[

      {"name":"arrival","type":"string","value":""}

      ]}],"updateAction":"UPDATE"}

      As you can see the "value" field for the attribute is empty.
      I'm using Orion version 1.10.0 and iot agent node lib version 2.5.1.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        3d 13h 29m 1 Backlog Manager 16/Jan/18 9:18 AM
        In Progress In Progress Answered Answered
        10m 57s 1 Backlog Manager 16/Jan/18 9:29 AM
        Answered Answered Closed Closed
        2d 2h 36m 1 Backlog Manager 18/Jan/18 12:05 PM
        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        fla Fernando Lopez made changes -
        HD-Enabler IDAS [ 10884 ]
        HD-Chapter IoT [ 10839 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-18 12:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-18 12:05|UPDATED status: transition Finish| # answers= 1, accepted answer= True
        backlogmanager Backlog Manager made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        jmcantera Jose Manuel Cantera made changes -
        Assignee Jose Manuel Cantera [ jmcantera ] Jose Gato Luis [ josegato ]
        fla Fernando Lopez made changes -
        Assignee Jose Manuel Cantera [ jmcantera ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-16 09:29|UPDATED status: transition Answered| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-16 09:29|UPDATED status: transition Answered| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-16 09:18|UPDATED status: transition Answer| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-16 09:18|UPDATED status: transition Answer| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-01-12 19:48|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-01-12 19:48|CREATED monitor | # answers= 0, accepted answer= False
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            josegato Jose Gato Luis
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: