# HG changeset patch # User Daniel O'Connor # Date 1384953989 -37800 # Node ID 3748cec0e322a5abeb22c0e0adfda645a33df2fc # Parent b1048f889ef8420fc58ef8e02c6ab6f6cccacb7d# Parent a795b6cd8b1ad9e9e341ff322f483a5880aa3b26 merge diff -r a795b6cd8b1a -r 3748cec0e322 adsl.html --- a/adsl.html Mon Mar 18 23:15:00 2013 +1030 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ADSL
Parameters
ADSL Mode - -
Modulator - -
DSP FirmwareVersionDMT FwVer: 3.7.6.98_A_TC, HwVer:T14F7_1.0 - -
DMT StatusUp -
Operational ModeADSL2 -
Upstream1001 kbps -
Downstream6094 kbps -
Noise Margin (Upstream)6.3 db -
Noise Margin (Downstream)6.2 db -
Attenuation (Upstream)35.2 db -
Attenuation (Downstream)46.0 db -
-
-  - -
- - - diff -r a795b6cd8b1a -r 3748cec0e322 adslstats.py --- a/adslstats.py Mon Mar 18 23:15:00 2013 +1030 +++ b/adslstats.py Wed Nov 20 23:56:29 2013 +1030 @@ -69,20 +69,10 @@ (options, args) = opts.parse_args() -statsurl = "http://%s/adsl.asp" % (options.name) +statsurl = "http://%s/status/status_deviceinfo.htm" % (options.name) rrdname = "%s.rrd" % (options.base) graphbasename = options.base -matchnum = re.compile('([0-9]+(\.[0-9]+)?)') -statsdict = { - 7 : 'Upstream', - 8 : 'Downstream', - 9 : 'Noise Margin (Upstream)', - 10 : 'Noise Margin (Downstream)', - 11 : 'Attenuation (Upstream)', - 12 : 'Attenuation (Downstream)' } - - class ADSLStats(object): def __str__(self): return """Line Rate - Up: %d kbits, Down %d kbits @@ -91,21 +81,29 @@ self.nmup, self.nmdown, self.attenup, self.attendown) -def cleannum(s): - s1 = matchnum.match(s).groups()[0] - try: - return int(s1) - except ValueError: - return float(s1) - def getstats(f): s = BeautifulSoup(f) - a = s.findAll('tr') + a = s.findAll('td') - for i in statsdict: - assert a[i].td.contents[0].contents[0] == statsdict[i] + # Sanity check in case the firmware changes page layout + assert(a[122]('font')[0].contents[0] == 'SNR Margin') + assert(a[129]('font')[0].contents[0] == 'Line Attenuation') + assert(a[136]('font')[0].contents[0] == 'Data Rate') + + # Check if the modem is offline + if a[124].contents[0].strip() == 'N/A': + return None stats = ADSLStats() + + stats.nmdown = float(a[124].contents[0]) # dB + stats.nmup = float(a[125].contents[0]) # dB + + stats.attendown = float(a[131].contents[0]) # dB + stats.attenup = float(a[132].contents[0]) # dB + + stats.downstream = float(a[138].contents[0]) # kbit/sec + stats.upstream = float(a[139].contents[0]) # kbit/sec # Check if the modem is offline if a[9].td.findNext('td').contents[0].contents[0].find('N/A') != -1: @@ -116,6 +114,7 @@ stats.nmdown = cleannum(a[10].td.findNext('td').contents[0].contents[0]) # dB stats.attenup = cleannum(a[11].td.findNext('td').contents[0].contents[0]) # dB stats.attendown = cleannum(a[12].td.findNext('td').contents[0].contents[0]) # dB +>>>>>>> other return stats diff -r a795b6cd8b1a -r 3748cec0e322 status_deviceinfo.htm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/status_deviceinfo.htm Wed Nov 20 23:56:29 2013 +1030 @@ -0,0 +1,120 @@ + + + + + + + +
+ + + + + + + + +
 
+Device Information    +
  
+Firmware Version
:
+2.11.91.0(UE2.C2)3.11.11.52
  
+MAC Address
:
+00:04:ed:bb:a9:66
+LAN 


  
+IP Address
:
+10.0.2.9
  
+Subnet Mask
:
+255.255.255.0
  
+DHCP Server
:
+Disabled
+ + + + + + + + + + + +
+WAN 


+
  
+Virtual Circuit
:
+
 
+Status
:
+Connected
 
+Connection Type
:
+Bridge +
 
+IP Address
:
+N/A +
 
+Subnet Mask
:
+N/A
 
+Default Gateway
:
+N/A
 
+Primary DNS
:
+N/A
 
+Secondary DNS
:
+N/A
+ + + + + + + + + + + + +
+ADSL 


 
+ADSL Firmware Version
:
+ FwVer:3.11.11.52_TC3085 HwVer:T14.F7_3.0
 
+Line State
:
+Showtime
 
+Modulation
:
+ADSL2 PLUS
 
+Annex Mode
:
+ANNEX_A
 


+Downstream +Upstream 
+SNR Margin
:
+6.5 +5.9db
+Line Attenuation
:
+47.9 + 33.5 db
+Data Rate
:
+ 5626 + 990 kbps
   
+ +
   
+ \ No newline at end of file