mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	UNDERPANTSGNOMES
git-svn-id: http://www.observium.org/svn/observer/trunk@1212 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		
							
								
								
									
										30
									
								
								includes/port-descr-parser.inc.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								includes/port-descr-parser.inc.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
  ## Very basic parser to parse classic Observer-type schemes.
 | 
			
		||||
  ## Parser should populate $port_ifAlias array with type, descr, circuit, speed and notes
 | 
			
		||||
 | 
			
		||||
  unset ($port_ifAlias);
 | 
			
		||||
 | 
			
		||||
#  echo("parser!");
 | 
			
		||||
 | 
			
		||||
  list($type,$descr) = preg_split("/[\:\[\]\{\}\(\)]/", $this_port['ifAlias']);
 | 
			
		||||
  list(,$circuit) = preg_split("/[\{\}]/", $this_port['ifAlias']);
 | 
			
		||||
  list(,$notes) = preg_split("/[\(\)]/", $this_port['ifAlias']);
 | 
			
		||||
  list(,$speed) = preg_split("/[\[\]]/", $this_port['ifAlias']);
 | 
			
		||||
  $descr = trim($descr);
 | 
			
		||||
 | 
			
		||||
  if($type && $descr) {
 | 
			
		||||
    $port_ifAlias['type']  = $type;
 | 
			
		||||
    $port_ifAlias['descr'] = $descr;
 | 
			
		||||
    $port_ifAlias['circuit'] = $circuit;
 | 
			
		||||
    $port_ifAlias['speed'] = $speed;
 | 
			
		||||
    $port_ifAlias['notes'] = $notes;
 | 
			
		||||
 | 
			
		||||
    print_r($port_ifAlias);
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  unset ($port_type, $port_descr, $port_circuit, $port_notes, $port_speed);
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user