Quagga diagnostics; closes #126

This commit is contained in:
Michael
2017-04-18 06:38:38 +02:00
committed by Franco Fichtner
parent 5c8979f5f2
commit 2260041016
10 changed files with 708 additions and 9 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= quagga
PLUGIN_VERSION= 1.1.0
PLUGIN_VERSION= 1.1.1
PLUGIN_COMMENT= Quagga Routing Suite
PLUGIN_DEPENDS= quagga ruby
PLUGIN_MAINTAINER= franz.fabian.94@gmail.com
@@ -0,0 +1,92 @@
<?php
/**
* Copyright (C) 2017 Frank Wall
* Copyright (C) 2017 Michael Muenz
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
namespace OPNsense\Quagga\Api;
use \OPNsense\Base\ApiControllerBase;
use \OPNsense\Core\Backend;
use \OPNsense\Core\Config;
/**
* Class DiagnosticsController
* @package OPNsense\Quagga
*/
class DiagnosticsController extends ApiControllerBase
{
/**
* show ip bgp
* @return array
*/
public function showipbgpAction()
{
$backend = new Backend();
$response = json_decode(trim($backend->configdRun("quagga diag-bgp2")));
return array("response" => $response);
}
/**
* show ip bgp summary
* @return array
*/
public function showipbgpsummaryAction()
{
$backend = new Backend();
$response = $backend->configdRun("quagga diag-bgp summary");
return array("response" => $response);
}
private function get_ospf_information($name)
{
$backend = new Backend();
return array("response" => json_decode(trim($backend->configdRun("quagga ospf-$name"))));
}
public function ospfoverviewAction()
{
return $this->get_ospf_information('overview');
}
public function ospfneighborAction()
{
return $this->get_ospf_information('neighbor');
}
public function ospfrouteAction()
{
return $this->get_ospf_information('route');
}
public function ospfdatabaseAction()
{
return $this->get_ospf_information('database');
}
private function get_general_information($name)
{
$backend = new Backend();
return array("response" => json_decode(trim($backend->configdRun("quagga general-$name"))));
}
public function generalroutesAction()
{
return $this->get_general_information('routes');
}
}
@@ -0,0 +1,45 @@
<?php
namespace OPNsense\Quagga;
/*
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
class DiagnosticsController extends \OPNsense\Base\IndexController
{
public function bgpAction()
{
$this->view->title = gettext("Diagnostics: BGP");
$this->view->diagnosticsForm = $this->getForm("diagnostics");
$this->view->pick('OPNsense/Quagga/diagnosticsbgp');
}
public function ospfAction()
{
$this->view->title = gettext("Diagnostics: OSPF");
$this->view->pick('OPNsense/Quagga/diagnosticsospf');
}
public function generalAction()
{
$this->view->title = gettext("Diagnostics: General");
$this->view->pick('OPNsense/Quagga/diagnosticsgeneral');
}
}
@@ -0,0 +1,8 @@
<form>
<field>
<id>diagnostics.bgpneighbor</id>
<label>BGP Neighbor</label>
<type>text</type>
<hint>One of the neighbor IPs</hint>
</field>
</form>
@@ -1,10 +1,14 @@
<menu>
<Routing cssClass="fa fa-map-signs" order="45">
<General VisibleName="General" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/general/index" order="1"/>
<RIP VisibleName="RIP" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/rip/index" order="10" />
<OSPF VisibleName="OSPF" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/ospf/index" order="20" />
<!--<ISIS VisibleName="IS-IS" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/isis/index" order="30" />-->
<BGP VisibleName="BGPv4" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/bgp/index" order="40" />
</Routing>
<Routing cssClass="fa fa-map-signs" order="45">
<General VisibleName="General" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/general/index" order="1"/>
<RIP VisibleName="RIP" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/rip/index" order="10" />
<OSPF VisibleName="OSPF" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/ospf/index" order="20" />
<!--<ISIS VisibleName="IS-IS" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/isis/index" order="30" />-->
<BGP VisibleName="BGPv4" cssClass="fa fa-bolt fa-fw" url="/ui/quagga/bgp/index" order="40" />
<Diagnostics VisibleName="Diagnostics" cssClass="fa fa-medkit fa-fw" order="50">
<General VisibleName="General" url="/ui/quagga/diagnostics/general" order="1" />
<BGP VisibleName="BGPv4" url="/ui/quagga/diagnostics/bgp" order="40" />
<OSPF VisibleName="OSPF" url="/ui/quagga/diagnostics/ospf" order="20" />
</Diagnostics>
</Routing>
</menu>
@@ -0,0 +1,115 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2017 Fabian Franz
Copyright (C) 2017 Michael Muenz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
{#
{{ partial("layout_partials/base_form",['fields':diagnosticsForm,'id':'frm_diagnostics_settings'])}}
#}
<script type="text/x-template" id="overviewtpl">
<table>
<tr>
<td>{{ lang._('Table Version') }}</td>
<td><%= bgp_overview['table_version'] %></td>
</tr>
<tr>
<td>{{ lang._('Local Router ID') }}</td>
<td><%= bgp_overview['local_router_id'] %></td>
</tr>
</table>
<table>
<thead>
<tr>
<th>{{ lang._('Status') }}</th>
<th>{{ lang._('Network') }}</th>
<th>{{ lang._('Next Hop') }}</th>
<th>{{ lang._('Metric') }}</th>
<th>{{ lang._('LocPrf') }}</th>
<th>{{ lang._('Weight') }}</th>
<th>{{ lang._('Path') }}</th>
</tr>
</thead>
<tbody>
<% _.each(bgp_overview['output'], function (row) { %>
<tr>
<td>
<% _.each(row['status'], function(element) { %>
<abbr title="<%= translate(element['dn']) %>"><%= element['abb'] %></abbr>
<% }) %>
</td>
<td><%= row['Network'] %></td>
<td><%= row['Next Hop'] %></td>
<td><%= row['Metric'] %></td>
<td><%= row['LocPrf'] %></td>
<td><%= row['Weight'] %></td>
<td>
<% _.each(row['Path'], function(element) { %>
<abbr title="<%= translate(element['dn']) %>"><%= element['abb'] %></abbr>
<% }) %>
</td>
</tr>
<% }); %>
</tbody>
</table>
</script>
<script type="text/javascript" src="/ui/js/lodash.js"></script>
<script type="text/javascript">
function translate(x) {
return x;
}
$(document).ready(function() {
ajaxCall(url="/api/quagga/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status']);
});
ajaxCall(url="/api/quagga/diagnostics/showipbgp", sendData={}, callback=function(data,status) {
content = _.template($('#overviewtpl').html())(data['response'])
$('#overview').html(content)
});
ajaxCall(url="/api/quagga/diagnostics/showipbgpsummary", sendData={}, callback=function(data,status) {
$("#summarycontent").text(data['response']);
});
});
</script>
<!-- Navigation bar -->
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#overview">{{ lang._('Overview') }}</a></li>
<li><a data-toggle="tab" href="#summary">{{ lang._('Summary') }}</a></li>
</ul>
<div class="tab-content content-box tab-content">
<div id="overview" class="tab-pane fade in active">
{{ lang._('loading...') }}
</div>
<div id="summary" class="tab-pane fade in">
<pre id="summarycontent"></pre>
</div>
</div>
@@ -0,0 +1,101 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
<script type="text/javascript" src="/ui/js/lodash.js"></script>
<script type="text/x-template" id="routestpl">
<table>
<thead>
<tr>
<th>{{ lang._('Code') }}</th>
<th>{{ lang._('Network') }}</th>
<th>{{ lang._('Administrative Distance') }}</th>
<th>{{ lang._('Metric') }}</th>
<th>{{ lang._('Interface') }}</th>
<th>{{ lang._('Time') }}</th>
</tr>
</thead>
<tbody>
<% _.each(general_routes, function(entry) { %>
<tr>
<td>
<% _.each(entry['code'], function(code) { %>
<abbr title="<%= translate(code['long']) %>"><%= (code['short']) %></abbr>
<% }); %>
</td>
<td><%= entry['network'] %></td>
<td><%= entry['ad'] %></td>
<td><%= entry['metric'] %></td>
<td><%= entry['interface'] %></td>
<td><%= entry['time'] %></td>
</tr>
<% }); %>
</tbody>
</table>
</script>
<script>
function translate(content) {
tr = {};
tr['kernel route'] = '{{ lang._('Kernel Route') }}';
tr['FIB route'] = '{{ lang._('FIB Route') }}';
tr['connected'] = '{{ lang._('Connected') }}';
tr['selected route'] = '{{ lang._('Selected Route') }}';
tr['OSPF'] = '{{ lang._('OSPF') }}';
tr['RIP'] = '{{ lang._('RIP') }}';
tr['BGP'] = '{{ lang._('BGP') }}';
if (_.has(tr,content))
{
return tr[content];
}
else
{
return content;
}
}
$(document).ready(function() {
ajaxCall(url="/api/quagga/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status'])
});
ajaxCall(url="/api/quagga/diagnostics/generalroutes", sendData={}, callback=function(data,status) {
content = _.template($('#routestpl').html())(data['response'])
$('#routing').html(content)
});
});
</script>
<!-- Navigation bar -->
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#routing">{{ lang._('Routing Table') }}</a></li>
</ul>
<div class="tab-content content-box tab-content">
<div id="routing" class="tab-pane fade in active">
</div>
</div>
@@ -0,0 +1,302 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2017 Fabian Franz
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
#}
<script type="text/x-template" id="overviewtpl">
<h2>{{ lang._('General') }}</h2>
<table>
<tbody>
<tr>
<td>{{ lang._("RFC2328 Conform") }}</td>
<td><%= checkmark(ospf_overview['rfc2328_conform']) %></td>
</tr>
<tr>
<td>{{ lang._("ASBR") }}</td>
<td><%= checkmark(ospf_overview['asbr']) %></td>
</tr>
<tr>
<td>{{ lang._("Router ID") }}</td>
<td><%= ospf_overview['router_id'] %></td>
</tr>
<tr>
<td>{{ lang._("RFC1583 Compatibility") }}</td>
<td><%= checkmark(ospf_overview['rfc1583_compatibility']) %></td>
</tr>
<tr>
<td>{{ lang._("Opaque Capability") }}</td>
<td><%= checkmark(ospf_overview['opaque_capability']) %></td>
</tr>
<tr>
<td>{{ lang._("Initial SPF Scheduling Delay") }}</td>
<td><%= ospf_overview['initial_spf_scheduling_delay'] %></td>
</tr>
<tr>
<td>{{ lang._("Minimum Hold Time") }}</td>
<td><%= ospf_overview['hold_time']['min'] %> {{ lang._('Milliseconds') }}</td>
</tr>
<tr>
<td>{{ lang._("Maximum Hold Time") }}</td>
<td><%= ospf_overview['hold_time']['max'] %> {{ lang._('Milliseconds') }}</td>
</tr>
<tr>
<td>{{ lang._("Current Hold Time Multipier") }}</td>
<td><%= ospf_overview['current_hold_time_multipier'] %></td>
</tr>
<tr>
<td>{{ lang._("SPF Timer") }}</td>
<td><%= ospf_overview['spf_timer'] %></td>
</tr>
<tr>
<td>{{ lang._("Refresh Timer") }}</td>
<td><%= ospf_overview['refresh_timer'] %></td>
</tr>
<tr>
<td>{{ lang._("Areas Attached Count") }}</td>
<td><%= ospf_overview['areas_attached_count'] %></td>
</tr>
</tbody>
</table>
<h2>{{ lang._('Link State Area') }}</h2>
<table>
<thead>
<tr>
<th></th>
<th>{{ lang._('Count') }}</th>
<th>{{ lang._('Checksum') }}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ lang._('External LSA') }}</td>
<td><%= ospf_overview['external_lsa']['count'] %></td>
<td><%= ospf_overview['external_lsa']['checksum'] %></td>
</tr>
<tr>
<td>{{ lang._('Opaque AS LSA') }}</td>
<td><%= ospf_overview['opaque_as_lsa']['count'] %></td>
<td><%= ospf_overview['opaque_as_lsa']['checksum'] %></td>
</tr>
</tbody>
</table>
<h2>{{ lang._('Areas') }}</h2>
TODO
</script>
<script type="text/x-template" id="databasetpl">
<% _.each(_.keys(ospf_database), function(router_id) { %>
<h1>{{ lang._('Router ID:')}} <%= router_id %></h1>
<hr />
<h2>{{ lang._('Link State Area') }}</h2>
<% _.each(_.keys(ospf_database[router_id]['link_state_area']), function(area) { %>
<h3>Area <%= area %></h3>
<table>
<thead>
<tr>
<th>{{ lang._('Link ID') }}</th>
<th>{{ lang._('ADV Router') }}</th>
<th>{{ lang._('Age') }}</th>
<th>{{ lang._('Sequence Number') }}</th>
<th>{{ lang._('Checksum') }}</th>
<th>{{ lang._('Link Count') }}</th>
</tr>
</thead>
<tbody>
<% _.each(ospf_database[router_id]['link_state_area'][area], function(entry) { %>
<tr>
<td><%= entry["Link ID"] %></td>
<td><%= entry["ADV Router"] %></td>
<td><%= entry["Age"] %></td>
<td><%= entry["Seq#"] %></td>
<td><%= entry["CkSum"] %></td>
<td><%= entry["Link count"] %></td>
</tr>
<% }); %>
</tbody>
<table>
<% }); %>
<h2>{{ lang._('External States') }}</h2>
<table>
<thead>
<tr>
<th>{{ lang._('Link ID') }}</th>
<th>{{ lang._('ADV Router') }}</th>
<th>{{ lang._('Age') }}</th>
<th>{{ lang._('Sequence Number') }}</th>
<th>{{ lang._('Checksum') }}</th>
<th>{{ lang._('Route') }}</th>
</tr>
</thead>
<tbody>
<% _.each(ospf_database[router_id]['external_states'], function(entry) { %>
<tr>
<td><%= entry["Link ID"] %></td>
<td><%= entry["ADV Router"] %></td>
<td><%= entry["Age"] %></td>
<td><%= entry["Seq#"] %></td>
<td><%= entry["CkSum"] %></td>
<td><%= entry["Route"] %></td>
</tr>
<% }); %>
</tbody>
</table>
<% }); %>
</script>
<script type="text/x-template" id="routestpl">
<h2>{{ lang._('Network Routing Table') }}</h2>
<table>
<thead>
<tr>
<th>{{ lang._('Type') }}</th>
<th>{{ lang._('Network') }}</th>
<th>{{ lang._('Cost') }}</th>
<th>{{ lang._('Area') }}</th>
<th>{{ lang._('Via') }}</th>
<th>{{ lang._('Via interface') }}</th>
</tr>
</thead>
<tbody>
<% _.each(ospf_route['OSPF network routing table'], function(entry) { %>
<tr>
<td><%= entry["type"] %></td>
<td><%= entry["network"] %></td>
<td><%= entry["cost"] %></td>
<td><%= entry["area"] %></td>
<td><%= entry["via"] %></td>
<td><%= entry["via_interface"] %></td>
</tr>
<% }); %>
</tbody>
</table>
<h2>{{ lang._('Router Routing Table') }}</h2>
<table>
<thead>
<tr>
<th>{{ lang._('Type') }}</th>
<th>{{ lang._('Network') }}</th>
<th>{{ lang._('Cost') }}</th>
<th>{{ lang._('Area') }}</th>
<th>{{ lang._('ASBR') }}</th>
<th>{{ lang._('Via') }}</th>
<th>{{ lang._('Via interface') }}</th>
</tr>
</thead>
<tbody>
<% _.each(ospf_route['OSPF router routing table'], function(entry) { %>
<tr>
<td><%= entry["type"] %></td>
<td><%= entry["network"] %></td>
<td><%= entry["cost"] %></td>
<td><%= entry["area"] %></td>
<td><%= checkmark(entry["asbr"]) %></td>
<td><%= entry["via"] %></td>
<td><%= entry["via_interface"] %></td>
</tr>
<% }); %>
</tbody>
</table>
<h2>{{ lang._('External Routing Table') }}</h2>
<table>
<thead>
<tr>
<th>{{ lang._('Type') }}</th>
<th>{{ lang._('Network') }}</th>
<th>{{ lang._('Cost') }}</th>
<th>{{ lang._('Area') }}</th>
<th>{{ lang._('Tag') }}</th>
<th>{{ lang._('Via') }}</th>
<th>{{ lang._('Via interface') }}</th>
</tr>
</thead>
<tbody>
<% _.each(ospf_route['OSPF external routing table'], function(entry) { %>
<tr>
<td><%= entry["type"] %></td>
<td><%= entry["network"] %></td>
<td><%= entry["cost"] %></td>
<td><%= entry["area"] %></td>
<td><%= entry["tag"] %></td>
<td><%= entry["via"] %></td>
<td><%= entry["via_interface"] %></td>
</tr>
<% }); %>
</tbody>
</table>
</script>
<script type="text/javascript" src="/ui/js/lodash.js"></script>
<script>
function translate(string)
{
return string;
}
function checkmark(bin)
{
return "<i class=\"fa " + (bin ? "fa-check-square" : "fa-square") + " text-muted\"></i>";
}
$(document).ready(function() {
ajaxCall(url="/api/quagga/service/status", sendData={}, callback=function(data,status) {
updateServiceStatusUI(data['status'])
});
ajaxCall(url="/api/quagga/diagnostics/ospfoverview", sendData={}, callback=function(data,status) {
content = _.template($('#overviewtpl').html())(data['response'])
$('#overview').html(content)
});
ajaxCall(url="/api/quagga/diagnostics/ospfdatabase", sendData={}, callback=function(data,status) {
content = _.template($('#databasetpl').html())(data['response'])
$('#database').html(content)
});
ajaxCall(url="/api/quagga/diagnostics/ospfroute", sendData={}, callback=function(data,status) {
content = _.template($('#routestpl').html())(data['response'])
$('#routing').html(content)
});
});
</script>
<!-- Navigation bar -->
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<li class="active"><a data-toggle="tab" href="#overview">{{ lang._('Overview') }}</a></li>
<li><a data-toggle="tab" href="#routing">{{ lang._('Routing Table') }}</a></li>
<li><a data-toggle="tab" href="#database">{{ lang._('OSPF Database') }}</a></li>
</ul>
<div class="tab-content content-box tab-content">
<div id="overview" class="tab-pane fade in active">
</div>
<div id="routing" class="tab-pane fade in">
</div>
<div id="database" class="tab-pane fade in">
</div>
</div>
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
case "$1" in
bgp)
vtysh -d bgpd -c "show ip bgp"
;;
summary)
vtysh -d bgpd -c "show ip bgp summary"
;;
neighbor)
vtysh -d bgpd -c "show ip bgp neighbors $2"
;;
neighbor-adv)
vtysh -d bgpd -c "show ip bgp neighbors $2 advertised-routes"
;;
*)
echo "Usage: $0 bgp|summary|neighbor <ip>|neighbor-adv <ip>"
exit 1
esac
exit 0
@@ -28,6 +28,18 @@ parameters:
type:script_output
message:request quagga
[diag-bgp]
command:/usr/local/opnsense/scripts/quagga/diag-bgp.sh
parameters:%s
type:script_output
message:bgp diagnostics
[diag-bgp2]
command:/usr/local/opnsense/scripts/quagga/quagga.rb --bgp-overview
parameters:
type:script_output
message:bgp diagnostics
[ospf-database]
command:/usr/local/opnsense/scripts/quagga/quagga.rb --ospf-database
parameters: