FIWARE Orion Context Broker subscription to several points - fiware

I'm using Orion with Keyrock, PEPproxy, Cygnus and STH-comet, but I'm having many issues with the subscriptions part. I want to send only one request to orion to subscribe all atributes of all entities in many services like Cygnus and STH. I'm using this body but I don't know how to add other notification URL.
{
"subject":{
"entities": [
{
"type": "Nodo_aire",
"idPattern": ".*"
}
],
"condition":{
"attrs": []
}
},
"notification":{
"http":{"url":"http://192.168.1.51:5050/notify"},
"attrs": [],
"attrsFormat":"legacy"
},
"expires": "2099-12-31T23:00:00.00Z",
"throttling": 5
}
I was reading the Orion documentation and the NGSIv2, but i dont find a related section or a solution in these documents.

Orion doesn't support (at least in the newest version) multi-URL subscriptions. However, there is an easy workaround: to implement a subscription for each one of the URLs.

Related

Webhook event not received from Autodesk Forge API

I'm using the Autodesk Forge API to convert a range of models from various formats into SVF files, and trying to use the Webhooks API to listen for transformation complete events for jobs posted to the Model Derivative service.
I have successfully created the webhook, and verified its existence by calling the get Hooks API endpoint. Below is the basic response i receive.
{
"hookId": "<my-hook-id>",
"tenant": "<my tennant>",
"callbackUrl": "<ngrok url>",
"createdBy": "...",
"event": "extraction.finished",
"createdDate": "2020-11-05T05:48:39.016+0000",
"system": "derivative",
"creatorType": "Application",
"status": "active",
"scope": {
"workflow": "<my-workflow-key>"
},
"urn": "<webhook-urn>",
"__self__": "..."
}
At my ngrok endpoint I have a basic Node ExpressJS server running. The server is set to respond to all methods across my designated callback url. I have also verfied my callback url is valid and active through postman, with POST request being successfully received and returning a valid 2XX reponse.
I then post a translation job like below to the Model Derivative API, and the job successfully starts and processes the job. I can verify this by manually calling to check the status of a job through the Model Derivative API, however my webhook callback endpoint never receives any notification of transformation completion event.
{
"input": {
"urn": "<Input Urn>"
},
"output": {
"destination": {
"region": "us"
},
"formats": [
{
"type": "svf",
"views": ["3d"]
}
],
"misc": {
"wokflow": "<my-workflow-key>"
}
}
}
Is there anything obvious that I might be missing as to why the webhook event never seems to be triggered, or any other way that I could see if the webhook event was even attempted to be fired from Autodesks/Forges side?
There seems to be a typo in the job payload: wokflow should be workflow.
Note that you can also test incoming webhook requests using online tools such as https://webhook.site.

QuantumLeap, OrionCB and IoTagent-LoRaWAN integration

I was reading the QuantumLeap docs and I was wondering how those Generic Enablers are integrated, I mean, I've deployed the docker containers and apparently are all running, in fact I've been able to create a device in the IoTagent-LoRaWAN with the POST request which I'm also able to retrieve with the GET request to http://localhost:4061/iot/devices; however and it's apparently receiving the info from TTN as the log shows:
fiware-iot-agent | {"timestamp":"2020-06-24T19:23:04.759Z","level":"info","message":"New message in topic"}
fiware-iot-agent | {"timestamp":"2020-06-24T19:23:04.760Z","level":"info","message":"IOTA provisioned devices:"}
fiware-iot-agent | {"timestamp":"2020-06-24T19:23:04.760Z","level":"info","message":"Decoding CaynneLPP message:AQIBbA=="}
fiware-iot-agent | {"timestamp":"2020-06-24T19:23:04.760Z","level":"error","message":"Could not cast message to NGSI"}
However ... there is a last error message that I don't know if could cause problems, "level":"error","message":"Could not cast message to NGSI"
Also ... I don't know how should I proced now with OrionCB and QuantumLeap because ... QuantumLeap docs talk about create an OrionCB subscription, but ... I had understood from OrionCB docs that subscriptions are created to follow a previously created entity, so .. should I create both?
Is QuantumLeap storing info from any created subscription in OrionCB? How can I tight an entity to that IoTagent-LoRaWAN device created?
Thank you all!
Well, It was apparently again a problem with docker-compose.yml file; it was not deploying correctly the mongoDB container thus OrionCB cannot connect to it.
When all containers are deployed the IoTagent should be able to create an new entity when you add a new device, then creating the proper subscription in OrionCB pointing the notifications to QuantumLeap should work:
{
"description": "Test subscription",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attrs": [
"temperature"
]
}
},
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"attrs": [
"temperature"
],
"metadata": ["dateCreated", "dateModified"]
},
"throttling": 5
}

Fiware IoTAgent and Context Broker

I'm following this example to create a simple scenario where I register a new device into the IoT Agent and it forwards it to the Context Broker. Then I want to check if the created device exists in the Context Broker, and I can seem to find it.
These are the steps I'm doing:
1. using Postman I'm sending a post request to the IoT Agent:
url: http://eidas5.lab.fi-ware.org:5371/iot/devices
headers:
APIKEY:4jggokgpepnvsb2uv4s40d59ov
Fiware-Service:openiot
Fiware-ServicePath:/
Content-Type:application/json
Accept:application/json
body:
{
"devices": [
{ "device_id": "DEV_ID",
"entity_name": "ENTITY_ID",
"entity_type": "thing",
"protocol": "PDI-IoTA-UltraLight",
"timezone": "Europe/Madrid",
"attributes": [
{ "object_id": "t",
"name": "temperature",
"type": "int"
} ],
"static_attributes": [
{ "name": "att_name",
"type": "string",
"value": "value"
}
]
}
]
}
Then I confirm that the device is registered with a GET request to the url http://eidas5.lab.fi-ware.org:5371/iot/devices/DEV_ID
request headers:
APIKEY:4jggokgpepnvsb2uv4s40d59ov
Fiware-Service:openiot
Fiware-ServicePath:/
Content-Type:application/json
Accept:application/json
everything seems ok so far, now I want to check where this device is in the context broker:
According to the docs:
Devices will be represented as NGSI entities in the ContextBroker at 130.206.80.40:1026 (within the FIWARE service-path "OpenIoT").
So with a GET request I should be able to see the new device,but I can't. I even tryed using the fiware-servicepath and fiware-service headers as above, and I can't find it.
Any advice on this?
fiware-service should be open-iot and fiware-servicepath /
have a look at
http://fiwaretourguide.readthedocs.io/en/latest/connection-to-the-internet-of-things/how-to-read-measures-captured-from-iot-devices/

Fiware: Cepheus security considerations?

How can we add security between Orion broker and Cepheus?
How can we use Cepheus with a protected Orion broker (pep is used to secure the access to the broker)?
Thanks and best regards.
Fiware-Cepheus currently does not act as an OAuth client and does not make requests to an IDM server to retrieve the OAuth token by itself.
However Fiware-Cepheus handles the three HTTP headers required by Orion Policy Enforcement Point (PEP) proxies : x-auth-token, fiware-servicepath and fiware-service.
Theses headers values can be set for either Cepheus Broker or Cepheus CEP from configuration settings.
For Cepheus Broker, this configuration is currently static. See Configuration section of the Admin manual.
remote.serviceName=tenant
remote.servicePath=test/example
remote.authToken=OAUTH_TOKEN
For Cepheus CEP, this configuration is more dynamic as it is part of the CEP rules provisioning and can be done independently for each outgoing event. See Configuration section of the User manual.
"out": [
{
"id": "FloorX",
"type": "Floor",
"attributes": [
{
"name": "temperature",
"type": "double",
"metadata": [
{
"name": "unit",
"type": "string"
}
]
}
],
"brokers": [
{
"url": "http://orion.fiware.org:3000",
"serviceName": "tenant",
"servicePath": "test/example",
"authToken": "OAUTH_TOKEN"
}
]
}
]

How to set the application log in an Azure webapp using Azure resource manager

Does anyone know how to set the below diagnostic settings on an Azure Web App using Azure Resource Manager (Powershell or JSON).
Using .json I can only find these settings
"requestTracingEnabled": true, /* Failed request tracing, aka 'freb' */
"httpLoggingEnabled": true, /* IIS logs (aka Web server logging) */
"logsDirectorySizeLimit": 40, /* 40 MB limit for IIS logs */
"detailedErrorLoggingEnabled": true, /* Detailed error messages */
Which turns on web server logging to filesystem but NOT Application Logging or to blob storage.
With Powershell this command only seems to work with ASM as it does not find Non-classic storage accounts given to it
Enable-AzureWebsiteApplicationDiagnostic
Any help would be appreciated. We are currently using Azure Powershell 0.9.8
Regards
The Azure Resource Manager (ARM) template json section for configuring Application Log (Blob) and Web Server Logging (Storage) based on your screenshot above is as shown below:
{
"apiVersion": "2015-08-01",
"name": "logs",
"type": "config",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
],
"properties": {
"applicationLogs": {
"azureBlobStorage": {
"level": "Information",
"sasUrl": "<Your Azure Blob Storage Account SAS Url>",
"retentionInDays": null
}
},
"httpLogs": {
"azureBlobStorage": {
"sasUrl": "<Your Azure Blob Storage Account SAS Url>",
"retentionInDays": null,
"enabled": true
}
},
"failedRequestsTracing": {
"enabled": true
},
"detailedErrorMessages": {
"enabled": true
}
}
}
References: AzureWebsitesSamples/ARMTemplates/WebAppManyFeatures.json
Hope this answer your question and help solving your issue.
Please let me know if you need further help or clarifications.
If you browse an existing webapp in Resource Explorer you'll find a config/logs section that looks something like this:
{
"id": "/subscriptions/.../config/logs",
"name": "logs",
"type": "Microsoft.Web/sites/config",
"location": "North Central US",
"properties": {
"applicationLogs": {
"fileSystem": {
"level": "Off"
},
"azureBlobStorage": {
"level": "Information",
"sasUrl": "...",
"retentionInDays": 14
}
},
...
}
I believe you can use this format in your json template to configure the logging. (This section would be a sibling to the config/web section which contains the settings mentioned in the question.)
Note though that the config/logs section is not described in the System.Web schema, and so I'd imagine is not currently supported by MS at this time. I'm pretty sure I've tried it and seen it work though.
I didn't find how to set it in the template at the first provision. But it turned out to be easy after resources were provisioned. Please see answer at https://stackoverflow.com/a/51617949/511144 for the actual script to do it that uses Set-AzureRmResource