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

[fiware-stackoverflow] Command doesn't forward from FIWARE JSON Agent toward the Broker MQTT

    Details

      Description

      Created question in FIWARE Q/A platform on 20-10-2018 at 19:10
      Please, ANSWER this question AT https://stackoverflow.com/questions/52908085/command-doesnt-forward-from-fiware-json-agent-toward-the-broker-mqtt

      Question:
      Command doesn't forward from FIWARE JSON Agent toward the Broker MQTT

      Description:
      I've deployed the iot stack with docker. These are the used containers:

      fiware/orion:1.13.0
      fiware/iotagent-json:1.8.0
      eclipse-mosquitto:1.4.12
      [other containers not involved in the issue ...]

      I've registered the following device on the agent:

      {
      "device_id": "t3",
      "service": "lmobile",
      "service_path": "/lmobile_Industry",
      "entity_name": "t3",
      "entity_type": "Device",
      "endpoint": "tcp://<mqttborker_publicip>:<port>",
      "transport": "MQTT",
      "attributes": [

      { "object_id": "led", "name": "led", "type": "text" }

      ],
      "lazy": [],
      "commands": [

      { "object_id": "c", "name": "c", "type": "Command" }

      ],
      "static_attributes": [
      ....
      ],
      "protocol": "JSON"
      }

      and the corresponding entity has been properly created on the OCB and when I publish a new measure on the mqttbroker, under the topic /<apikey>/t3/attrs the measure is properly forward toward the OCB.

      In order to send the command c to the device I send the following updateContext on OCB:

      curl -s -X POST http://:1026/v1/updateContext
      -H 'accept: application/json'
      -H 'cache-control: no-cache'
      -H 'content-type: application/json'
      -H 'fiware-service: lmobile'
      -H 'fiware-servicepath: /lmobile_Industry'
      -d '{
      "contextElements": [
      {
      "type": "Device",
      "isPattern": "false",
      "id": "t3",
      "attributes": [

      { "name":"c", "type":"Command", "value":100 }

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

      and I receive the following error response:

      {
      "errorCode":

      { "code": "404", "reasonPhrase": "No context element found", "details": "invalid context provider response" }

      }

      In the OCB Log I can see the following WARNING Message:
      time=Thursday 18 Oct 08:55:54 2018.431Z | lvl=WARN | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=postQueryContext.cpp[169]:queryForward | msg=Other Error (context provider response to QueryContext is empty).
      Anyway, the updateContext is properly forwarded to the Agent.

      In the Agent Log (in DEBUG) I can see the followings:

      iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.975Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.GenericMiddlewares | srv=lmobile | subsrv=/lmobile_Industry | msg=Request for path [/updateContext] from [<agent_publicip>:<port>] | comp=IoTAgent
      iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.976Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.GenericMiddlewares | srv=lmobile | subsrv=/lmobile_Industry | msg=Body:
      iotstack_agent-json.1.xyz@xerus-1 |
      iotstack_agent-json.1.xyz@xerus-1 | {
      iotstack_agent-json.1.xyz@xerus-1 | "contextElements": [
      iotstack_agent-json.1.xyz@xerus-1 | {
      iotstack_agent-json.1.xyz@xerus-1 | "type": "Device",
      iotstack_agent-json.1.xyz@xerus-1 | "isPattern": "false",
      iotstack_agent-json.1.xyz@xerus-1 | "id": "t3",
      iotstack_agent-json.1.xyz@xerus-1 | "attributes": [
      iotstack_agent-json.1.xyz@xerus-1 |

      { iotstack_agent-json.1.xyz@xerus-1 | "name": "c", iotstack_agent-json.1.xyz@xerus-1 | "type": "Command", iotstack_agent-json.1.xyz@xerus-1 | "value": "100" iotstack_agent-json.1.xyz@xerus-1 | }

      iotstack_agent-json.1.xyz@xerus-1 | ]
      iotstack_agent-json.1.xyz@xerus-1 | }
      iotstack_agent-json.1.xyz@xerus-1 | ],
      iotstack_agent-json.1.xyz@xerus-1 | "updateAction": "UPDATE"
      iotstack_agent-json.1.xyz@xerus-1 | }
      iotstack_agent-json.1.xyz@xerus-1 |
      iotstack_agent-json.1.xyz@xerus-1 | | comp=IoTAgent
      iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.978Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.DomainControl | srv=lmobile | subsrv=/lmobile_Industry | msg=response-time: 6 | comp=IoTAgent

      Here I don't see warnings or errors but no commands are forwarded to the MQTT Broker on any topic (I'm subscribed both to the specific topic for commands /<apikey>/t3/cmd and to all topics by using the wildcard #).

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        2d 18h 1 Backlog Manager 23/Oct/18 3:06 PM
        In Progress In Progress Answered Answered
        2h 59m 1 Backlog Manager 23/Oct/18 6:06 PM
        Answered Answered Closed Closed
        7d 3h 59m 1 Backlog Manager 30/Oct/18 9:05 PM
        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        fla Fernando Lopez made changes -
        HD-Enabler IDAS [ 10884 ]
        Description
        Created question in FIWARE Q/A platform on 20-10-2018 at 19:10
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/52908085/command-doesnt-forward-from-fiware-json-agent-toward-the-broker-mqtt


        +Question:+
        Command doesn&#39;t forward from FIWARE JSON Agent toward the Broker MQTT

        +Description:+
        I've deployed the iot stack with docker. These are the used containers:


        fiware/orion:1.13.0
        fiware/iotagent-json:1.8.0
        eclipse-mosquitto:1.4.12
        [other containers not involved in the issue ...]


        I've registered the following device on the agent:

        {
             "device_id": "t3",
             "service": "lmobile",
             "service_path": "/lmobile_Industry",
             "entity_name": "t3",
             "entity_type": "Device",
             "endpoint": "tcp://&lt;mqttborker_publicip&gt;:&lt;port>",
             "transport": "MQTT",
             "attributes": [{
                        "object_id": "led",
                        "name": "led",
                        "type": "text"
             }],
             "lazy": [],
             "commands": [{
                        "object_id": "c",
                        "name": "c",
                        "type": "Command"
             }],
             "static_attributes": [
                              ....
             ],
             "protocol": "JSON"
        }


        and the corresponding entity has been properly created on the OCB and when I publish a new measure on the mqttbroker, under the topic /&lt;apikey&gt;/t3/attrs the measure is properly forward toward the OCB.

        In order to send the command c to the device I send the following updateContext on OCB:

        curl -s -X POST http://:1026/v1/updateContext
               -H 'accept: application/json'
               -H 'cache-control: no-cache'
               -H 'content-type: application/json'
               -H 'fiware-service: lmobile'
               -H 'fiware-servicepath: /lmobile_Industry'
               -d '{
                     "contextElements": [
                         {
                            "type": "Device",
                             "isPattern": "false",
                             "id": "t3",
                             "attributes": [
                               {
                                 "name":"c",
                                 "type":"Command",
                                 "value":100
                               }
                             ]
                         }
                     ],
                     "updateAction": "UPDATE"
                 }'

        and I receive the following error response:

        {
             "errorCode": {
                 "code": "404",
                 "reasonPhrase": "No context element found",
                 "details": "invalid context provider response"
             }
        }


        In the OCB Log I can see the following WARNING Message:
        time=Thursday 18 Oct 08:55:54 2018.431Z | lvl=WARN | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=postQueryContext.cpp[169]:queryForward | msg=Other Error (context provider response to QueryContext is empty).
        Anyway, the updateContext is properly forwarded to the Agent.

        In the Agent Log (in DEBUG) I can see the followings:

        iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.975Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.GenericMiddlewares | srv=lmobile | subsrv=/lmobile_Industry | msg=Request for path [/updateContext] from [&lt;agent_publicip&gt;:&lt;port&gt;] | comp=IoTAgent
        iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.976Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.GenericMiddlewares | srv=lmobile | subsrv=/lmobile_Industry | msg=Body:
        iotstack_agent-json.1.xyz@xerus-1 |
        iotstack_agent-json.1.xyz@xerus-1 | {
        iotstack_agent-json.1.xyz@xerus-1 | "contextElements": [
        iotstack_agent-json.1.xyz@xerus-1 | {
        iotstack_agent-json.1.xyz@xerus-1 | "type": "Device",
        iotstack_agent-json.1.xyz@xerus-1 | "isPattern": "false",
        iotstack_agent-json.1.xyz@xerus-1 | "id": "t3",
        iotstack_agent-json.1.xyz@xerus-1 | "attributes": [
        iotstack_agent-json.1.xyz@xerus-1 | {
        iotstack_agent-json.1.xyz@xerus-1 | "name": "c",
        iotstack_agent-json.1.xyz@xerus-1 | "type": "Command",
        iotstack_agent-json.1.xyz@xerus-1 | "value": "100"
        iotstack_agent-json.1.xyz@xerus-1 | }
        iotstack_agent-json.1.xyz@xerus-1 | ]
        iotstack_agent-json.1.xyz@xerus-1 | }
        iotstack_agent-json.1.xyz@xerus-1 | ],
        iotstack_agent-json.1.xyz@xerus-1 | "updateAction": "UPDATE"
        iotstack_agent-json.1.xyz@xerus-1 | }
        iotstack_agent-json.1.xyz@xerus-1 |
        iotstack_agent-json.1.xyz@xerus-1 | | comp=IoTAgent
        iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.978Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.DomainControl | srv=lmobile | subsrv=/lmobile_Industry | msg=response-time: 6 | comp=IoTAgent


        Here I don't see warnings or errors but no commands are forwarded to the MQTT Broker on any topic (I'm subscribed both to the specific topic for commands /&lt;apikey&gt;/t3/cmd and to all topics by using the wildcard #).
        Created question in FIWARE Q/A platform on 20-10-2018 at 19:10
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/52908085/command-doesnt-forward-from-fiware-json-agent-toward-the-broker-mqtt


        +Question:+
        Command doesn&#39;t forward from FIWARE JSON Agent toward the Broker MQTT

        +Description:+
        I've deployed the iot stack with docker. These are the used containers:


        fiware/orion:1.13.0
        fiware/iotagent-json:1.8.0
        eclipse-mosquitto:1.4.12
        [other containers not involved in the issue ...]


        I've registered the following device on the agent:

        {
             "device_id": "t3",
             "service": "lmobile",
             "service_path": "/lmobile_Industry",
             "entity_name": "t3",
             "entity_type": "Device",
             "endpoint": "tcp://&lt;mqttborker_publicip&gt;:&lt;port>",
             "transport": "MQTT",
             "attributes": [{
                        "object_id": "led",
                        "name": "led",
                        "type": "text"
             }],
             "lazy": [],
             "commands": [{
                        "object_id": "c",
                        "name": "c",
                        "type": "Command"
             }],
             "static_attributes": [
                              ....
             ],
             "protocol": "JSON"
        }


        and the corresponding entity has been properly created on the OCB and when I publish a new measure on the mqttbroker, under the topic /&lt;apikey&gt;/t3/attrs the measure is properly forward toward the OCB.

        In order to send the command c to the device I send the following updateContext on OCB:

        curl -s -X POST http://:1026/v1/updateContext
               -H 'accept: application/json'
               -H 'cache-control: no-cache'
               -H 'content-type: application/json'
               -H 'fiware-service: lmobile'
               -H 'fiware-servicepath: /lmobile_Industry'
               -d '{
                     "contextElements": [
                         {
                            "type": "Device",
                             "isPattern": "false",
                             "id": "t3",
                             "attributes": [
                               {
                                 "name":"c",
                                 "type":"Command",
                                 "value":100
                               }
                             ]
                         }
                     ],
                     "updateAction": "UPDATE"
                 }'

        and I receive the following error response:

        {
             "errorCode": {
                 "code": "404",
                 "reasonPhrase": "No context element found",
                 "details": "invalid context provider response"
             }
        }


        In the OCB Log I can see the following WARNING Message:
        time=Thursday 18 Oct 08:55:54 2018.431Z | lvl=WARN | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=postQueryContext.cpp[169]:queryForward | msg=Other Error (context provider response to QueryContext is empty).
        Anyway, the updateContext is properly forwarded to the Agent.

        In the Agent Log (in DEBUG) I can see the followings:

        iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.975Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.GenericMiddlewares | srv=lmobile | subsrv=/lmobile_Industry | msg=Request for path [/updateContext] from [&lt;agent_publicip&gt;:&lt;port&gt;] | comp=IoTAgent
        iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.976Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.GenericMiddlewares | srv=lmobile | subsrv=/lmobile_Industry | msg=Body:
        iotstack_agent-json.1.xyz@xerus-1 |
        iotstack_agent-json.1.xyz@xerus-1 | {
        iotstack_agent-json.1.xyz@xerus-1 | "contextElements": [
        iotstack_agent-json.1.xyz@xerus-1 | {
        iotstack_agent-json.1.xyz@xerus-1 | "type": "Device",
        iotstack_agent-json.1.xyz@xerus-1 | "isPattern": "false",
        iotstack_agent-json.1.xyz@xerus-1 | "id": "t3",
        iotstack_agent-json.1.xyz@xerus-1 | "attributes": [
        iotstack_agent-json.1.xyz@xerus-1 | {
        iotstack_agent-json.1.xyz@xerus-1 | "name": "c",
        iotstack_agent-json.1.xyz@xerus-1 | "type": "Command",
        iotstack_agent-json.1.xyz@xerus-1 | "value": "100"
        iotstack_agent-json.1.xyz@xerus-1 | }
        iotstack_agent-json.1.xyz@xerus-1 | ]
        iotstack_agent-json.1.xyz@xerus-1 | }
        iotstack_agent-json.1.xyz@xerus-1 | ],
        iotstack_agent-json.1.xyz@xerus-1 | "updateAction": "UPDATE"
        iotstack_agent-json.1.xyz@xerus-1 | }
        iotstack_agent-json.1.xyz@xerus-1 |
        iotstack_agent-json.1.xyz@xerus-1 | | comp=IoTAgent
        iotstack_agent-json.1.xyz@xerus-1 | time=2018-10-18T09:02:33.978Z | lvl=DEBUG | corr=8d2864ec-d2b4-11e8-b445-02420aff0161 | trans=de5680e7-0727-4577-ac44-ddeb59df1f31 | op=IoTAgentNGSI.DomainControl | srv=lmobile | subsrv=/lmobile_Industry | msg=response-time: 6 | comp=IoTAgent


        Here I don't see warnings or errors but no commands are forwarded to the MQTT Broker on any topic (I'm subscribed both to the specific topic for commands /&lt;apikey&gt;/t3/cmd and to all topics by using the wildcard #).
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-10-30 21:05|UPDATED status: transition Finish| # answers= 2, accepted answer= True

        Show
        backlogmanager Backlog Manager added a comment - 2018-10-30 21:05|UPDATED status: transition Finish| # answers= 2, accepted answer= True
        backlogmanager Backlog Manager made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-10-23 18:06|UPDATED status: transition Answered| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-10-23 18:06|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-10-23 15:06|UPDATED status: transition Answer| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-10-23 15:06|UPDATED status: transition Answer| # answers= 1, accepted answer= False
        backlogmanager Backlog Manager made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        jmcantera Jose Manuel Cantera made changes -
        Assignee Jose Manuel Cantera [ jmcantera ] Jose Gato Luis [ josegato ]
        veronika Veronika Vlnkova made changes -
        Assignee Jose Manuel Cantera [ jmcantera ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        Hide
        backlogmanager Backlog Manager added a comment -

        2018-10-20 21:06|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2018-10-20 21:06|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: