|
@@ -21,10 +21,23 @@ use eyelib::main;
|
|
|
use eyelib::database;
|
|
use eyelib::database;
|
|
|
use eyelib::common;
|
|
use eyelib::common;
|
|
|
|
|
|
|
|
-my @router_list = get_records_sql($dbh,"SELECT D.*, DM.model_name, B.name AS building_name FROM devices D
|
|
|
|
|
-LEFT JOIN device_models DM ON D.device_model_id = DM.id
|
|
|
|
|
-LEFT JOIN building B ON D.building_id = B.id
|
|
|
|
|
-WHERE D.deleted = 0 and device_type<=2 ORDER BY building_name,ip");
|
|
|
|
|
|
|
+my @router_list = get_records_sql($dbh, "
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ D.*,
|
|
|
|
|
+ DM.model_name,
|
|
|
|
|
+ B.name AS building_name
|
|
|
|
|
+ FROM devices D
|
|
|
|
|
+ LEFT JOIN device_models DM ON D.device_model_id = DM.id
|
|
|
|
|
+ LEFT JOIN building B ON D.building_id = B.id
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ D.deleted = 0
|
|
|
|
|
+ AND D.device_type <= 2
|
|
|
|
|
+ AND D.protocol >= 0
|
|
|
|
|
+ ORDER BY
|
|
|
|
|
+ (building_name IS NULL),
|
|
|
|
|
+ building_name,
|
|
|
|
|
+ ip
|
|
|
|
|
+");
|
|
|
|
|
|
|
|
foreach my $device (@router_list) {
|
|
foreach my $device (@router_list) {
|
|
|
next if (!$device->{password} or !$device->{login});
|
|
next if (!$device->{password} or !$device->{login});
|
|
@@ -33,9 +46,9 @@ next if ($device->{protocol} eq '-1');
|
|
|
$device = netdev_set_auth($device);
|
|
$device = netdev_set_auth($device);
|
|
|
my $oxi_model = 'dcnos';
|
|
my $oxi_model = 'dcnos';
|
|
|
my $comware_cmdline = '';
|
|
my $comware_cmdline = '';
|
|
|
-my $vendor = get_record_sql($dbh,"SELECT * FROM vendors WHERE id=".$device->{vendor_id});
|
|
|
|
|
-my $model = get_record_sql($dbh,"SELECT * FROM device_models WHERE id=".$device->{device_model_id});
|
|
|
|
|
-my $building = get_record_sql($dbh,"SELECT * FROM building WHERE id=".$device->{building_id});
|
|
|
|
|
|
|
+my $vendor = get_record_sql($dbh,"SELECT * FROM vendors WHERE id=?", $device->{vendor_id});
|
|
|
|
|
+my $model = get_record_sql($dbh,"SELECT * FROM device_models WHERE id=?", $device->{device_model_id});
|
|
|
|
|
+my $building = get_record_sql($dbh,"SELECT * FROM building WHERE id=?", $device->{building_id});
|
|
|
if ($vendor->{name} =~/zyxel/i) { $oxi_model = 'zynoscli'; }
|
|
if ($vendor->{name} =~/zyxel/i) { $oxi_model = 'zynoscli'; }
|
|
|
if ($vendor->{name} =~/snr/i) { $oxi_model = 'dcnos'; }
|
|
if ($vendor->{name} =~/snr/i) { $oxi_model = 'dcnos'; }
|
|
|
if ($vendor->{name} =~/huawei/i) { $oxi_model = 'vrp'; }
|
|
if ($vendor->{name} =~/huawei/i) { $oxi_model = 'vrp'; }
|