fix: vyos discovery fix #4486

fix: vyos discovery fix #4486
This commit is contained in:
Neil Lathwood
2016-09-19 16:09:02 +01:00
committed by GitHub
4 changed files with 23 additions and 12 deletions
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^EdgeOS/', $sysDescr)) {
$os = 'edgeos';
}
if (starts_with($sysDescr, 'EdgeOS')) {
$os = 'edgeos';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os) {
if (preg_match('/^Vyatta/', $sysDescr)) {
$os = 'vyatta';
}
if (starts_with($sysDescr, 'Vyatta') && !str_contains($sysDescr, 'VyOS')) {
$os = 'vyatta';
}
+2 -4
View File
@@ -1,7 +1,5 @@
<?php
if (!$os || $os == 'vyatta') {
if (preg_match('/^Vyatta VyOS/', $sysDescr) || preg_match('/^VyOS/i', $sysDescr)) {
$os = 'vyos';
}
if (starts_with($sysDescr, 'Vyatta VyOS') || starts_with($sysDescr, 'VyOS', true)) {
$os = 'vyos';
}
+17
View File
@@ -126,6 +126,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('eatonups', 'Eaton 5PX 2000');
}
public function testEdgeos()
{
$this->checkOS('edgeos', 'EdgeOS');
}
public function testEndian()
{
$this->checkOS('endian', 'Linux endian');
@@ -210,6 +215,18 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('unifi', 'Linux', '.1.3.6.1.4.1.10002.1', $mockSnmp);
}
public function testVyatta()
{
$this->checkOS('vyatta', 'Vyatta');
}
public function testVyos()
{
$this->checkOS('vyos', 'Vyatta VyOS');
$this->checkOS('vyos', 'VyOS');
$this->checkOS('vyos', 'vyos');
}
public function testZxr10()
{
$this->checkOS('zxr10', 'ZTE Ethernet Switch ZXR10 5250-52TM-H, Version: V2.05.11B23');