FIWARE / NGSI-LD_TestSuite

:bar_chart: This repository contains tests to verify compliance of NGSI-LD implementations
https://www.etsi.org/deliver/etsi_gs/CIM/001_099/009/01.02.01_60/gs_CIM009v010201p.pdf
MIT License
3 stars 5 forks source link

notification_test problem #48

Open ScorpioBroker opened 4 years ago

ScorpioBroker commented 4 years ago

Hi,

the notification tests are somehow not properly working as you can see here https://travis-ci.org/github/ScorpioBroker/ScorpioBroker

There notifications send and received by the accumulator but when the test wants to access them it fails with undefined.

Regards Benni

ScorpioBroker commented 4 years ago

@MohamedSadiq102 @jason-fox So i guess i figured the general problem. The tests assume to get an initial notification which isn't the case and shouldn't be from my understanding. From what i got from the spec subscriptions are on change subscriptions. So you get a notification after something has changed. I made some changes to have the tests behave this way and expanded the pull request. aside from that test 158 doesn't make any sense to me when you subscribe with an attribute filter you wont get any notification.

jason-fox commented 4 years ago

Yes, this is all a matter of working out implicit assumptions and deciding which ones are correct, currently the test is following NGSI v2 as defined in Orion classic rather than Scorpio's take on NGSI-LD.

Orion-LD currently follows Orion classic and takes the view that initial subscription is all, subsequent updates are deltas - this was the only way it could be done in Orion classic until recently. Interestingly, Orion classic has just added a new skipInitialNotification Flag to offer the alternative Scorpio style of subscription notification. Maybe Orion-LD could cherry pick the code?

For the test, I'm neutral either way, but the NGSI-LD spec must be updated to clarify what should really be happen on first firing. Alternatively anyone could quote the relevant section of the holy book (i.e. the NGSI-LD spec) we could come to an agreement earlier.

@kzangeli @ScorpioBroker

martin-p-bauer commented 4 years ago

@jason-fox @kzangeli @ScorpioBroker @MohamedSadiq102 As usual, it is not a question what the Orion-LD or the Scorpio Broker do, but what the NGSI-LD specification says.

In 5.8.1 Create Subscription, I find the following under Behaviour: • If timeInterval is not defined, whenever there is a change in the watched Attribute nodes (Properties or Relationships) of the concerned Entities, implementations shall post a new Notification as per the rules defined by clause 5.8.6.

So it is clearly about a change - and a bit further up, it says "Watched Attributes are those that trigger a new notification when they are changed." Thus, no notification without a change.

At the moment, I see nothing in the specification that would support the initial notification in the on_change case. If we want such a behaviour, the specification would have to be changed to add it ...

kzangeli commented 4 years ago

So, Martin speaks the truth. What we need to do is to decide whether we want this "Initial Notifications" feature or not. And, whether it should be the default behaviour.

jason-fox commented 4 years ago

So it seems we are in agreement - Scorpio behaviour follows spec - test and Orion-LD should be updated.