OIDSHuaweiV1.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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.5875.800.3.9.3.3.1.6";
  12. const OID_onuPonTxOpticalPower = "1.3.6.1.4.1.5875.800.3.9.3.3.1.7";
  13. const OID_onuPonOpticalVltage = "1.3.6.1.4.1.5875.800.3.9.3.3.1.8";
  14. const OID_onuPonOpticalTemperature = "1.3.6.1.4.1.5875.800.3.9.3.3.1.10";
  15. const OID_onuStatus = "1.3.6.1.4.1.5875.800.3.10.1.1.11";
  16. const OID_oltPonDesc = "1.3.6.1.2.1.31.1.1.1.1";
  17. const OID_oltPonEnableStatus = "1.3.6.1.4.1.5875.800.3.9.3.4.1.4";
  18. const OID_oltPonRxOpticalPower = "1.3.6.1.4.1.5875.800.3.9.3.7.1.2";
  19. const OID_oltPonTxOpticalPower = "1.3.6.1.4.1.5875.800.3.9.3.4.1.8";
  20. const OID_oltPonOpticalVltage = "1.3.6.1.4.1.5875.800.3.9.3.4.1.9";
  21. const OID_oltPonOpticalCurrent = "1.3.6.1.4.1.5875.800.3.9.3.4.1.10";
  22. const OID_oltPonOpticalTemperature = "1.3.6.1.4.1.5875.800.3.9.3.4.1.11";
  23. //Genericos
  24. const OID_ifHCInOctets = "1.3.6.1.2.1.31.1.1.1.6";
  25. const OID_ifHCOutOctets = "1.3.6.1.2.1.31.1.1.1.10";
  26. const OID_ifInOctets = "1.3.6.1.2.1.2.2.1.10";
  27. const OID_ifOutOctets = "1.3.6.1.2.1.2.2.1.16";
  28. const OID_ifDescr = "1.3.6.1.2.1.2.2.1.2";
  29. function convertIndex($index, $values) {
  30. $data = array();
  31. foreach($values as $i => $v) {
  32. if(isset($index[$i])) {
  33. $data[$index[$i]] = $v;
  34. }
  35. }
  36. if(!empty($index)) return $data;
  37. return $values;
  38. }
  39. public function onuSlot() {
  40. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListSlot,14);
  41. }
  42. public function onuPon() {
  43. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListPon,14);
  44. }
  45. public function onuOnuid() {
  46. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListOnuid,14);
  47. }
  48. public function onuSerialNumber($index = null) {
  49. if(is_null($index)) {
  50. return $this->getSNMP()->lastOidWalk(self::OID_authOnuListMac,16);
  51. }
  52. $values = $this->getSNMP()->lastOidWalk(self::OID_authOnuListMac,14);
  53. return $this->convertIndex($index, $values);
  54. }
  55. public function onuPonRxOpticalPower($index = null) {
  56. if(is_null($index)) {
  57. return $this->getSNMP()->lastOidWalk(self::OID_onuPonRxOpticalPower,15);
  58. }
  59. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonRxOpticalPower,15);
  60. return $this->convertIndex($index, $values);
  61. }
  62. public function onuPonTxOpticalPower($index = null) {
  63. if(is_null($index)) {
  64. return $this->getSNMP()->lastOidWalk(self::OID_onuPonTxOpticalPower,15);
  65. }
  66. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonTxOpticalPower,15);
  67. return $this->convertIndex($index, $values);
  68. }
  69. public function onuPonOpticalVltage($index = null) {
  70. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonOpticalVltage,15);
  71. return $this->convertIndex($index, $values);
  72. }
  73. public function onuPonOpticalTemperature($index = null) {
  74. $values = $this->getSNMP()->lastOidWalk(self::OID_onuPonOpticalTemperature,15);
  75. return $this->convertIndex($index, $values);
  76. }
  77. public function onuStatus($index = null) {
  78. $values = $this->getSNMP()->lastOidWalk(self::OID_onuStatus,14);
  79. return $this->convertIndex($index, $values);
  80. }
  81. /* OLT PON */
  82. public function oltPonDesc($index = null) {
  83. return $this->getSNMP()->lastOidWalk(self::OID_oltPonDesc,12);
  84. }
  85. public function oltPonEnableStatus($index = null) {
  86. return $this->getSNMP()->lastOidWalk(self::OID_oltPonEnableStatus,15);
  87. // return $this->convertIndex($index, $values);
  88. }
  89. public function oltPonRxOpticalPower($index = null) {
  90. return $this->getSNMP()->lastOidWalk(self::OID_oltPonRxOpticalPower,15);
  91. // return $this->convertIndex($index, $values);
  92. }
  93. public function oltPonTxOpticalPower($index = null) {
  94. return $this->getSNMP()->lastOidWalk(self::OID_oltPonTxOpticalPower,15);
  95. // return $this->convertIndex($index, $values);
  96. }
  97. public function oltPonOpticalVltage($index = null) {
  98. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalVltage,15);
  99. // return $this->convertIndex($index, $values);
  100. }
  101. public function oltPonOpticalCurrent($index = null) {
  102. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalCurrent,15);
  103. // return $this->convertIndex($index, $values);
  104. }
  105. public function oltPonOpticalTemperature($index = null) {
  106. return $this->getSNMP()->lastOidWalk(self::OID_oltPonOpticalTemperature,15);
  107. // return $this->convertIndex($index, $values);
  108. }
  109. public function ifInOctets() {
  110. return $this->getSNMP()->lastOidWalk(self::OID_ifInOctets,11);
  111. }
  112. public function ifOutOctets() {
  113. return $this->getSNMP()->lastOidWalk(self::OID_ifOutOctets,11);
  114. }
  115. public function ifHCInOctets() {
  116. return $this->getSNMP()->lastOidWalk(self::OID_ifHCInOctets,12);
  117. }
  118. public function ifHCOutOctets() {
  119. return $this->getSNMP()->lastOidWalk(self::OID_ifHCOutOctets,12);
  120. }
  121. public function ifDescr() {
  122. return $this->getSNMP()->lastOidWalk(self::OID_ifDescr,11);
  123. }
  124. }