telefonicaid / fiware-orion

Context Broker and CEF building block for context data management, providing NGSI interfaces.
https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/orion-api.md
GNU Affero General Public License v3.0
210 stars 265 forks source link

Subscription using wrong regex patterns #968

Closed fgalan closed 8 years ago

fgalan commented 9 years ago

Raised during Developers Week Viena 2015.

It seem there are problems with subscriptions using patterns when the pattern is not a righ regex. Eg, when using * (wrong) instead of .* (right). Details below (IPs has been offuscated).

Orion Context Broker GE version 0.14.0 image 3.4

Subscription request

Endpoint: http://A.B.C.D:1026/ngsi10/subscribeContext

payload:

{
    "entities": [
        {
            "type": "Patient",
            "isPattern": "true",
            "id": "*"
        }
    ],
    "attributes": [
        "Blood glucose",
        "Body temperature",
        "Systolic blood pressure",
        "Diastolic blood pressure",
        "Respiration rate",
        "Heart rate",
        "Blood oxygen",
        "timestamp"
    ],
    "reference": "http://A.B.C.D:5999/orion2mysql",
    "duration": "P1Y",
    "notifyConditions": [
        {
            "type": "ONCHANGE",
            "condValues": [
                "timestamp"
            ]
        }
    ],
    "throttling": "PT1S"
}

Update request: Endpoint: http://A.B.C.D:1026/ngsi10/updateContext

Payload:

{
     "contextElements":
     [
        {
            "type": "Patient",
            "isPattern": "false",
            "id": "Patient138866191",
            "attributes": [
            {
                "name": "Heart rate",
                "type": "bpm",
                "value": "72"
            },
            {
                "name" : "Diastolic blood pressure",
                "type" : "mmHg",
                "value" : "11.6"
            },
            {
                "name" : "Systolic blood pressure",
                "type" : "mmHg",
                "value" : "7.6"
            },
            {
                "name" : "timestamp",
                "type" : "Europe/Athens",
                "value" : "2014-12-09 17:05:34"
            }
            ]
        }
    ],
    "updateAction": "APPEND"
}

You have to replace the id:"Patient138866191" included in the update request payload with id:"GR138866191" to get a right response.

fgalan commented 9 years ago

Need to check if the problem happens in a recent version (Orion 0.24.0).