From 67362e0124cd322796cb7f799849b69441d41f97 Mon Sep 17 00:00:00 2001 From: Neil Lathwood Date: Wed, 28 Dec 2016 22:34:21 +0000 Subject: [PATCH] newdevice: Added support for DCN switches #5031 (#5238) --- html/images/os/dcn.png | Bin 0 -> 441 bytes includes/definitions/dcn-software.yaml | 8 +++++ includes/discovery/os/dcn-software.inc.php | 34 +++++++++++++++++++++ includes/polling/os/dcn-software.inc.php | 30 ++++++++++++++++++ tests/OSDiscoveryTest.php | 5 +++ tests/snmpsim/dcn-software.snmprec | 2 ++ 6 files changed, 79 insertions(+) create mode 100644 html/images/os/dcn.png create mode 100644 includes/definitions/dcn-software.yaml create mode 100644 includes/discovery/os/dcn-software.inc.php create mode 100644 includes/polling/os/dcn-software.inc.php create mode 100644 tests/snmpsim/dcn-software.snmprec diff --git a/html/images/os/dcn.png b/html/images/os/dcn.png new file mode 100644 index 0000000000000000000000000000000000000000..7d89f9e8fcd1bf8edf9f1069e4b4d5742b4a3e9f GIT binary patch literal 441 zcmV;q0Y?6bP)1ES`(d%=zVfC{c0#hoCyQQRr0JHc=86Wog8FDNK!E4Z7Ay3mCy zb+ChVyh)QW)0vUkxygY;)0=aXlhaVgv9PePu(0@V#D0(?zfC4ZEsy-*HS*cviQ^0i zt$1<|j&Sb1+@py-Z%x$UI5X;bOkhv%$-Q7z)ju6MpkY&!du%>-*=$7EGA@>?+CgC! z_DyZ%!zs?q3BBeu8K03_8fKNgcOtqq8|zYS2>XgTe2DpT9b04B79dp!S|2wym1yL}npDgpcy^&)}r z!_?mPk${MuyAxApZ$yKJ8h09qJ+_Xu6}&XtxbcIE?p%F>v$i|n!A0W3n$#q{~-$t3k!=My(L+El}Be_00000NkvXXu0mjfwyVy; literal 0 HcmV?d00001 diff --git a/includes/definitions/dcn-software.yaml b/includes/definitions/dcn-software.yaml new file mode 100644 index 0000000000..4dd4b75a46 --- /dev/null +++ b/includes/definitions/dcn-software.yaml @@ -0,0 +1,8 @@ +os: dcn-software +text: 'Digital China Networks' +type: network +icon: dcn +over: + - { graph: device_bits, text: 'Device Traffic' } + - { graph: device_processor, text: 'Processor Usage' } + - { graph: device_mempool, text: 'Memory Usage' } diff --git a/includes/discovery/os/dcn-software.inc.php b/includes/discovery/os/dcn-software.inc.php new file mode 100644 index 0000000000..e0066dab0e --- /dev/null +++ b/includes/discovery/os/dcn-software.inc.php @@ -0,0 +1,34 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +$dcn_oids = array( + '.1.3.6.1.4.1.6339.1.1.1.280', +); + +if (starts_with($sysObjectId, $dcn_oids)) { + $os = 'dcn-software'; +} + +unset($dcn_oids); diff --git a/includes/polling/os/dcn-software.inc.php b/includes/polling/os/dcn-software.inc.php new file mode 100644 index 0000000000..13aa5faa58 --- /dev/null +++ b/includes/polling/os/dcn-software.inc.php @@ -0,0 +1,30 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Neil Lathwood + * @author Neil Lathwood + */ + +preg_match('/([\w-]+) Device, .* SoftWare Version ([\w\.\(\)]+) .* Serial No.:([\w]+) .*/', $poll_device['sysDescr'], $match); + +$hardware = $match[1]; +$version = $match[2]; +$serial = $match[3]; diff --git a/tests/OSDiscoveryTest.php b/tests/OSDiscoveryTest.php index 63dcc39809..0ade9a7341 100644 --- a/tests/OSDiscoveryTest.php +++ b/tests/OSDiscoveryTest.php @@ -393,6 +393,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase $this->checkOS('datadomain'); } + public function testDcnSoftware() + { + $this->checkOS('dcn-software'); + } + public function testDdnos() { $this->checkOS('ddnos'); diff --git a/tests/snmpsim/dcn-software.snmprec b/tests/snmpsim/dcn-software.snmprec new file mode 100644 index 0000000000..4fd010679e --- /dev/null +++ b/tests/snmpsim/dcn-software.snmprec @@ -0,0 +1,2 @@ +1.3.6.1.2.1.1.1.0|4|S4600-52P-SI Device, Compiled Jun 06 16:24:54 2016 SoftWare Version 7.0.3.5(R0241.0101) BootRom Version 7.2.16 HardWare Version 1.0.1 Serial No.:SW045010FB16000330 Copyright (C) 2001-2016 by Digital China Networks Limited. All rights reserved +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.6339.1.1.1.280