Changeset 267

Show
Ignore:
Timestamp:
10/12/08 12:33:47 (3 months ago)
Author:
pwh
Message:

Reversed the scaling code added in r218, since it's silly to do so much work to get around a bug in one vendor's software.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nethorus/app/models/bridge.rb

    r227 r267  
    133133 
    134134 
    135   # Some items of network equipment violate the BRIDGE-MIB and return values 
    136   # in seconds, rather than centi-seconds.  This model will automatically 
    137   # upscale the following attributes by a factor of 100 for the specified 
    138   # values: 
    139  
    140   #  * *dot1d_stp_max_age* 
    141   #  * *dot1d_stp_hello_time* 
    142   #  * *dot1d_stp_hold_time* 
    143   #  * *dot1d_stp_forward_delay* 
    144   #  * *dot1d_stp_bridge_max_age* - values between 6 and 40 will be upscaled by a factor of 100 
    145   #  * *dot1d_stp_bridge_hello_time* - values between 1 and 100 will be upscaled by a factor of 100 
    146   #  * *dot1d_stp_bridge_forward_delay* 
    147  
    148   def before_validation 
    149  
    150     if !self.dot1d_stp_max_age.nil? && self.dot1d_stp_max_age < 100 
    151       logger.warn "dot1d_stp_max_age is #{self.dot1d_stp_max_age} - multiplying by 100" 
    152       self.dot1d_stp_max_age = self.dot1d_stp_max_age * 100 
    153     end       
    154  
    155     if !self.dot1d_stp_hello_time.nil? && self.dot1d_stp_hello_time < 100 
    156       logger.warn "dot1d_stp_hello_time is #{self.dot1d_stp_hello_time} - multiplying by 100" 
    157       self.dot1d_stp_hello_time = self.dot1d_stp_hello_time * 100 
    158     end 
    159      
    160     if !self.dot1d_stp_hold_time.nil? && self.dot1d_stp_hold_time < 100 
    161       logger.warn "dot1d_stp_hold_time is #{self.dot1d_stp_hold_time} - multiplying by 100" 
    162       self.dot1d_stp_hold_time = self.dot1d_stp_hold_time * 100 
    163     end 
    164      
    165     if !self.dot1d_stp_forward_delay.nil? && self.dot1d_stp_forward_delay < 100 
    166       logger.warn "dot1d_stp_forward_delay is #{self.dot1d_stp_forward_delay} - multiplying by 100" 
    167       self.dot1d_stp_forward_delay = self.dot1d_stp_forward_delay * 100 
    168     end 
    169      
    170     if !self.dot1d_stp_bridge_max_age.nil? && self.dot1d_stp_bridge_max_age < 40 
    171       logger.warn "dot1d_stp_bridge_max_age is #{self.dot1d_stp_bridge_max_age} - multiplying by 100" 
    172       self.dot1d_stp_bridge_max_age = self.dot1d_stp_bridge_max_age * 100 
    173     end 
    174  
    175     if !self.dot1d_stp_bridge_hello_time.nil? && self.dot1d_stp_bridge_hello_time < 10 
    176       logger.warn "dot1d_stp_bridge_hello_time is #{self.dot1d_stp_bridge_hello_time} - multiplying by 100" 
    177       self.dot1d_stp_bridge_hello_time = self.dot1d_stp_bridge_hello_time * 100 
    178     end 
    179  
    180     if !self.dot1d_stp_bridge_forward_delay.nil? && self.dot1d_stp_bridge_forward_delay < 100 
    181       logger.warn "dot1d_stp_bridge_forward_delay is #{self.dot1d_stp_bridge_forward_delay} - multiplying by 100" 
    182       self.dot1d_stp_bridge_forward_delay = self.dot1d_stp_bridge_forward_delay * 100 
    183     end 
    184  
    185   end 
    186  
    187  
    188135  # Returns the L2Interface object corresponding to the STP root port 
    189136