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

FIWARE.Question.Tech.Adding device to OPC-UA IoT Agent trough REST API call.

    Details

      Description

      Created question in FIWARE Q/A platform on 13-05-2022 at 13:05
      Please, ANSWER this question AT https://stackoverflow.com/questions/72230070/adding-device-to-opc-ua-iot-agent-trough-rest-api-call

      Question:
      Adding device to OPC-UA IoT Agent trough REST API call

      Description:
      I'm struggling trying to add a device via API call.
      If I start the docker container with the docker-compse.yml, I'm able to load a device to the local OPC-UA server, with the following REST API call.

      curl http://localhost:4001/iot/devices -H "fiware-service: opcua_car" -H "fiware-servicepath: /demo" -H "Content-Type: application/json" -d @testCommands/add_device_NGSIv2.json

      But, if I start the docker container with the docker-compse-external-server.yml, which instead of the iotagent4fiware/iotagent-opcua:latest uses the iotagent4fiware/iotagent-opcua:1.3.4, and I use the same API call, I get the following error:

      {"name":"WRONG_SYNTAX","message":"Wrong syntax in request: Errors found validating request."}

      From the Docker log:
      "op":"IoTAgentNGSI.RestUtils","time":"2022-05-12T19:47:59.467Z","lvl":"DEBUG","msg":"Errors found validating request: {
      "valid":false,"errors": [

      {"attribute":"pattern","property":"devices.0.commands.1.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Accelerate","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.commands.0.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Stop","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.attributes.4.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Oxigen","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.attributes.3.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Temperature","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.attributes.2.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=EngineStopped","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.attributes.1.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Acceleration","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.attributes.0.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=EngineBrake","message":"invalid input"}

      ,

      {"attribute":"pattern","property":"devices.0.lazy.0.object_id","expected":"^([^<>();'="]+)+$","actual":"ns=3;s=Speed","message":"invalid input"}

      ]
      }

      Then, If I run the Agent in Node.js, I get the same error:

      {"name":"WRONG_SYNTAX","message":"Wrong syntax in request: Errors found validating request."}

      If I try to use iotagent4fiware/iotagent-opcua:latest, which should be the same of running the cloned repository in Node.js, it seems to ignore the endpointUrl present in the configuration.properties file, and it try to connect always to opc.tcp://iotcarsrv:5001/UA/CarServer.
      Of course, connection fails...
      I'm pretty confused from that behaviors, and I can't add anything to the IoTAgent.

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2022-05-14 05:31|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2022-05-14 05:31|CREATED monitor | # answers= 0, accepted answer= False
        Hide
        backlogmanager Backlog Manager added a comment -

        2022-05-21 05:31|UPDATED status: transition Answer| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2022-05-21 05:31|UPDATED status: transition Answer| # answers= 1, accepted answer= False
        Hide
        backlogmanager Backlog Manager added a comment -

        2022-05-22 05:31|UPDATED status: transition Answered| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2022-05-22 05:31|UPDATED status: transition Answered| # answers= 1, accepted answer= False
        Hide
        gabriele Gabriele De Luca added a comment -

        The docker image will be aligned with the master branch and updated soon

        Show
        gabriele Gabriele De Luca added a comment - The docker image will be aligned with the master branch and updated soon

          People

          • Assignee:
            gabriele Gabriele De Luca
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: