newdevice: Added Coriant support (#6026)

* Added Coriant TNMS MIB and MEF (Metro Ethernet Forum) MIB

* Coriant Logo

* Added Basic Librenms Support and MEF support

* Forgot snmpsim

* Better like this

* Spaces !

* Renamed sql file

* Space

* Fix spaces

* svgo optimized logo

* Removed modules that are by default to 0

* Added sysDescr as requested

* Fix conflict file

* Setting right severity id in the discovery log_event()

* Since MEF-EVC can be used on other devices than Coriant's one, lets this be used by the poller/discovery itself

* Fixed spaces

* Rename 173.sql to 174.sql

* Moved logo from os/  to logos/
Addd Icon

* Fix name

* minimize file

* Change l/w to viewbox and minify

* Renamed mef-evc to mef on request from @laf

* Rename 174.sql to 175.sql
This commit is contained in:
Xavier Beaudouin 2017-03-11 14:30:31 +01:00 committed by Tony Murray
parent 872eb225dd
commit fa29839d36
16 changed files with 20313 additions and 0 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 549 158.07011"><path fill="#00467f" d="M79 30.334l16-11.667S84.333 0 56.333 0 0 21.667 0 57.667 29 113 58.667 113s39-19.667 39-19.667L81 81s-8.666 13-23.333 13C43 94 22.334 84 22.334 56.5s21-36.5 34-36.5S79 30.335 79 30.335zM139.667 35s-40.333 1.334-40.333 39.334S138 113 138 113s41.667-2 41.667-39-40-39-40-39zm-.167 58.764c-11.414 0-20.667-9.254-20.667-20.667 0-11.414 9.253-20.667 20.667-20.667 11.414 0 20.667 9.253 20.667 20.667 0 11.413-9.253 20.667-20.667 20.667zm65.833 16.904h-20V37.334h20v10s9.333-17.333 28.333-10c.333 7.333 0 18 0 18s-22.667-7.667-28 13.333c0 8.334-.333 42-.333 42zm37-73H263v73h-20.667zm0-27.667H263v20h-20.667zM364.667 110.67h-19.333v-73h19.333V46s4.667-11 20-11 27.667 11 27.667 23.334v52.333h-20V67s0-14-13.5-14C370.334 53 365 63 365 68.333s-.333 42.335-.333 42.335zM431.334 55H417V37.67h14.334V17h20V37.67h12.333L472 55h-20.333V89.67s1 7 9.667 5l8.666-2 2 16s-8.666 8-29.333 2C430.334 105.668 431 92 431 82s.334-27 .334-27z"/><circle cx="491.833" cy="101.834" r="13.167" fill="#00467f"/><path fill="#008c99" d="M487.334 64.95l-8.667-18.283s60-14.333 70.333 55.167c0 59.5-80 79.833-109.666 21.166 14 3.667 25.333 1.667 25.333 1.667s8.334 13 27.167 12.333c18.833-.666 35.833-12 35.833-33.666 0-21.667-16-37.768-40.333-38.384z"/><path fill="#00467f" d="M335.667 58.334C334.334 45.667 324 35 304 35s-31.333 13-31.333 13l10.667 10.334S291 51 304.667 51c13.667 0 14 13.334 14 13.334h-16.204c-14.537 0-33.796 8-33.796 23.667 0 15.668 12.333 24 26 25S318 103.335 318 103.335v7.334h17.667s1.333-39.667 0-52.334zm-19 28.333S314 97.334 302.463 97.334C294 97.334 289 94 289 88.667S298.334 78 306.667 78.334c8.333.333 10 0 10 0z"/></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.666 112.625"><circle r="13.167" cy="56.389" cx="52.499" fill="#00467f"/><path d="M48 19.505L39.333 1.222s60-14.333 70.333 55.167c0 59.5-80 79.832-109.666 21.165 14 3.667 25.333 1.667 25.333 1.667s8.334 13 27.167 12.333c18.833-.666 35.833-12 35.833-33.666 0-21.668-16-37.77-40.333-38.385z" fill="#008c99"/></svg>

After

Width:  |  Height:  |  Size: 369 B

View File

@ -0,0 +1,23 @@
<?php
echo '<tr class="list">';
echo '<td class="list">';
echo $mef['mefIdent'];
echo '</td>';
echo '<td class="list">'. $mef['mefType'] . '</td>';
echo '<td class="list">'. $mef['mefMTU'] . '</td>';
echo '<td class="list">';
if ($mef['mefAdmState'] == 'unlocked') {
echo '<i class="fa fa-unlock fa-lg icon-theme" aria-hidden="true" style="color:green"></i>';
} else {
echo '<i class="fa fa-lock fa-lg icon-theme" aria-hidden="true" style="color:red"></i>';
}
echo '</td>';
if ($mef['mefRowState'] == 'active') {
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-success">active</span></td>';
} else {
echo '<td class="list"><span style="min-width:40px; display:inline-block;" class="label label-default">'.$mef['mefRowState'].'</span></td>';
}
echo '</tr>';

View File

@ -164,6 +164,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
</a>
</li>';
}
if (@dbFetchCell("SELECT COUNT(id) FROM mefinfo WHERE device_id = '".$device['device_id']."'") > '0') {
echo '<li class="'.$select['mef'].'">
<a href="'.generate_device_url($device, array('tab' => 'mef')).'">
<i class="fa fa-link fa-lg icon-theme" aria-hidden="true"></i> Metro Ethernet
</a>
</li>';
}
// $loadbalancer_tabs is used in device/loadbalancer/ to build the submenu. we do it here to save queries
if ($device['os'] == 'netscaler') {

View File

@ -0,0 +1,11 @@
<?php
$pagetitle[] = 'Metro Ethernet';
echo '<table border="0" cellspacing="0" cellpadding="5" width="100%" class="table table-condensed"><tr class="tablehead"><th>Link</th><th>Type</th><th>MTU</th><th>Admin State</th><th>Row State</th></tr>';
$i = '1';
foreach (dbFetchRows('SELECT `mefIdent`,`mefType`,`mefMTU`,`mefAdmState`,`mefRowState` FROM `mefinfo` WHERE `device_id` = ? ORDER BY `mefID`', array($device['device_id'])) as $mef) {
include 'includes/print-mef.inc.php';
$i++;
}
echo '</table>';

View File

@ -712,6 +712,7 @@ $config['poller_modules']['stp'] = 1;
$config['poller_modules']['ntp'] = 1;
$config['poller_modules']['services'] = 1;
$config['poller_modules']['loadbalancers'] = 0;
$config['poller_modules']['mef'] = 0;
// List of discovery modules. Need to be in this array to be
// considered for execution.
@ -749,6 +750,7 @@ $config['discovery_modules']['services'] = 1;
$config['discovery_modules']['stp'] = 1;
$config['discovery_modules']['ntp'] = 1;
$config['discovery_modules']['loadbalancers'] = 0;
$config['discovery_modules']['mef'] = 0;
$config['modules_compat']['rfc1628']['liebert'] = 1;
$config['modules_compat']['rfc1628']['netmanplus'] = 1;

View File

@ -0,0 +1,39 @@
os: coriant
text: 'Coriant TNMS'
type: network
icon: coriant
discovery_modules:
ntp: 0
ospf: 0
stp: 0
ucd-diskio: 0
ucd-mib: 0
ipmi: 0
bgp-peers: 0
services: 0
vlans: 0
arp-table: 0
mef-evc: 1
cisco-vrf-lite: 0
storage: 0
poller_modules:
ntp: 0
ospf: 0
stp: 0
ucd-diskio: 0
ucd-mib: 0
ipmi: 0
bgp-peers: 0
services: 0
libvirt-vminfo: 0
vmware-vminfo: 0
vlans: 0
arp-table: 0
mef-evc: 1
cisco-vrf-lite: 0
storage: 0
discovery:
- sysObjectId:
- .1.3.6.1.4.1.42229.6.22
register_mibs:
mefServiceEvcCfgTable: MEF-UNI-EVC-MIB

View File

@ -0,0 +1,70 @@
<?php
/*
* Try to discover any MEF Links
*/
/*
* Variable to hold the discovered MEF Links.
*/
$mef_list = array();
/*
* Fetch information about MEF Links.
*/
$oids = snmpwalk_cache_multi_oid($device, 'MefServiceEvcCfgEntry', $oids, 'MEF-UNI-EVC-MIB');
echo "MEF : ";
foreach ($oids as $index => $entry) {
$mefIdent = $entry['mefServiceEvcCfgIdentifier'];
$mefType = $entry['mefServiceEvcCfgServiceType'];
$mefMtu = $entry['mefServiceEvcCfgMtuSize'];
$mefAdmState = $entry['mefServiceEvcCfgAdminState'];
$mefRowState = $entry['mefServiceEvcCfgRowStatus'];
/*
* Coriant MEF-EVC is quite strange, MTU is sometime set to 0 setting it to "strange" default value
* According to Coriant this should be fixed in Nov 2017.
*/
if (($mefMtu == 0) && ($device['os'] == 'coriant')) {
$mefMtu = 1600;
}
/*
* Check if the MEF is already known for this host
*/
if (dbFetchCell("SELECT COUNT(id) FROM `mefinfo` WHERE `device_id` = ? AND `mefID` = ?", array($device['device_id'], $index)) == 0) {
$mefid = dbInsert(array('device_id' => $device['device_id'], 'mefID' => $index, 'mefType' => mres($mefType), 'mefIdent' => mres($mefIdent), 'mefMTU' => mres($mefMtu), 'mefAdmState' => mres($mefAdmState), 'mefRowState' => mres($mefRowState)), 'mefinfo');
log_event("MEF link: ". mres($mefIdent) . " (" . $index . ") Discovered", $device, 'system', 2);
echo '+';
} else {
echo '.';
}
/*
* Save the discovered MEF Link
*/
$mef_list[] = $index;
}
/*
* Get a list of all the known MEF Links for this host
*/
$sql = "SELECT id, mefID, mefIdent FROM mefinfo WHERE device_id = '".$device['device_id']."'";
foreach (dbFetchRows($sql) as $db_mef) {
/*
* Delete the MEF Link that are removed from the host.
*/
if (!in_array($db_mef['mefID'], $mef_list)) {
dbDelete('mefinfo', '`id` = ?', array($db_mef['id']));
log_event("MEF link: ".mres($db_mef['mefIdent']).' Removed', $device, 'system', 3);
echo '-';
}
}
/*
* Finished MEF information
*/
unset($mef_list, $oids, $db_mef);
echo PHP_EOL;

View File

@ -0,0 +1,51 @@
<?php
echo 'MEF Links: ';
/*
* Get a list of all the known MEF Links for this host.
*/
$db_info_list = dbFetchRows('SELECT id, mefID, mefType, mefIdent, mefMTU, mefAdmState, mefRowState FROM mefinfo WHERE device_id = ?', array($device['device_id']));
$current_mefinfo = snmpwalk_cache_multi_oid($device, 'MefServiceEvcCfgEntry', array(), 'MEF-UNI-EVC-MIB');
foreach ($db_info_list as $db_info) {
$mef_info = array();
$mef_info['mefType'] = $current_mefinfo[$db_info['mefID']]['mefServiceEvcCfgServiceType'];
$mef_info['mefIdent'] = $current_mefinfo[$db_info['mefID']]['mefServiceEvcCfgIdentifier'];
$mef_info['mefMTU'] = $current_mefinfo[$db_info['mefID']]['mefServiceEvcCfgMtuSize'];
$mef_info['mefAdmState'] = $current_mefinfo[$db_info['mefID']]['mefServiceEvcCfgAdminState'];
$mef_info['mefRowState'] = $current_mefinfo[$db_info['mefID']]['mefServiceEvcCfgRowStatus'];
/*
* Coriant MEF-EVC is quite strange, MTU is sometime set to 0 so we can set it into 1600 instead
* According to Coriant this should be fixed in Nov 2017
*/
if (($mef_info['mefMTU'] == 0) && ($device['os'] == 'coriant')) {
$mef_info['mefMTU'] = 1600;
}
/*
* Process all the MEF properties.
*/
foreach ($mef_info as $property => $value) {
/*
* Check the property for any modifications.
*/
if ($mef_info[$property] != $db_info[$property]) {
// FIXME - this should loop building a query and then run the query after the loop (bad geert!)
dbUpdate(array($property => mres($mef_info[$property])), 'mefinfo', '`id` = ?', array($db_info['id']));
if ($db_info['mefIdent'] != null) {
log_event("MEF Link : ".mres($db_info['mefIdent']) . ' (' . preg_replace('/^mef/', '', mres($db_info[$property])) . ') -> ' . $mef_info[$property], $device);
}
}
}
}//end foreach
/*
* Finished discovering MEF Links information.
*/
unset($db_info_list,$current_mefinfo);
echo PHP_EOL;

178
mibs/ENTITY-STATE-TC-MIB Executable file
View File

@ -0,0 +1,178 @@
ENTITY-STATE-TC-MIB DEFINITIONS ::= BEGIN
IMPORTS
MODULE-IDENTITY, mib-2 FROM SNMPv2-SMI
TEXTUAL-CONVENTION FROM SNMPv2-TC;
entityStateTc MODULE-IDENTITY
LAST-UPDATED "200511220000Z"
ORGANIZATION "IETF Entity MIB Working Group"
CONTACT-INFO
"General Discussion: entmib@ietf.org
To Subscribe:
http://www.ietf.org/mailman/listinfo/entmib
http://www.ietf.org/html.charters/entmib-charter.html
Sharon Chisholm
Nortel Networks
PO Box 3511 Station C
Ottawa, Ont. K1Y 4H7
Canada
schishol@nortel.com
David T. Perkins
548 Qualbrook Ct
San Jose, CA 95110
USA
Phone: 408 394-8702
dperkins@snmpinfo.com"
DESCRIPTION
"This MIB defines state textual conventions.
Copyright (C) The Internet Society 2005. This version
of this MIB module is part of RFC 4268; see the RFC
itself for full legal notices."
REVISION "200511220000Z"
DESCRIPTION
"Initial version, published as RFC 4268."
::= { mib-2 130 }
EntityAdminState ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
" Represents the various possible administrative states.
A value of 'locked' means the resource is administratively
prohibited from use. A value of 'shuttingDown' means that
usage is administratively limited to current instances of
use. A value of 'unlocked' means the resource is not
administratively prohibited from use. A value of
'unknown' means that this resource is unable to
report administrative state."
SYNTAX INTEGER
{
unknown (1),
locked (2),
shuttingDown (3),
unlocked (4)
}
EntityOperState ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
" Represents the possible values of operational states.
A value of 'disabled' means the resource is totally
inoperable. A value of 'enabled' means the resource
is partially or fully operable. A value of 'testing'
means the resource is currently being tested
and cannot therefore report whether it is operational
or not. A value of 'unknown' means that this
resource is unable to report operational state."
SYNTAX INTEGER
{
unknown (1),
disabled (2),
enabled (3),
testing (4)
}
EntityUsageState ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
" Represents the possible values of usage states.
A value of 'idle' means the resource is servicing no
users. A value of 'active' means the resource is
currently in use and it has sufficient spare capacity
to provide for additional users. A value of 'busy'
means the resource is currently in use, but it
currently has no spare capacity to provide for
additional users. A value of 'unknown' means
that this resource is unable to report usage state."
SYNTAX INTEGER
{
unknown (1),
idle (2),
active (3),
busy (4)
}
EntityAlarmStatus ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
" Represents the possible values of alarm status.
An Alarm [RFC3877] is a persistent indication
of an error or warning condition.
When no bits of this attribute are set, then no active
alarms are known against this entity and it is not under
repair.
When the 'value of underRepair' is set, the resource is
currently being repaired, which, depending on the
implementation, may make the other values in this bit
string not meaningful.
When the value of 'critical' is set, one or more critical
alarms are active against the resource. When the value
of 'major' is set, one or more major alarms are active
against the resource. When the value of 'minor' is set,
one or more minor alarms are active against the resource.
When the value of 'warning' is set, one or more warning
alarms are active against the resource. When the value
of 'indeterminate' is set, one or more alarms of whose
perceived severity cannot be determined are active
against this resource.
A value of 'unknown' means that this resource is
unable to report alarm state."
SYNTAX BITS
{
unknown (0),
underRepair (1),
critical(2),
major(3),
minor(4),
-- The following are not defined in X.733
warning (5),
indeterminate (6)
}
EntityStandbyStatus ::= TEXTUAL-CONVENTION
STATUS current
DESCRIPTION
" Represents the possible values of standby status.
A value of 'hotStandby' means the resource is not
providing service, but it will be immediately able to
take over the role of the resource to be backed up,
without the need for initialization activity, and will
contain the same information as the resource to be
backed up. A value of 'coldStandy' means that the
resource is to back up another resource, but will not
be immediately able to take over the role of a resource
to be backed up, and will require some initialization
activity. A value of 'providingService' means the
resource is providing service. A value of
'unknown' means that this resource is unable to
report standby state."
SYNTAX INTEGER
{
unknown (1),
hotStandby (2),
coldStandby (3),
providingService (4)
}
END

3043
mibs/MEF-UNI-EVC-MIB Executable file

File diff suppressed because it is too large Load Diff

3356
mibs/RFC1271-MIB Executable file

File diff suppressed because it is too large Load Diff

13522
mibs/TNMS-NBI-MIB Normal file

File diff suppressed because it is too large Load Diff

1
sql-schema/175.sql Normal file
View File

@ -0,0 +1 @@
CREATE TABLE IF NOT EXISTS `mefinfo` ( `id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `mefID` int(32) NOT NULL, `mefType` varchar(128) NOT NULL, `mefIdent` varchar(128) NOT NULL, `mefMTU` int(16) NOT NULL DEFAULT '1500', `mefAdmState` varchar(128) NOT NULL, `mefRowState` varchar(128) NOT NULL, PRIMARY KEY (`id`), KEY `device_id` (`device_id`), KEY `mefID` (`mefID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -459,6 +459,11 @@ class DiscoveryTest extends \PHPUnit_Framework_TestCase
$this->checkOS('comware', 'comware-hp-c1234');
}
public function testCoriant()
{
$this->checkOS('coriant');
}
public function testCtcu()
{
$this->checkOS('ctcu');

View File

@ -0,0 +1,2 @@
1.3.6.1.2.1.1.1.0|4|Linux version 3.10.0-327.el7.x86_64
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.42229.6.22