|
@@ -10,14 +10,14 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
|
|
|
const OID_docsIfCmtsCmStatusDownChannelIfIndex = "1.3.6.1.2.1.10.127.1.3.3.1.4";
|
|
|
const OID_docsIfCmtsCmStatusIpAddress = "1.3.6.1.2.1.10.127.1.3.3.1.3";
|
|
|
const OID_docsQosCmtsIfIndex = "1.3.6.1.2.1.10.127.7.1.11.1.3";
|
|
|
+ const OID_docsQos3CmtsIfIndex = "1.3.6.1.4.1.4491.2.1.21.1.11.1.3";
|
|
|
const OID_docsIfCmtsCmStatusIndex = "1.3.6.1.2.1.10.127.1.3.3.1.1";
|
|
|
const OID_docsQosServiceFlowOctets = "1.3.6.1.2.1.10.127.7.1.4.1.2";
|
|
|
const OID_docsQosServiceFlowDirection = "1.3.6.1.2.1.10.127.7.1.3.1.7";
|
|
|
+ const OID_docsQos3ServiceFlowDirection = "1.3.6.1.4.1.4491.2.1.21.1.3.1.7";
|
|
|
const OID_docsIfCmtsCmStatusRxPower = "1.3.6.1.2.1.10.127.1.3.3.1.6";
|
|
|
const OID_docsIfCmtsCmStatusValue = "1.3.6.1.2.1.10.127.1.3.3.1.9";
|
|
|
- const OID_docsQos3CmtsIfIndex = "1.3.6.1.4.1.4491.2.1.21.1.11.1.3";
|
|
|
const OID_docsQos3ServiceFlowOctets = "1.3.6.1.4.1.4491.2.1.21.1.4.1.2";
|
|
|
- const OID_docsQos3ServiceFlowDirection = "1.3.6.1.4.1.4491.2.1.21.1.3.1.7";
|
|
|
const OID_docsIfSigQSignalNoise = "1.3.6.1.2.1.10.127.1.1.4.1.5";
|
|
|
const OID_docsIfSigQMicroreflections = "1.3.6.1.2.1.10.127.1.1.4.1.6";
|
|
|
const docsIfCmtsChannelUtilization = "1.3.6.1.2.1.10.127.1.3.9.1.3";
|
|
@@ -27,10 +27,9 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
|
|
|
|
|
|
public function docsIfCmtsCmPtr(){
|
|
|
$ptr = array();
|
|
|
- $ptr2 = $this->docsIfCmtsCmStatusIpAddress();
|
|
|
foreach($this->getSNMP()->realWalk(self::OID_docsIfCmtsCmPtr) as $key => $val){
|
|
|
$mac =implode('',array_map(function($x) { return sprintf("%02x", $x);}, array_slice(explode(".",$key),14,6)));
|
|
|
- $ptr[$mac] = $ptr2[$this->getSNMP()->parseSnmpValue($val)];
|
|
|
+ $ptr[$mac] = $this->getSNMP()->parseSnmpValue($val);
|
|
|
}
|
|
|
return $ptr;
|
|
|
}
|
|
@@ -50,25 +49,38 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
|
|
|
return $rtr;
|
|
|
}
|
|
|
|
|
|
- public function docsQos3ServiceFlowDirection(){
|
|
|
- try{
|
|
|
- $rtr = array();
|
|
|
- foreach((array)$this->getSNMP()->realWalk(self::OID_docsQos3ServiceFlowDirection) as $k => $v){
|
|
|
- $k_prim = preg_split("|\.|",$k);
|
|
|
- if(!isset($k_prim[15])) break;
|
|
|
- $rtr[$k_prim[15].".".$k_prim[16]] = $this->getSNMP()->parseSnmpValue($v);
|
|
|
+ public function docsQos3ServiceFlowDirection($translate=false){
|
|
|
+ $rtr = array();
|
|
|
+ $oid = self::OID_docsQos3ServiceFlowDirection;
|
|
|
+ $stats = $this->getSNMP()->realWalk($oid);
|
|
|
+ foreach((array)$stats as $k => $v){
|
|
|
+ $k_prim = preg_split("|\.|",$k);
|
|
|
+ //$dds = strpos($v, ':');
|
|
|
+ if(!isset($k_prim[15])){
|
|
|
+ break;
|
|
|
}
|
|
|
- return $rtr;
|
|
|
-
|
|
|
- }catch (\Exception $e){
|
|
|
- echo "ouch!".$e->getMessage()."\n";
|
|
|
- return array();
|
|
|
+ $rtr[$k_prim[15].".".$k_prim[16]] = $this->getSNMP()->parseSnmpValue($v);
|
|
|
}
|
|
|
+ if( !$translate )
|
|
|
+ return $rtr;
|
|
|
+
|
|
|
+ return $this->getSNMP()->translate( $rtr, self::$FLOW_DIRECTIONS);
|
|
|
}
|
|
|
|
|
|
- public function docsQos3CmtsIfIndex(){
|
|
|
+ private function getDecMac($mac){
|
|
|
+ preg_match('/^([a-f0-9]{1,2})[-:]*([a-f0-9]{1,2})[-:]*([a-f0-9]{1,2})[-:]*([a-f0-9]{1,2})[-:]*([a-f0-9]{1,2})[-:]*([a-f0-9]{1,2})$/i', $mac, $matches);
|
|
|
+ unset($matches[0]);
|
|
|
+ return implode('.', array_map('hex2dec', $matches));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function docsQos3CmtsIfIndex($mac=null){
|
|
|
try{
|
|
|
$rtr = array();
|
|
|
+ if(!is_null($mac)){
|
|
|
+ $oid = self::OID_docsQosCmtsIfIndex .'.'.$this->getDecMac($mac);
|
|
|
+ }else{
|
|
|
+ $oid = self::OID_docsQosCmtsIfIndex;
|
|
|
+ }
|
|
|
foreach($this->getSNMP()->realWalk(self::OID_docsQos3CmtsIfIndex) as $k => $v){
|
|
|
$k_prim = preg_split("|\.|",$k);
|
|
|
$k_mac = sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
|
|
@@ -96,14 +108,27 @@ class DocsIfCmts extends \OSS_SNMP\MIB {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function docsQosServiceFlowDirection(){
|
|
|
- return $this->getSNMP()->walk1d(self::OID_docsQosServiceFlowDirection);
|
|
|
+ public static $FLOW_DIRECTIONS = array(1 => "downstream", 2 => 'upstream');
|
|
|
+
|
|
|
+ public function docsQosServiceFlowDirection($translate=false){
|
|
|
+ $oid = self::OID_docsQosServiceFlowDirection;
|
|
|
+ $states = $this->getSNMP()->walk1d($oid);
|
|
|
+ $rtr = array();
|
|
|
+ if( !$translate )
|
|
|
+ return $states;
|
|
|
+
|
|
|
+ return $this->getSNMP()->translate( $states, self::$FLOW_DIRECTIONS);
|
|
|
}
|
|
|
|
|
|
- public function docsQosCmtsIfIndex(){
|
|
|
+ public function docsQosCmtsIfIndex($mac=null){
|
|
|
try{
|
|
|
$rtr = array();
|
|
|
- foreach($this->getSNMP()->realWalk(self::OID_docsQosCmtsIfIndex) as $k => $v){
|
|
|
+ if(!is_null($mac)){
|
|
|
+ $oid = self::OID_docsQosCmtsIfIndex .'.'.$this->getDecMac($mac);
|
|
|
+ }else{
|
|
|
+ $oid = self::OID_docsQosCmtsIfIndex;
|
|
|
+ }
|
|
|
+ foreach($this->getSNMP()->realWalk($oid) as $k => $v){
|
|
|
$k_prim = preg_split("|\.|",$k);
|
|
|
$k_mac = sprintf("%02x:%02x:%02x:%02x:%02x:%02x",
|
|
|
$k_prim[14], $k_prim[15], $k_prim[16], $k_prim[17], $k_prim[18], $k_prim[19]);
|
|
@@ -184,4 +209,31 @@ accessDenied(7) The CMTS has sent a Registration Aborted message to the CM
|
|
|
public function docsIfCmtsChannelUtilization(){
|
|
|
return $this->getSNMP()->realWalk(self::docsIfCmtsChannelUtilization);
|
|
|
}
|
|
|
+
|
|
|
+ public function getCmStatus($index){
|
|
|
+ $mibs = array(
|
|
|
+ 'docsIfCmtsCmStatusMacAddress' => 'docsIfCmtsCmStatusMacAddress',
|
|
|
+ 'docsIfCmtsCmStatusIpAddress' => 'docsIfCmtsCmStatusIpAddress',
|
|
|
+ 'docsIfCmtsCmStatusDownChannelIfIndex' => 'docsIfCmtsCmStatusDownChannelIfIndex',
|
|
|
+ 'docsIfCmtsCmStatusUpChannelIfIndex' => 'docsIfCmtsCmStatusUpChannelIfIndex',
|
|
|
+ 'docsIfCmtsCmStatusRxPower' => 'docsIfCmtsCmStatusRxPower',
|
|
|
+ 'docsIfCmtsCmStatusValue' => 'docsIfCmtsCmStatusValue',
|
|
|
+ 'docsIfCmtsCmStatusUnerroreds' => 'docsIfCmtsCmStatusUnerroreds',
|
|
|
+ 'docsIfCmtsCmStatusCorrecteds' => 'docsIfCmtsCmStatusCorrecteds',
|
|
|
+ 'docsIfCmtsCmStatusUncorrectables' => 'docsIfCmtsCmStatusUncorrectables',
|
|
|
+ 'docsIfCmtsCmStatusSignalNoise' => 'docsIfCmtsCmStatusSignalNoise',
|
|
|
+ 'docsIfCmtsCmStatusMicroreflections' => 'docsIfCmtsCmStatusMicroreflections',
|
|
|
+ 'docsIfCmtsCmStatusDocsisRegMode' => 'docsIfCmtsCmStatusDocsisRegMode',
|
|
|
+ 'docsIfCmtsCmStatusModulationType' => 'docsIfCmtsCmStatusModulationType',
|
|
|
+ );
|
|
|
+
|
|
|
+ foreach($mibs as $k=> $m){
|
|
|
+ $m .= ".".$index;
|
|
|
+ $v = current($this->getSNMP()->realWalk($m));
|
|
|
+ $dds = strpos($v, ':');
|
|
|
+ $v = substr($v, $dds+2);
|
|
|
+ $rtr[$k] = $v;
|
|
|
+ }
|
|
|
+ return $rtr;
|
|
|
+ }
|
|
|
}
|