Changeset 12
- Timestamp:
- Jan 31, 2008, 11:19:50 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r11 r12 17 17 my $KLASK_CFG = '/etc/klask.conf'; 18 18 19 my $ SWITCH_DB= YAML::LoadFile("$KLASK_CFG");20 21 my %DEFAULT = %{$ SWITCH_DB->{default}};22 my @SWITCH = @{$ SWITCH_DB->{switch}};19 my $KLASK_CFG = YAML::LoadFile("$KLASK_CFG"); 20 21 my %DEFAULT = %{$KLASK_CFG->{default}}; 22 my @SWITCH = @{$KLASK_CFG->{switch}}; 23 23 24 24 my %switch_level = (); … … 27 27 $switch_level{$sw->{hostname}} = $sw->{level} || $DEFAULT{switch_level} || 2; 28 28 } 29 @SWITCH = sort { $switch_level{$b->{hostname}} <=> $switch_level{$a->{hostname}} } @{$ SWITCH_DB->{switch}};29 @SWITCH = sort { $switch_level{$b->{hostname}} <=> $switch_level{$a->{hostname}} } @{$KLASK_CFG->{switch}}; 30 30 31 31 my %switch_port_count = (); … … 366 366 sub get_list_network { 367 367 368 return keys %{$ SWITCH_DB->{network}};368 return keys %{$KLASK_CFG->{network}}; 369 369 } 370 370 … … 372 372 my $network = shift; 373 373 374 return $ SWITCH_DB->{network}{$network}{interface};374 return $KLASK_CFG->{network}{$network}{interface}; 375 375 } 376 376 … … 383 383 384 384 for my $net (@network) { 385 my @line = @{$ SWITCH_DB->{network}{$net}{'ip-subnet'}};385 my @line = @{$KLASK_CFG->{network}{$net}{'ip-subnet'}}; 386 386 for my $cmd (@line) { 387 387 for my $method (keys %$cmd){ … … 411 411 412 412 for my $net (@network) { 413 push @res, $ SWITCH_DB->{network}{$net}{'main-router'};413 push @res, $KLASK_CFG->{network}{$net}{'main-router'}; 414 414 } 415 415
Note: See TracChangeset
for help on using the changeset viewer.