source: genesis/tools/conf2inc.pl@ 3550

Last change on this file since 3550 was 1978, checked in by dirkx, 21 years ago

Conversion tooltjes to XML

File size: 932 bytes
Line 
1#!/usr/bin/perl
2# use strict;
3use Data::Dumper;
4
5$|++;
6
7my $DIR='../nodes';
8my @nodes=();
9
10opendir(DIR,$DIR) or die $!;
11
12my $nodes = \();
13
14foreach(readdir(DIR)) {
15 next unless m/[CH]Node[\w+]/;
16 # print STDERR "Working on: $_\n";
17 my $n = $_;
18 my $f = $DIR.'/'.$n.'/wleiden.conf';
19 next unless -r $f;
20 eval qq|
21 package $n;
22 require "$f";
23 \$\::nodes->{$n} = \{
24 'location' => \$location,
25 'master_ip' => \$master_ip,
26 'nodename' => \$nodename,
27 'X' => \$X,
28 'Y' => \$Y,
29 'config' => \{ %config },
30 };
31 1;
32 |;
33 die "Parse error: $@" if $@;
34 push @nodes, $_;
35};
36
37foreach my $n (@nodes) {
38 $c = $::nodes->{$n}->{config};
39 foreach my $if (keys %$c ) {
40 foreach(split(m/\n/,$c->{$if})) {
41 chomp;
42 s/#.*//;
43 next if m/^\s*$/;
44 die unless my ($k,$v) = split /=/;
45 # print "$n\t$if\t$k\t$v\n";
46 $::nodes->{$n}->{ifaces}->{$if}->{$k}=$v;
47 };
48 };
49 delete $::nodes->{$n}->{config};
50}
51
52print Dumper($::nodes);
53
Note: See TracBrowser for help on using the repository browser.