From 519bae0f07f38bd82257c61a924085f64ad360cc Mon Sep 17 00:00:00 2001 From: Joachim Tingvold Date: Fri, 25 Mar 2016 15:23:08 +0100 Subject: Moved old, unused files. --- examples/historical/tools/make-switches.pl | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 examples/historical/tools/make-switches.pl (limited to 'examples/historical/tools/make-switches.pl') diff --git a/examples/historical/tools/make-switches.pl b/examples/historical/tools/make-switches.pl new file mode 100755 index 0000000..c0c842a --- /dev/null +++ b/examples/historical/tools/make-switches.pl @@ -0,0 +1,36 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +my $switchtype = "ex2200"; + +print "begin;\n"; +print "delete from temppoll;\n"; +print "delete from dhcp;\n"; +print "delete from switches where switchtype = '$switchtype';\n"; +#print "SELECT pg_catalog.setval('switches_switch_seq', 1, false);\n"; +print "SELECT pg_catalog.setval('polls_poll_seq', 1, false);\n"; + +my %ip; +my $i = 1; +while () { + chomp; + my @info = split(/ /); + + if (scalar @info < 5) { + die "Unknown line: $_"; + } + + my $name = $info[0]; + my $range = $info[1]; + my $ip = $info[3]; + $ip =~ s/\/.*$//; + + + print "insert into switches (ip, sysname, switchtype) values ('$ip', '$name', '$switchtype');\n"; + print "insert into dhcp select switch, '$range' from switches where sysname = '$name';\n"; +} +close HOSTS; + +print "end;\n"; -- cgit v1.2.3