├── .gitignore ├── docs ├── zte │ └── img.png └── modules_example_output │ ├── save_config.json │ ├── clear_counters.json │ ├── zte_unregistered_onu.json │ ├── ctrl_port_descr.json │ ├── pvid.json │ ├── zte_onu_signal_strength.json │ ├── interface_vlan_info.json │ ├── fdb.json │ ├── pon_fdb.json │ ├── dhcp_server_info.json │ └── pon_onts_mac_addr.json ├── configs ├── oids │ ├── alcatel.yml │ ├── mikrotik │ │ ├── ros14988.yml │ │ ├── ros.yml │ │ └── crs.yml │ ├── bdcom │ │ └── 3310b.yml │ ├── dell │ │ ├── ems.yml │ │ └── network-os.yml │ ├── applynet.yml │ ├── cdata │ │ └── fd-1208s-r1.yml │ ├── dlink │ │ ├── dgs-3420-26sc-b1.yml │ │ ├── dgs-3420-28sc-b1.yml │ │ ├── dgs-3120-24sc-bx.yml │ │ ├── dgs-3120-24sc-a2.yml │ │ ├── des-3028G.yml │ │ ├── des-1228me.yml │ │ ├── des-3200-10-a1.yml │ │ ├── des-3200-18-a1.yml │ │ ├── des-3200-18-c1.yml │ │ ├── des-3200-26-a1.yml │ │ ├── des-3200-26-c1.yml │ │ ├── des-3200-28-a1.yml │ │ ├── des-3200-28F-c1.yml │ │ ├── des-3200-28F-a1.yml │ │ ├── des-3200-28-c1.yml │ │ ├── des-3200-52-c1.yml │ │ ├── des-3200-10-c1.yml │ │ ├── dgs-1510-20l-me.yml │ │ ├── des-3026.yml │ │ ├── dgs-3000-28l.yml │ │ ├── dgs-3000-10tc.yml │ │ ├── dgs-3000-26tc.yml │ │ ├── des-3526.yml │ │ ├── des-3528.yml │ │ └── dgs-3612g.yml │ └── arista │ │ └── defaults.yml ├── traps │ ├── cdata.yml │ └── global.yml └── models │ └── ZZZ_ApplyNet.yml ├── src ├── Exceptions │ ├── TrapDeclarationNotFoundByObject.php │ ├── InterfaceNotFound.php │ ├── ModuleErrorLoadException.php │ ├── ModuleNotFoundException.php │ ├── NoSuchInstanceException.php │ └── IncompleteResponseException.php ├── Modules │ ├── DCN │ │ ├── NetSettings.php │ │ ├── RawConsoleCommand.php │ │ ├── Errors.php │ │ ├── System.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── InterfacesList.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ ├── Descriptions.php │ │ ├── ParseInterface.php │ │ ├── Counters.php │ │ ├── Rmon.php │ │ ├── PvidDot1q.php │ │ └── Fdb.php │ ├── Arista │ │ ├── NetSettings.php │ │ ├── Errors.php │ │ ├── System.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── InterfacesList.php │ │ ├── LinkInfo.php │ │ ├── RawConsoleCommand.php │ │ ├── Descriptions.php │ │ ├── VlanByPorts.php │ │ ├── ParseInterface.php │ │ └── Counters.php │ ├── Raisecom │ │ ├── NetSettings.php │ │ ├── LldpInfo.php │ │ ├── SfpMediaInfo.php │ │ ├── StatePortControl.php │ │ ├── Descriptions.php │ │ ├── SetPortDescription.php │ │ ├── Fdb.php │ │ ├── System.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── Errors.php │ │ └── Rmon.php │ ├── Edgecore │ │ ├── RawConsoleCommand.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── Descriptions.php │ │ ├── SetPortDescription.php │ │ ├── Fdb.php │ │ ├── System.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ ├── VlansDot1q.php │ │ └── ClearCounters.php │ ├── Huawei │ │ ├── RawConsoleCommand.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ ├── System.php │ │ └── Descriptions.php │ ├── SwOS │ │ ├── Errors.php │ │ ├── System.php │ │ ├── InterfacesList.php │ │ ├── StatePortControl.php │ │ ├── Counters.php │ │ └── ParseInterface.php │ ├── CiscoSwitch │ │ ├── RawConsoleCommand.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── Fdb.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ └── Descriptions.php │ ├── Juniper │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── InterfacesList.php │ │ ├── System.php │ │ ├── ParseInterface.php │ │ ├── VlanByPorts.php │ │ ├── RawConsoleCommand.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ └── Descriptions.php │ ├── DellSwitch │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ ├── RawConsoleCommand.php │ │ └── Descriptions.php │ ├── Dlink │ │ ├── Acl │ │ │ └── ProfilesList.php │ │ ├── LldpInfo.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── SaveConfig.php │ │ ├── ClearCounters.php │ │ ├── CableDiag │ │ │ └── Des3526Parser.php │ │ ├── ClearCountersDGS1100.php │ │ ├── StatePortControl.php │ │ ├── RawConsoleCommand.php │ │ ├── ParseInterface.php │ │ ├── InterfacesList.php │ │ ├── DescriptionPortControl.php │ │ └── SpeedPortControl.php │ ├── ExtremeXOS │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── SetPortDescription.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── VlanByPorts.php │ │ ├── RawConsoleCommand.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ └── Descriptions.php │ ├── HuaweiQuidwayS93 │ │ ├── RawConsoleCommand.php │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ ├── System.php │ │ └── Descriptions.php │ ├── AlcatelSwitch │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── Fdb.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ ├── RawConsoleCommand.php │ │ ├── Descriptions.php │ │ └── SystemTemperatures.php │ ├── CData │ │ ├── FD5008 │ │ │ ├── RawConsoleCommand.php │ │ │ ├── System.php │ │ │ ├── InterfacesList.php │ │ │ ├── MultiRawConsoleCommand.php │ │ │ └── ParseInterface.php │ │ ├── FD16xxV3 │ │ │ ├── SfpMediaInfo.php │ │ │ ├── InterfacesList.php │ │ │ ├── PonPortsList.php │ │ │ └── ParseInterface.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ └── FD11XX │ │ │ └── ParseInterface.php │ ├── HPESwitch │ │ ├── LldpInfo.php │ │ ├── InterfacesList.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── VlanByPorts.php │ │ ├── LinkInfo.php │ │ └── Descriptions.php │ ├── HpSwitch │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ └── Descriptions.php │ ├── EltexSwitch │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── Fdb.php │ │ ├── InterfacesList.php │ │ ├── System.php │ │ ├── ParseInterface.php │ │ ├── VlanByPorts.php │ │ ├── Rmon.php │ │ ├── Counters.php │ │ └── Descriptions.php │ ├── UbntSwitch │ │ ├── LldpInfo.php │ │ ├── SetPortDescription.php │ │ ├── StatePortControl.php │ │ ├── Fdb.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── VlanByPorts.php │ │ ├── LinkInfo.php │ │ └── Descriptions.php │ ├── ApplyNet │ │ ├── StatePortControl.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ └── LinkInfo.php │ ├── MikrotikCRS │ │ ├── InterfacesList.php │ │ ├── SetPortDescription.php │ │ ├── StatePortControl.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── VlanByPorts.php │ │ ├── LinkInfo.php │ │ ├── PvidDot1q.php │ │ └── VlansDot1q.php │ ├── TpLinkSwitch │ │ ├── LldpInfo.php │ │ ├── InterfacesList.php │ │ ├── SetPortDescription.php │ │ ├── StatePortControl.php │ │ ├── Fdb.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── VlanByPorts.php │ │ ├── LinkInfo.php │ │ ├── PvidDot1q.php │ │ ├── VlansDot1q.php │ │ └── Descriptions.php │ ├── AlliedTelesisSwitch │ │ ├── MultiRawConsoleCommand.php │ │ ├── LldpInfo.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── Fdb.php │ │ ├── InterfacesList.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Rmon.php │ │ ├── LinkInfo.php │ │ ├── VlanByPorts.php │ │ └── Descriptions.php │ ├── HpArubaOsSwitch │ │ ├── LldpInfo.php │ │ ├── InterfacesList.php │ │ ├── StatePortControl.php │ │ ├── SetPortDescription.php │ │ ├── ParseInterface.php │ │ ├── System.php │ │ ├── Errors.php │ │ ├── Rmon.php │ │ ├── VlanByPorts.php │ │ ├── LinkInfo.php │ │ ├── PvidDot1q.php │ │ └── Descriptions.php │ ├── RouterOS │ │ ├── InterfacesList.php │ │ └── LinkInfo.php │ ├── General │ │ ├── Switches │ │ │ ├── AbstractInterfaces.php │ │ │ ├── ParseInterface.php │ │ │ └── InterfacesList.php │ │ └── SupportedModules.php │ ├── ZTE │ │ ├── C300Series │ │ │ ├── InterfaceParser.php │ │ │ ├── SaveConfig.php │ │ │ ├── InterfacesList.php │ │ │ └── DeregOnt.php │ │ └── C600Series │ │ │ ├── InterfaceParser.php │ │ │ ├── SaveConfig.php │ │ │ ├── InterfacesList.php │ │ │ ├── DeregOnt.php │ │ │ └── PonPortsList.php │ ├── BDcom │ │ ├── DescriptionControl.php │ │ ├── OntReboot.php │ │ ├── PonPortsList.php │ │ ├── GP3600 │ │ │ ├── PonPortsList.php │ │ │ ├── PortDescriptionControl.php │ │ │ └── ParseInterface.php │ │ └── ParseInterface.php │ ├── HuaweiOLT │ │ ├── PonPortsList.php │ │ └── ParseInterface.php │ ├── VsolOlts │ │ ├── PonPortsList.php │ │ ├── GPONV1600 │ │ │ ├── PonPortsList.php │ │ │ ├── InterfacesList.php │ │ │ └── PortDescriptionControl.php │ │ └── ParseInterface.php │ ├── Sensors │ │ └── Ping3 │ │ │ ├── KnockSensorState.php │ │ │ └── PowerSensorState.php │ └── GCOM │ │ └── ParseInterface.php ├── Switcher │ ├── CacheInterface.php │ ├── Objects │ │ ├── Cache.php │ │ └── SnmpResponse.php │ ├── PhpCache.php │ └── Console │ │ └── ConsoleInterface.php └── Config │ └── Collector.php ├── bin ├── connection.conf.yml └── console ├── test.php └── phpunit.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | composer.lock 4 | configs/proxies.yml 5 | -------------------------------------------------------------------------------- /docs/zte/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meklis/switcher-core/HEAD/docs/zte/img.png -------------------------------------------------------------------------------- /configs/oids/alcatel.yml: -------------------------------------------------------------------------------- 1 | - {name: sensors.temperature.board, oid: .1.3.6.1.4.1.89.53.15.1.9.1} -------------------------------------------------------------------------------- /configs/oids/mikrotik/ros14988.yml: -------------------------------------------------------------------------------- 1 | - {name: sys.serialNum, oid: .1.3.6.1.4.1.14988.1.1.7.3.0} 2 | -------------------------------------------------------------------------------- /docs/modules_example_output/save_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": true, 3 | "arguments": [] 4 | } -------------------------------------------------------------------------------- /docs/modules_example_output/clear_counters.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": true, 3 | "arguments": [] 4 | } -------------------------------------------------------------------------------- /docs/modules_example_output/zte_unregistered_onu.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [], 3 | "arguments": [] 4 | } -------------------------------------------------------------------------------- /configs/oids/bdcom/3310b.yml: -------------------------------------------------------------------------------- 1 | #ONT BLOCK 2 | - {name: pon.opticalOltRx, oid: .1.3.6.1.4.1.3320.9.183.1.1.5 } 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/modules_example_output/ctrl_port_descr.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": true, 3 | "arguments": { 4 | "port": "2", 5 | "description": "TEST" 6 | } 7 | } -------------------------------------------------------------------------------- /src/Exceptions/TrapDeclarationNotFoundByObject.php: -------------------------------------------------------------------------------- 1 | model->getPorts()}"; 12 | } 13 | } -------------------------------------------------------------------------------- /docs/modules_example_output/interface_vlan_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "vlan_id": "100", 5 | "name": "ControlPower", 6 | "disabled": "false", 7 | "arp": "enabled" 8 | } 9 | ], 10 | "arguments": { 11 | "vlan_id": "100" 12 | } 13 | } -------------------------------------------------------------------------------- /src/Modules/General/Switches/AbstractInterfaces.php: -------------------------------------------------------------------------------- 1 | parseInterface($params['interface']); 15 | return "config ports {$interface['_key']} state {$params['state']}"; 16 | } 17 | } -------------------------------------------------------------------------------- /src/Modules/HpArubaOsSwitch/System.php: -------------------------------------------------------------------------------- 1 | VLAN ID: $vlanId" . PHP_EOL; 18 | } -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | -------------------------------------------------------------------------------- /src/Modules/Dlink/ParseInterface.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } 21 | 22 | 23 | } -------------------------------------------------------------------------------- /src/Modules/Huawei/System.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } 21 | 22 | 23 | } -------------------------------------------------------------------------------- /src/Modules/HuaweiQuidwayS93/System.php: -------------------------------------------------------------------------------- 1 | memcache = new Memcache; 17 | $this->memcache->connect($config['host'], $config['port']); 18 | } 19 | 20 | } 21 | function get($key) { 22 | 23 | } 24 | function set($key, $value, $timeout = 3600) { 25 | 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /docs/modules_example_output/dhcp_server_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "name": "ControlPower", 5 | "interface": "ControlPower", 6 | "lease_time": "1d", 7 | "address_pool": "ControlPower", 8 | "extra": { 9 | "vlan": { 10 | "vlan_id": "100", 11 | "name": "ControlPower", 12 | "disabled": "false", 13 | "arp": "enabled" 14 | } 15 | } 16 | } 17 | ], 18 | "arguments": { 19 | "vlan_id": "100" 20 | } 21 | } -------------------------------------------------------------------------------- /src/Config/Collector.php: -------------------------------------------------------------------------------- 1 | reader = $reader; 22 | $instance->read(); 23 | $instance->instance = $instance; 24 | return $instance; 25 | } 26 | protected abstract function read(); 27 | } -------------------------------------------------------------------------------- /src/Modules/ZTE/C300Series/InterfaceParser.php: -------------------------------------------------------------------------------- 1 | response = $this->parseInterface($params['interface']); 16 | return $this; 17 | } 18 | public function getPretty() 19 | { 20 | return $this->response; 21 | } 22 | 23 | public function getPrettyFiltered($filter = []) 24 | { 25 | return $this->response; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /configs/oids/mikrotik/crs.yml: -------------------------------------------------------------------------------- 1 | 2 | - {name: sensors.temperature.board, oid: .1.3.6.1.4.1.14988.1.1.3.100.1.3.51 } 3 | - {name: sensors.temperature.cpu, oid: .1.3.6.1.4.1.14988.1.1.3.10.0 } 4 | 5 | 6 | - { name: sfp.media.vendorName, oid: .1.3.6.1.4.1.14988.1.1.19.1.1.11 } 7 | 8 | - { name: sfp.optical.temp, oid: .1.3.6.1.4.1.14988.1.1.19.1.1.6 } 9 | - { name: sfp.optical.vcc, oid: .1.3.6.1.4.1.14988.1.1.19.1.1.7 } 10 | #- { name: sfp.optical.txPower, oid: .1.3.6.1.4.1.14988.1.1.19.1.1.9 } 11 | - { name: sfp.optical.rxPower, oid: .1.3.6.1.4.1.14988.1.1.19.1.1.10 } 12 | #- { name: sfp.optical.txBias, oid: .1.3.6.1.4.1.14988.1.1.19.1.1.8 } -------------------------------------------------------------------------------- /configs/traps/cdata.yml: -------------------------------------------------------------------------------- 1 | - name: onuOnlineStatusChange 2 | description: Online status changed 3 | object: .1.3.6.1.4.1.34592.1.3.6.0.7 4 | is_interface: true 5 | modules: 6 | - pon_onts_status 7 | 8 | - name: onuPortLoopBack 9 | description: Port loopback detected 10 | object: .1.3.6.1.4.1.34592.1.3.6.0.18 11 | is_interface: true 12 | 13 | - name: powerStatusChange 14 | description: Power status changed 15 | object: .1.3.6.1.4.1.34592.1.3.6.0.3 16 | is_interface: false 17 | 18 | - name: fanStatusChange 19 | description: Fan status changed 20 | object: .1.3.6.1.4.1.34592.1.3.6.0.4 21 | is_interface: false 22 | -------------------------------------------------------------------------------- /src/Modules/Dlink/InterfacesList.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface'])]; 21 | } else { 22 | return array_values($this->getIndexes()); 23 | } 24 | } 25 | 26 | 27 | } -------------------------------------------------------------------------------- /src/Modules/HPESwitch/Descriptions.php: -------------------------------------------------------------------------------- 1 | response = $this->parseInterface($params['interface']); 16 | return $this; 17 | } 18 | public function getPretty() 19 | { 20 | return $this->response; 21 | } 22 | 23 | public function getPrettyFiltered($filter = []) 24 | { 25 | return $this->response; 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /src/Modules/AlcatelSwitch/Descriptions.php: -------------------------------------------------------------------------------- 1 | parseInterface($params['interface']); 14 | $description = str_replace([" "], '_', $params['description']); 15 | if(trim($description)) { 16 | return "config ports {$interface['_key']} description {$description}"; 17 | } else { 18 | return "config ports {$interface['_key']} description \"\""; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Modules/General/SupportedModules.php: -------------------------------------------------------------------------------- 1 | model->getModulesList(); 16 | } 17 | 18 | 19 | function getPrettyFiltered($filter = []) 20 | { 21 | return $this->model->getModulesList(); 22 | } 23 | 24 | public function run($filter = []) 25 | { 26 | return $this; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/Modules/AlcatelSwitch/SystemTemperatures.php: -------------------------------------------------------------------------------- 1 | snmp->get([ 17 | Oid::init($this->oids->getOidByName('sensors.temperature.board')->getOid()) 18 | ]); 19 | $this->response = $this->formatResponse($returnedGets); 20 | return $this; 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/Modules/ZTE/C300Series/SaveConfig.php: -------------------------------------------------------------------------------- 1 | telnet) { 16 | throw new Exception("Module required telnet connection"); 17 | } 18 | $this->exec("end"); 19 | $this->exec("wr"); 20 | return $this; 21 | } 22 | 23 | 24 | public function getPretty() 25 | { 26 | return true; 27 | } 28 | 29 | public function getPrettyFiltered($filter = []) 30 | { 31 | return true; 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/Modules/ZTE/C600Series/SaveConfig.php: -------------------------------------------------------------------------------- 1 | telnet) { 16 | throw new Exception("Module required telnet connection"); 17 | } 18 | $this->exec("end"); 19 | $this->exec("wr"); 20 | return $this; 21 | } 22 | 23 | 24 | public function getPretty() 25 | { 26 | return true; 27 | } 28 | 29 | public function getPrettyFiltered($filter = []) 30 | { 31 | return true; 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /configs/traps/global.yml: -------------------------------------------------------------------------------- 1 | - name: LinkUp 2 | description: | 3 | A linkUp trap signifies that the SNMPv2 entity, 4 | acting in an agent role, has detected that the 5 | ifOperStatus object for one of its communication links 6 | has transitioned out of the down state. 7 | object: .1.3.6.1.6.3.1.1.5.4 8 | is_interface: true 9 | modules: 10 | - link_info 11 | 12 | - name: LinkDown 13 | description: | 14 | A linkDown trap signifies that the SNMPv2 entity, 15 | acting in an agent role, has detected that the 16 | ifOperStatus object for one of its communication links 17 | is about to transition into the down state. 18 | object: .1.3.6.1.6.3.1.1.5.3 19 | is_interface: true 20 | modules: 21 | - link_info 22 | -------------------------------------------------------------------------------- /src/Switcher/PhpCache.php: -------------------------------------------------------------------------------- 1 | cache[$key] = [ 13 | 'value' => $value, 14 | 'timeout' => $timeout + time(), 15 | ]; 16 | return $this; 17 | } 18 | public function get($key) { 19 | if(isset($this->cache[$key]) && $this->cache[$key]['timeout'] > time()) { 20 | return $this->cache[$key]['value']; 21 | } else { 22 | return null; 23 | } 24 | } 25 | public function isExist($key) { 26 | return isset($this->cache[$key]); 27 | } 28 | } -------------------------------------------------------------------------------- /configs/oids/dell/network-os.yml: -------------------------------------------------------------------------------- 1 | 2 | - {name: sensors.temperature.board, oid: .1.3.6.1.4.1.6027.3.26.1.3.4.1.13 } 3 | 4 | 5 | - {name: sfp.media.connectorType, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.4} 6 | - {name: sfp.media.vendorName, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.5} 7 | - {name: sfp.media.partNumber, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.6} 8 | - {name: sfp.media.serialNum, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.7} 9 | 10 | - {name: sfp.optical.temp, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.16} 11 | - {name: sfp.optical.vcc, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.17} 12 | - {name: sfp.optical.txPower, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.8} 13 | - {name: sfp.optical.rxPower, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.12} 14 | - {name: sfp.optical.txBias, oid: .1.3.6.1.4.1.6027.3.11.1.3.1.1.18} -------------------------------------------------------------------------------- /configs/models/ZZZ_ApplyNet.yml: -------------------------------------------------------------------------------- 1 | 2 | models: 3 | - name: ApplyNet AN-SW812 4 | key: applynet_sw812 5 | device_type: SWITCH 6 | inputs: 7 | - snmp 8 | - console 9 | detect: {description: 'NOT_EXISTED', objid: 'NOT_EXISTED' } 10 | oids: 11 | - ./oids/applynet.yml 12 | extra: 13 | console_conn_type: dell 14 | modules: 15 | parse_interface: \SwitcherCore\Modules\ApplyNet\ParseInterface 16 | fdb: \SwitcherCore\Modules\ApplyNet\Fdb 17 | link_info: \SwitcherCore\Modules\ApplyNet\LinkInfo 18 | interface_counters: \SwitcherCore\Modules\ApplyNet\Counters 19 | system: \SwitcherCore\Modules\ApplyNet\System 20 | interfaces_list: \SwitcherCore\Modules\ApplyNet\InterfacesList 21 | ctrl_port_state: \SwitcherCore\Modules\ApplyNet\StatePortControl 22 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3420-26sc-b1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.119.6.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.sysPortCtrlSpeed, oid: .1.3.6.1.4.1.171.11.119.6.2.3.2.1.5, values: {1: Other, 2: Enabled, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full,10: 1G-Full}} 3 | - {name: dlink.sysPortCtrlOperStatus, oid: .1.3.6.1.4.1.171.11.119.6.2.3.1.1.6, values: {0: Down, 1: 10-Full, 2: 10-Full, 3: 10-Half, 4: 10-Half, 5: 100-Full, 6: 100-Full, 7: 100-Full, 8: 100-Half, 9: 1G-Full, 10: 1G-Full, 11: 1G-Half, 12: 1G-Half, 13: 10G-Full, 14: 10G-Full,15: 10G-Half, 16: 10G-Half, 17: empty, 18: err-disabled}} 4 | - {name: dlink.sysPortCtrlState, oid: .1.3.6.1.4.1.171.11.119.6.2.3.2.1.4, values: {2: Disabled, 3: Enabled}} 5 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3420-28sc-b1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.119.2.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.sysPortCtrlSpeed, oid: .1.3.6.1.4.1.171.11.119.2.2.3.2.1.5, values: {1: Other, 2: Enabled, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full,10: 1G-Full}} 3 | - {name: dlink.sysPortCtrlOperStatus, oid: .1.3.6.1.4.1.171.11.119.2.2.3.1.1.6, values: {0: Down, 1: 10-Full, 2: 10-Full, 3: 10-Half, 4: 10-Half, 5: 100-Full, 6: 100-Full, 7: 100-Full, 8: 100-Half, 9: 1G-Full, 10: 1G-Full, 11: 1G-Half, 12: 1G-Half, 13: 10G-Full, 14: 10G-Full,15: 10G-Half, 16: 10G-Half, 17: empty, 18: err-disabled}} 4 | - {name: dlink.sysPortCtrlState, oid: .1.3.6.1.4.1.171.11.119.2.2.3.2.1.4, values: {2: Disabled, 3: Enabled}} 5 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3120-24sc-bx.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.117.4.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.sysPortCtrlSpeed, oid: .1.3.6.1.4.1.171.11.117.4.1.2.3.2.1.5, values: {1: Other, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full,10: 1G-Full(S)}} 3 | - {name: dlink.sysPortCtrlOperStatus, oid: .1.3.6.1.4.1.171.11.117.4.1.2.3.1.1.6, values: {0: Down, 1: 10-Full, 2: 10-Full, 3: 10-Half, 4: 10-Half, 5: 100-Full, 6: 100-Full, 7: 100-Half, 8: 100-Half, 9: 1G-Full, 10: 1G-Full, 11: 1G-Half, 12: 1G-Half, 13: 10G-Full, 14: 10G-Full, 15: 10G-Half, 16: 10G-Half, 17: Empty, 18: Err-Disabled}} 4 | - {name: dlink.sysPortCtrlState, oid: .1.3.6.1.4.1.171.11.117.4.1.2.3.2.1.4, values: {2: Disabled, 3: Enabled}} 5 | 6 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3120-24sc-a2.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.117.1.3.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.sysPortCtrlSpeed, oid: .1.3.6.1.4.1.171.11.117.1.3.2.3.2.1.5, values: {1: Other, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full,10: 1G-Full(S)}} 3 | - {name: dlink.sysPortCtrlOperStatus, oid: .1.3.6.1.4.1.171.11.117.1.3.2.3.1.1.6, values: {0: Down, 1: 10-Full, 2: 10-Full, 3: 10-Half, 4: 10-Half, 5: 100-Full, 6: 100-Full, 7: 100-Half, 8: 100-Half, 9: 1G-Full, 10: 1G-Full, 11: 1G-Half, 12: 1G-Half, 13: 10G-Full, 14: 10G-Full, 15: 10G-Half, 16: 10G-Half, 17: Empty, 18: Err-Disabled}} 4 | - {name: dlink.sysPortCtrlState, oid: .1.3.6.1.4.1.171.11.117.1.3.2.3.2.1.4, values: {2: Disabled, 3: Enabled}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Modules/Huawei/Descriptions.php: -------------------------------------------------------------------------------- 1 | $v) { 18 | if(strpos($v['description'], 'HUAWEI,') === 0) { 19 | $pretty[$k]['description'] = ''; 20 | } 21 | } 22 | return $pretty; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Modules/General/Switches/InterfacesList.php: -------------------------------------------------------------------------------- 1 | getInterfacesIds()); 20 | if($filter['interface']) { 21 | $iface = $this->parseInterface($filter['interface']); 22 | $ifaces = array_filter($ifaces, function ($e) use ($iface) { 23 | return $e['id'] == $iface['id']; 24 | }); 25 | } 26 | return $ifaces; 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /configs/oids/dlink/des-3028G.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.63.11.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.63.11.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.63.11.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.63.11.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.63.11.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.63.11.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-1228me.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.116.2.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.116.2.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.116.2.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.116.2.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.116.2.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.116.2.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Modules/HuaweiQuidwayS93/Descriptions.php: -------------------------------------------------------------------------------- 1 | $v) { 18 | if(strpos($v['description'], 'HUAWEI,') === 0) { 19 | $pretty[$k]['description'] = ''; 20 | } 21 | } 22 | return $pretty; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Modules/BDcom/DescriptionControl.php: -------------------------------------------------------------------------------- 1 | parseInterface($params['interface']); 12 | 13 | 14 | $description = str_replace(' ', '_', $params['description']); 15 | $this->checkSnmpRespError($this->snmp->set( 16 | Oid::init($this->oids->getOidByName('if.Alias')->getOid() . ".{$interface['xid']}") 17 | ->setType('StringValue') 18 | ->setValue($description) 19 | )); 20 | 21 | $this->response = true; 22 | return $this; 23 | } 24 | 25 | function getPretty() 26 | { 27 | return $this->response; 28 | } 29 | } -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-10-a1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.1.1.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.1.1.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.1.1.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.1.1.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.1.1.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.1.1.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-18-a1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.1.2.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.1.2.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.1.2.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.1.2.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.1.2.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.1.2.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-18-c1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.3.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.3.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.3.1.2.3.1.1.6, values: {2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.3.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.3.1.2.3.2.1.5, values: {2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.3.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-26-a1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.1.5.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.1.5.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.1.5.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.1.5.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.1.5.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.1.5.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-26-c1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.4.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.4.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.4.1.2.3.1.1.6, values: {2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.4.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.4.1.2.3.2.1.5, values: {2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.4.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-28-a1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.1.3.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.1.3.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.1.3.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.1.3.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.1.3.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.1.3.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-28F-c1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.6.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.6.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.6.1.2.3.1.1.6, values: {2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.6.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.6.1.2.3.2.1.5, values: {2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.6.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-28F-a1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.1.4.2.2.1.1.2, values: {100: Cooper, 101: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.1.4.2.2.1.1.4, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.1.4.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.1.4.2.2.2.1.3, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.1.4.2.2.2.1.4, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.1.4.2.2.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /src/Modules/ZTE/C600Series/InterfacesList.php: -------------------------------------------------------------------------------- 1 | response = []; 16 | if($params['interface']) { 17 | $this->response[] = $this->parseInterface($params['interface']); 18 | } else { 19 | $this->response = array_values($this->listInterfacesByXidNames()['id']); 20 | } 21 | return $this; 22 | } 23 | public function getPretty() 24 | { 25 | return $this->response; 26 | } 27 | 28 | public function getPrettyFiltered($filter = []) 29 | { 30 | return $this->response; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/Switcher/Objects/SnmpResponse.php: -------------------------------------------------------------------------------- 1 | parsed_value = $value; 12 | return $this; 13 | } 14 | 15 | function getParsedValue() { 16 | return trim($this->parsed_value); 17 | } 18 | function setValue($val) { 19 | $this->value = $val; 20 | return $this; 21 | } 22 | function setOid($val) { 23 | $this->oid = $val; 24 | return $this; 25 | } 26 | function setHexValue($val) { 27 | $this->hex_value = $val; 28 | return $this; 29 | } 30 | function setType($val) { 31 | $this->type = $val; 32 | return $this; 33 | } 34 | } -------------------------------------------------------------------------------- /src/Modules/CData/FD16xxV3/InterfacesList.php: -------------------------------------------------------------------------------- 1 | response; 20 | } 21 | 22 | function getPretty() 23 | { 24 | return array_values($this->getPhysicalInterfaces()); 25 | } 26 | 27 | /** 28 | * @param array $filter 29 | * @return $this|AbstractModule 30 | * @throws Exception 31 | */ 32 | public function run($filter = []) 33 | { 34 | return $this; 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-28-c1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.5.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.5.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.5.1.2.3.1.1.6, values: {0: Down, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 10: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.5.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.5.1.2.3.2.1.5, values: {2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.5.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-52-c1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.9.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.9.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.9.1.2.3.1.1.6, values: {0: Down, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 10: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.9.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.9.1.2.3.2.1.5, values: {2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.9.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3200-10-c1.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.113.2.1.2.3.2.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.113.2.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.113.2.1.2.3.1.1.6, values: {0: Down, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 10: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.113.2.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.113.2.1.2.3.2.1.5, values: {2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.113.2.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Modules/Juniper/Rmon.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | $this->response = $this->snmpGetByInterfaces($ifaces,$this->oids->getOidsByRegex('rmon.*')); 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Modules/ExtremeXOS/Rmon.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | $this->response = $this->snmpGetByInterfaces($ifaces,$this->oids->getOidsByRegex('rmon.*')); 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-1510-20l-me.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.10.141.2.1.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.10.141.2.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.10.141.2.1.2.3.1.1.6, values: {0: Other, 1: Empty, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.10.141.2.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.10.141.2.1.2.3.2.1.5, values: { 1: Other, 2: Enabled, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full } } 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.10.141.2.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /src/Modules/EltexSwitch/Rmon.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | $this->response = $this->snmpGetByInterfaces($ifaces,$this->oids->getOidsByRegex('rmon.*')); 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | setName("SwitcherCore dev console"); 22 | 23 | $app->add(new \SwitcherCore\Dev\SwitcherCoreModules()); 24 | $app->add(new \SwitcherCore\Dev\SwitcherCoreCallModuleCommand()); 25 | $app->add(new \SwitcherCore\Dev\GetModelsByKey()); 26 | 27 | 28 | $app->run(); 29 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3026.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.63.3.2.2.1.1.4, values: {2: Up, 3: Down}} 2 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.63.3.2.2.1.1.5, values: {1: Down, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 3 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.63.3.2.2.2.1.2, values: {3: Enabled, 2: Disabled}} 4 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.63.3.2.2.2.1.3, values: {1: Auto, 2: 10-Half, 3: 10-Full, 4: 100-Half, 5: 100-Full, 6: 1G-Half, 7: 1G-Full}} 5 | 6 | - {name: dlink.DevCtrlCleanAllStatisticCounter, oid: .1.3.6.1.4.1.171.11.63.6.2.1.2.12.0, values: {1: normal, 2: active}} 7 | - {name: dlink.DevCtrlSystemReboot, oid: .1.3.6.1.4.1.171.11.63.6.2.1.2.1.0, values: {1: other, 2: reboot, 3: save-config-and-reboot, 4: reboot-and-load-factory-default-config}} 8 | 9 | -------------------------------------------------------------------------------- /src/Modules/Juniper/Counters.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | $this->response = $this->snmpGetByInterfaces($ifaces, $this->oids->getOidsByRegex('if\.HC.*')); 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Modules/ExtremeXOS/Counters.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | $this->response = $this->snmpGetByInterfaces($ifaces, $this->oids->getOidsByRegex('if\.HC.*')); 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Modules/EltexSwitch/Counters.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | $this->response = $this->snmpGetByInterfaces($ifaces, $this->oids->getOidsByRegex('if\.HC.*')); 24 | return $this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3000-28l.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.10.133.8.2.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.10.133.8.2.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.10.133.8.2.2.3.1.1.6, values: {0: Other, 1: Empty, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 10G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.10.133.8.2.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.10.133.8.2.2.3.2.1.5, values: {1: Other, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full-Master, 10: 10G-Full, 11: 10G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.10.133.8.2.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | -------------------------------------------------------------------------------- /src/Modules/Edgecore/ClearCounters.php: -------------------------------------------------------------------------------- 1 | getPretty(); 27 | } 28 | 29 | public function run($params = []) 30 | { 31 | foreach ($this->getInterfacesIds() as $port) { 32 | $this->console->exec('clear counters ethernet '.$port['_unit'].'/'.$port['_port']); 33 | } 34 | return $this; 35 | } 36 | } -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3000-10tc.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.133.1.1.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.133.1.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.133.1.1.2.3.1.1.6, values: {0: Other, 1: Empty, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 10G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.133.1.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.133.1.1.2.3.2.1.5, values: {1: Other, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full-Master, 10: 10G-Full, 11: 10G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.133.1.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | -------------------------------------------------------------------------------- /src/Modules/CData/InterfacesList.php: -------------------------------------------------------------------------------- 1 | response; 21 | } 22 | 23 | function getPretty() 24 | { 25 | return array_values($this->model->getExtraParamByName('interfaces')); 26 | } 27 | 28 | /** 29 | * @param array $filter 30 | * @return $this|AbstractModule 31 | * @throws Exception 32 | */ 33 | public function run($filter = []) 34 | { 35 | return $this; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/Modules/HuaweiOLT/PonPortsList.php: -------------------------------------------------------------------------------- 1 | response; 21 | } 22 | 23 | function getPretty() 24 | { 25 | return array_values(array_filter($this->getInterfaces(), function($e){ 26 | return $e['type'] == 'PON'; 27 | })); 28 | } 29 | 30 | /** 31 | * @param array $filter 32 | * @return $this|AbstractModule 33 | * @throws Exception 34 | */ 35 | public function run($filter = []) 36 | { 37 | return $this; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Modules/VsolOlts/PonPortsList.php: -------------------------------------------------------------------------------- 1 | response; 21 | } 22 | 23 | function getPretty() 24 | { 25 | return array_values(array_filter($this->getInterfaces(), function ($e) { 26 | return $e['type'] == 'PON'; 27 | })); 28 | } 29 | 30 | /** 31 | * @param array $filter 32 | * @return $this|AbstractModule 33 | * @throws Exception 34 | */ 35 | public function run($filter = []) 36 | { 37 | return $this; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3000-26tc.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.133.2.1.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.133.2.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.133.2.1.2.3.1.1.6, values: {0: Other, 1: Empty, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 10G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.133.2.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.133.2.1.2.3.2.1.5, values: {1: Other, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full, 9: 1G-Full-Master, 10: 10G-Full, 11: 10G-Full}} 6 | - {name: dlink.PortCtrlAddressLearning, oid: .1.3.6.1.4.1.171.11.133.2.1.2.3.2.1.7, values: {2: Disabled, 3: Enabled}} 7 | 8 | -------------------------------------------------------------------------------- /src/Modules/ZTE/C600Series/DeregOnt.php: -------------------------------------------------------------------------------- 1 | telnet) { 15 | throw new Exception("Module required telnet connection"); 16 | } 17 | $iface = $this->parseInterface($params['interface']); 18 | $interface = "{$iface['_technology']}_olt-{$iface['_shelf']}/{$iface['_slot']}/{$iface['_port']}"; 19 | $this->exec("conf t"); 20 | $this->exec("interface {$interface}"); 21 | $this->exec("no onu {$iface['_onu']}"); 22 | return $this; 23 | } 24 | 25 | public function getPretty() 26 | { 27 | return true; 28 | } 29 | 30 | public function getPrettyFiltered($filter = []) 31 | { 32 | return true; 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/Modules/Sensors/Ping3/KnockSensorState.php: -------------------------------------------------------------------------------- 1 | getOid()); 14 | }, [ 15 | $this->oids->getOidByName('knock.state'), 16 | ] 17 | ); 18 | $this->response = $this->formatResponse($this->snmp->get($oids)); 19 | return $this; 20 | } 21 | 22 | public function getPretty() 23 | { 24 | return [ 25 | 'state' => $this->getResponseByName('knock.state')->fetchOne()->getParsedValue() 26 | ]; 27 | } 28 | 29 | public function getPrettyFiltered($filter = []) 30 | { 31 | return $this->getPretty(); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/Modules/ZTE/C300Series/InterfacesList.php: -------------------------------------------------------------------------------- 1 | response = []; 16 | if($params['interface']) { 17 | $this->response[] = $this->parseInterface($params['interface']); 18 | } else { 19 | $this->response = array_values(array_map(function ($i) { 20 | return $this->parseInterface($i['_xid'], 'xid'); 21 | }, $this->listInterfacesByXidNames())); 22 | } 23 | return $this; 24 | } 25 | public function getPretty() 26 | { 27 | return $this->response; 28 | } 29 | 30 | public function getPrettyFiltered($filter = []) 31 | { 32 | return $this->response; 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /src/Modules/Juniper/Descriptions.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | 24 | $oid = $this->oids->getOidByName('if.Alias') ; 25 | 26 | $this->response = $this->snmpGetByInterfaces($ifaces, [$oid]); 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Modules/VsolOlts/GPONV1600/PonPortsList.php: -------------------------------------------------------------------------------- 1 | response; 21 | } 22 | 23 | function getPretty() 24 | { 25 | return array_values(array_filter($this->getPhysicalInterfaces(), function ($e) { 26 | return $e['type'] == 'PON'; 27 | })); 28 | } 29 | 30 | /** 31 | * @param array $filter 32 | * @return $this|AbstractModule 33 | * @throws Exception 34 | */ 35 | public function run($filter = []) 36 | { 37 | return $this; 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/Modules/CData/FD16xxV3/PonPortsList.php: -------------------------------------------------------------------------------- 1 | response; 20 | } 21 | 22 | function getPretty() 23 | { 24 | return array_values(array_filter($this->getPhysicalInterfaces(), function($interface) { 25 | return $interface['type'] == 'PON'; 26 | })); 27 | } 28 | 29 | /** 30 | * @param array $filter 31 | * @return $this|AbstractModule 32 | * @throws Exception 33 | */ 34 | public function run($filter = []) 35 | { 36 | return $this; 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/Modules/Sensors/Ping3/PowerSensorState.php: -------------------------------------------------------------------------------- 1 | getOid()); 14 | }, [ 15 | $this->oids->getOidByName('power.sensorState'), 16 | ] 17 | ); 18 | $this->response = $this->formatResponse($this->snmp->get($oids)); 19 | return $this; 20 | } 21 | 22 | public function getPretty() 23 | { 24 | return [ 25 | 'state' => $this->getResponseByName('power.sensorState')->fetchOne()->getParsedValue() 26 | ]; 27 | } 28 | 29 | public function getPrettyFiltered($filter = []) 30 | { 31 | return $this->getPretty(); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /docs/modules_example_output/pon_onts_mac_addr.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "interface": { 5 | "name": "pon0\/0\/2:1", 6 | "parent": 16780800, 7 | "id": 16780801, 8 | "xid": 14, 9 | "type": "ONU", 10 | "onu_num": 1, 11 | "uni": null, 12 | "onu_id": "16780801" 13 | }, 14 | "mac_address": "E0:E8:E6:B9:57:99" 15 | }, 16 | { 17 | "interface": { 18 | "name": "pon0\/0\/2:2", 19 | "parent": 16780800, 20 | "id": 16780802, 21 | "xid": 14, 22 | "type": "ONU", 23 | "onu_num": 2, 24 | "uni": null, 25 | "onu_id": "16780802" 26 | }, 27 | "mac_address": "E0:E8:E6:B9:57:9F" 28 | } 29 | ], 30 | "arguments": [] 31 | } -------------------------------------------------------------------------------- /src/Modules/EltexSwitch/Descriptions.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | 24 | $oid = $this->oids->getOidByName('if.Alias') ; 25 | 26 | $this->response = $this->snmpGetByInterfaces($ifaces, [$oid]); 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Modules/ExtremeXOS/Descriptions.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 20 | } else { 21 | $ifaces = $this->getInterfacesIds(); 22 | } 23 | 24 | $oid = $this->oids->getOidByName('if.Alias') ; 25 | 26 | $this->response = $this->snmpGetByInterfaces($ifaces, [$oid]); 27 | return $this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /configs/oids/dlink/des-3526.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.64.1.2.4.4.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.64.1.2.4.4.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.64.1.2.4.4.1.6, values: {0: Other, 1: Empty, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.64.1.2.4.5.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.64.1.2.4.5.1.5, values: {0: Other, 1: Disabled, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | 7 | - {name: agent.PortUtilizationTx, oid: .1.3.6.1.4.1.171.12.1.1.7.1.2 } 8 | - {name: agent.PortUtilizationRx, oid: .1.3.6.1.4.1.171.12.1.1.7.1.3 } 9 | - {name: agent.PortUtilizationUtil, oid: .1.3.6.1.4.1.171.12.1.1.7.1.4 } 10 | -------------------------------------------------------------------------------- /src/Modules/BDcom/OntReboot.php: -------------------------------------------------------------------------------- 1 | parseInterface($filter['interface']); 30 | $this->console->exec("epon reboot onu interface {$iface['name']}", true, "Are you sure"); 31 | $this->console->exec("y"); 32 | return $this; 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/Modules/ZTE/C300Series/DeregOnt.php: -------------------------------------------------------------------------------- 1 | telnet) { 16 | throw new Exception("Module required telnet connection"); 17 | } 18 | $iface = $this->parseInterface($params['interface']); 19 | $interface = "{$iface['_technology']}-olt_{$iface['_shelf']}/{$iface['_slot']}/{$iface['_port']}"; 20 | $this->exec("conf t"); 21 | $this->exec("interface {$interface}"); 22 | $this->exec("no onu {$iface['_onu']}"); 23 | return $this; 24 | } 25 | 26 | public function getPretty() 27 | { 28 | return true; 29 | } 30 | 31 | public function getPrettyFiltered($filter = []) 32 | { 33 | return true; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /configs/oids/dlink/des-3528.yml: -------------------------------------------------------------------------------- 1 | - {name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.105.1.2.3.1.1.2, values: {1: Cooper, 2: Fiber}} 2 | - {name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.105.1.2.3.1.1.5, values: {2: Up, 3: Down}} 3 | - {name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.105.1.2.3.1.1.6, values: {0: Other, 1: Empty, 2: Down, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 4 | - {name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.105.1.2.3.2.1.4, values: {3: Enabled, 2: Disabled}} 5 | - {name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.105.1.2.3.2.1.5, values: {0: Other, 1: Disabled, 2: Auto, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full}} 6 | 7 | - {name: agent.PortUtilizationTx, oid: .1.3.6.1.4.1.171.12.1.1.7.1.2 } 8 | - {name: agent.PortUtilizationRx, oid: .1.3.6.1.4.1.171.12.1.1.7.1.3 } 9 | - {name: agent.PortUtilizationUtil, oid: .1.3.6.1.4.1.171.12.1.1.7.1.4 } 10 | 11 | -------------------------------------------------------------------------------- /configs/oids/dlink/dgs-3612g.yml: -------------------------------------------------------------------------------- 1 | - { name: dlink.PortInfoMediumType, oid: .1.3.6.1.4.1.171.11.70.9.2.3.1.1.2, values: { 1: Cooper, 2: Fiber } } 2 | - { name: dlink.PortInfoLinkStatus, oid: .1.3.6.1.4.1.171.11.70.9.2.3.1.1.5, values: { 2: Up, 3: Down } } 3 | - { name: dlink.PortInfoNwayStatus, oid: .1.3.6.1.4.1.171.11.70.9.2.3.1.1.6, values: { 4 | 0: Down, 5 | 1: 10-Full, 6 | 2: 10-Full, 7 | 3: 10-Half, 8 | 4: 10-Half, 9 | 5: 100-Full, 10 | 6: 100-Full, 11 | 7: 100-Half, 12 | 8: 100-Half, 13 | 9: 1G-Full, 14 | 10: 1G-Full, 15 | 11: 1G-Half, 16 | 12: 1G-Half, 17 | 13: 10G-Full, 18 | 14: 10G-Full, 19 | 15: 10G-Half, 20 | 16: 10G-Half 21 | } } 22 | - { name: dlink.PortCtrlPortAdminState, oid: .1.3.6.1.4.1.171.11.70.9.2.3.2.1.4, values: { 3: Enabled, 2: Disabled } } 23 | - { name: dlink.PortCtrlPortNwayState, oid: .1.3.6.1.4.1.171.11.70.9.2.3.2.1.5, values: { 1: Other, 2: Enabled, 3: 10-Half, 4: 10-Full, 5: 100-Half, 6: 100-Full, 7: 1G-Half, 8: 1G-Full } } 24 | -------------------------------------------------------------------------------- /src/Modules/BDcom/PonPortsList.php: -------------------------------------------------------------------------------- 1 | response; 21 | } 22 | 23 | function getPretty() 24 | { 25 | return array_map(function($e){ 26 | if(!isset($e['pontype'])) { 27 | $e['pontype'] = null; 28 | } 29 | return $e; 30 | },$this->getPhysicalInterfaces()); 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | return $this; 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/Modules/VsolOlts/GPONV1600/InterfacesList.php: -------------------------------------------------------------------------------- 1 | response; 24 | } 25 | 26 | function getPrettyFiltered($filter = [], $fromCache = false) 27 | { 28 | $data = $this->getPretty(); 29 | return $data; 30 | } 31 | 32 | function getPretty() 33 | { 34 | return $this->response; 35 | } 36 | 37 | 38 | public function run($filter = []) 39 | { 40 | //$this->response = $this->getInterfaces(); 41 | $this->response = $this->getPhysicalInterfaces(); 42 | return $this; 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/Modules/Arista/Counters.php: -------------------------------------------------------------------------------- 1 | oids->getOidByName('if.HCInOctets')->getOid(), 14 | $this->oids->getOidByName('if.HCOutOctets')->getOid(), 15 | ]; 16 | 17 | if($params['interface']) { 18 | $interface = $this->parseInterface($params['interface']); 19 | foreach ($oids as $num=>$oid) { 20 | $oids[$num] .= ".{$interface['_snmp_id']}"; 21 | } 22 | } 23 | 24 | $oidObjects = []; 25 | foreach ($oids as $oid) { 26 | $oidObjects[] = Oid::init($oid); 27 | } 28 | 29 | $this->response = $this->formatResponse($this->snmp->walk($oidObjects)); 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Modules/BDcom/GP3600/PonPortsList.php: -------------------------------------------------------------------------------- 1 | response; 21 | } 22 | 23 | function getPretty() 24 | { 25 | return array_map(function($e){ 26 | if(!isset($e['pontype'])) { 27 | $e['pontype'] = null; 28 | } 29 | return $e; 30 | },$this->getPhysicalInterfaces()); 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | return $this; 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/Modules/BDcom/GP3600/PortDescriptionControl.php: -------------------------------------------------------------------------------- 1 | parseInterface($params['interface']); 11 | 12 | if ($interface['type'] == 'ONU') { 13 | throw new \InvalidArgumentException("ONU not allowed, just physical ports"); 14 | } 15 | 16 | $description = str_replace(' ', '_', $params['description']); 17 | $this->checkSnmpRespError($this->snmp->set( 18 | Oid::init($this->oids->getOidByName('if.Alias')->getOid() . ".{$interface['xid']}") 19 | ->setType('StringValue') 20 | ->setValue($description) 21 | )); 22 | 23 | $this->response = true; 24 | return $this; 25 | } 26 | 27 | function getPretty() 28 | { 29 | return $this->response; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Modules/BDcom/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/CData/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/GCOM/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/BDcom/GP3600/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/VsolOlts/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/Dlink/SpeedPortControl.php: -------------------------------------------------------------------------------- 1 | getModule('link_info')->run(['interface' => $params['interface']])->getPrettyFiltered(['interface' => $params['interface']]); 17 | $interface = $this->parseInterface($params['interface']); 18 | if(count($interfaces) > 1) { 19 | return "config ports {$interface['_key']} speed {$this->getRevertSpeed($params['speed'])} && 20 | config ports {$interface['_key']} medium_type fiber speed {$this->getRevertSpeed($params['speed'])} 21 | "; 22 | } 23 | return "config ports {$interface['_key']} speed {$this->getRevertSpeed($params['speed'])}"; 24 | } 25 | } -------------------------------------------------------------------------------- /src/Modules/HuaweiOLT/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/VsolOlts/GPONV1600/PortDescriptionControl.php: -------------------------------------------------------------------------------- 1 | parseInterface($params['interface']); 12 | 13 | if ($interface['type'] == 'ONU') { 14 | throw new \InvalidArgumentException("ONU not allowed, just physical interfaces"); 15 | } 16 | $description = str_replace(' ', '_', $params['description']); 17 | $this->checkSnmpRespError($this->snmp->set( 18 | Oid::init($this->oids->getOidByName('if.Alias')->getOid() . ".{$interface['xid']}") 19 | ->setType('StringValue') 20 | ->setValue($description) 21 | )); 22 | 23 | $this->response = true; 24 | return $this; 25 | } 26 | 27 | function getPretty() 28 | { 29 | return $this->response; 30 | } 31 | } -------------------------------------------------------------------------------- /src/Switcher/Console/ConsoleInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/Modules/ZTE/C600Series/PonPortsList.php: -------------------------------------------------------------------------------- 1 | getModule('card_list')->run()->getPretty(); 17 | foreach ($cards as $card) { 18 | if(!$card['technology']) continue; 19 | for($port = 1; $port <= $card['num_ports']; $port++) { 20 | $response[] = $this->parseInterface("{$card['technology']}-olt_{$card['shelf']}/{$card['slot']}/{$port}"); 21 | } 22 | } 23 | $this->response = $response; 24 | return $this; 25 | } 26 | public function getPretty() 27 | { 28 | return $this->response; 29 | } 30 | 31 | public function getPrettyFiltered($filter = []) 32 | { 33 | return $this->response; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/Modules/CData/FD16xxV3/ParseInterface.php: -------------------------------------------------------------------------------- 1 | response; 26 | } 27 | 28 | function getPretty() 29 | { 30 | return $this->response; 31 | } 32 | 33 | /** 34 | * @param array $filter 35 | * @return $this|AbstractModule 36 | * @throws Exception 37 | */ 38 | public function run($filter = []) 39 | { 40 | $this->response = $this->parseInterface($filter['interface']); 41 | return $this; 42 | } 43 | } 44 | 45 | --------------------------------------------------------------------------------