summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-lldpd/root/usr/share/rpcd/ucode/luci.lldpd
blob: fff7ac55f3a522853bf1a7842b56dbf22a3390b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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")
				};
			}
		}
	}
};