소스 검색

Se agrega TrafficMaxRate para CMTSs con DOCS 1

Daniel Libonati 8 년 전
부모
커밋
36a1f6c85a
1개의 변경된 파일54개의 추가작업 그리고 33개의 파일을 삭제
  1. 54 33
      OSS_SNMP/MIBS/DocsIfCmts.php

+ 54 - 33
OSS_SNMP/MIBS/DocsIfCmts.php

@@ -31,38 +31,59 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
     const OID_docsIfUpChannelFrequency		= "1.3.6.1.2.1.10.127.1.1.2.1.2";
     const OID_docsIfUpChannelWidth 		= "1.3.6.1.2.1.10.127.1.1.2.1.3";
     const OID_docsIfCmtsCmStatusSignalNoise 	= "1.3.6.1.2.1.10.127.1.3.3.1.13";
-    
+
     const OID_docsQosServiceFlowTimeActive 	= "1.3.6.1.2.1.10.127.7.1.4.1.4";
     const OID_docsQos3ServiceFlowTimeActive 	= "1.3.6.1.4.1.4491.2.1.21.1.4.1.4";
-  
+
     const OID_docsQosParamSetMaxTrafficRate		= "1.3.6.1.2.1.10.127.7.1.2.1.6";
     const OID_docsQos3ParamSetMaxTrafficRate	= "1.3.6.1.4.1.4491.2.1.21.1.2.1.6";
 
     public function docsQosParamSetMaxTrafficRate() {
-      return $this->getSNMP()->realwalk(self::OID_docsQosParamSetMaxTrafficRate);
+
+        try{
+
+            $rtr = array();
+
+            $oid = self::OID_docsQosParamSetMaxTrafficRate;
+
+            foreach($this->getSNMP()->realWalk($oid) as $k => $v){
+                $k_prim = preg_split("|\.|",$k);
+                if ($k_prim[17] == 1) { // Solo activos
+                    $rtr[$k_prim[15].$k_prim[16]] = $this->getSNMP()->parseSnmpValue($v);
+                }
+            }
+
+          return $rtr;
+
+        } catch (\Exception $e) {
+          echo "ouch! ".$e->getMessage()."\n";
+          return array();
+        }
     }
-  
+
     public function docsQos3ParamSetMaxTrafficRate() {
-      
+
       	try{
-	    
+
           $rtr = array();
 
           $oid = self::OID_docsQos3ParamSetMaxTrafficRate;
 
           foreach($this->getSNMP()->realWalk($oid) as $k => $v){
             $k_prim = preg_split("|\.|",$k);
-            $rtr[$k_prim[15].$k_prim[17]] = $this->getSNMP()->parseSnmpValue($v);
+            if ($k_prim[16] == 1) { // solo activos
+                $rtr[$k_prim[15].$k_prim[17]] = $this->getSNMP()->parseSnmpValue($v);
+            }
           }
 
           return $rtr;
 
-        } catch (\Exception $e) { 
+        } catch (\Exception $e) {
           echo "ouch! ".$e->getMessage()."\n";
           return array();
         }
     }
-  
+
     public function docsIfUpChannelWidth(){
 		return $this->getSNMP()->walk1d(self::OID_docsIfUpChannelWidth);
     }
@@ -105,7 +126,7 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
 	$rtr = array();
         foreach($this->getSNMP()->realWalk(self::OID_ipNetToMediaPhysAddress) as $k => $m){
 ////tring(40) ".1.3.6.1.2.1.4.22.1.2.2000001.10.14.8.69"
-//string(23) "STRING: 0:c:e5:7d:93:d0"                  
+//string(23) "STRING: 0:c:e5:7d:93:d0"
 ////
 		$karray = preg_split("|\.|",$k);
 		$mac = preg_split("|:|", trim(substr($m,8)));
@@ -193,7 +214,7 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
 		$rtr[$k_prim[15].".".$k_prim[16]] = $this->getSNMP()->parseSnmpValue($v);
 	    }
 	    return $rtr;
-	}catch (\Exception $e){ 
+	}catch (\Exception $e){
 	    echo "ouch! ".$e->getMessage()."\n";
 	    return array();
 	}
@@ -262,7 +283,7 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
 		$oid = self::OID_docsQosServiceFlowOctets ."." .$ifId;
         }else{
 		$oid = self::OID_docsQosServiceFlowOctets;
-        }	
+        }
 	$rtr = array();
 	$stats = $this->getSNMP()->realWalk($oid);
 	if(!is_array($stats)){
@@ -313,22 +334,22 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
     }
 
 
-    public function docsIfCmtsCmStatusValue(){	
+    public function docsIfCmtsCmStatusValue(){
 
         $rtr = $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusValue);
         $replace = array(1 => 'other' , 2 =>  'ranging', 3 => 'rangingAborted', 4 => 'rangingComplete', 5 => 'ipComplete',
                         6 => 'registrationComplete', 7 => 'accessDenied');
         foreach($rtr as $k => $v){ if(isset($replace[$v])) {$rtr[$k] = $replace[$v];} }
 	return $rtr;
-        
+
     }
 
     public function docsIfCmtsCmStatusRxPower(){
 	$rtr = $this->getSNMP()->walk1d(self::OID_docsIfCmtsCmStatusRxPower);
 	return $rtr;
     }
-  
-    public function docsIfCmStatusRxPower(){ 
+
+    public function docsIfCmStatusRxPower(){
 	$rtr = $this->getSNMP()->walk1d(self::OID_docsIfCmStatusRxPower);
 	return $rtr;
     }
@@ -357,7 +378,7 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
 		return $this->getSNMP()->walk1d(self::OID_docsIfSigQMicroreflections);
 	}
     }
-    
+
     public function docsIfCmtsChannelUtilization(){
 	return $this->getSNMP()->realWalk(self::docsIfCmtsChannelUtilization);
     }
@@ -389,9 +410,9 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
                 'docsIfCmtsCmStatusSignalNoise' => 'docsIfCmtsCmStatusSignalNoise',
                 'docsIfCmtsCmStatusMicroreflections' => 'docsIfCmtsCmStatusMicroreflections',
                 'docsIfCmtsCmStatusDocsisRegMode' => 'docsIfCmtsCmStatusDocsisRegMode',
-                'docsIfCmtsCmStatusModulationType' => 'docsIfCmtsCmStatusModulationType',  
+                'docsIfCmtsCmStatusModulationType' => 'docsIfCmtsCmStatusModulationType',
 	);
-	
+
 	foreach($mibs as $k=> $m){
 		$m .= ".".$index;
 		$rta = $this->getSNMP()->realWalk($m);
@@ -403,7 +424,7 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
 	}
 	return $rtr;
     }
-    
+
     public function docsIfCmtsCmStatusSignalNoise(){
 	$rtr = array();
 	$data = $this->getSNMP()->realWalk(self::OID_docsIfCmtsCmStatusSignalNoise);
@@ -413,7 +434,7 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
 	}
 	return $rtr;
     }
-    
+
     public function docsQos3ServiceFlowTimeActive($ifId = null) {
         try {
             $rtr = array();
@@ -455,44 +476,44 @@ accessDenied(7)   The CMTS has sent a Registration Aborted message   to the CM
         }
         return $rtr;
     }
-    
+
     public function docsQosServiceFlowOctetsRealValues($ifId=null){
         try{
-            
+
             if(!is_null($ifId)){
                 $oid = self::OID_docsQosServiceFlowOctets ."." .$ifId;
             }else{
                 $oid = self::OID_docsQosServiceFlowOctets;
-            }	
-            
+            }
+
             $stats = $this->getSNMP()->realWalk($oid);
-            
+
             if(!is_array($stats)){return array();}
 
             return $stats;
-            
-        }catch (\Exception $e){ 
+
+        }catch (\Exception $e){
 	    echo "ouch! ".$e->getMessage()."\n";
 	    return array();
 	}
     }
-    
+
     public function docsQos3ServiceFlowOctetsRealValues($ifId=null){
 	try{
-            
+
 	    if(!is_null($ifId)){
 		$oid = self::OID_docsQos3ServiceFlowOctets ."." .$ifId;
 	    }else{
 		$oid = self::OID_docsQos3ServiceFlowOctets;
             }
-            
+
             $stats = $this->getSNMP()->realWalk($oid);
-            
+
             if(!is_array($stats)){return array();}
 
             return $stats;
 
-        }catch (\Exception $e){ 
+        }catch (\Exception $e){
 	    echo "ouch! ".$e->getMessage()."\n";
 	    return array();
 	}