mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/quagga: style and whitespace cleanups
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Quagga\BGP;
|
||||
use \OPNsense\Core\Config;
|
||||
use \OPNsense\Base\ApiMutableModelControllerBase;
|
||||
@@ -361,7 +362,7 @@ class BgpController extends ApiMutableModelControllerBase
|
||||
}
|
||||
return array("result" => "failed");
|
||||
}
|
||||
|
||||
|
||||
public function searchRoutemapAction()
|
||||
{
|
||||
$this->sessionClose();
|
||||
@@ -458,7 +459,7 @@ class BgpController extends ApiMutableModelControllerBase
|
||||
}
|
||||
return array("result" => "failed");
|
||||
}
|
||||
|
||||
|
||||
public function toggle_handler($uuid, $elements, $element)
|
||||
{
|
||||
$result = array("result" => "failed");
|
||||
@@ -487,7 +488,7 @@ class BgpController extends ApiMutableModelControllerBase
|
||||
{
|
||||
return $this->toggle_handler($uuid, 'neighbors', 'neighbor');
|
||||
}
|
||||
|
||||
|
||||
public function toggleAspathAction($uuid)
|
||||
{
|
||||
return $this->toggle_handler($uuid, 'aspaths', 'aspath');
|
||||
@@ -496,8 +497,8 @@ class BgpController extends ApiMutableModelControllerBase
|
||||
public function togglePrefixlistAction($uuid)
|
||||
{
|
||||
return $this->toggle_handler($uuid, 'prefixlists', 'prefixlist');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function toggleRoutemapAction($uuid)
|
||||
{
|
||||
return $this->toggle_handler($uuid, 'routemaps', 'routemap');
|
||||
|
||||
+1
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Core\Backend;
|
||||
use \OPNsense\Core\Config;
|
||||
|
||||
+2
-1
@@ -27,8 +27,9 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Quagga\General;
|
||||
use \OPNsense\Core\Config;
|
||||
|
||||
+1
@@ -31,6 +31,7 @@
|
||||
*/
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Quagga\OSPF6;
|
||||
use \OPNsense\Core\Config;
|
||||
use \OPNsense\Base\ApiMutableModelControllerBase;
|
||||
|
||||
+1
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Quagga\OSPF;
|
||||
use \OPNsense\Core\Config;
|
||||
use \OPNsense\Base\ApiMutableModelControllerBase;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Quagga\RIP;
|
||||
use \OPNsense\Core\Config;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
*/
|
||||
|
||||
namespace OPNsense\Quagga\Api;
|
||||
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Core\Backend;
|
||||
use \OPNsense\Quagga\General;
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
<label>Name</label>
|
||||
<type>text</type>
|
||||
<help>The name of your Prefix-List, please choose one near to the result you want to achieve.</help>
|
||||
</field>
|
||||
</field>
|
||||
<field>
|
||||
<id>prefixlist.seqnumber</id>
|
||||
<label>Number</label>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</Model>
|
||||
<ValidationMessage>Related Prefix-List item not found</ValidationMessage>
|
||||
<Multiple>N</Multiple>
|
||||
<Required>N</Required>
|
||||
<Required>N</Required>
|
||||
</linkedPrefixlistIn>
|
||||
<linkedPrefixlistOut type="ModelRelationField">
|
||||
<Model>
|
||||
@@ -89,7 +89,7 @@
|
||||
</Model>
|
||||
<ValidationMessage>Related Prefix-List item not found</ValidationMessage>
|
||||
<Multiple>N</Multiple>
|
||||
<Required>N</Required>
|
||||
<Required>N</Required>
|
||||
</linkedPrefixlistOut>
|
||||
<linkedRoutemapIn type="ModelRelationField">
|
||||
<Model>
|
||||
@@ -102,7 +102,7 @@
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
<Multiple>N</Multiple>
|
||||
<Required>N</Required>
|
||||
<Required>N</Required>
|
||||
</linkedRoutemapIn>
|
||||
<linkedRoutemapOut type="ModelRelationField">
|
||||
<Model>
|
||||
@@ -115,7 +115,7 @@
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
<Multiple>N</Multiple>
|
||||
<Required>N</Required>
|
||||
<Required>N</Required>
|
||||
</linkedRoutemapOut>
|
||||
</neighbor>
|
||||
</neighbors>
|
||||
@@ -124,7 +124,7 @@
|
||||
<enabled type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
</enabled>
|
||||
<number type="IntegerField">
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
@@ -143,7 +143,7 @@
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
</as>
|
||||
</aspath>
|
||||
</aspath>
|
||||
</aspaths>
|
||||
<prefixlists>
|
||||
<prefixlist type="ArrayField">
|
||||
@@ -173,8 +173,8 @@
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
</network>
|
||||
</prefixlist>
|
||||
</prefixlists>
|
||||
</prefixlist>
|
||||
</prefixlists>
|
||||
<routemaps>
|
||||
<routemap type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
@@ -215,7 +215,7 @@
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
</set>
|
||||
</routemap>
|
||||
</routemap>
|
||||
</routemaps>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
namespace OPNsense\Quagga;
|
||||
|
||||
use OPNsense\Base\BaseModel;
|
||||
|
||||
class OSPF6 extends BaseModel
|
||||
|
||||
@@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<li><a data-toggle="tab" href="#neighbors">{{ lang._('Neighbors') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#aspaths">{{ lang._('AS Path Lists') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#prefixlists">{{ lang._('Prefix Lists') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#routemaps">{{ lang._('Route Maps') }}</a></li>
|
||||
<li><a data-toggle="tab" href="#routemaps">{{ lang._('Route Maps') }}</a></li>
|
||||
</ul>
|
||||
<div class="tab-content content-box tab-content">
|
||||
<div id="general" class="tab-pane fade in active">
|
||||
@@ -59,7 +59,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<th data-column-id="linkedPrefixlistIn" data-type="string" data-visible="true">{{ lang._('Prefix List inbound') }}</th>
|
||||
<th data-column-id="linkedPrefixlistOut" data-type="string" data-visible="true">{{ lang._('Prefix List outbound') }}</th>
|
||||
<th data-column-id="linkedRoutemapIn" data-type="string" data-visible="true">{{ lang._('Route Map inbound') }}</th>
|
||||
<th data-column-id="linkedRoutemapOut" data-type="string" data-visible="true">{{ lang._('Route Map outbound') }}</th>
|
||||
<th data-column-id="linkedRoutemapOut" data-type="string" data-visible="true">{{ lang._('Route Map outbound') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
|
||||
</tr>
|
||||
@@ -127,7 +127,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="routemaps" class="tab-pane fade in">
|
||||
<table id="grid-routemaps" class="table table-responsive" data-editDialog="DialogEditBGPRouteMaps">
|
||||
<thead>
|
||||
@@ -216,7 +216,7 @@ $(document).ready(function() {
|
||||
'toggle':'/api/quagga/bgp/toggleRoutemap/',
|
||||
'options':{selection:false, multiSelect:false}
|
||||
}
|
||||
);
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<% } else if (propertyname == 'area_cost') { %>
|
||||
<% _.each(int[propertyname], function (ac) { %>
|
||||
<%= ac['area'] %>: <%= ac['cost'] %><br />
|
||||
<% }) %>
|
||||
<% }) %>
|
||||
<% } else { %>
|
||||
<%= translate(int[propertyname]) %>
|
||||
<% } %>
|
||||
|
||||
@@ -52,7 +52,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<tr>
|
||||
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
|
||||
<th data-column-id="interfacename" data-type="string" data-visible="true">{{ lang._('Interface Name') }}</th>
|
||||
<th data-column-id="area" data-type="string" data-visible="true">{{ lang._('Area') }}</th>
|
||||
<th data-column-id="area" data-type="string" data-visible="true">{{ lang._('Area') }}</th>
|
||||
<th data-column-id="networktype" data-type="string" data-visible="true">{{ lang._('Network Type') }}</th>
|
||||
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
|
||||
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
|
||||
|
||||
@@ -124,7 +124,7 @@ class General
|
||||
end
|
||||
entries
|
||||
end
|
||||
|
||||
|
||||
def routes6
|
||||
routes(true)
|
||||
end
|
||||
@@ -432,7 +432,7 @@ class OSPFv3
|
||||
def initialize(sh)
|
||||
@vtysh = sh
|
||||
end
|
||||
|
||||
|
||||
def overview
|
||||
lines = @vtysh.execute("show ipv6 ospf6").lines
|
||||
overview = {}
|
||||
@@ -485,11 +485,11 @@ class OSPFv3
|
||||
end
|
||||
overview
|
||||
end
|
||||
|
||||
|
||||
def linkstate
|
||||
lines = @vtysh.execute("show ipv6 ospf6 linkstate").lines
|
||||
linkstate = {}
|
||||
|
||||
|
||||
qta = nil
|
||||
current_area = []
|
||||
while line = lines.shift&.strip
|
||||
@@ -507,11 +507,11 @@ class OSPFv3
|
||||
end
|
||||
linkstate
|
||||
end
|
||||
|
||||
|
||||
def route
|
||||
route = []
|
||||
lines = @vtysh.execute("show ipv6 ospf6 route").lines
|
||||
|
||||
|
||||
lines.each do |line|
|
||||
f1, f2, network, gateway, interface, time = line.strip.split(/\s+/)
|
||||
route << { f1: f1,
|
||||
@@ -523,7 +523,7 @@ class OSPFv3
|
||||
end
|
||||
route
|
||||
end
|
||||
|
||||
|
||||
def neighbor
|
||||
qta = QuaggaTableReader.new(["Neighbor ID","Pri", "DeadTime", "State/IfState", "Duration I/F[State]"])
|
||||
neighbor = []
|
||||
@@ -571,7 +571,7 @@ class OSPFv3
|
||||
end
|
||||
database
|
||||
end
|
||||
|
||||
|
||||
def interface
|
||||
lines = @vtysh.execute("show ipv6 ospf6 interface").lines
|
||||
int = {}
|
||||
@@ -631,7 +631,7 @@ class OSPFv3
|
||||
end
|
||||
int
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def database_qta(lines)
|
||||
# DON'T REMOVE THE SPACES!!!
|
||||
|
||||
@@ -31,7 +31,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
{% for prefixlist in neighbor.linkedPrefixlistIn.split(",") %}
|
||||
{% set prefixlist2_data = helpers.getUUID(prefixlist) %}
|
||||
{% if prefixlist2_data != '' %}
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist2_data.name }} in
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist2_data.name }} in
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -39,7 +39,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
{% for prefixlist in neighbor.linkedPrefixlistOut.split(",") %}
|
||||
{% set prefixlist_data = helpers.getUUID(prefixlist) %}
|
||||
{% if prefixlist_data != '' %}
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist_data.name }} out
|
||||
neighbor {{ neighbor.address }} prefix-list {{ prefixlist_data.name }} out
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -47,7 +47,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
{% for aspath in neighbor.linkedRoutemapIn.split(",") %}
|
||||
{% set routemap2_data = helpers.getUUID(aspath) %}
|
||||
{% if routemap2_data != '' %}
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap2_data.name }} in
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap2_data.name }} in
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -55,7 +55,7 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
{% for aspath in neighbor.linkedRoutemapOut.split(",") %}
|
||||
{% set routemap_data = helpers.getUUID(aspath) %}
|
||||
{% if routemap_data != '' %}
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap_data.name }} out
|
||||
neighbor {{ neighbor.address }} route-map {{ routemap_data.name }} out
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -78,7 +78,7 @@ ip as-path access-list {{ aspath.number }} {{ aspath.action }} {{ aspath.as }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
!
|
||||
!
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.routemaps.routemap') %}
|
||||
{% for routemap in helpers.sortDictList(OPNsense.quagga.bgp.routemaps.routemap, 'name', 'id' ) %}
|
||||
{% if routemap.enabled == '1' %}
|
||||
|
||||
Reference in New Issue
Block a user