2 open PATCHLIST, "<patchlist.txt"
3 or die "patchlist.txt: $!";
8 my ($name, $distro, $port) = split / /;
10 $name =~ /e(\d+)-(\d+)/;
11 my ($row, $switch) = ($1, $2);
15 $ip = "87.76." . ($row) . ".1";
16 } elsif ($switch == 2) {
17 $ip = "87.76." . ($row) . ".65";
18 } elsif ($switch == 3) {
19 $ip = "87.76." . ($row) . ".129";
20 } elsif ($switch == 4) {
21 $ip = "87.76." . ($row + 1) . ".1";
22 } elsif ($switch == 5) {
23 $ip = "87.76." . ($row + 1) . ".65";
24 } elsif ($switch == 6) {
25 $ip = "87.76." . ($row + 1) . ".129";
28 my $vlan = "$row$switch";
30 $distros{$distro} .= <<"EOF";
34 default interface vlan $vlan
37 ip address $ip 255.255.255.192
38 ip directed-broadcast 10
39 ip helper-address 87.76.254.2
41 ip access-group great-wall-of-tg in
42 ipv6 address 2001:16D8:FFFF:$vlan::1/64
46 default interface $port
49 switchport mode access
50 switchport access vlan $vlan
52 spanning-tree portfast
53 spanning-tree bpduguard enable
56 storm-control broadcast level 2
62 for my $distro (keys %distros) {
63 open DISTRO, ">$distro-config"
64 or die "$distro-config: $!";
65 print DISTRO $distros{$distro};