summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd')
-rw-r--r--applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd22
1 files changed, 22 insertions, 0 deletions
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")
+ };
+ }
+ }
+ }
+};