diff options
author | Paul Donald <newtwen+github@gmail.com> | 2024-04-22 23:56:06 +0200 |
---|---|---|
committer | Paul Donald <newtwen+github@gmail.com> | 2024-04-22 23:56:06 +0200 |
commit | 622dbf6420faee336bc2c4f5b6f6842307fe0c40 (patch) | |
tree | 3241d7dcf21f294978c3d73ade7691eb96804150 /applications/luci-app-lldpd/root/usr | |
parent | 32babe7069c2297ae8f2578e38762b3406bc84d7 (diff) | |
parent | d3953006c2fe54806db97dbbadc2163847cd1dbf (diff) |
Merge branch 'lldp_app'
Diffstat (limited to 'applications/luci-app-lldpd/root/usr')
3 files changed, 103 insertions, 0 deletions
diff --git a/applications/luci-app-lldpd/root/usr/share/luci/menu.d/luci-app-lldpd.json b/applications/luci-app-lldpd/root/usr/share/luci/menu.d/luci-app-lldpd.json new file mode 100644 index 0000000000..6944fafa46 --- /dev/null +++ b/applications/luci-app-lldpd/root/usr/share/luci/menu.d/luci-app-lldpd.json @@ -0,0 +1,38 @@ +{ + "admin/services/lldpd": { + "title": "LLDP", + "order": 80, + "action": { + "type": "firstchild" + }, + "depends": { + "uci": { + "lldpd": true + } + } + }, + + "admin/services/lldpd/status": { + "title": "Status", + "order": 10, + "action": { + "type": "view", + "path": "lldpd/status" + }, + "depends": { + "acl": [ "luci-app-lldpd-status" ] + } + }, + + "admin/services/lldpd/config": { + "title": "Settings", + "order": 20, + "action": { + "type": "view", + "path": "lldpd/config" + }, + "depends": { + "acl": [ "luci-app-lldpd-config" ] + } + } +} diff --git a/applications/luci-app-lldpd/root/usr/share/rpcd/acl.d/luci-app-lldpd.json b/applications/luci-app-lldpd/root/usr/share/rpcd/acl.d/luci-app-lldpd.json new file mode 100644 index 0000000000..240cd24779 --- /dev/null +++ b/applications/luci-app-lldpd/root/usr/share/rpcd/acl.d/luci-app-lldpd.json @@ -0,0 +1,43 @@ +{ + "luci-app-lldpd-status": { + "description": "Grant access for LLDP status information", + "read": { + "ubus": { + "luci.lldpd": [ + "getStatus" + ] + }, + "uci": [ + "lldpd", + "luci" + ] + } + }, + + "luci-app-lldpd-config": { + "description": "Grant access for LLDP configuration", + "read": { + "uci": [ + "lldpd" + ], + "ubus": { + "luci.lldpd": [ + "getStatus" + ], + "luci": [ + "getInitList" + ] + } + }, + "write": { + "uci": [ + "lldpd" + ], + "ubus": { + "luci": [ + "setInitAction" + ] + } + } + } +} diff --git a/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd b/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd new file mode 100644 index 0000000000..fff7ac55f3 --- /dev/null +++ b/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd @@ -0,0 +1,22 @@ +'use strict'; + +import { popen } from 'fs'; + +function lldpcli_json(section) { + return json(popen(`lldpcli -f json0 show ${section}`, 'r')); +} + +return { + 'luci.lldpd': { + getStatus: { + call: function() { + return { + statistics: lldpcli_json("statistics"), + neighbors: lldpcli_json("neighbors details"), + interfaces: lldpcli_json("interfaces"), + chassis: lldpcli_json("chassis") + }; + } + } + } +}; |