diff options
author | root <root@colazero.tele.tg18.gathering.org> | 2018-03-21 14:13:32 +0100 |
---|---|---|
committer | root <root@colazero.tele.tg18.gathering.org> | 2018-03-21 14:13:32 +0100 |
commit | 05e09f3b63269a48d1beb0dc9900b180101cec7f (patch) | |
tree | b96dbc2cc53a79968e4c60a7b3a729ea4d937299 /web/api/write/switch-add | |
parent | c6d676b8d07dcd081626ad86849900977327bbb7 (diff) | |
parent | 8bee35e8be72510d8bdc7ed5de49a8d031e829a5 (diff) |
Merge branch 'master' of github.com:tech-server/gondul
Diffstat (limited to 'web/api/write/switch-add')
-rwxr-xr-x | web/api/write/switch-add | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/web/api/write/switch-add b/web/api/write/switch-add index dbaa1e5..c92cf31 100755 --- a/web/api/write/switch-add +++ b/web/api/write/switch-add @@ -23,7 +23,7 @@ my @dups; my $sth = $nms::web::dbh->prepare("SELECT sysname FROM switches WHERE sysname=?"); -my @fields = ( 'community', 'distro_name', 'distro_phy_port', 'mgmt_v4_addr', 'mgmt_v4_gw', 'mgmt_v6_addr', 'mgmt_v6_gw', 'mgmt_vlan', 'placement', 'poll_frequency', 'subnet4', 'subnet6', 'sysname', 'traffic_vlan'); +my @fields = ( 'community', 'distro_name', 'distro_phy_port', 'mgmt_v4_addr', 'mgmt_v6_addr', 'mgmt_vlan', 'placement', 'poll_frequency', 'sysname', 'traffic_vlan'); sub convertplace { @@ -74,15 +74,15 @@ foreach my $tmp2 (@tmp) { $x2 = $placement{'xx'}; $y2 = $placement{'yy'}; $switch{'placement'} = "(($x1,$y1),($x2,$y2))"; - + map { if (defined ($template{$_})) { $template{$_} = $dbh->quote($switch{$_}); } } keys %switch; - - $nms::web::dbh->do("INSERT INTO SWITCHES (mgmt_v4_addr, sysname, poll_frequency, community, mgmt_v6_addr, placement,subnet4,subnet6,distro_name) VALUES ($template{'mgmt_v4_addr'}, $template{'sysname'}, $template{'poll_frequency'}, $template{'community'}, $template{'mgmt_v6_addr'}, $template{'placement'},$template{'subnet4'},$template{'subnet6'},$template{'distro_name'});"); + + $nms::web::dbh->do("INSERT INTO SWITCHES (mgmt_v4_addr, sysname, poll_frequency, community, mgmt_v6_addr, placement, distro_name) VALUES ($template{'mgmt_v4_addr'}, $template{'sysname'}, $template{'poll_frequency'}, $template{'community'}, $template{'mgmt_v6_addr'}, $template{'placement'}, $template{'distro_name'});"); push @added, $switch{'sysname'}; oplog("\"" . $switch{'sysname'} . "\"", "Switch added: " . $switch{'sysname'}); } |