mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Modified SQL delete statement for vrf is null (#13199)
* Modified SQL delete for is NULL instead of = null * Fixed spacing * Fixed more spacing issues * Replaced double quotes with single quotes for echo statement * Fixed more spacing issues * Modified null vrf db check to match vrp.inc.php * Clean up comments * Modified git username to fix CLA * Revert bgp-peers.inc.php Co-authored-by: Kate Robinson <katerobinson@KateRobinson-imac.local> Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -43,6 +43,7 @@ if (Config::get('enable_bgp')) {
|
||||
|
||||
foreach ($bgpPeers as $vrfOid => $vrf) {
|
||||
$vrfId = dbFetchCell('SELECT vrf_id from `vrfs` WHERE vrf_oid = ?', [$vrfOid]);
|
||||
d_echo($vrfId);
|
||||
foreach ($vrf as $address => $value) {
|
||||
$astext = get_astext($value['tBgpPeerNgPeerAS4Byte']);
|
||||
|
||||
@@ -80,11 +81,15 @@ if (Config::get('enable_bgp')) {
|
||||
$peers = dbFetchRows('SELECT `B`.`vrf_id` AS `vrf_id`, `bgpPeerIdentifier`, `vrf_oid` FROM `bgpPeers` AS B LEFT JOIN `vrfs` AS V ON `B`.`vrf_id` = `V`.`vrf_id` WHERE `B`.`device_id` = ?', [$device['device_id']]);
|
||||
foreach ($peers as $value) {
|
||||
$vrfId = $value['vrf_id'];
|
||||
$checkVrf = ' AND vrf_id = ? ';
|
||||
if (empty($vrfId)) {
|
||||
$checkVrf = ' AND `vrf_id` IS NULL ';
|
||||
}
|
||||
$vrfOid = $value['vrf_oid'];
|
||||
$address = $value['bgpPeerIdentifier'];
|
||||
|
||||
if (empty($bgpPeers[$vrfOid][$address])) {
|
||||
$deleted = dbDelete('bgpPeers', 'device_id = ? AND bgpPeerIdentifier = ? AND vrf_id = ?', [$device['device_id'], $address, $vrfId]);
|
||||
$deleted = dbDelete('bgpPeers', 'device_id = ? AND bgpPeerIdentifier = ? ' . $checkVrf, [$device['device_id'], $address, $vrfId]);
|
||||
|
||||
echo str_repeat('-', $deleted);
|
||||
echo PHP_EOL;
|
||||
|
||||
Reference in New Issue
Block a user