newdevice: Added support for Axis network video encoder #4395 (#4400)

* newdevice: Added support for Axis network video encoder #4395

* Merge the preg_match

* Add Network Camera test

Couldn't find one for "Video Server"
This commit is contained in:
Neil Lathwood 2016-09-12 18:19:24 +01:00 committed by Tony Murray
parent 9e85f24b00
commit a710c4a33c
3 changed files with 41 additions and 16 deletions

View File

@ -1,11 +1,7 @@
<?php
if (!$os) {
if (preg_match('/AXIS .* Network Camera/', $sysDescr)) {
$os = 'axiscam';
}
if (preg_match('/AXIS .* Video Server/', $sysDescr)) {
if (preg_match('/AXIS .* (Network Camera|Video Server|Network Video Encoder)/', $sysDescr)) {
$os = 'axiscam';
}
}

View File

@ -0,0 +1,23 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$data = explode('; ', $poll_device['sysDescr']);
if (isset($data[1])) {
$hardware = $data[1];
}
if (isset($data[3])) {
$version = $data[3];
}

View File

@ -29,17 +29,6 @@ include 'tests/mocks/mock.snmp.inc.php';
class DiscoveryTest extends \PHPUnit_Framework_TestCase
{
public function testAiros()
{
$this->checkOS('airos', 'Linux', '.1.3.6.1.4.1.10002.1');
$this->checkOS('airos', 'Linux', '.1.3.6.1.4.1.41112.1.4');
$mockSnmp = array(
'dot11manufacturerName.5' => 'Ubiquiti',
);
$this->checkOS('airos', 'Linux', '', $mockSnmp);
}
/**
* Set up variables and include os discovery
*
@ -67,6 +56,17 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedOS, $os);
}
public function testAiros()
{
$this->checkOS('airos', 'Linux', '.1.3.6.1.4.1.10002.1');
$this->checkOS('airos', 'Linux', '.1.3.6.1.4.1.41112.1.4');
$mockSnmp = array(
'dot11manufacturerName.5' => 'Ubiquiti',
);
$this->checkOS('airos', 'Linux', '', $mockSnmp);
}
public function testAirosAf()
{
$mockSnmp = array(
@ -75,6 +75,12 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('airos-af', 'Linux', '.1.3.6.1.4.1.10002.1', $mockSnmp);
}
public function testAxiscam()
{
$this->checkOS('axiscam', ' ; AXIS 221; Network Camera; 4.30; Nov 29 2005 11:18; 141; 1;');
$this->checkOS('axiscam', ' ; AXIS M7011; Network Video Encoder; 5.75.1; Mar 04 2015 10:10; 1FC; 1;');
}
public function testCiscosmblinux()
{
$this->checkOS('ciscosmblinux', 'Linux Cisco Small Business');