Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Incorrect processing for notification about changes in multiple context entities. #73

Open
efviodo opened this issue Jul 4, 2018 · 4 comments
Labels
bug multitenancy Support for Fiware-Service and Fiware-ServicePath

Comments

@efviodo
Copy link

efviodo commented Jul 4, 2018

Experimenting with Orion and Cepheus I discovered that if a cepheus configuration is used for an EventIn that refers to a particular context entity, everything works as expected.

"in": [ { "host":"http://localhost:8080", "in":[ { "id":"Room1", "type":"Room", "attributes":[ { "name":"temperature", "type":"double" }, { "name":"floor", "type":"string" } ], ... }

How ever If I define a generic EventIn for all rooms, then the Cepheus behaves unexpectedly. When configuring the cepheus with such a configuration and despite having well-defined rules, no exit event is recorded and no errors appear in the logfile. This is rare since Cepheus generates a subscription for each EventIn that is defined in the configuration file. When creating the subscription in Orion, it should notify the cepheus by means of a request, sending all the contexts that meet the criteria of this subscription.

"in": [ { "host":"http://localhost:8080", "in":[ { "id":".*", "type":"Room", "isPattern": true, "attributes":[ { "name":"temperature", "type":"double" }, { "name":"floor", "type":"string" } ], ... }

Perhaps the cepheus is not ready to receive a notifyContext request where changes to multiple context entities are notified.

I did not mention it, I have three different rooms in my Orion context broker: Room1, Room2 and Room3. When the subscription is created in Orion, the three context entities are notified. Finally my application has the Fiware-ServicePath: /hotel.

I did some dubugging using the Fiware accumulator-server.py and then I got the following notifyContext request:

POST http://172.17.0.1:1028/accumulate
Fiware-Servicepath: /hotel,/hotel,/hotel
Content-Length: 1551
User-Agent: orion/1.7.0-next libcurl/7.19.7
Host: 172.17.0.1:1028
Accept: application/json
Fiware-Service: sheraton
Content-Type: application/json; charset=utf-8
Fiware-Correlator: b5324fd4-7f8f-11e8-b121-0242ac110003

{
    "contextResponses": [
        {
            "contextElement": {
                "attributes": [
                    {
                        "name": "pressure", 
                        "type": "Integer", 
                        "value": 720
                    }, 
                    {
                        "name": "temperature", 
                        "type": "Float", 
                        "value": 23
                    }
                ], 
                "id": "Room1", 
                "isPattern": "false", 
                "type": "Room"
            }, 
            "statusCode": {
                "code": "200", 
                "reasonPhrase": "OK"
            }
        }, 
        {
            "contextElement": {
                "attributes": [
                    {
                        "name": "pressure", 
                        "type": "Integer", 
                        "value": 700
                    }, 
                    {
                        "name": "temperature", 
                        "type": "Float", 
                        "value": 21
                    }
                ], 
                "id": "Room2", 
                "isPattern": "false", 
                "type": "Room"
            }, 
            "statusCode": {
                "code": "200", 
                "reasonPhrase": "OK"
            }
        }, 
        {
            "contextElement": {
                "attributes": [
                    {
                        "name": "pressure", 
                        "type": "Integer", 
                        "value": 740
                    }, 
                    {
                        "name": "temperature", 
                        "type": "Float", 
                        "value": 18
                    }
                ], 
                "id": "Room3", 
                "isPattern": "false", 
                "type": "Room"
            }, 
            "statusCode": {
                "code": "200", 
                "reasonPhrase": "OK"
            }
        }
    ], 
    "originator": "localhost", 
    "subscriptionId": "5b3cce1faa7643a55888eb77"
}

Is it possible that the cepheus is not doing anything when receiving the request, because of the value of the header it brings? Look at the value that the accumulator-server saved in the log file:

/hotel, /hotel, /hotel

It would seem that Orion concatenated the Fiware-ServicePath of each context that met the criteria of the subscription. So, since the Cepheus configuration has a value other than Fiware-ServicePath ("/ hotel"), nothing happens.

@marcc-orange
Copy link
Contributor

Clearly, Fiware-Cepheus CEP does not handle this case where the Fiware-ServicePath header defines provides multiples servicePath for each entity in the notifyContext request.

This needs an evolution of the current code to be supported.

For reference, https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/user/service_path.md is the documentation of the Orion description of the service path, clearly Fiware-Cepheus is missing some edge cases.

@marcc-orange marcc-orange added bug multitenancy Support for Fiware-Service and Fiware-ServicePath and removed feature labels Jul 5, 2018
@iamarnavgarg
Copy link
Contributor

Hi @marcc-orange @efviodo

[Steps]

I followed the given below procedure for Reproducing this issue :
• Created three entities naming with id – Room1,Room2 and Lab3 of type “Room” as follows :
image

• Verified the Creation of entity in Orion by displaying the entities in its database as shown below:
image

Therefore, the creation of entity in Orion has been successful.

• Now, I POST’ed my config.json in Cepheus file as follows :

{
"host":"http://cepheus:8080",
"in":[
{
"id":".*",
"type":"Room",
"isPattern": true,
"attributes":[
{
"name":"temperature", "type":"double",
"metadata": [
{ "name":"unit", "type":"string" }
]
},
{ "name":"floor", "type":"string" }
],
"providers":[
{
"url":"http://orion:1026",
"servicePath": "/dany",
"serviceName":"necti"
}
]
}
],
"out":[
{
"id":"FloorX",
"type":"Floor",
"attributes":[
{
"name":"temperature", "type":"double",
"metadata": [
{ "name":"unit", "type":"string" }
]
}
],
"brokers":[
{
"url":"http://context-broker2:1026"
}
]
}
],
"statements":[
"INSERT INTO Floor SELECT floor as id, avg(temperature) as temperature, temperature_unit FROM Room.win:time(10 min) GROUP BY floor OUTPUT LAST EVERY 10 sec"
]
}

[Result]
I got the following logs in Cepheus after Running the POST Request as shown below :

image

[Observation]
• We also observed that whenever we update the value of temperature attribute in Lab3 at Orion the notifycontext does occur for Only the changed value in Cepheus and the logs are as follows :

image

After observing and investigating the logs, we find that the Communication between both, Fiware Cepheus and Orion works well for (id : “.*”) as we receive the notifycontext request whenever we change/updateContext in any of (Room1,Room2,Lab3) as shown in the logs of Cepheus as above. Similarly,I subscribed for only Single entity Room1 (id:Room1) from Cepheus and whenever I update the value in Room1 at fiware-orion,I subsequently receive the notifyContext request on Cepheus.

[Confirmation]
If my above understanding is incorrect or if I have missed on something. Please correct me and confirm about the expected result.

@iamarnavgarg
Copy link
Contributor

iamarnavgarg commented Aug 7, 2018

Hi @marcc-orange sir , @efviodo
If my above understanding is incorrect or if I have missed on something. Please correct me and confirm about the expected result.?

@pooja1pathak
Copy link
Contributor

Hi @marcc-orange @efviodo

I am not able to reproduce this issue. Cepheus-CEP is working as expected.
No error logs or any unexpected behavior is seen in Cepheus-CEP.

I followed the steps:

  1. Created three different rooms in my Orion context broker: Room1, Room2 and Room3.

image

  1. Updated configuration as:
    image

Logs observed on Cepheus-CEP:
image

Observations:

  1. Floor data is updated in orion.
  2. Cepheus-CEP processes notify context received from orion as expected.

Please verify if my above understanding is correct or I missed something from the reported issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug multitenancy Support for Fiware-Service and Fiware-ServicePath
Projects
None yet
Development

No branches or pull requests

4 participants