aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/write/switch-add
diff options
context:
space:
mode:
authorKristian Lyngstøl <kly@kly.no>2018-03-21 14:12:47 +0100
committerGitHub <noreply@github.com>2018-03-21 14:12:47 +0100
commit8bee35e8be72510d8bdc7ed5de49a8d031e829a5 (patch)
tree1cf02f46483365911735bb0cdedbebf22a006eab /web/api/write/switch-add
parent227cc8ee0c4640d4e8eb63bde2f8742ea7199a81 (diff)
parent2b3beb9f93fc6486169e47f96995a97dd64baf2a (diff)
Merge pull request #168 from olemathias/network-firstclass
Network as own table
Diffstat (limited to 'web/api/write/switch-add')
-rwxr-xr-xweb/api/write/switch-add8
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'});
}