Orion Context broker - request by location without elements

I am working with version 0.25.0 of Orion Context Broker.

If I load a context broker with only context objects and I search for objects in a specific area, everything seems to work fine:

(curl localhost:1026/v1/queryContext?limit=100 -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d  @- | python -mjson.tool) <<EOF
{
    "entities":[
        {
            "type":"Dispositivo_tmp",
            "isPattern":"true",
            "id":".*"
        }
    ],
    "restriction": {
        "scopes": [
            {
                "type": "FIWARE::Location",
                "value": {
                    "circle": {
                        "centerLatitude": "43.322361",
                        "centerLongitude": "-1.983222",
                        "radius": "1500"
                    }
                }
            }
        ]
    }
}
EOF

I get a response with context objects located in this area:

...
{
            "contextElement": {
                "attributes": [
                    {
                        "metadatas": [
                            {
                                "name": "location",
                                "type": "string",
                                "value": "WGS84"
                            }
                        ],
                        "name": "position",
                        "type": "coords",
                        "value": "43.3221, -1.9831"
                    },
                    {
                        "name": "pressure",
                        "type": "integer",
                        "value": "1"
                    },
                    {
                        "name": "temperature",
                        "type": "float",
                        "value": "25"
                    }
                ],
                "id": "CE_5.1",
                "isPattern": "false",
                "type": "Dispositivo_tmp"
            },
            "statusCode": {
                "code": "200",
                "reasonPhrase": "OK"
            }
        }
    ]
}

And if there are no elements in a certain area, I get the expected response:

{
    "errorCode": {
        "code": "404",
        "reasonPhrase": "No context element found"
    }
}

The problem occurs if I download a context broker with context registration. If I have both context entities and context registrations in the context broker, and I check the context objects for the area that I know is empty, I will not receive any response, or I will get this:

{
    "errorCode": {
        "code": "200",
        "reasonPhrase": "OK"
    }
}

, , , () .

, . .

?

+4
1

, URL-, .

URL . , URL-, , .

URL- "accumulate-server.py":

http://localhost:1028/accumulate

, .

+1

Source: https://habr.com/ru/post/1622937/


All Articles