Location: PHPKode > scripts > ONU > onu/onu.php
<?php

/*
*
* @author: hide@address.com
*
* OLT , onu Class 
*
*
*	Copyright (C) 2008 Fernando André
*	
*	This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; *	*	either version 2 of the License, or (at your option) any later version.
*
*	This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *	PURPOSE. See the GNU General Public License for more details.
*
*	You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite *	*	330, Boston, MA 02111-1307 USA
*
**/

class onu {
	
	/*
	* Loads information using the methods bellow into the object.
	*/
	function load() {
		$this->ifPhy		= $this->getIfPhy();
		$this->operStatus	= $this->getOperStatus();
		$this->AdminStatus	= $this->getAdminStatus();
		$this->ifDescr		= $this->getIfDescr();
	}
	/*
	* @params $olt object OLT
	* Specifies the $olt object where the onu can be found
	*/
	function setOlt($olt){
		$this->olt = $olt;
	}

	/*
	* sets the index to obtain details for a specific onu
	*/
	function setIndex($index){
		$this->index = $index;
	}
	/*
	* Get's ONU MAC
	*/
	function getIfPhy(){
		$ifPhy = "1.3.6.1.2.1.2.2.1.6";
		return str_replace("STRING: ", "", $this->olt->snmpquery($ifPhy.".".$this->index));
	}
	/*
	* Gets operational status according to the oid. Usually it's only "up" if down the
	* onu will not appear in the listing of the olt
	*/
	function getOperStatus(){
		$operStatus = "1.3.6.1.2.1.2.2.1.8";
		return str_replace("INTEGER: ", "", $this->olt->snmpquery($operStatus.".".$this->index));
	}
	/*
	* Returns the admin status
	*/
	function getAdminStatus(){
		$adminStatus = "1.3.6.1.2.1.2.2.1.7";
		return str_replace("INTEGER: ", "", $this->olt->snmpquery($adminStatus.".".$this->index));
	}
	/*
	* Return Interface Description usually in BBS1000 return the PORT/CARD/(ONU LOGICAL ID)
	*/
	function getIfDescr(){
		$ifDescr = "1.3.6.1.2.1.2.2.1.2";
		return str_replace("STRING: ", "", $this->olt->snmpquery($ifDescr.".".$this->index));
	}
	/*
	* same has setIndex
	*/
	function setIfIndex($index) {
		$this->index = $index;
	}

}

?>
Return current item: ONU