Orion CB 不会更新 IoT 代理上的惰性属性

2023-12-02

我正在尝试使用 Orion CB 作为 IoT 代理的上下文提供程序,其中我仅注册了具有惰性属性的设备。

在 IoT 代理上,我需要处理 updateContext 请求,因此我为这些请求做了一个处理程序,如下所示:

iotAgentLib.setDataUpdateHandler(updateContextHandler);

在 updateContextHandler 函数中我只有一条指令:

console.log(attributes);

为了查看我想要更新的所有值是否都已正确接收。

现在,如果我对设备所代表的实体的属性之一进行更新:

curl -i -X POST \
-H "fiware-service:service1" \
-H "fiware-servicepath:/subservice1" \
-H "X-Auth-Token:wNRwDwqYlLoLD8U9sFkTAEE6PfYMbQ" \
-H "Content-Type:application/json" \
-d \
'{
    "contextElements": [
        {
            "id": "ncc_estimate",
            "attributes": [
                {
                    "name": "arrival",
                    "type": "string",
                    "value": "some_value"
                }
            ]
        }
    ],
    "updateAction": "UPDATE"
} ' \
'http://{orion_address}/v1/updateContext'

我在 IoT Agent 输出控制台上看到的是:

time=2018-01-09T08:14:59.539Z | lvl=DEBUG | corr=2f4fdb0c-f515-11e7-86b2-0242ac110003 | trans=6ac5c35d-d7bf-419c-8f64-bc843b991d47 | op=IoTAgentNGSI.GenericMiddlewares | srv=service1 | subsrv=/subservice1 | msg=Body:

{
    "contextElements": [
        {
            "type": "nccestimate",
            "isPattern": "false",
            "id": "ncc_estimate",
            "attributes": [
                {
                    "name": "arrival",
                    "type": "string",
                    "value": ""
                }
            ]
        }
    ],
    "updateAction": "UPDATE"
}

正如您所看到的值字段为空,我还可以从 UpdateHandler 函数中的 console.log() 输出中看到:

[ { name: 'arrival', type: 'string', value: '' } ]

Orion 似乎在将值发送到 IoT 代理之前删除了该值。可能是什么问题呢?我做错了什么吗?

edit:

以下是调用的响应:/v1/registry/contextEntities/ncc_estimate

{"contextRegistrationResponses":[
    {"contextRegistration":
        {"entities":[
            {
                "type":"nccestimate",
                "isPattern":"false",
                "id":"ncc_estimate"
            }
        ],
        "attributes":[
            {
                "name":"transport_type",
                "type":"string",
                "isDomain":"false"
            },
            {
                "name":"arrival",
                "type":"string",
                "isDomain":"false" 
           }
        ],
        "providingApplication":"http://192.168.199.151:4044"}
    }
]}

edit2:

这是 Orion 在执行前面描述的 updateContext 操作时发送到物联网代理的内容:

POST //updateContext HTTP/1.1
User-Agent: orion/1.10.0-next libcurl/7.19.7
Host: 192.168.199.151:4044
fiware-service: service1
Fiware-ServicePath: /subservice1
X-Auth-Token: M62UkJc7yKX5aQwaHrsODfIrV4Ou85
Accept: application/json
Content-length: 169
Content-type: application/json; charset=utf-8
Fiware-Correlator: 42561e9a-f615-11e7-8610-0242ac110003

{"contextElements":[{"type":"nccestimate","isPattern":"false","id":"ncc_estimate","attributes":[{"name":"arrival","type":"string","value":""}]}],"updateAction":"UPDATE"}

正如您所看到的,该属性的“值”字段为空。 我正在使用 Orion 版本 1.10.0 和 iot 代理节点库版本 2.5.1。


我已经使用与您相同版本的 CB 完成了以下测试(即 1.10.0)

首先,创建一个注册,作为 IOTA 将创建的注册:

(curl -s -S localhost:1026/v1/registry/registerContext -H "fiware-service:service1" -H "fiware-servicepath:/subservice1" -H 'Content-Type: application/json' -d @- | python -mjson.tool) <<EOF
{
    "contextRegistrations": [
        {
            "entities": [
                {
                    "type": "nccestimate",
                    "isPattern": "false",
                    "id": "ncc_estimate"
                }
            ],
            "attributes": [
                {
                    "name": "transport_type",
                    "type": "string",
                    "isDomain": "false"
                },
                {
                    "name": "arrival",
                    "type": "string",
                    "isDomain": "false"
                }
            ],
            "providingApplication": "http://localhost:4044"
        }
    ],
    "duration": "P1M"
}
EOF

接下来,检查它是否与问题帖子中显示的注册完全相同(除了providingApplication,指向本地主机):

curl localhost:1026/v1/registry/contextEntities/ncc_estimate -s -S -H "fiware-service:service1" -H "fiware-servicepath:/subservice1" -H 'Accept: application/json' | python -mjson.tool

哪个响应是

{
    "contextRegistrationResponses": [
        {
            "contextRegistration": {
                "attributes": [
                    {
                        "isDomain": "false",
                        "name": "transport_type",
                        "type": "string"
                    },
                    {
                        "isDomain": "false",
                        "name": "arrival",
                        "type": "string"
                    }
                ],
                "entities": [
                    {
                        "id": "ncc_estimate",
                        "isPattern": "false",
                        "type": "nccestimate"
                    }
                ],
                "providingApplication": "http://localhost:4044"
            }
        }
    ]
}

接下来,运行nc本地主机上的进程providingApplication port.

nc -l -p 4044

设置完成后,我们首先根据问题中的更新进行测试。

curl -s -S -X POST http://localhost:1026/v1/updateContext -H "fiware-service:service1" -H "fiware-servicepath:/subservice1" -H "Content-Type:application/json" -d @- <<EOF
{
    "contextElements": [
        {
            "id": "ncc_estimate",
            "attributes": [
                {
                    "name": "arrival",
                    "type": "string",
                    "value": "some_value"
                }
            ]
        }
    ],
    "updateAction": "UPDATE"
}
EOF

在这种情况下,Orion 无法识别注册并返回 Not Found 响应:

{
    "contextResponses": [{
        "contextElement": {
            "type": "",
            "isPattern": "false",
            "id": "ncc_estimate",
            "attributes": [{
                "name": "arrival",
                "type": "string",
                "value": ""
            }]
        },
        "statusCode": {
            "code": "404",
            "reasonPhrase": "No context element found",
            "details": "ncc_estimate"
        }
    }]
}

换句话说,Orion 不会转发响应。我不知道为什么在你的情况下被转发并在 IOTA 日志文件中留下痕迹。

下一个测试使用相同的请求,但添加type实体的字段。

curl -s -S -X POST http://localhost:1026/v1/updateContext -H "fiware-service:service1" -H "fiware-servicepath:/subservice1" -H "Content-Type:application/json" -d @- <<EOF
{
    "contextElements": [
        {
            "id": "ncc_estimate",
            "type": "nccestimate",
            "attributes": [
                {
                    "name": "arrival",
                    "type": "string",
                    "value": "some_value"
                }
            ]
        }
    ],
    "updateAction": "UPDATE"
}
EOF

在这种情况下,请求被转发,我在nc终端。

POST //updateContext HTTP/1.1
User-Agent: orion/1.10.0 libcurl/7.38.0
Host: localhost:4044
fiware-service: service1
Fiware-ServicePath: /subservice1
Accept: application/json
Content-length: 179
Content-type: application/json; charset=utf-8
Fiware-Correlator: 42e75f8a-fa0d-11e7-93f1-000c29173617

{"contextElements":[{"type":"nccestimate","isPattern":"false","id":"ncc_estimate","attributes":[{"name":"arrival","type":"string","value":"some_value"}]}],"updateAction":"UPDATE"}

请注意some_value在回应中。在这种情况下,Orion 似乎正在正确处理请求。

EDIT:根据用户反馈,实体type解决了问题。我们在其中强调它有关上下文提供者的文档:

您应该在查询/更新中包含实体类型,以便 ContextBroker 能够转发到上下文提供程序

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Orion CB 不会更新 IoT 代理上的惰性属性 的相关文章

  • 按 Orion Context Broker 0.23.0 中的属性值过滤

    在当前版本的 Orion Context Broker 0 23 0 中 新增功能之一是支持根据属性值过滤实体 NGSI v2 我当前正在执行 GET 操作 如所示http telefonicaid github io fiware ori
  • 固件 Orion 上下文代理订阅条件不起作用

    我正在使用 Orion Context Broker 版本 1 1 0 我的数据库中有唯一的实体 id gt Room1 type gt Room temperature gt type gt none value gt 10 metada
  • 在短时间内打开大量连接时的ECONNRESET

    我有这样的情况 我想在猎户座上创建大量实体 我正在将 Orion 和 mongo 的 docker 版本与此 docker compose 一起使用 version 3 services mongo image mongo 3 4 volu
  • Orion CB 不会更新 IoT 代理上的惰性属性

    我正在尝试使用 Orion CB 作为 IoT 代理的上下文提供程序 其中我仅注册了具有惰性属性的设备 在 IoT 代理上 我需要处理 updateContext 请求 因此我为这些请求做了一个处理程序 如下所示 iotAgentLib s
  • 固件错误:Access-Control-Allow-Origin

    我正在调用 contextBroker 它给了我这个错误 Response to preflight request doesn t pass access control check No Access Control Allow Ori
  • Ubuntu 上的固件 Orion 上下文代理

    我愿意使用 FiWare Cloud 中的映像在 Ubuntu 12 04 服务器上安装 Orion 上下文代理独立实例 看起来 orion contextBroker 主要支持 CentOS 它要么是 rpm 包 要么是 yum 存储库
  • 如何存储来自上下文代理的图像?

    我想将图像从各种 android 发送到上下文代理 我不确定如何从字符串格式解码图像 然后分别将其存储到文件系统和数据库 我是否必须开发自己的 python 脚本 或者 Cygnus 可以帮助我吗 尽管有多种方法可以将二进制文件 例如图像
  • Orion API 通过 Keycloak 进行身份验证

    我想通过 Keycloak IdM 在 Orion API 上添加身份验证 我知道可以将 Orion 与 Pep Proxy Wilma 和 Keyrock 一起使用来完成此任务 并且可能的解决方法是将 keyrock 与 keycloak
  • cosmos.lab.fi-ware.org 上的 SafeModeException

    根据维基百科 http forge fiware org plugins mediawiki wiki fiware index php BigData Analysis Quick Start for Programmers Step 1
  • Orion Context Broker 安装问题

    我们正在尝试按照此链接中的建议在 CentOS 7 虚拟机中安装 Orion Context Broker https fiware orion readthedocs io en master admin install index ht
  • Fiware - 上下文代理:NGSIv2 订阅问题

    我正在使用 Orion 上下文代理版本 1 2 0 我使用 NGSIv2 订阅了两个不同的 cygnus 0 11 和 0 13 如下 curl 172 21 0 23 1026 v2 subscriptions s S header Fi
  • ContextBroker 订阅错误

    我已按照本教程安装 NGSI 将 cygnus 从版本 0 13 更新到 1 7 0 https github com telefonicaid fiware cygnus tree master cygnus ngsi https git
  • 通过 IDAS 注册设备时 Orion CB 实体缺少属性

    我在进行练习时遇到了一些麻烦 无法获得预期的结果http www slideshare net FI WARE io t basicexercisesdevelopersweek http www slideshare net FI WAR
  • Fiware Ultralight 2.0 IoTAgent:如何从设备发送测量?

    我正在研究一个 POC 使用 Fiware 平台创建智能城市物联网项目 我正在尝试运行端到端流程 我正在运行以下 Docker 容器 容器 ID 端口名称 24f036202f78 0 0 0 0 4041 gt 4041 tcp 0 0
  • Perseo fe docker 实例无法启动

    我面临以下问题 我正在尝试将 FIWARE Perseo 作为 docker 实例部署到我的 Centos 7 服务器 尽管 perseocore 实例运行没有问题 但 perseo 前端的情况却不同 它已创建但无法启动 从日志中可以清楚地
  • 在 lubuntu 15.04 上构建 Kurento

    我正在尝试在我的 lubuntu 15 04 上构建整个 Kurento 与 ubuntu 15 04 相同 但 UI 不同 我首先克隆所有存储库 mkdir kurento cd kurento git clone https githu
  • 如何配置系统以使用 FIWARE yum 存储库?

    我知道 FI WARE 提供了一个公共 yum 存储库 位于http repositories testbed fiware org http repositories testbed fiware org 可用于安装 FI WARE 软件
  • 从 Keyrock 固件 API 获取 Auth-Token

    我在我的笔记本电脑上的 docker 本地运行 Keyrock Fiware 我知道这有效 因为我可以访问http localhost 8000 and http localhost 8000 sign up通过我的浏览器 他们响应正确 我
  • 创建虚拟机实例后如何扩展默认分区? [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我使用 FI WARE 云创建了一个具有 12GB 磁盘的 Centos x64 VM 实例 我可以毫无问题地访问它 并且我已经开始安装软
  • Orion 的 Freeboard 数据源与 Context Broker 之间没有连接

    我一直在尝试连接 Freeboard 以可视化来自 OCB 的上下文信息 但是遇到了一些困难 导致我无法从那里接收任何数据 我的想法是 将Freeboard连接到OCB有问题 因为在OCB的订阅列表中没有任何新条目 并且Freeboard中

随机推荐