HTML based parsing in Discovery Pattern Operations HTTP Get Call

Nikhil Sharma
Tera Contributor

Has anyone created HTML based parsing method for http get call discovery pattern? I am doing a get command and getting a html response in a text format. Finding it very difficult to parse the output using regular expressions. RegEx is not working at all. Any experience on it - 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><HEAD><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>System Log</title><style type="text/css"> <!--.Stil1 {font-family: Arial;font-size: 18;font-weight: bold;color: #000099;}.Stil2 {font-family: Arial;font-size: 24;font-weight: bold;}.Stil3 {font-family: Arial;font-size: 12;font-weight: bold;color: #000000;}.Stil4 {color: #999999}.Stil5 {margin-left: 0; font-size: 12; color: #000000; font-family: Arial;}.Stil6 {margin-left: 0; font-family: Arial; color: #999999; font-size: 12;}.Stil7 {margin-left: 0; font-family: Arial; color: #009900; font-size: 12; }.Stil8 {margin-left: 0; font-family: Arial; color: #FF0000; font-size: 12; }.Stil9 {font-family: Arial; font-size: 18; font-weight: bold; color: #000099; }.Stil12 {margin-left: 0;color: #FFFFFF;font-size: 13;background-color: #000066;font-family: Arial;}.Stil16 {font-family: Arial; font-size: 12; font-weight: bold; color: #000066; }.Stil17 {font-family: Arial; font-size: 18; font-weight: bold; color: #000066; }.Stil18 {margin-left: 0; font-size: 12; color: #000000; font-family: Arial;white-space:nowrap;}.Stil19 {margin-left: 0;color: #FFFFFF;font-size: 13;background-color: #000066;font-family: Arial;white-space:nowrap;}.nobr { white-space:nowrap; }--></style></head> <body><p class="Stil2">System Log</p>
<p class="Stil17"> </p>
<p class="Stil17">System Information</p><table border="0" cellpadding="1" cellspacing="1"><tr bgcolor="#CCCCCC"><td nowrap ><span class="Stil5">Product&nbsp;</span></td> <td nowrap ><span class="Stil18">ABCDEF&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">Release&nbsp;</span></td><td nowrap><span class="Stil5">HiOS&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Hardware version&nbsp;</span></td><td nowrap><span class="Stil5">1204&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">Serial number&nbsp;</span></td><td nowrap><span class="Stil5">123456789&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Firmware software release (RAM)&nbsp;</span></td><td nowrap><span class="Stil5">HiOS-2S-08&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">Firmware software release (FLASH)&nbsp;</span></td><td nowrap><span class="Stil5">HiOS-&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Firmware software release (BAK)&nbsp;</span></td><td nowrap><span class="Stil5">HiOS&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">Bootcode software release (FLASH)&nbsp;</span></td><td nowrap><span class="Stil5">HiBOOT&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Management IP&nbsp;</span></td><td nowrap><span class="Stil5">10.10.10.10&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">IPv6 Link Local Address&nbsp;</span></td><td nowrap><span class="Stil5">aa:Aa:Aa:aa:aa:aa:aa:aa&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">MAC[Range: 32]&nbsp;</span></td><td nowrap><span class="Stil5">aa:aa:aa:aa:aa:Aa&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">System Name&nbsp;</span></td><td nowrap><span class="Stil5">Name&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">System Up Time&nbsp;</span></td><td nowrap><span class="Stil5">70 days 5 hrs 18 mins 56 secs&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">System Date and Time (local time zone)&nbsp;</span></td><td nowrap><span class="Stil5">2020-03-11 06:18:48&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">System operating hours&nbsp;</span></td><td nowrap><span class="Stil5">76 days 11 hrs 23 mins 55 secs&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">Power1&nbsp;</span></td><td nowrap><span class="Stil8">DEFECTIVE&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Power2&nbsp;</span></td><td nowrap><span class="Stil7">PRESENT&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">Current temperature&nbsp;</span></td><td nowrap><span class="Stil5">40 &deg;C&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Configuration state (running to NVM)&nbsp;</span></td><td nowrap><span class="Stil7">OK&nbsp;</span></td></tr><tr ><td nowrap><span class="Stil5">ACA (envm/USB) Status&nbsp;</span></td><td nowrap><span class="Stil5">notPresent&nbsp;</span></td></tr><tr bgcolor="#CCCCCC"><td nowrap><span class="Stil5">Service shell admin status&nbsp;</span></td><td nowrap><span class="Stil5">enabled&nbsp;</span></td></tr></table>
<br>
Severity threshold for high priority buffer........warning
<br>
<br>
<font color="#3366FF" face=monospace>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6542: Notice&nbsp;&nbsp;&nbsp; Mar 11 2020 05:43:58 [SNMP_TRAP SNMPTrapTask 0x00230001] hm2WebLogoutTrap: hm2WebLastLogoutUserName.0=admin</font>
<br>
<font color="#3366FF" face=monospace>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6541: Notice&nbsp;&nbsp;&nbsp; Mar 11 2020 05:43:57 [USERMGR tLighty 0x0002005b] Logout via web interface successful for user 'admin', role 'Administrator'.</font>
<br>

0 REPLIES 0