orchestracities / ngsi-timeseries-api

QuantumLeap: a FIWARE Generic Enabler to support the usage of NGSIv2 (and NGSI-LD experimentally) data in time-series databases
https://quantumleap.rtfd.io/
MIT License
37 stars 49 forks source link

Test integration with Orion-LD #394

Open c0c0n3 opened 3 years ago

c0c0n3 commented 3 years ago

Is your feature request related to a problem? Please describe

Ken from FiWare implemented an backward compat patch for Orion-LD that will let NGSI-v2 clients subscribe for NGSI-LD entity changes and get notified of any changes through an NGSI-v2 payload. In principle, this patch should make QL usable with Orion-LD right now, without having to wait for a full blown NGSI-LD implementation. FiWare TSC are eager to know if this is the case :-)

Describe the solution you'd like

Get in touch with Ken to see if there's a Docker image we could use for the integration test, plonk that image into the reporter test suite and see what happens. Then report back to FiWare TSC.

Describe alternatives you've considered

N/A

Additional context

Nov 2020's FiWare TSC minutes.

kzangeli commented 3 years ago

As mentioned, Orion-LD implements "cross-notifications" in NGSIv2 format for NGSI-LD subscriptions. Check out this doc for a full explanation of the NGSI-LD API, subscriptions being a part of that spec.

This is how a simple subscription can look in NGSI-LD:

POST /ngsi-ld/v1/subscriptions
{
  "id": "urn:ngsi-ld:subscriptions:S1",
  "type": "Subscription",
  "name": "Subscription for T",
  "description": "Description of Test subscription T",
  "entities": [
    {
      "idPattern": ".*",
      "type": "T"         # Note that typePattern is not supported in NGSI-LD ...
    }
  ],
  "notification": {
    "format": "NGSIv2-Normalized",
    "endpoint": {
      "uri": "http://valid.url/url",
      "accept": "application/json"
    }
  },
  "expires": "2028-12-31T10:00:00",
  "throttling": 5
}

As you can see, the notification::format field is set to "NGSIv2-Normalized" (not part of the NGSI-LD spec as it's still just experimental) which is how to get Orion-LD to notify in NGSIv2 format.

Orion-LD listens on the port 1026, just like Orion.

You'll find documentation on NGSI-LD and Orion-LD on the Orion-LD github. If you need help to get familiar with NGSI-LD (it's more complex than NGSIv2), just let me know and we can have a session or two.

docker: https://hub.docker.com/r/fiware/orion-ld

c0c0n3 commented 3 years ago

@kzangeli awesome, thanks for this, that's exactly the kind of info we needed. I reckon we should be able to give it a shot. We'll let you know how it goes...

chicco785 commented 3 years ago

@kzangeli we included a simple integration experiment: https://github.com/smartsdk/ngsi-timeseries-api/tree/master/experiments/ngsi-ld

of course it's dumb simple, but no issue :)

kzangeli commented 3 years ago

No issue, that's good! :) Anytime you have an issue, I'll be happy to work with you to resolve whatever problem occurs.

Now, I need to warn you, in case you are working on latest of Orion-LD ... The "format of the format" :) has changed (yesterday):

The value that used to be NGSIv2-Normalized has been replaced by 4 different values (plus one alias ' x-ngsiv2'):

See https://github.com/FIWARE/context.Orion-LD/issues/623 for details.

IoT Agents "want" the NGSI-LD broker to compact the attribute names (according to the context they supplied for the subscription), so I implemented that option - .

I'd be careful with short-names if I were a TRoE (Temporal Representation of Entities) - i.e. Cygnus/QL/Draco/etc. Better to use the long name as the long name is the real name of the attribute/entity-type-value.

But, you need to know that the format value has been changed So, sorry ... this is all really experimental still - I don't foresee any additional name changes.

github-actions[bot] commented 3 years ago

Stale issue message