OIDSHuaweiV1.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. namespace HuaweiBundle\SNMP\MIBS;
  3. // https://ixnfo.com/oid-i-mib-dlya-huawei-olt-i-onu.html
  4. // https://translate.google.com/translate?hl=en&sl=auto&tl=en&u=https%3A%2F%2Fixnfo.com%2Foid-i-mib-dlya-huawei-olt-i-onu.html
  5. // https://github.com/chinnurtb/xiaoli/tree/master/node/monitd/include/mib
  6. class OIDSHuaweiV1 extends \HuaweiBundle\SNMP\MIB {
  7. const OID_authOnuListSlot = "1.3.6.1.4.1.5875.800.3.10.1.1.2";
  8. const OID_authOnuListPon = "1.3.6.1.4.1.5875.800.3.10.1.1.3";
  9. const OID_authOnuListOnuid = "1.3.6.1.4.1.5875.800.3.10.1.1.4";
  10. const OID_authOnuListMac = "1.3.6.1.4.1.2011.6.128.1.1.2.43.1.3";
  11. const OID_onuPonRxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.4";
  12. const OID_onuPonTxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.3";
  13. const OID_onuPonOpticalVltage = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.5";
  14. const OID_onuPonOpticalTemperature = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.1";
  15. const OID_onuPonOpticalCurrent = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.2";
  16. const OID_onuCatvRxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.7";
  17. const OID_onuStatus = "1.3.6.1.4.1.5875.800.3.10.1.1.11";
  18. const OID_oltPonDesc = "1.3.6.1.2.1.31.1.1.1.1";
  19. const OID_oltPonEnableStatus = "1.3.6.1.4.1.5875.800.3.9.3.4.1.4";
  20. const OID_oltPonRxOpticalPower = "1.3.6.1.4.1.2011.6.128.1.1.2.51.1.6";
  21. const OID_oltPonTxOpticalPower = "1.3.6.1.4.1.5875.800.3.9.3.4.1.8";
  22. const OID_oltPonOpticalVltage = "1.3.6.1.4.1.5875.800.3.9.3.4.1.9";
  23. const OID_oltPonOpticalCurrent = "1.3.6.1.4.1.5875.800.3.9.3.4.1.10";
  24. const OID_oltPonOpticalTemperature = "1.3.6.1.4.1.5875.800.3.9.3.4.1.11";
  25. //Genericos
  26. const OID_ifHCInOctets = "1.3.6.1.2.1.31.1.1.1.6";
  27. const OID_ifHCOutOctets = "1.3.6.1.2.1.31.1.1.1.10";
  28. const OID_ifInOctets = "1.3.6.1.2.1.2.2.1.10";
  29. const OID_ifOutOctets = "1.3.6.1.2.1.2.2.1.16";
  30. const OID_ifDescr = "1.3.6.1.2.1.2.2.1.2";
  31. function convertIndex($index, $values) {
  32. $data = array();
  33. foreach($values as $i => $v) {
  34. if(isset($index[$i])) {
  35. $data[$index[$i]] = $v;
  36. }
  37. }
  38. if(!empty($index)) return $data;
  39. return $values;
  40. }
  41. public function onuSlot() {
  42. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListSlot,14);
  43. }
  44. public function onuPon() {
  45. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListPon,14);
  46. }
  47. public function onuOnuid() {
  48. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListOnuid,14);
  49. }
  50. public function onuSerialNumber($index = null) {
  51. if(is_null($index)) {
  52. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListMac,16);
  53. }
  54. $values = $this->getSNMP()->lastOidWalk(self::OID_authOnuListMac,16);
  55. return $this->convertIndex($index, $values);
  56. }
  57. public function onuCatvRxOpticalPower($index = null) {
  58. if(is_null($index)) {
  59. return $this->getSNMP()->lastOidWalk(self::OID_onuCatvRxOpticalPower,16);
  60. }
  61. $values = $this->getSNMP()->lastOidWalk(self::OID_onuCatvRxOpticalPower,16);
  62. return $this->convertIndex($index, $values);
  63. }
  64. public function onuPonRxOpticalPower($index = null) {
  65. if(is_null($index)) {
  66. return $this->getSNMP()->lastOidWalk(self::OID_onuPonRxOpticalPower,16);
  67. }
  68. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonRxOpticalPower,16);
  69. return $this->convertIndex($index, $values);
  70. }
  71. public function onuPonTxOpticalPower($index = null) {
  72. if(is_null($index)) {
  73. return $this->getSNMP()->lastOidWalk(self::OID_onuPonTxOpticalPower,16);
  74. }
  75. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonTxOpticalPower,16);
  76. return $this->convertIndex($index, $values);
  77. }
  78. public function onuPonOpticalVltage($index = null) {
  79. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonOpticalVltage,16);
  80. return $this->convertIndex($index, $values);
  81. }
  82. public function onuPonOpticalTemperature($index = null) {
  83. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonOpticalTemperature,16);
  84. return $this->convertIndex($index, $values);
  85. }
  86. public function onuStatus($index = null) {
  87. $values = $this->getSNMP()->lastOidWalk(self::OID_onuStatus,14);
  88. return $this->convertIndex($index, $values);
  89. }
  90. /* OLT PON */
  91. public function oltPonDesc($index = null) {
  92. return $this->getSNMP()->lastOidWalk(self::OID_oltPonDesc,12);
  93. }
  94. public function oltPonEnableStatus($index = null) {
  95. return $this->getSNMP()->lastOidWalk(self::OID_oltPonEnableStatus,15);
  96. // return $this->convertIndex($index, $values);
  97. }
  98. public function oltPonRxOpticalPower($index = null) {
  99. return $this->getSNMP()->lastOidWalk(self::OID_oltPonRxOpticalPower,15);
  100. // return $this->convertIndex($index, $values);
  101. }
  102. public function oltPonTxOpticalPower($index = null) {
  103. return $this->getSNMP()->lastOidWalk(self::OID_oltPonTxOpticalPower,15);
  104. // return $this->convertIndex($index, $values);
  105. }
  106. public function oltPonOpticalVltage($index = null) {
  107. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalVltage,15);
  108. // return $this->convertIndex($index, $values);
  109. }
  110. public function oltPonOpticalCurrent($index = null) {
  111. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalCurrent,15);
  112. // return $this->convertIndex($index, $values);
  113. }
  114. public function oltPonOpticalTemperature($index = null) {
  115. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalTemperature,15);
  116. // return $this->convertIndex($index, $values);
  117. }
  118. public function ifInOctets() {
  119. return $this->getSNMP()->lastOidWalk(self::OID_ifInOctets,11);
  120. }
  121. public function ifOutOctets() {
  122. return $this->getSNMP()->lastOidWalk(self::OID_ifOutOctets,11);
  123. }
  124. public function ifHCInOctets() {
  125. return $this->getSNMP()->lastOidWalk(self::OID_ifHCInOctets,12);
  126. }
  127. public function ifHCOutOctets() {
  128. return $this->getSNMP()->lastOidWalk(self::OID_ifHCOutOctets,12);
  129. }
  130. public function ifDescr() {
  131. return $this->getSNMP()->lastOidWalk(self::OID_ifDescr,11);
  132. }
  133. }