mirror of
https://github.com/emqx/neuron.git
synced 2026-10-26 03:40:01 +08:00
refactor(mqtt): add upload ft
This commit is contained in:
@@ -50,7 +50,7 @@ Recv Message
|
||||
${msg} = Listen ${topic_res} timeout=10
|
||||
Should Not Be True $msg == None
|
||||
${res} = evaluate json.loads('''${msg}''') json
|
||||
Should Be Equal As Strings ${res}[uuid] ${MQTT_UUID}
|
||||
|
||||
[RETURN] ${res}
|
||||
|
||||
Pub And Recv
|
||||
@@ -63,7 +63,7 @@ Pub And Recv
|
||||
|
||||
# try to receive a message with a matching UUID
|
||||
${res} = Wait Until Keyword Succeeds 10s 0s Recv Message ${topic_res}
|
||||
# Should Be Equal As Strings ${res}[command] ${cmd}
|
||||
Should Be Equal As Strings ${res}[uuid] ${MQTT_UUID}
|
||||
|
||||
# strip the `function` and `uuid` field
|
||||
Remove From Dictionary ${res} uuid command
|
||||
@@ -160,6 +160,13 @@ Subscribe Group
|
||||
|
||||
[RETURN] ${res}[0]
|
||||
|
||||
Unsubscribe Group
|
||||
[Arguments] ${driver_node_id} ${app_node_id} ${group_config_name}
|
||||
DELETE /api/v2/subscribe {"src_node_id": ${driver_node_id}, "dst_node_id": ${app_node_id}, "name": "${group_config_name}"}
|
||||
${res} = Object response body
|
||||
|
||||
[RETURN] ${res}[0]
|
||||
|
||||
Add Tags
|
||||
[Arguments] ${node_id} ${group} ${tags}
|
||||
POST /api/v2/tags {"node_id": ${node_id}, "group_config_name": "${group}", "tags": [${tags}]}
|
||||
|
||||
+2
-2
@@ -68,12 +68,12 @@ ${TOPIC_WRITE_REQ} neuron/${MQTT_CLIENTID}/write/req
|
||||
${TOPIC_STATUS_RES} neuron/${MQTT_CLIENTID}/status
|
||||
${TOPIC_READ_RES} neuron/${MQTT_CLIENTID}/read/resp
|
||||
${TOPIC_WRITE_RES} neuron/${MQTT_CLIENTID}/write/resp
|
||||
${TOPIC_TTYS_RES} neuron/${MQTT_CLIENTID}/ttys/resp
|
||||
${TOPIC_UPLOAD} neuron/${MQTT_CLIENTID}/upload
|
||||
|
||||
${MQTT_UUID} 123456-789abc-123456-aabbcc
|
||||
${MQTT_CONFIG_HOST} 127.0.0.1
|
||||
${MQTT_CONFIG_PORT} ${1883}
|
||||
${MQTT_CONFIG} {"client-id": "${MQTT_CLIENTID}", "format": 0,
|
||||
${MQTT_CONFIG} {"client-id": "${MQTT_CLIENTID}", "format": 1,
|
||||
... "ssl": false, "host": "${MQTT_CONFIG_HOST}", "port": ${MQTT_CONFIG_PORT},
|
||||
... "username": "", "password": "", "ca":"", "cert":"", "key":""}
|
||||
|
||||
|
||||
@@ -352,6 +352,50 @@ Read multiple points belonging to different areas(coil/input/input reg/hold reg)
|
||||
|
||||
[Teardown] Del Tags ${test_node_id} ${group} ${tag1_id},${tag2_id},${tag3_id},${tag4_id},${tag5_id},${tag6_id},${tag7_id},${tag8_id},${tag9_id},${tag10_id}
|
||||
|
||||
|
||||
Recv multiple points belonging to different areas(coil/input/input reg/hold reg) and different sites, the point address includes continuous and non-continuous, and the data include int16/uint16/int32/uint32/float type, it should return success
|
||||
Skip If Not MQTT API
|
||||
|
||||
${tag1_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag1", "address": "1!000018", "attribute": ${TAG_ATTRIBUTE_RW}, "type": ${TAG_DATA_TYPE_BIT}}
|
||||
${tag2_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag2", "address": "2!000018", "attribute": ${TAG_ATTRIBUTE_RW}, "type": ${TAG_DATA_TYPE_BIT}}
|
||||
${tag3_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag3", "address": "3!000021", "attribute": ${TAG_ATTRIBUTE_RW}, "type": ${TAG_DATA_TYPE_BIT}}
|
||||
${tag4_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag4", "address": "4!100018", "attribute": ${TAG_ATTRIBUTE_READ}, "type": ${TAG_DATA_TYPE_BIT}}
|
||||
${tag5_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag5", "address": "5!300018", "attribute": ${TAG_ATTRIBUTE_READ}, "type": ${TAG_DATA_TYPE_INT16}}
|
||||
${tag6_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag6", "address": "6!300018", "attribute": ${TAG_ATTRIBUTE_READ}, "type": ${TAG_DATA_TYPE_UINT32}}
|
||||
${tag7_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag7", "address": "7!300022", "attribute": ${TAG_ATTRIBUTE_READ}, "type": ${TAG_DATA_TYPE_FLOAT}}
|
||||
${tag8_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag8", "address": "8!400018", "attribute": ${TAG_ATTRIBUTE_RW}, "type": ${TAG_DATA_TYPE_UINT16}}
|
||||
${tag9_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag9", "address": "9!400040", "attribute": ${TAG_ATTRIBUTE_RW}, "type": ${TAG_DATA_TYPE_INT32}}
|
||||
${tag10_id} = Add Tag And Return ID ${test_node_id} ${group} {"name": "tag10", "address": "10!400022", "attribute": ${TAG_ATTRIBUTE_RW}, "type": ${TAG_DATA_TYPE_FLOAT}}
|
||||
|
||||
Should Not Be Equal As Integers ${tag1_id} -1
|
||||
Should Not Be Equal As Integers ${tag2_id} -1
|
||||
Should Not Be Equal As Integers ${tag3_id} -1
|
||||
Should Not Be Equal As Integers ${tag4_id} -1
|
||||
Should Not Be Equal As Integers ${tag5_id} -1
|
||||
Should Not Be Equal As Integers ${tag6_id} -1
|
||||
Should Not Be Equal As Integers ${tag7_id} -1
|
||||
Should Not Be Equal As Integers ${tag8_id} -1
|
||||
Should Not Be Equal As Integers ${tag9_id} -1
|
||||
Should Not Be Equal As Integers ${tag10_id} -1
|
||||
|
||||
Subscribe ${TOPIC_UPLOAD} qos=0 timeout=5
|
||||
Sleep 1s 500ms
|
||||
${res} = Recv Message ${TOPIC_UPLOAD}
|
||||
Log ${res}[tags]
|
||||
|
||||
Compare Tag Value As Int ${res}[tags] tag1 1
|
||||
Compare Tag Value As Int ${res}[tags] tag2 1
|
||||
Compare Tag Value As Int ${res}[tags] tag3 1
|
||||
Compare Tag Value As Int ${res}[tags] tag4 1
|
||||
Compare Tag Value As Int ${res}[tags] tag5 17
|
||||
Compare Tag Value As Int ${res}[tags] tag6 1114130
|
||||
Compare Tag Value As Float ${res}[tags] tag7 1.928576247884031e-39
|
||||
Compare Tag Value As Int ${res}[tags] tag8 62226
|
||||
Compare Tag Value As Int ${res}[tags] tag9 66651136
|
||||
Compare Tag Value As Float ${res}[tags] tag10 11.789
|
||||
|
||||
[Teardown] Del Tags ${test_node_id} ${group} ${tag1_id},${tag2_id},${tag3_id},${tag4_id},${tag5_id},${tag6_id},${tag7_id},${tag8_id},${tag9_id},${tag10_id}
|
||||
|
||||
*** Keywords ***
|
||||
Neuron Context Ready
|
||||
Import Neuron API Resource
|
||||
|
||||
Reference in New Issue
Block a user