diff options
Diffstat (limited to 'applications/luci-app-lldpd/root')
4 files changed, 120 insertions, 0 deletions
diff --git a/applications/luci-app-lldpd/root/etc/uci-defaults/40_luci-lldpd b/applications/luci-app-lldpd/root/etc/uci-defaults/40_luci-lldpd new file mode 100644 index 0000000000..d7bfee271d --- /dev/null +++ b/applications/luci-app-lldpd/root/etc/uci-defaults/40_luci-lldpd @@ -0,0 +1,4 @@ +#!/bin/sh + +rm -f /tmp/luci-indexcache +exit 0 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..d79d7bd3c6 --- /dev/null +++ b/applications/luci-app-lldpd/root/usr/share/rpcd/acl.d/luci-app-lldpd.json @@ -0,0 +1,56 @@ +{ + "luci-app-lldpd-status": { + "description": "Grant access for LLDP status information", + "read": { + "ubus": { + "lldpd": [ + "getStatus" + ] + }, + "uci": [ + "lldpd", + "luci" + ] + } + }, + + "luci-app-lldpd-config": { + "description": "Grant access for LLDP configuration", + "read": { + "uci": [ + "lldpd", + "luci", + "network", + "wireless", + "firewall" + ], + "ubus": { + "luci": [ + "getInitList" + ], + "luci-rpc": [ + "getBoardJSON", + "getHostHints", + "getNetworkDevices", + "getWirelessDevices" + ], + "network": [ + "get_proto_handlers" + ], + "network.interface": [ + "dump" + ] + } + }, + "write": { + "uci": [ + "lldpd" + ], + "ubus": { + "luci": [ + "setInitAction" + ] + } + } + } +} diff --git a/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/lldpd b/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/lldpd new file mode 100644 index 0000000000..a35376f871 --- /dev/null +++ b/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/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 { + lldpd: { + getStatus: { + call: function() { + return { + statistics: lldpcli_json("statistics"), + neighbors: lldpcli_json("neighbors details"), + interfaces: lldpcli_json("interfaces"), + chassis: lldpcli_json("chassis") + }; + } + } + } +}; |