diff --git a/net/quagga/Makefile b/net/quagga/Makefile index 6c47bea7d..3f21c5465 100644 --- a/net/quagga/Makefile +++ b/net/quagga/Makefile @@ -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 diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php new file mode 100644 index 000000000..d938c5b8e --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/Api/DiagnosticsController.php @@ -0,0 +1,92 @@ +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'); + } +} diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php new file mode 100644 index 000000000..457048562 --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/DiagnosticsController.php @@ -0,0 +1,45 @@ +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'); + } +} diff --git a/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/diagnostics.xml b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/diagnostics.xml new file mode 100644 index 000000000..0c0fff293 --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/controllers/OPNsense/Quagga/forms/diagnostics.xml @@ -0,0 +1,8 @@ +
+ + diagnostics.bgpneighbor + + text + One of the neighbor IPs + +
diff --git a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml index 1e31ab0e3..fa17e6b9b 100644 --- a/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml +++ b/net/quagga/src/opnsense/mvc/app/models/OPNsense/Quagga/Menu/Menu.xml @@ -1,10 +1,14 @@ - - - - - - - - + + + + + + + + + + + + diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsbgp.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsbgp.volt new file mode 100644 index 000000000..e7b4344ab --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsbgp.volt @@ -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'])}} +#} + + + + + + + + +
+
+ {{ lang._('loading...') }} +
+
+

+    
+
diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt new file mode 100644 index 000000000..52053a52e --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsgeneral.volt @@ -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. + +#} + + + + + + + + +
+
+
+
diff --git a/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt new file mode 100644 index 000000000..8b1060d90 --- /dev/null +++ b/net/quagga/src/opnsense/mvc/app/views/OPNsense/Quagga/diagnosticsospf.volt @@ -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. + +#} + + + + + + + + + + + +
+
+
+
+
+
+
+
diff --git a/net/quagga/src/opnsense/scripts/quagga/diag-bgp.sh b/net/quagga/src/opnsense/scripts/quagga/diag-bgp.sh new file mode 100755 index 000000000..e3c60a49b --- /dev/null +++ b/net/quagga/src/opnsense/scripts/quagga/diag-bgp.sh @@ -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 |neighbor-adv " + exit 1 +esac +exit 0 diff --git a/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf b/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf index cb9f4b0cf..530827f8e 100644 --- a/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf +++ b/net/quagga/src/opnsense/service/conf/actions.d/actions_quagga.conf @@ -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: