Changeset 176

Show
Ignore:
Timestamp:
07/24/08 08:42:07 (4 months ago)
Author:
pwh
Message:

Added basic support for DS1/E1 interfaces

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nethorus/app/controllers/manage_controller.rb

    r172 r176  
    143143      @interface_specific_partial = "ethernet_interface" 
    144144 
     145    elsif @interface.iftype == "ds1" 
     146 
     147      # Read the DS1 stats for this interface 
     148 
     149      begin 
     150        dsx1_config_table = @device.get_table('DS1-MIB::dsx1ConfigTable') 
     151      rescue Device::SNMPProxyConnectFailure 
     152      end 
     153 
     154 
     155      dsx1_config_table.each do |ds1_row| 
     156       
     157        if ds1_row[1]['dsx1IfIndex'] == @interface.ifindex 
     158 
     159          logger.debug "Found a ds1_interface=#{ds1_row[1]['dsx1LineIndex']} for ifindex=#{@interface.ifindex}" 
     160          @ds1_interface = ds1_row[1] 
     161 
     162        end 
     163 
     164      end 
     165 
     166 
     167      @ds1_send_code = Hash.new 
     168      @ds1_send_code['dsx1SendNoCode'] = "Normal/looped data" 
     169      @ds1_send_code['dsx1SendLineCode'] = "Requesting line loopback" 
     170      @ds1_send_code['dsx1SendPayloadCode'] = "Requesting payload loopback" 
     171      @ds1_send_code['dsx1SendResetCode'] = "Requesting loop termination" 
     172      @ds1_send_code['dsx1SendQRS'] = "Sending quasi-random signal (QRS)" 
     173      @ds1_send_code['dsx1Send511Pattern'] = "Sending 511-bit fixed test pattern" 
     174      @ds1_send_code['dsx1Send3in24Pattern'] = "Sending 3-in-24-bits-set test pattern" 
     175      @ds1_send_code['dsx1SendOtherTestPattern'] = "Sending other test pattern" 
     176       
     177       
     178      # Translate the dsx1LineStatus value in to individual states 
     179       
     180      @ds1_line_status = Array.new 
     181      @ds1_line_status.push "No alarm present" if (@ds1_interface['dsx1LineStatus'] & 1 == 1) 
     182      @ds1_line_status.push "Yellow Alarm: Far end Loss of Framing (LOF)" if (@ds1_interface['dsx1LineStatus'] & 2 == 2) 
     183      @ds1_line_status.push "Near end sending Loss of Framing (LOF)" if (@ds1_interface['dsx1LineStatus'] & 4 == 4) 
     184      @ds1_line_status.push "Far end sending Alarm Indication Signal (AIS)" if (@ds1_interface['dsx1LineStatus'] & 8 == 8) 
     185      @ds1_line_status.push "Near end sending Alarm Indication Signal (AIS)" if (@ds1_interface['dsx1LineStatus'] & 16 == 16) 
     186      @ds1_line_status.push "Red Alarm: Near end Loss of Framing (LOF)" if (@ds1_interface['dsx1LineStatus'] & 32 == 32) 
     187      @ds1_line_status.push "Near end Loss of Signal (LOS)" if (@ds1_interface['dsx1LineStatus'] & 64 == 64) 
     188      @ds1_line_status.push "Near end looped" if (@ds1_interface['dsx1LineStatus'] & 128 == 128) 
     189      @ds1_line_status.push "E1 Timeslot 16 Alarm Indication Signal (AIS)" if (@ds1_interface['dsx1LineStatus'] & 256 == 256) 
     190      @ds1_line_status.push "Far end sending Timeslot 16 Loss of Signalling Multiframe (LOMF) alarm" if (@ds1_interface['dsx1LineStatus'] & 512 == 512) 
     191      @ds1_line_status.push "Near end sending Timeslot 16 Loss of Signalling Multiframe (LOMF) alarm" if (@ds1_interface['dsx1LineStatus'] & 1024 == 1024) 
     192      @ds1_line_status.push "Near end detected a test code" if (@ds1_interface['dsx1LineStatus'] & 2048 == 2048) 
     193      @ds1_line_status.push "Unknown line status - failure?" if (@ds1_interface['dsx1LineStatus'] & 4096 == 4096) 
     194      @ds1_line_status.push "Near end in Unavailable Signal State" if (@ds1_interface['dsx1LineStatus'] & 8192 == 8192) 
     195      @ds1_line_status.push "Carrier equipment Out Of Service (OOS)" if (@ds1_interface['dsx1LineStatus'] & 16384 == 16384) 
     196      @ds1_line_status.push "DS2 Payload Alarm Indication Signal (AIS)" if (@ds1_interface['dsx1LineStatus'] & 32768 == 32768) 
     197      @ds1_line_status.push "DS2 Performance Threshold Exceeded" if (@ds1_interface['dsx1LineStatus'] & 65536 == 65536) 
     198       
     199 
     200 
     201      @ds1_loopback_config = Hash.new 
     202      @ds1_loopback_config['dsx1NoLoop'] = "No loopback set" 
     203      @ds1_loopback_config['dsx1PayloadLoop'] = "Local loop through device" 
     204      @ds1_loopback_config['dsx1LineLoop'] = "Local loop set" 
     205      @ds1_loopback_config['dsx1OtherLoop'] = "Undefined loopback set" 
     206      @ds1_loopback_config['dsx1InwardLoop'] = "Remote loop set" 
     207      @ds1_loopback_config['dsx1DualLoop'] = "Local and remote loops set" 
     208 
     209      @interface_specific_partial = "ds1_interface" 
     210 
    145211    end 
    146212 
  • nethorus/app/helpers/application_helper.rb

    r168 r176  
    228228 
    229229 
     230  # Output the variable if it is not nil, otherwise output "Unavailable" 
     231   
     232  def variable_or_unavailable(variable) 
     233   
     234    if variable.nil? || variable.blank? 
     235      return "Unavailable" 
     236    else 
     237      return variable 
     238    end 
     239   
     240  end 
     241 
     242 
    230243  # Validates an IP address by attempting to convert it to an integer, then back again. 
    231244