首页 文章

Fiware Orion上下文代理和iotagentUL命令问题

提问于
浏览
2

我是Fiware用户,我在 Cloud 上的不同虚拟机中部署了猎户座上下文代理GE,cepheus GE和iotagent-ul实例 . 我在iot代理中注册了一个设备,在注册请求中指定了一个命令属性,并在注册过程中在上下文代理中创建了相应的实体 . 现在,当我使用其属性和命令属性及其名称和类型注册设备时,设备在iot代理上注册,并且其实体也在上下文代理中创建 . 但奇怪的是,命令属性只被转换为其特殊属性,即commandName_info和commandName_status,但命令属性本身并未在iot代理日志的注册结果中显示 . 此外,当我这样做时对Orion上下文代理中的命令属性执行更新操作时,无法识别该属性,并且更新失败,因为在权限本身中缺少命令属性 . 注册过程如下:

  • 这是我发送的注册请求:

(curl -v -H 'content-type: application/json' -H 'fiware-service: ourservicename' -H 'fiware-servicepath: /ourservicpath' -X POST'http://iotagentULaddress:8080/iot/devices'-d @ - )<< EOF

{
"`devices`": [
    {
        "device_id": "controller12",
        "entity_name": "labcontroller12",
        "entity_type": "Controller",
        "isPattern" :"false",
        "protocol": "IoTA-UL",
        "timezone": "Egypt/Cairo",
        "endpoint": "http://iotagentULaddress:8080",
        "attributes": [
        {
            "object_id": "n",
            "name": "number",
            "type": "string"
        }],
        "commands": [{
            "name": "play",
            "type": "string"
        }]
    }]
}
EOF

这是iot代理的日志中的注册结果,显示注册实体及其在上下文代理中的创建方式:

time=2017-03-06T18:10:56.335Z | lvl=DEBUG | corr=dee16709-4b99-4336-b23a-722878a8b628 | trans=dee16709-4b99-4336-b23a-722878a8b628 | op=IoTAgentNGSI.ContextServer | srv=n/a | subsrv=n/a | msg=Successfully subscribed to the following topics:
["/+/+/attrs/+","/+/+/attrs","/+/+/cmdexe"]
 | comp=IoTAgent
{"op":"IOTAUL.Executable","time":"2017-03-06T18:10:56.427Z","lvl":"INFO","msg":"Ultralight 2.0 IoT Agent started"}
time=2017-03-06T18:12:14.459Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.GenericMiddlewares | srv=hi | subsrv=/hi | msg=Request for path [/iot/devices] from [217.172.12.190:8080] | comp=IoTAgent
time=2017-03-06T18:12:14.460Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.GenericMiddlewares | srv=hi | subsrv=/hi | msg=Body:

{
    "devices": [
        {
            "device_id": "controller12",
            "entity_name": "labcontroller12",
            "entity_type": "Controller",
            "isPattern": "false",
            "protocol": "IoTA-UL",
            "timezone": "Egypt/Cairo",
            "endpoint": "http://217.172.12.190:8080",
            "attributes": [
                {
                    "object_id": "n",
                    "name": "number",
                    "type": "string"
                }
            ],
            "commands": [
                {
                    "object_id": "s",
                    "name": "play",
                    "type": "string"
                }
            ]
        }
    ]
}

 | comp=IoTAgent
time=2017-03-06T18:12:14.463Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceProvisioning | srv=hi | subsrv=/hi | msg=Handling device provisioning request. | comp=IoTAgent
time=2017-03-06T18:12:14.464Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Looking for entity params undefined | comp=IoTAgent
Mongoose: mpromise (mongoose's default promise library) is deprecated, plug in your own promise library instead: http://mongoosejs.com/docs/promises.html
time=2017-03-06T18:12:14.473Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Device group for fields [undefined] not found: [{"undefined":"Controller"}] | comp=IoTAgent
time=2017-03-06T18:12:14.473Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.BidirectionalPlugin | srv=hi | subsrv=/hi | msg=Extracting attribute list | comp=IoTAgent
time=2017-03-06T18:12:14.473Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.BidirectionalPlugin | srv=hi | subsrv=/hi | msg=Sending bidirectionality subscriptions for device [controller12] | comp=IoTAgent
time=2017-03-06T18:12:14.474Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Looking for bindings for the function [deviceProvisioningHandler] and protocol [null] | comp=IoTAgent
time=2017-03-06T18:12:14.474Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Binding found for function [deviceProvisioningHandler] and protocol [null] | comp=IoTAgent
time=2017-03-06T18:12:14.475Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=hi | subsrv=/hi | msg=Looking for entity with id [controller12]. | comp=IoTAgent
time=2017-03-06T18:12:14.476Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=hi | subsrv=/hi | msg=Entity [controller12] not found. | comp=IoTAgent
time=2017-03-06T18:12:14.477Z | lvl=ERROR | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.Alarms | srv=hi | subsrv=/hi | msg=Raising [MONGO-ALARM]: undefined | comp=IoTAgent
time=2017-03-06T18:12:14.477Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Looking for entity params undefined | comp=IoTAgent
time=2017-03-06T18:12:14.478Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBGroupRegister | srv=hi | subsrv=/hi | msg=Device group for fields [undefined] not found: [{"undefined":"Controller"}] | comp=IoTAgent
time=2017-03-06T18:12:14.479Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Registering device into NGSI Service:
{
    "id": "controller12",
    "type": "Controller",
    "name": "labcontroller12",
    "service": "hi",
    "subservice": "/hi",
    "active": [
        {
            "object_id": "n",
            "name": "number",
            "type": "string"
        }
    ],
    "staticAttributes": [],
    "lazy": null,
    "commands": [
        {
            "object_id": "s",
            "name": "play",
            "type": "string"
        }
    ],
    "timezone": "Egypt/Cairo",
    "endpoint": "http://217.172.12.190:8080",
    "protocol": "IoTA-UL",
    "transport": "HTTP",
    "internalId": null,
    "subscriptions": [],
    "polling": false
} | comp=IoTAgent
time=2017-03-06T18:12:14.480Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Sending device registrations to Context Broker at [http://147.27.60.58:1026/NGSI9/registerContext] | comp=IoTAgent
time=2017-03-06T18:12:14.480Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Using the following request:

{
    "url": "http://147.27.60.58:1026/NGSI9/registerContext",
    "method": "POST",
    "json": {
        "contextRegistrations": [
            {
                "entities": [
                    {
                        "type": "Controller",
                        "isPattern": "false",
                        "id": "labcontroller12"
                    }
                ],
                "attributes": [
                    {
                        "name": "play",
                        "type": "string",
                        "isDomain": "false"
                    }
                ],
                "providingApplication": "http://localhost:4061"
            }
        ],
        "duration": "P1Y"
    },
    "headers": {
        "fiware-service": "hi",
        "fiware-servicepath": "/hi"
    }
}

 | comp=IoTAgent
time=2017-03-06T18:12:14.701Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Registration success. | comp=IoTAgent
time=2017-03-06T18:12:14.702Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Creating initial entity in the Context Broker:
 {
    "url": "http://147.27.60.58:1026/v1/updateContext",
    "method": "POST",
    "json": {
        "contextElements": [
            {
                "type": "Controller",
                "isPattern": "false",
                "id": "labcontroller12",
                "attributes": [
                    {
                        "name": "number",
                        "type": "string",
                        "value": " "
                    },
                    {
                        "name": "play_status",
                        "type": "commandStatus",
                        "value": "UNKNOWN"
                    },
                    {
                        "name": "play_info",
                        "type": "commandResult",
                        "value": " "
                    },
                    {
                        "name": "TimeInstant",
                        "type": "ISO8601",
                        "value": " "
                    }
                ]
            }
        ],
        "updateAction": "APPEND"
    },
    "headers": {
        "fiware-service": "hi",
        "fiware-servicepath": "/hi",
        "fiware-correlator": "2d54c696-7c62-454a-bdf2-5fb289f53e28"
    }
} | comp=IoTAgent
time=2017-03-06T18:12:14.915Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceService | srv=hi | subsrv=/hi | msg=Initial entity created successfully. | comp=IoTAgent
time=2017-03-06T18:12:14.920Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=hi | subsrv=/hi | msg=Storing device with id [controller12] and type [Controller] | comp=IoTAgent
time=2017-03-06T18:12:14.930Z | lvl=ERROR | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.Alarms | srv=hi | subsrv=/hi | msg=Releasing [MONGO-ALARM] | comp=IoTAgent
time=2017-03-06T18:12:14.931Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DeviceProvisioning | srv=hi | subsrv=/hi | msg=Device provisioning request succeeded | comp=IoTAgent
time=2017-03-06T18:12:14.933Z | lvl=DEBUG | corr=2d54c696-7c62-454a-bdf2-5fb289f53e28 | trans=2d54c696-7c62-454a-bdf2-5fb289f53e28 | op=IoTAgentNGSI.DomainControl | srv=hi | subsrv=/hi | msg=response-time: 486 | comp=IoTAgent

现在很清楚,命令属性不是创建的,只是它的特殊属性描述了命令状态本身,但是没有要更新的命令 . 那么,我的注册请求是否正确组合以适应iotagen-ul实例,特别是对于命令的解释?我怎样才能验证注册的正确性?我只是想知道问题究竟在哪里 . 并非常感谢 .

1 回答

  • 0

    正如您在日志中看到的那样,您必须查询的命令将创建为Context Provider注册(对以下URL的请求“http://147.27.60.58:1026/NGSI9/registerContext”) . 命令属性未注册为NGSI属性,而是定义为另一个Context Provider(在本例中为IoTAgent)提供的属性 . 那是's why there is no mention of the command attribute in the request that creates the initial entity: it'的预期行为 .

相关问题