var net = nets[i] = networks[i];
var dev = net.l3_device || net.l2_device;
if (dev)
- net.device = devs[dev] = { };
+ net.device = devs[dev] || (devs[dev] = { });
}
_luci2.rpc.batch();
for (var dev in devs)
- _luci2.network.listDeviceNamestatus(dev);
+ _luci2.network.getDeviceStatus(dev);
return _luci2.rpc.flush();
}).then(function(devices) {
if (!devs[brm[j]])
{
devs[brm[j]] = { };
- _luci2.network.listDeviceNamestatus(brm[j]);
+ _luci2.network.getDeviceStatus(brm[j]);
}
devs[devices[i]['device']].subdevices[j] = devs[brm[j]];
for (var i = 0; i < interfaces.length; i++)
{
+ if (!interfaces[i].route)
+ continue;
+
for (var j = 0; j < interfaces[i].route.length; j++)
{
var rt = interfaces[i].route[j];
}
}),
- listDeviceNamestatus: _luci2.rpc.declare({
+ getDeviceStatus: _luci2.rpc.declare({
object: 'network.device',
method: 'status',
params: [ 'name' ],
object: 'luci2.network',
method: 'conntrack_count',
expect: { '': { count: 0, limit: 0 } }
+ }),
+
+ listSwitchNames: _luci2.rpc.declare({
+ object: 'luci2.network',
+ method: 'switch_list',
+ expect: { switches: [ ] }
+ }),
+
+ getSwitchInfo: _luci2.rpc.declare({
+ object: 'luci2.network',
+ method: 'switch_info',
+ params: [ 'switch' ],
+ expect: { info: { } },
+ filter: function(data, params) {
+ data['attrs'] = data['switch'];
+ data['vlan_attrs'] = data['vlan'];
+ data['port_attrs'] = data['port'];
+ data['switch'] = params['switch'];
+
+ delete data.vlan;
+ delete data.port;
+
+ return data;
+ }
+ }),
+
+ getSwitchStatus: _luci2.rpc.declare({
+ object: 'luci2.network',
+ method: 'switch_status',
+ params: [ 'switch' ],
+ expect: { ports: [ ] }
})
};
}).then(function(data) {
try {
var viewConstructorSource = (
- '(function(L, $) {\n' +
+ '(function(L, $) { ' +
'return %s' +
'})(_luci2, $);\n\n' +
'//@ sourceURL=%s'