add speed to retrieved devicelinks

This commit is contained in:
Oliver Gorwits
2017-12-28 23:51:26 +00:00
parent ae5496310e
commit 72961f172d
2 changed files with 12 additions and 2 deletions

View File

@@ -11,11 +11,14 @@ __PACKAGE__->table('device_links');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(<<ENDSQL
SELECT dp.ip AS left_ip, dp.port AS left_port, dp.name AS left_descr,
dp.speed,
dp2.ip AS right_ip, dp2.port AS right_port, dp2.name AS right_descr
FROM ( SELECT device_port.ip, device_port.port, device_port.name,
device_port.speed,
device_port.remote_ip, device_port.remote_port
FROM device_port
WHERE device_port.remote_port IS NOT NULL ) dp
WHERE device_port.remote_port IS NOT NULL
AND device_port.type = 'ethernetCsmacd' ) dp
INNER JOIN device_ip di ON dp.remote_ip = di.alias
INNER JOIN device_port dp2 ON (di.ip = dp2.ip AND dp.remote_port = dp2.port)
WHERE dp.ip <= dp2.ip
@@ -33,6 +36,9 @@ __PACKAGE__->add_columns(
'left_descr' => {
data_type => 'text',
},
'speed' => {
data_type => 'text',
},
'right_ip' => {
data_type => 'inet',
},