Changeset 79


Ignore:
Timestamp:
Mar 29, 2011, 5:37:45 PM (10 years ago)
Author:
g7moreau
Message:
  • Add verbose option to updatesw
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r78 r79  
    2222# apt-get install snmp fping libnet-cidr-lite-perl libnet-netmask-perl libnet-snmp-perl libnetaddr-ip-perl libyaml-perl
    2323# libcrypt-des-perl libcrypt-hcesha-perl libdigest-hmac-perl
    24 # arping fping bind9-host arpwatch
     24# arping net-tools fping bind9-host arpwatch
    2525
    2626my $KLASK_VAR      = '/var/cache/klask';
     
    445445
    446446#print "DEBUG $arp  $swport --  $sw->{hostname} \n";
    447          if ( $sw->{hostname} eq 'sw10-batE1-3s.hmg.priv' and $swport == 19 ) { $swport = 20; print "DEBUG $swport --  $sw->{hostname} \n";}
    448          if ( $sw->{hostname} eq 'sw8-batE1-3s.hmg.priv'  and $swport == 23 ) { $swport = 24; print "DEBUG $swport --  $sw->{hostname} \n";}
     447#         if ( $sw->{hostname} eq 'sw10-batE1-3s.hmg.priv' and $swport == 19 ) { $swport = 20; print "DEBUG $swport --  $sw->{hostname} \n";}
     448#         if ( $sw->{hostname} eq 'sw8-batE1-3s.hmg.priv'  and $swport == 23 ) { $swport = 24; print "DEBUG $swport --  $sw->{hostname} \n";}
    449449#         if ( $sw->{hostname} eq 'sw10-batE1-3s.hmg.priv' ) {  print "DEBUG $swport --  $sw->{hostname} \n";}
    450450#         if ( $sw->{hostname} eq 'sw8-batE1-3s.hmg.priv'  ) {  print "DEBUG $swport --  $sw->{hostname} \n";}
     
    14201420
    14211421sub cmd_updatesw {
     1422   my @options = @_;
     1423
     1424   my $verbose;
     1425
     1426   my $ret = GetOptionsFromArray(\@options,
     1427      'verbose|v' => \$verbose,
     1428      );
    14221429
    14231430   init_switch_names('yes');    #nomme les switchs
     
    14341441      next DETECT_ALL_ROUTER if $resol_arp{mac_address} eq 'unknow';
    14351442      $where{$resol_arp{ipv4_address}} = find_all_switch_port($resol_arp{mac_address}); # retrouve les emplacements des routeurs
     1443      print "VERBOSE_1: Router detected $resol_arp{ipv4_address} - $resol_arp{mac_address}\n" if $verbose;
    14361444      }
    14371445
     
    14491457
    14501458         $db_switch_output_port{$switch->{hostname}} = $switch->{port};
     1459         print "VERBOSE_2: output port $switch->{hostname} : $switch->{port}\n" if $verbose;
    14511460         }
    14521461      }
     
    14911500      for my $switch_detected ( keys %{$where{$ip}} ) {
    14921501
    1493          next DETECTED_SWITCH if not exists $SWITCH_PORT_COUNT{ $db_switch_ip_hostname{$ip}};
     1502         next DETECTED_SWITCH if not exists $SWITCH_PORT_COUNT{ $db_switch_ip_hostname{$ip} };
    14941503
    14951504         my $switch = $where{$ip}->{$switch_detected};
     
    15021511         $db_switch_link_with{ $db_switch_ip_hostname{$ip} } ||= {};
    15031512         $db_switch_link_with{ $db_switch_ip_hostname{$ip} }->{ $switch->{hostname} } = $switch->{port};
     1513         print "VERBOSE_3: $db_switch_ip_hostname{$ip} -> $switch->{hostname} : $switch->{port}\n" if $verbose;
    15041514#print "DEBUG :  $db_switch_ip_hostname{$ip} / $switch->{hostname} : $switch->{port}\n" if $switch->{hostname} !~ m/sw3-batA0-3s/;
    15051515         }
Note: See TracChangeset for help on using the changeset viewer.