mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
namespace OPNsense\Quagga\Api;
|
||||
use \OPNsense\Base\ApiControllerBase;
|
||||
use \OPNsense\Quagga\BGP;
|
||||
use \OPNsense\Core\Config;
|
||||
use \OPNsense\Base\ApiMutableModelControllerBase;
|
||||
use \OPNsense\Base\UIModelGrid;
|
||||
/**
|
||||
* Copyright (C) 2015 - 2017 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.
|
||||
*
|
||||
*/
|
||||
class BgpController extends ApiMutableModelControllerBase
|
||||
{
|
||||
static protected $internalModelName = 'BGP';
|
||||
static protected $internalModelClass = '\OPNsense\Quagga\BGP';
|
||||
public function getAction()
|
||||
{
|
||||
// define list of configurable settings
|
||||
$result = array();
|
||||
if ($this->request->isGet()) {
|
||||
$mdlBGP = new BGP();
|
||||
$result['bgp'] = $mdlBGP->getNodes();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function setAction()
|
||||
{
|
||||
$result = array("result"=>"failed");
|
||||
if ($this->request->isPost()) {
|
||||
// load model and update with provided data
|
||||
$mdlBGP = new BGP();
|
||||
$mdlBGP->setNodes($this->request->getPost("bgp"));
|
||||
// perform validation
|
||||
$valMsgs = $mdlBGP->performValidation();
|
||||
foreach ($valMsgs as $field => $msg) {
|
||||
if (!array_key_exists("validations", $result)) {
|
||||
$result["validations"] = array();
|
||||
}
|
||||
$result["validations"]["bgp.".$msg->getField()] = $msg->getMessage();
|
||||
}
|
||||
// serialize model to config and save
|
||||
if ($valMsgs->count() == 0) {
|
||||
$mdlBGP->serializeToConfig();
|
||||
Config::getInstance()->save();
|
||||
$result["result"] = "saved";
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function searchNeighborAction()
|
||||
{
|
||||
$this->sessionClose();
|
||||
$mdlBGP = $this->getModel();
|
||||
$grid = new UIModelGrid($mdlBGP->neighbors->neighbor);
|
||||
return $grid->fetchBindRequest(
|
||||
$this->request,
|
||||
array("enabled", "address", "remoteas", "updatesource", "nexthopself", "defaultoriginate" )
|
||||
);
|
||||
}
|
||||
|
||||
public function getNeighborAction($uuid = null)
|
||||
{
|
||||
$mdlBGP = $this->getModel();
|
||||
if ($uuid != null) {
|
||||
$node = $mdlBGP->getNodeByReference('neighbors.neighbor.' . $uuid);
|
||||
if ($node != null) {
|
||||
// return node
|
||||
return array("neighbor" => $node->getNodes());
|
||||
}
|
||||
} else {
|
||||
$node = $mdlBGP->neighbors->neighbor->add();
|
||||
return array("neighbor" => $node->getNodes());
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
public function addNeighborAction()
|
||||
{
|
||||
$result = array("result" => "failed");
|
||||
if ($this->request->isPost() && $this->request->hasPost("neighbor")) {
|
||||
$result = array("result" => "failed", "validations" => array());
|
||||
$mdlBGP = $this->getModel();
|
||||
$node = $mdlBGP->neighbors->neighbor->Add();
|
||||
$node->setNodes($this->request->getPost("neighbor"));
|
||||
$valMsgs = $mdlBGP->performValidation();
|
||||
foreach ($valMsgs as $field => $msg) {
|
||||
$fieldnm = str_replace($node->__reference, "neighbor", $msg->getField());
|
||||
$result["validations"][$fieldnm] = $msg->getMessage();
|
||||
}
|
||||
if (count($result['validations']) == 0) {
|
||||
// save config if validated correctly
|
||||
$mdlBGP->serializeToConfig();
|
||||
Config::getInstance()->save();
|
||||
$result["result"] = "saved";
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function delNeighborAction($uuid)
|
||||
{
|
||||
$result = array("result" => "failed");
|
||||
if ($this->request->isPost()) {
|
||||
$mdlBGP = $this->getModel();
|
||||
if ($uuid != null) {
|
||||
if ($mdlBGP->neighbors->neighbor->del($uuid)) {
|
||||
$mdlBGP->serializeToConfig();
|
||||
Config::getInstance()->save();
|
||||
$result['result'] = 'deleted';
|
||||
} else {
|
||||
$result['result'] = 'not found';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function setNeighborAction($uuid)
|
||||
{
|
||||
if ($this->request->isPost() && $this->request->hasPost("neighbor")) {
|
||||
$mdlNeighbor = $this->getModel();
|
||||
if ($uuid != null) {
|
||||
$node = $mdlNeighbor->getNodeByReference('neighbors.neighbor.' . $uuid);
|
||||
if ($node != null) {
|
||||
$result = array("result" => "failed", "validations" => array());
|
||||
$neighborInfo = $this->request->getPost("neighbor");
|
||||
$node->setNodes($neighborInfo);
|
||||
$valMsgs = $mdlNeighbor->performValidation();
|
||||
foreach ($valMsgs as $field => $msg) {
|
||||
$fieldnm = str_replace($node->__reference, "neighbor", $msg->getField());
|
||||
$result["validations"][$fieldnm] = $msg->getMessage();
|
||||
}
|
||||
if (count($result['validations']) == 0) {
|
||||
// save config if validated correctly
|
||||
$mdlNeighbor->serializeToConfig();
|
||||
Config::getInstance()->save();
|
||||
$result = array("result" => "saved");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array("result" => "failed");
|
||||
}
|
||||
|
||||
public function toggle_handler($uuid, $elements, $element)
|
||||
{
|
||||
$result = array("result" => "failed");
|
||||
if ($this->request->isPost()) {
|
||||
$mdlNeighbor = $this->getModel();
|
||||
if ($uuid != null) {
|
||||
$node = $mdlNeighbor->getNodeByReference($elements . '.'. $element .'.' . $uuid);
|
||||
if ($node != null) {
|
||||
if ($node->enabled->__toString() == "1") {
|
||||
$result['result'] = "Disabled";
|
||||
$node->enabled = "0";
|
||||
} else {
|
||||
$result['result'] = "Enabled";
|
||||
$node->enabled = "1";
|
||||
}
|
||||
// if item has toggled, serialize to config and save
|
||||
$mdlNeighbor->serializeToConfig();
|
||||
Config::getInstance()->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function toggleNeighborAction($uuid)
|
||||
{
|
||||
return $this->toggle_handler($uuid, 'neighbors', 'neighbor');
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,34 @@
|
||||
<?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 BgpController extends \OPNsense\Base\IndexController
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->view->title = gettext("BGP-Settings");
|
||||
$this->view->generalForm = $this->getForm("bgp");
|
||||
$this->view->title = gettext("BGP Settings");
|
||||
$this->view->bgpForm = $this->getForm("bgp");
|
||||
$this->view->formDialogEditBGPNeighbor = $this->getForm("dialogEditBGPNeighbor");
|
||||
$this->view->pick('OPNsense/Quagga/bgp');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,30 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>routing.bgp.general.Enabled</id>
|
||||
<id>bgp.enabled</id>
|
||||
<label>enable</label>
|
||||
<type>checkbox</type>
|
||||
<help>This will activate the bgp service.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>bgp.asnumber</id>
|
||||
<label>BGP AS Number</label>
|
||||
<type>text</type>
|
||||
<hint>Your AS Number here</hint>
|
||||
</field>
|
||||
<field>
|
||||
<id>bgp.networks</id>
|
||||
<label>Network</label>
|
||||
<style>tokenize</style>
|
||||
<type>select_multiple</type>
|
||||
<allownew>true</allownew>
|
||||
<help>Select the network to advertise, you have to set a Null route via System -> Routes</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>bgp.redistribute</id>
|
||||
<label>Route Redistribution</label>
|
||||
<type>select_multiple</type>
|
||||
<style>tokenize</style>
|
||||
<help><![CDATA[Select other routing sources, which should be redistributed to the other nodes.]]></help>
|
||||
<hint>Type or select a route source.</hint>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>neighbor.enabled</id>
|
||||
<label>Enabled</label>
|
||||
<type>checkbox</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>neighbor.address</id>
|
||||
<label>Peer-IP</label>
|
||||
<type>text</type>
|
||||
<help>Specify the IP of your neighbor.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>neighbor.remoteas</id>
|
||||
<label>Remote AS</label>
|
||||
<type>text</type>
|
||||
<help>Neighbor AS.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>neighbor.updatesource</id>
|
||||
<label>Update-Source Interface</label>
|
||||
<type>text</type>
|
||||
<help>Physical name of the interface facing the peer</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>neighbor.nexthopself</id>
|
||||
<label>Next-Hop-Self</label>
|
||||
<type>checkbox</type>
|
||||
</field>
|
||||
<field>
|
||||
<id>neighbor.defaultoriginate</id>
|
||||
<label>Send Defaultroute</label>
|
||||
<type>checkbox</type>
|
||||
</field>
|
||||
</form>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace OPNsense\Quagga;
|
||||
use OPNsense\Base\BaseModel;
|
||||
/*
|
||||
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 BGP extends BaseModel
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<model>
|
||||
<mount>//OPNsense/quagga/bgp</mount>
|
||||
<description>BGP Routing configuration</description>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<asnumber type="TextField">
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
</asnumber>
|
||||
<networks type="CSVListField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
<mask>/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2},)*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2})$/</mask>
|
||||
</networks>
|
||||
<redistribute type="OptionField">
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
<default></default>
|
||||
<OptionValues>
|
||||
<babel>Babel routing protocol (Babel)</babel>
|
||||
<ospf>Open Shortest Path First (OSPF)</ospf>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<isis>Intermediate System to Intermediate System (IS-IS)</isis>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<pim>Protocol Independent Multicast (PIM)</pim>
|
||||
<rip>Routing Information Protocol (RIP)</rip>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<neighbors>
|
||||
<neighbor type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<address type="TextField">
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
<mask>/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/</mask>
|
||||
</address>
|
||||
<remoteas type="TextField">
|
||||
<default></default>
|
||||
<Required>Y</Required>
|
||||
</remoteas>
|
||||
<updatesource type="TextField">
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
</updatesource>
|
||||
<nexthopself type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</nexthopself>
|
||||
<defaultoriginate type="BooleanField">
|
||||
<default>0</default>
|
||||
<Required>N</Required>
|
||||
</defaultoriginate>
|
||||
</neighbor>
|
||||
</neighbors>
|
||||
</items>
|
||||
</model>
|
||||
@@ -3,8 +3,8 @@
|
||||
<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" />-->
|
||||
<!--<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>
|
||||
</menu>
|
||||
|
||||
@@ -1 +1,104 @@
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_ospf_settings'])}}
|
||||
{#
|
||||
|
||||
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':bgpForm,'id':'frm_bgp_settings'])}}
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var data_get_map = {'frm_bgp_settings':"/api/quagga/bgp/get"};
|
||||
mapDataToFormUI(data_get_map).done(function(data){
|
||||
formatTokenizersUI();
|
||||
$('.selectpicker').selectpicker('refresh');
|
||||
});
|
||||
ajaxCall(url="/api/quagga/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
|
||||
// link save button to API set action
|
||||
$("#saveAct").click(function(){
|
||||
saveFormToEndpoint(url="/api/quagga/bgp/set",formid='frm_bgp_settings',callback_ok=function(){
|
||||
ajaxCall(url="/api/quagga/service/reconfigure", sendData={}, callback=function(data,status) {
|
||||
ajaxCall(url="/api/quagga/service/status", sendData={}, callback=function(data,status) {
|
||||
updateServiceStatusUI(data['status']);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
$("#grid-neighbors").UIBootgrid(
|
||||
{ 'search':'/api/quagga/bgp/searchNeighbor',
|
||||
'get':'/api/quagga/bgp/getNeighbor/',
|
||||
'set':'/api/quagga/bgp/setNeighbor/',
|
||||
'add':'/api/quagga/bgp/addNeighbor/',
|
||||
'del':'/api/quagga/bgp/delNeighbor/',
|
||||
'toggle':'/api/quagga/bgp/toggleNeighbor/',
|
||||
'options':{selection:false, multiSelect:false}
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="col-md-12">
|
||||
<button class="btn btn-primary" id="saveAct" type="button"><b>{{ lang._('Save') }}</b></button>
|
||||
</div>
|
||||
|
||||
<h2>{{ lang._('Neighbors') }}</h2>
|
||||
<div class="tab-content content-box tab-content">
|
||||
<div id="neighbors" class="tab-pane fade in active">
|
||||
|
||||
<table id="grid-neighbors" class="table table-responsive" data-editDialog="DialogEditBGPNeighbor">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
|
||||
<th data-column-id="address" data-type="string" data-visible="true">{{ lang._('Neighbor Address') }}</th>
|
||||
<th data-column-id="remoteas" data-type="string" data-visible="true">{{ lang._('Remote AS') }}</th>
|
||||
<th data-column-id="updatesource" data-type="string" data-visible="true">{{ lang._('Update Source Address') }}</th>
|
||||
<th data-column-id="nexthopself" data-type="string" data-formatter="rowtoggle">{{ lang._('Next Hop Self') }}</th>
|
||||
<th data-column-id="defaultoriginate" data-type="string" data-formatter="rowtoggle">{{ lang._('Default Originate') }}</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>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5"></td>
|
||||
<td>
|
||||
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
|
||||
<!-- <button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button> -->
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPNeighbor,'id':'DialogEditBGPNeighbor','label':'Edit Neighbor'])}}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
bgpd.conf:/usr/local/etc/quagga/bgpd.conf
|
||||
ospfd.conf:/usr/local/etc/quagga/ospfd.conf
|
||||
ripd.conf:/usr/local/etc/quagga/ripd.conf
|
||||
quagga:/etc/rc.conf.d/quagga
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.enabled') and OPNsense.quagga.bgp.enabled == '1' %}
|
||||
!
|
||||
! Zebra configuration saved from vty
|
||||
! 2017/03/03 20:21:04
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.asnumber') and OPNsense.quagga.bgp.asnumber != '' %}
|
||||
router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.networks') %}
|
||||
{% for network in OPNsense.quagga.bgp.networks.split(',') %}
|
||||
network {{ network }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% for neighbor in helpers.toList('OPNsense.quagga.bgp.neighbors.neighbor') %}
|
||||
{% if neighbor.enabled == '1' %}
|
||||
neighbor {{ neighbor.address }} remote-as {{ neighbor.remoteas }}
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.neighbors.neighbor.updatesource') and OPNsense.quagga.bgp.neighbors.neighbor.updatesource != '' %}
|
||||
neighbor {{ neighbor.address }} update-source {{ neighbor.updatesource }}
|
||||
{% endif %}
|
||||
{% if neighbor.nexthopself == '1' %}
|
||||
neighbor {{ neighbor.address }} next-hop-self
|
||||
{% endif %}
|
||||
{% if neighbor.defaultoriginate == '1' %}
|
||||
neighbor {{ neighbor.address }} default-originate
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
!
|
||||
line vty
|
||||
!
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user