-
Всього повідомлень
158 -
Приєднався
-
Останній візит
-
Дней в лидерах
1
Тип контенту
Профили
Форум
Календарь
Все, що було написано dnserg
-
Подключение абонентов ПОН. Срочно.
тема ответил в dnserg пользователя dnserg в Вакансії. Робота. Курси.
Ап. Вопросы в личку.- 2 ответа
-
- pon
- частный сетор
-
(та 1 ще)
Теги:
-
Нужно две бригады чтобы быстро включить около 100 абонентов ПОН в ЧС. Локация - Запорожская область. Васильевский район.
- 2 ответа
-
- pon
- частный сетор
-
(та 1 ще)
Теги:
-
<?php namespace App; use App\Jobs\OLTAddServicePort; use DivineOmega\SSHConnection\SSHConnection; use Mockery\Exception; use SNMP; class HuaweilOLT { const GPON_ONU_QTY_IN_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.21.1.16'; const EPON_ONU_QTY_IN_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.31.1.12'; const GPON_OPTICS_TX_POWER_IN_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.23.1.4'; const EPON_OPTICS_TX_POWER_IN_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.33.1.4'; const GPON_ONT_UNREGISTERED = '1.3.6.1.4.1.2011.6.128.1.1.2.48.1.2'; const EPON_ONT_UNREGISTERED = '1.3.6.1.4.1.2011.6.128.1.1.2.58.1.2'; const GPON_ONT_REGISTERED_IN_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.43.1.3.%s'; const EPON_ONT_REGISTERED_IN_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.53.1.3.%s'; const GPON_ONT_DESCRIPTION = '1.3.6.1.4.1.2011.6.128.1.1.2.43.1.9.%s.%s'; const EPON_ONT_DESCRIPTION = '1.3.6.1.4.1.2011.6.128.1.1.2.53.1.9.%s.%s'; const GPON_ONT_DESCRIPTION_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.43.1.9.%s'; const EPON_ONT_DESCRIPTION_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.53.1.9.%s'; const GPON_ONT_SIGNALS_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.51.1.4.%s'; const ONT_SIGNALS_INTERFACE = '1.3.6.1.4.1.2011.6.128.1.1.2.104.1.5.%s'; const ONT_CONFIGURED_STRING = 'configured'; const GPON_ONT_STATUS = '1.3.6.1.4.1.2011.6.128.1.1.2.46.1.15.%s.%s'; // 1 - online , 2 - offline const ONT_STATUS = '1.3.6.1.4.1.2011.6.128.1.1.2.57.1.15.%s.%s'; // 1 - online , 2 - offline const GPON_ONT_SIGNAL = '1.3.6.1.4.1.2011.6.128.1.1.2.51.1.4.%s.%s'; const ONT_SIGNAL = '1.3.6.1.4.1.2011.6.128.1.1.2.104.1.5.%s.%s'; const GPON_ONT_DISTANCE = '1.3.6.1.4.1.2011.6.128.1.1.2.46.1.20.%s.%s'; const ONT_DISTANCE = '1.3.6.1.4.1.2011.6.128.1.1.2.57.1.19.%s.%s'; const GPON_ONT_DOWN_CAUSE = '1.3.6.1.4.1.2011.6.128.1.1.2.46.1.24.%s.%s'; // 13 - power , 2 - оптика const ONT_DOWN_CAUSE = '1.3.6.1.4.1.2011.6.128.1.1.2.57.1.25.%s.%s'; // 13 - power , 2 - оптика const GPON_ONT_SOFT_VERSION = '1.3.6.1.4.1.2011.6.128.1.1.2.45.1.1.%s.%s'; const ONT_SOFT_VERSION = '1.3.6.1.4.1.2011.6.128.1.1.2.55.1.5.%s.%s'; /* @var $snmpSession SNMP */ private $snmpSession; /* @var $sshSession SSHConnection */ // private $sshSession; /* @var $sshSession PHPTelnet */ private $telnetSession; /* @var $telnetLog string[] */ private $telnetLog; public function __construct() { $snmpSession = new \SNMP(\SNMP::VERSION_2c, '192.168.101.18', 'comunity'); $snmpSession->oid_increasing_check = FALSE; $this->snmpSession = $snmpSession; } private function getSnmpValue($oid) { $parts = explode(': ', $this->snmpSession->get($oid)); if (strpos($parts[0], 'Hex-STRING') === 0) { return hex2bin(trim(str_replace(' ', '', str_replace('00', '', $parts[1])))); } return trim($parts[1]); } public function getOntDataByInterfaceOntId($ifIndex, $ontId) { $interface = $this->decode_ifIndex($ifIndex); switch ($interface['type']) { case 'epon': $oidStatus = vsprintf(self::ONT_STATUS, [$ifIndex, $ontId]); $oidSignal = vsprintf(self::ONT_SIGNAL, [$ifIndex, $ontId]); $oidDistance = vsprintf(self::ONT_DISTANCE, [$ifIndex, $ontId]); $oidDownCause = vsprintf(self::ONT_DOWN_CAUSE, [$ifIndex, $ontId]); $oidSoftVersion = vsprintf(self::ONT_SOFT_VERSION, [$ifIndex, $ontId]); $ifaceUrl = route('eponPort', ['ifIndex' => $ifIndex]); break; case 'gpon': $oidStatus = vsprintf(self::GPON_ONT_STATUS, [$ifIndex, $ontId]); $oidSignal = vsprintf(self::GPON_ONT_SIGNAL, [$ifIndex, $ontId]); $oidDistance = vsprintf(self::GPON_ONT_DISTANCE, [$ifIndex, $ontId]); $oidDownCause = vsprintf(self::GPON_ONT_DOWN_CAUSE, [$ifIndex, $ontId]); $oidSoftVersion = vsprintf(self::GPON_ONT_SOFT_VERSION, [$ifIndex, $ontId]); $ifaceUrl = route('gponPort', ['ifIndex' => $ifIndex]); break; } return [ 'ifaceUrl' => $ifaceUrl, 'status' => $this->getSnmpValue($oidStatus), 'softVersion' => $this->getSnmpValue($oidSoftVersion), 'signal' => $this->getSnmpValue($oidSignal), 'distance' => $this->getSnmpValue($oidDistance), 'downCause' => $this->getSnmpValue($oidDownCause), 'interface' => "{$interface['type']} {$interface['shelf']}/{$interface['slot']}/{$interface['port']} {$ontId}", ]; } public function getONTsQuantityInInterfaces($type = 'epon') { $result = []; switch ($type) { case 'epon': $oid = self::EPON_ONU_QTY_IN_INTERFACE; break; case 'gpon': $oid = self::GPON_ONU_QTY_IN_INTERFACE; break; } try { $response = $this->snmpSession->walk($oid); if (is_array($response)) { foreach ($response as $key=>$value) { preg_match('/.([\d]+)$/', $key, $portRegexpResult); $result[$portRegexpResult[1]] = (int)(str_replace('INTEGER: ', '', trim($value))); } } } catch (\Exception $e) {} return $result; } public function getPONTxPowerInInterfaces($type = 'epon') { $result = []; switch ($type) { case 'epon': $oid = self::EPON_OPTICS_TX_POWER_IN_INTERFACE; break; case 'gpon': $oid = self::GPON_OPTICS_TX_POWER_IN_INTERFACE; break; } try { $response = $this->snmpSession->walk($oid); if (is_array($response)) { foreach ($response as $key=>$value) { preg_match('/.([\d]+)$/', $key, $portRegexpResult); $result[$portRegexpResult[1]] = (int)(str_replace('INTEGER: ', '', trim($value)))/100; } } } catch (\Exception $e) {} return $result; } public function getUnregisteredOnts() { $result = []; try { $response_epon = $this->snmpSession->walk(self::EPON_ONT_UNREGISTERED); if (is_array($response_epon)) { foreach ($response_epon as $key=>$value) { preg_match('/.([\d]+).([\d]+)$/', $key, $portRegexpResult); $result[$portRegexpResult[1]][$portRegexpResult[2]] = str_replace(' ', ':', str_replace('Hex-STRING: ', '', trim($value))); } } } catch (\Exception $e) {} try { $response_gpon = $this->snmpSession->walk(self::GPON_ONT_UNREGISTERED); if (is_array($response_gpon)) { foreach ($response_gpon as $key=>$value) { preg_match('/.([\d]+).([\d]+)$/', $key, $portRegexpResult); $result[$portRegexpResult[1]][$portRegexpResult[2]] = str_replace(' ', '', str_replace('Hex-STRING: ', '', trim($value))); } } } catch (\Exception $e) {} return $result; } public function getOntsSignalsInInterface($ifIndex) { $interface = $this->decode_ifIndex($ifIndex); $result = []; switch ($interface['type']) { case 'epon': $oid = vsprintf(self::ONT_SIGNALS_INTERFACE, [$ifIndex]); break; case 'gpon': $oid = vsprintf(self::GPON_ONT_SIGNALS_INTERFACE, [$ifIndex]); break; } try { $response = $this->snmpSession->walk($oid); if (is_array($response)) { foreach ($response as $key=>$value) { preg_match('/.([\d]+)$/', $key, $portRegexpResult); $result[$portRegexpResult[1]] = (int)(str_replace('INTEGER: ', '', trim($value)))/100; } } } catch (\Exception $e) {} return $result; } public function getRegisteredOntsInInterface($ifIndex) { $interface = $this->decode_ifIndex($ifIndex); $result = []; switch ($interface['type']) { case 'epon': $oid = vsprintf(self::EPON_ONT_REGISTERED_IN_INTERFACE, [$ifIndex]); try { $response = $this->snmpSession->walk($oid); if (is_array($response)) { foreach ($response as $key=>$value) { preg_match('/.([\d]+)$/', $key, $portRegexpResult); $result[$ifIndex][$portRegexpResult[1]] = strtolower(str_replace(' ', ':', str_replace('Hex-STRING: ', '', trim($value)))); } } } catch (\Exception $e) {} break; case 'gpon': $oid = vsprintf(self::GPON_ONT_REGISTERED_IN_INTERFACE, [$ifIndex]); try { $response = $this->snmpSession->walk($oid); if (is_array($response)) { foreach ($response as $key=>$value) { preg_match('/.([\d]+)$/', $key, $portRegexpResult); $result[$ifIndex][$portRegexpResult[1]] = $this->valueToSerial($value); } } } catch (\Exception $e) {} break; } return $result; } private function valueToSerial($value) { if (strpos($value, 'Hex-STRING') !== false) { return strtolower(str_replace(' ', '', str_replace('Hex-STRING: ', '', trim($value)))); } if (strpos($value, 'STRING') !== false) { return bin2hex(str_replace('"', '', str_replace('STRING: ', '', trim($value)))); } return $value; } public function confirmOntsInInterface($ifIndex) { $interface = $this->decode_ifIndex($ifIndex); $this->telnetCheckSession(); $result[] = $this->telnetSession->doCommand("config\n"); sleep(1); $result[] = $this->telnetSession->doCommand("interface {$interface['type']} {$interface['shelf']}/{$interface['slot']}\n"); sleep(1); switch ($interface['type']) { case 'epon': $result[] = $this->telnetSession->doCommand("ont confirm {$interface['port']} all mac-auth oam ont-lineprofile-name ftth ont-srvprofile-name ftth\n"); break; case 'gpon': $result[] = $this->telnetSession->doCommand("ont confirm {$interface['port']} all sn-auth omci ont-lineprofile-name ftth ont-srvprofile-name ftth\n"); break; } sleep(1); $result[] = $this->telnetSession->doCommand("\n"); sleep(1); $result[] = $this->telnetSession->doCommand("quit\n"); return $result; } public function getOntsUnconfiguredInInterface($ifIndex) { $interface = $this->decode_ifIndex($ifIndex); $result = []; switch ($interface['type']) { case 'epon': $oid = vsprintf(self::EPON_ONT_DESCRIPTION_INTERFACE, [$ifIndex]); break; case 'gpon': $oid = vsprintf(self::GPON_ONT_DESCRIPTION_INTERFACE, [$ifIndex]); break; } try { $response = $this->snmpSession->walk($oid); if (is_array($response)) { foreach ($response as $key=>$value) { preg_match('/.([\d]+)$/', $key, $ontRegexpResult); switch ($interface['type']) { case 'epon': $checkOid = "1.3.6.1.4.1.2011.6.128.1.1.2.81.1.5.{$ifIndex}.{$ontRegexpResult[1]}.1"; break; case 'gpon': $checkOid = "1.3.6.1.4.1.2011.6.128.1.1.2.62.1.7.{$ifIndex}.{$ontRegexpResult[1]}.1"; break; } $checkResult = $this->snmpSession->get($checkOid); if (!strpos($checkResult, '4094')) { $result[$ifIndex][] = $ontRegexpResult[1]; } } } } catch (\Exception $e) {} return $result; } public function createOntsServicePortsInInterface($ifIndex) { $result = []; $interface = $this->decode_ifIndex($ifIndex); $this->telnetCheckSession(); $unconfiguredOnts = $this->getOntsUnconfiguredInInterface($ifIndex); if ($unconfiguredOnts) { $result[] = $this->telnetSession->doCommand("config\n"); sleep(2); foreach ($unconfiguredOnts[$ifIndex] as $ontId) { $vlan = $interface['slot'] . ($interface['port'] > 9 ? $interface['port'] - 10 : $interface['port']); $result[] = $this->telnetSession->doCommand("service-port vlan {$vlan} port {$interface['shelf']}/{$interface['slot']}/{$interface['port']} ont {$ontId} eth 1-4 multi-service user-vlan untagged\n"); sleep(2); $result[] = $this->telnetSession->doCommand("\n"); sleep(2); switch ($interface['type']) { case 'epon': $checkOid = "1.3.6.1.4.1.2011.6.128.1.1.2.81.1.5.{$ifIndex}.{$ontId}.1"; break; case 'gpon': $checkOid = "1.3.6.1.4.1.2011.6.128.1.1.2.62.1.7.{$ifIndex}.{$ontId}.1"; break; } $checkResult = $this->snmpSession->get($checkOid); if (!strpos($checkResult, '4094')) { OLTAddServicePort::dispatch($ifIndex, $ontId); } else { $this->setOntDescriptionAsConfigured($ifIndex, $ontId); } } $result[] = $this->telnetSession->doCommand("quit\n"); } return $result; } public function createOntsServicePortsInInterfaceOnt($ifIndex, $ontId) { $result = []; $interface = $this->decode_ifIndex($ifIndex); $this->telnetCheckSession(); $result[] = $this->telnetSession->doCommand("config\n"); sleep(2); $vlan = $interface['slot'] . ($interface['slot'] > 9 ? $interface['slot'] - 10 : $interface['slot']); $result[] = $this->telnetSession->doCommand("service-port vlan {$vlan} port {$interface['shelf']}/{$interface['slot']}/{$interface['port']} ont {$ontId} eth 1 multi-service user-vlan untagged\n"); sleep(2); $result[] = $this->telnetSession->doCommand("\n"); sleep(2); switch ($interface['type']) { case 'epon': $checkOid = "1.3.6.1.4.1.2011.6.128.1.1.2.81.1.5.{$ifIndex}.{$ontId}.1"; break; case 'gpon': $checkOid = "1.3.6.1.4.1.2011.6.128.1.1.2.62.1.7.{$ifIndex}.{$ontId}.1"; break; } $checkResult = $this->snmpSession->get($checkOid); if (!strpos($checkResult, '4094')) { OLTAddServicePort::dispatch($ifIndex, $ontId); } else { $this->setOntDescriptionAsConfigured($ifIndex, $ontId); } $result[] = $this->telnetSession->doCommand("quit\n"); return $result; } public function setOntDescriptionAsConfigured($ifIndex, $ontId) { $this->setOntDescription($ifIndex, $ontId, self::ONT_CONFIGURED_STRING); } public function setOntDescription($ifIndex, $ontId, $description) { $interface = $this->decode_ifIndex($ifIndex); switch ($interface['type']) { case 'epon': $oid = vsprintf(self::EPON_ONT_DESCRIPTION, [$ifIndex, $ontId]); break; case 'gpon': $oid = vsprintf(self::GPON_ONT_DESCRIPTION, [$ifIndex, $ontId]); break; } $this->snmpSession->set($oid, 's', $description); } public function deleteOntsInInterface($ifIndex) { $interface = $this->decode_ifIndex($ifIndex); $ontQuantity= $this->getONTsQuantityInInterfaces($interface['type']); if ($ontQuantity[$ifIndex] == 0) { return true; } $this->telnetCheckSession(); $this->telnetExecCommands([ "undo service-port port {$interface['shelf']}/{$interface['slot']}/{$interface['port']}", "", "y", "interface {$interface['type']} {$interface['shelf']}/{$interface['slot']}", "ont delete {$interface['port']} all", "y", "quit" ], true); } // private function checkSSHSession() { // if ($this->sshSession instanceof SSHConnection) { // return true; // } // $this->makeSSHSession(); // } // // private function makeSSHSession() { // $this->sshSession = (new SSHConnection()) // ->to('192.168.101.18') // ->onPort(22) // ->as('login') // ->withPassword('password') // // ->withPrivateKey($privateKeyPath) // ->connect(); // } // public function ssh() { // $this->checkSSHSession(); //// $command = $this->sshSession->run("quit"); // $command = $this->sshSession->run("display system sys-info\n"); //// $command = $this->sshSession->run("enable\n"); //// $this->sshSession->run("config\n"); //// $command = $this->sshSession->run("display system sys-info"); // // dd($command->getOutput()); // 'Hello World' // dd($command->getRawError()); // } private function telnetCheckSession() { if ($this->telnetSession instanceof PHPTelnet) { return true; } $this->telnetMakeSession(); } private function telnetMakeSession() { $this->telnetSession = new PHPTelnet(); $this->telnetSession->connect('192.168.101.18', 'user', 'pass'); $this->telnetSession->doCommand("enable\n"); } public function telnetCloseSession() { if ($this->telnetSession instanceof PHPTelnet) { $this->telnetSession->disconnect(); } } public function telnetExecCommands($commands = [], $isConfiguration = true) { $this->telnetCheckSession(); if ($isConfiguration) { $this->telnetLog[] = $this->telnetSession->doCommand("config\n"); sleep(2); } foreach ($commands as $command) { $this->telnetLog[] = $this->telnetSession->doCommand("{$command}\n"); sleep(2); } if ($isConfiguration) { $this->telnetLog[] = $this->telnetSession->doCommand("quit\n"); sleep(2); } } public function telnetGetLog() { return $this->telnetLog; } public static function decode_ifIndex($ifIndex) { $board_type = ( $ifIndex & bindec('11111110000000000000000000000000') ) >> 25 ; switch($board_type) { case 126: $port_type="epon"; $shelf_no = ( $ifIndex & bindec('00000001111110000000000000000000') ) >> 19 ; $slot_no = ( $ifIndex & bindec('00000000000001111110000000000000') ) >> 13 ; $port_no = ( $ifIndex & bindec('00000000000000000001111100000000') ) >> 8 ; return(array("type"=>$port_type,"shelf"=>$shelf_no,"slot"=>$slot_no,"port"=>$port_no)); break; case 125: $port_type = "gpon"; $shelf_no = ( $ifIndex & bindec('00000001111110000000000000000000') ) >> 19 ; $slot_no = ( $ifIndex & bindec('00000000000001111110000000000000') ) >> 13 ; $port_no = ( $ifIndex & bindec('00000000000000000001111100000000') ) >> 8 ; return(array("type"=>$port_type,"shelf"=>$shelf_no,"slot"=>$slot_no,"port"=>$port_no)); break; } } } Может кому понадобиться
-
Продам EPON SFP модули Agear, Step4net, Foxgate
тема ответил в dnserg пользователя dnserg в Обладнання
UPD 1. Step4Net PX++ - 4 шт по $15 за штуку 3. A-Gear Grade C PX20+ (33dB) - 2 шт по $15 за шт 3. A-Gear Grade D PX20++ (35dB) - 2 шт по $20 за шт -
Продам EPON SFP модули Agear, Step4net, Foxgate
тема ответил в dnserg пользователя dnserg в Обладнання
UPD 1. Step4Net PX++ - 6 шт по $15 за штуку 2. Foxgate C++ - 6 шт по $15 за штуку 3. A-Gear Grade C PX20+ (33dB) - 2 шт по $15 за шт 3. A-Gear Grade D PX20++ (35dB) - 2 шт по $20 за шт -
Продам EPON SFP модули Agear, Step4net, Foxgate
тема ответил в dnserg пользователя dnserg в Обладнання
Модуля БУ -
В наличии такие типа EPON SFP модулей: 1. Step4Net PX++ - 6 шт по $17 за штуку 2. Foxgate C++ - 6 шт по $17 за штуку 3. A-Gear Grade C PX20+ (33dB) - 2 шт по $17 за шт 3. A-Gear Grade D PX20++ (35dB) - 2 шт по $22 за шт
-
Продано
-
-
АП. Цена : 1150 грн. - есть 2 штуки
-
Продам Extreme x450a-24x Core License
тема ответил в dnserg пользователя dnserg в Торгівля. Серверне обладнання
UP $375 -
Dlink DES-1016D - по 300 грн. DES-1024D - по 475 грн.
-
Продам Extreme x450a-24x Core License
тема ответил в dnserg пользователя dnserg в Торгівля. Серверне обладнання
UP $400 -
Цены актуальные ?
-
-
А свои где потеряли ?
-
Цена, аналог ВПС в два раза больше по цене, по крайней мере в моем случае. Да места на диске меньше, но можно подключить BoxStorage. Буду переезжать на облако. Самое главное кстати отказоустойчивость. Облако есть облако.
