2 open PATCHLIST, "<patchlist.txt"
3 or die "patchlist.txt: $!";
9 my ($name, $distro, $port) = split / /;
11 $name =~ /e(\d+)-(\d+)/;
12 my ($row, $switch) = ($1, $2);
16 $ip = "87.76." . ($row) . ".1";
17 } elsif ($switch == 2) {
18 $ip = "87.76." . ($row) . ".65";
19 } elsif ($switch == 3) {
20 $ip = "87.76." . ($row) . ".129";
21 } elsif ($switch == 4) {
22 $ip = "87.76." . ($row + 1) . ".1";
23 } elsif ($switch == 5) {
24 $ip = "87.76." . ($row + 1) . ".65";
25 } elsif ($switch == 6) {
26 $ip = "87.76." . ($row + 1) . ".129";
29 my $vlan = "$row$switch";
30 my $ipv6 = sprintf "F%02u%u", $row, $switch;
32 $vlans{$distro} .= <<"EOF";
38 $ports{$distro} .= <<"EOF";
39 default interface vlan $vlan
42 ip address $ip 255.255.255.192
43 ip directed-broadcast 10
44 ip helper-address 87.76.254.2
46 ip access-group great-wall-of-tg in
47 ipv6 address 2001:16D8:FFFF:${ipv6}::1/64
53 default interface $port
56 switchport mode access
57 switchport access vlan $vlan
59 spanning-tree portfast
60 spanning-tree bpduguard enable
62 storm-control broadcast level 2
69 for my $distro (keys %vlans) {
70 open DISTRO, ">$distro-config"
71 or die "$distro-config: $!";
72 print DISTRO $vlans{$distro};
73 print DISTRO $ports{$distro};