Capture OSPF test data (#12215)

This commit is contained in:
Tony Murray
2020-10-19 09:35:41 -05:00
committed by GitHub
parent fd2c1361ef
commit a0f91de9b2
4 changed files with 19 additions and 10 deletions

View File

@ -31,7 +31,6 @@ use LibreNMS\Component;
use LibreNMS\Config;
use LibreNMS\Exceptions\FileNotFoundException;
use LibreNMS\Exceptions\InvalidModuleException;
use LibreNMS\OS;
use Symfony\Component\Yaml\Yaml;
class ModuleTestHelper
@ -62,6 +61,7 @@ class ModuleTestHelper
'vrf' => ['ports', 'vrf'],
'mpls' => ['ports', 'vrf', 'mpls'],
'nac' => ['ports', 'nac'],
'ospf' => ['ports', 'ospf'],
'cisco-mac-accounting' => ['ports', 'cisco-mac-accounting'],
];

View File

@ -1,6 +1,5 @@
<?php
use App\Models\Device;
use App\Models\Ipv4Address;
use App\Models\OspfArea;
use App\Models\OspfInstance;
@ -8,13 +7,10 @@ use App\Models\OspfNbr;
use App\Models\OspfPort;
use LibreNMS\RRD\RrdDefinition;
$device_model = Device::find($device['device_id']);
if (key_exists('vrf_lite_cisco', $device) && ($device['vrf_lite_cisco'] != '')) {
$vrfs_lite_cisco = $device['vrf_lite_cisco'];
} else {
$vrfs_lite_cisco = [['context_name' => null]];
}
$device_model = DeviceCache::getPrimary();
$vrfs_lite_cisco = empty($device['vrf_lite_cisco'])
? [['context_name' => null]]
: $device['vrf_lite_cisco'];
foreach ($vrfs_lite_cisco as $vrf_lite) {
$device['context_name'] = $vrf_lite['context_name'];

View File

@ -391,9 +391,11 @@ function snmp_walk($device, $oid, $options = null, $mib = null, $mibdir = null)
$data = str_replace('"', '', $data);
$data = str_replace('End of MIB', '', $data);
if (is_string($data) && (preg_match('/No Such (Object|Instance)/i', $data) || preg_match('/Wrong Type(.*)should be/', $data))) {
if (is_string($data) && preg_match('/No Such (Object|Instance)/i', $data)) {
d_echo('Invalid snmp_walk() data = ' . print_r($data, true));
$data = false;
} elseif (preg_match('/Wrong Type(.*)should be/', $data)) {
$data = preg_replace('/Wrong Type \(should be .*\): /', '', $data);
} else {
if (Str::endsWith($data, '(It is past the end of the MIB tree)')) {
$no_more_pattern = '/.*No more variables left in this MIB View \(It is past the end of the MIB tree\)[\n]?/';

View File

@ -57,6 +57,17 @@ mpls:
joins:
- { left: mpls_saps.svc_id, right: mpls_services.svc_id, select: [mpls_services.svc_oid] }
order_by: mpls_services.svc_oid, mpls_saps.sapPortId, mpls_saps.sapEncapValue
ospf:
ospf_ports:
excluded_fields: [id, device_id, port_id]
joins:
- { left: ospf_ports.port_id, right: ports.port_id, select: [ ifIndex ] }
ospf_instances:
excluded_fields: [id, device_id]
ospf_areas:
excluded_fields: [id, device_id]
ospf_nbrs:
excluded_fields: [id, device_id]
ports:
ports:
excluded_fields: [device_id, port_id, poll_time, poll_period, ifVrf]