Changeset 12


Ignore:
Timestamp:
Jan 31, 2008, 11:19:50 AM (17 years ago)
Author:
g7moreau
Message:
  • Rename SWITCH_DB variable to KLASK_CFG
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r11 r12  
    1717my $KLASK_CFG = '/etc/klask.conf';
    1818
    19 my $SWITCH_DB = YAML::LoadFile("$KLASK_CFG");
    20 
    21 my %DEFAULT = %{$SWITCH_DB->{default}};
    22 my @SWITCH  = @{$SWITCH_DB->{switch}};
     19my $KLASK_CFG = YAML::LoadFile("$KLASK_CFG");
     20
     21my %DEFAULT = %{$KLASK_CFG->{default}};
     22my @SWITCH  = @{$KLASK_CFG->{switch}};
    2323
    2424my %switch_level = ();
     
    2727   $switch_level{$sw->{hostname}} = $sw->{level} || $DEFAULT{switch_level}  || 2;
    2828   }
    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}}; 
    3030
    3131my %switch_port_count = ();
     
    366366sub get_list_network {
    367367
    368    return keys %{$SWITCH_DB->{network}};
     368   return keys %{$KLASK_CFG->{network}};
    369369   }
    370370
     
    372372   my $network = shift;
    373373
    374    return $SWITCH_DB->{network}{$network}{interface};
     374   return $KLASK_CFG->{network}{$network}{interface};
    375375   }
    376376 
     
    383383
    384384   for my $net (@network) {
    385       my @line  = @{$SWITCH_DB->{network}{$net}{'ip-subnet'}};
     385      my @line  = @{$KLASK_CFG->{network}{$net}{'ip-subnet'}};
    386386      for my $cmd (@line) {
    387387         for my $method (keys %$cmd){
     
    411411
    412412   for my $net (@network) {
    413       push @res, $SWITCH_DB->{network}{$net}{'main-router'};
     413      push @res, $KLASK_CFG->{network}{$net}{'main-router'};
    414414      }
    415415
Note: See TracChangeset for help on using the changeset viewer.