mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
test: json plugin with index
This commit is contained in:
parent
7bc286f7e1
commit
1b4c5f9d1e
4 changed files with 103 additions and 0 deletions
69
test/files/etc/bbfdm/json/index.json
Normal file
69
test/files/etc/bbfdm/json/index.json
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"Device.PD2.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": {
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "proxd",
|
||||
"method": "list",
|
||||
"args": {},
|
||||
"key": "devices"
|
||||
}
|
||||
},
|
||||
"Device.PD2.{i}.MiniHub.{i}.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": true,
|
||||
"mapping": {
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "proxd",
|
||||
"method": "list",
|
||||
"args": {},
|
||||
"key": "devices"
|
||||
}
|
||||
},
|
||||
"Device.PD2.{i}.MiniHub.{i}.DeviceInfo.": {
|
||||
"type": "object",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"Description": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "proxd",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"path": "Device.ProxiedDevice.{i}.MiniHub.{i}.DeviceInfo.Description"
|
||||
},
|
||||
"key": "Description"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
test/files/tmp/proxd.data
Normal file
6
test/files/tmp/proxd.data
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"devices": [
|
||||
{ "name": "one"},
|
||||
{"name": "two"}
|
||||
]
|
||||
}
|
||||
3
test/files/tmp/proxd.get.data
Normal file
3
test/files/tmp/proxd.get.data
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"Description": "Test Description"
|
||||
}
|
||||
25
test/files/usr/libexec/rpcd/proxd
Executable file
25
test/files/usr/libexec/rpcd/proxd
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "list" : {}, "get": {"path":"str"}}'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
list)
|
||||
cat /tmp/proxd.data 2>/dev/null
|
||||
;;
|
||||
get)
|
||||
read input;
|
||||
json_load "$input"
|
||||
json_get_var path path
|
||||
json_init
|
||||
json_add_string "Description" "$path"
|
||||
json_dump >/dev/console
|
||||
json_dump
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
Loading…
Add table
Reference in a new issue