+## Collect switch ips
+
+my %switchips;
+
+open(SWITCHES, $switches) or die "Unable to open switches";
+while(<SWITCHES>) {
+ my ($ip, $net, $name) = split;
+
+ print $name."\n";
+ if ($name =~ /e\d+-\d/) {
+ die "We only support /26 nets for now you wanted $net" if ($net ne "26");
+ $switchips{$name} = $ip;
+ }
+}
+close(SWITCHES);
+
+
+open(PATCHLIST, $patchlist) or die "Unable to open patchlist";
+while (<PATCHLIST>) {
+ my ($switch, $distro, $port) = split;
+
+ $switch =~ /e(\d+)-(\d)/;
+ my ($row, $place) = ($1, $2);
+ my $ipnet = $switchips{$switch};
+ my $vlan = $row . $place;
+ print "Switch: $switch, Distro: $distro, vlan: $vlan\n";
+ print "Ip net: $ipnet\n";
+ my ($first, $second, $third, $fourth) = split(/\./, $ipnet);
+ my $ip = "$first.$second.$third.".(int($fourth)+2);
+ print "Ip: $ip\n";
+ my $dip = $distro.".net.tg07.gathering.org";
+
+ do_distro($dip, $ip, $vlan);
+# my ($dip, $newip, $vlan) = @_;
+}
+close(PATCHLIST);
+