Added BGP Peer Descriptions (#9165)

* Added BGP Peer Descriptions

* Fixed formatting

* Added to device routing tab too

* Some text formatting

* Test files

* Added default null to bgpPeerDescr

* Added db_schema.yaml

* Fix default value for bgpPeerDescr

* Fixed Order and Search box

* Added glyphicon for success/error

* Switch to toastr notification

* Removed unused bootstrap code
This commit is contained in:
TheGreatDoc
2018-09-11 05:54:46 +02:00
committed by Tony Murray
parent e367f46fee
commit d475665601
15 changed files with 397 additions and 102 deletions

View File

@@ -0,0 +1,53 @@
<?php
/*
* LibreNMS
*
* Copyright (c) 2018 TheGreatDoc
*
* 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.
*/
use LibreNMS\Authentication\Auth;
header('Content-type: application/json');
if (!Auth::user()->hasGlobalAdmin()) {
$response = array(
'status' => 'error',
'message' => 'Need to be admin',
);
echo _json_encode($response);
exit;
}
$status = 'error';
$message = 'Error updating routing information';
$device_id = $_POST['device_id'];
$routing_id = $_POST['routing_id'];
$data = $_POST['data'];
if (!is_numeric($device_id)) {
$message = 'Missing device id';
} elseif (!is_numeric($routing_id)) {
$message = 'Missing routing id';
} else {
if (dbUpdate(array('bgpPeerDescr'=>$data), 'bgpPeers', '`bgpPeer_id`=? AND `device_id`=?', array($routing_id,$device_id)) >= 0) {
$message = 'Routing information updated';
$status = 'ok';
} else {
$message = 'Could not update Routing information';
}
}
$response = array(
'status' => $status,
'message' => $message,
'extra' => $extra,
);
echo _json_encode($response);