Code Monkey home page Code Monkey logo

Comments (6)

MattiaMarzano-Eng avatar MattiaMarzano-Eng commented on May 20, 2024 1

You can solve that issue using the config.json template provided as example where you can find the additional fields

"ngsiVersion": "ld",
"jsonLdContext": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",

allowing you to call ngsi-ld/v1/entities enpoint

from iotagent-opcua.

IngMiad avatar IngMiad commented on May 20, 2024 1

Hello,

thank you for the quick response. Yes after some experiments it seems to work also with scorpio. I thought that registration URLs might differ in case of Scorpio, but this is not the case.

The differences I recognized is that it is hard to use mapping tool and auto-configuration. Scorpio needs much more time to start than Orion context broker, so that the automatic registrations at context broker fail (at least in my case). I tried to use docker-compose 'depends_on', but Scorpio needs around 20-30 seconds to 'really start', so that the IoT-Agent can't connect to broker for device registration.

So you have to add a wait-for-scorpio-to-be-ready mechanism or use REST API for device/registration configuration.

from iotagent-opcua.

MattiaMarzano-Eng avatar MattiaMarzano-Eng commented on May 20, 2024

Hello,
actually we're already compliant with NGSI-ld. You can try to setup (if you haven't done it yet)

 "contextBroker": {
		"host": "scorpioHostname",
		"port": scorpioPort
	}

in config.js to forward the requests to Scorpio Context Broker.
Never had experience with that, but my expectation is that we're ready to use that CB since we support NGSI-ld

from iotagent-opcua.

rosieks avatar rosieks commented on May 20, 2024

Actually I'm also trying to work with Scorpio. What about different URLs. I think that right now agent call /v2/entities while scorpio/ngsi-ld assumes it will be ngsi-ld/v1/entities

from iotagent-opcua.

Anupamskd7 avatar Anupamskd7 commented on May 20, 2024

Hi,

I tried as suggested by @MattiaMarzano-Eng by making necessary changes in the conf/config.json:

{ "logLevel" : "INFO", "multiCore" : true, "relaxTemplateValidation":true, "contextBroker" : { "host" : "gateway.default.svc.cluster.local", "port" : 9090 }, "server" : { "port" : 4001, "baseRoot" : "/" }, "deviceRegistry" : { "type" : "memory" }, "mongodb" : { "host" : "iotmongo", "port" : "27017", "db" : "iotagent_opcua", "retries" : 5, "retryTime" : 5 }, "types" : { "Device" : { "service" : "opcua_car", "subservice" : "/demo", "active" : [{ "name" : "EngineBrake", "type" : "Number" }, { "name" : "Acceleration", "type" : "Number" }, { "name" : "EngineStopped", "type" : "Boolean" }, { "name" : "Engine_Temperature", "type" : "Number" }, { "name" : "Engine_Oxigen", "type" : "Number" }, { "name" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy", "type" : "String" }, { "name" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus", "type" : "Boolean" }, { "name" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone", "type" : "String" }, { "name" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus", "type" : "Boolean" }], "lazy" : [{ "name": "Speed", "type": "Number" }], "commands" : [{ "name" : "Error", "type" : "command" }, { "name" : "Stop", "type" : "command" }, { "name" : "Accelerate", "type" : "command" }, { "name" : "ActivateSensor", "type" : "command" }, { "name" : "DeactivateSensor", "type" : "command" }, { "name" : "ToggleSensorActivation", "type" : "command" }] } }, "browseServerOptions" : null, "service" : "opcua_car", "subservice" : "/demo", "providerUrl" : "http://iotage:4001", "pollingExpiration" : "200000", "pollingDaemonFrequency" : "20000", "deviceRegistrationDuration" : "P1M", "defaultType" : null, "contexts" : [ { "id" : "age01_Car", "type" : "Device", "service" : "opcua_car", "subservice" : "/demo", "polling" : false, "mappings" : [{ "ocb_id" : "Error", "opcua_id" : "ns=3;s=Error", "object_id" : null, "inputArguments" : [ ] },{ "ocb_id" : "Acceleration", "opcua_id" : "ns=3;s=Acceleration", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "EngineStopped", "opcua_id" : "ns=3;s=EngineStopped", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "Engine_Temperature", "opcua_id" : "ns=3;s=Temperature", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "Engine_Oxigen", "opcua_id" : "ns=3;s=Oxigen", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy", "opcua_id" : "ns=3;s=DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusy", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus", "opcua_id" : "ns=3;s=DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xBusyStatus", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone", "opcua_id" : "ns=3;s=DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDone", "object_id" : null, "inputArguments" : [ ] }, { "ocb_id" : "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus", "opcua_id" : "ns=3;s=DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus", "object_id" : null, "inputArguments" : [ ] }] } ], "contextSubscriptions" : [ { "id" : "age01_Car", "type" : "Device", "mappings" : [ { "ocb_id" : "Error", "opcua_id" : "ns=3;s=Error", "object_id" : "ns=3;i=1000", "inputArguments" : [ { "dataType" : 12, "type" : "Error Type" } ] }, { "ocb_id": "Speed", "opcua_id": "ns=3;s=Speed", "object_id": "ns=3;i=1000", "inputArguments" : [ ] }, { "ocb_id" : "Stop", "opcua_id" : "ns=3;s=Stop", "object_id" : "ns=3;i=1000", "inputArguments" : [ ] }, { "ocb_id" : "Accelerate", "opcua_id" : "ns=3;s=Accelerate", "object_id" : "ns=3;i=1000", "inputArguments" : [ { "dataType" : 6, "type" : "Intensity" } ] }, { "ocb_id" : "ActivateSensor", "opcua_id" : "ns=3;s=ActivateSensor", "object_id" : "ns=3;i=1000", "inputArguments" : [ { "dataType" : 6, "type" : "SensorIndex" } ] }, { "ocb_id" : "DeactivateSensor", "opcua_id" : "ns=3;s=DeactivateSensor", "object_id" : "ns=3;i=1000", "inputArguments" : [ { "dataType" : 6, "type" : "SensorIndex" } ] }, { "ocb_id" : "ToggleSensorActivation", "opcua_id" : "ns=3;s=ToggleSensorActivation", "object_id" : "ns=3;i=1000", "inputArguments" : [ { "dataType" : 6, "type" : "SensorIndex" } ] } ] } ] }

and AGECONF/config.json.:
{
"logLevel" : "INFO",
"contextBroker" : {
"host" : "gateway.default.svc.cluster.local",
"port" : 9090
},
"server" : {
"port" : 4001,
"baseRoot" : "/"
},
"deviceRegistry" : {
"type" : "memory"
},
"mongodb" : {
"host" : "mongo-common-0.mongo-common",
"port" : "27017",
"db" : "iotagent_opcua",
"retries" : 5,
"retryTime" : 5
},
"types" : {
"Device" : {
"service" : "opcua_car",
"subservice" : "/demo",
"active" : [ ],
"lazy" : [ ],
"commands" : [ ]
}
},
"browseServerOptions" : null,
"service" : "opcua_car",
"subservice" : "/demo",
"providerUrl" : "http://iotage:4001",
"pollingExpiration" : "200000",
"pollingDaemonFrequency" : "20000",
"deviceRegistrationDuration" : "P1M",
"defaultType" : null,
"contexts" : [ ],
"contextSubscriptions" : []
}

Still I am unable to connect IOTAgent OPC UA with Scorpio broker.
Also, When I checked OPC UA logs, the default Context broker URL doesn't seem to change with the changes made in the config files:

"url": "http://orion:1026/ngsi-ld/v1/entityOperations/upsert/?options=update", "method": "POST", "headers": { "fiware-service": "opcua_car", "fiware-servicepath": "/demo", "Content-Type": "application/ld+json", "NGSILD-Tenant": "opcua_car", "NGSILD-Path": "/demo" }, "json": [ { "@context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld", "DataBlocksGlobal_3_dbRfidCntr_3_ID1_3_xDoneStatus": { "type": "Property", "value": true }, "id": "urn:ngsi-ld:Device:age01_Car", "type": "Device" } ] }

And the default service that gets provisioned also has cbHost": "orion:1026

@MattiaMarzano-Eng Could you please tell which config files are needed to be changed?

from iotagent-opcua.

MattiaMarzano-Eng avatar MattiaMarzano-Eng commented on May 20, 2024

Hello @Anupamskd7, please look at this template to update accordingly your config.json where are missing those fields "ngsiVersion": "ld", "jsonLdContext": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld",

update also the docker compose
################################################################################################################# # please comment out if you want to use NGSI-ld, the OPCUA Agent is provided with NGSIv2 as default configuration #- IOTA_CB_NGSI_VERSION=ld #- IOTA_JSON_LD_CONTEXT=https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld #################################################################################################################
in thi section

from iotagent-opcua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.