mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
net/frr: Add BGP/OSPF/OSPF6 route redistribution with route-map feature (#4578)
* net/frr: Add BGP route redistribution with route-map feature. Add migration. * net/frr: Small template fix in redistribution since route-map is optional * net/frr: Add OSPF and OSPF6 route redistribution with route-map feature. Adjust migration to migrate OSPF, OSPF6 and BGP models. * net/frr: make sweep * net/frr: Fix wrong diff in ospf6 template * net/frr: Add a little css to make the redistribution grid look like its part of the base form, more seamless integration * net/frr: Show route-map in grid and hide description
This commit is contained in:
@@ -14,6 +14,8 @@ Plugin Changelog
|
||||
|
||||
1.44
|
||||
|
||||
* Add route-map functionality to route redistribution in bgp (opnsense/plugins/issues/4570)
|
||||
* Add route-map functionality to route redistribution in ospf/ospf6 (opnsense/plugins/issues/4580)
|
||||
* Add BGP remote-as internal and external (opnsense/plugins/issues/4609)
|
||||
|
||||
1.43
|
||||
|
||||
@@ -187,6 +187,31 @@ class BgpController extends ApiMutableModelControllerBase
|
||||
return $this->setBase('peergroup', 'peergroups.peergroup', $uuid);
|
||||
}
|
||||
|
||||
public function searchRedistributionAction()
|
||||
{
|
||||
return $this->searchBase('redistributions.redistribution');
|
||||
}
|
||||
|
||||
public function getRedistributionAction($uuid = null)
|
||||
{
|
||||
return $this->getBase('redistribution', 'redistributions.redistribution', $uuid);
|
||||
}
|
||||
|
||||
public function addRedistributionAction()
|
||||
{
|
||||
return $this->addBase('redistribution', 'redistributions.redistribution');
|
||||
}
|
||||
|
||||
public function delRedistributionAction($uuid)
|
||||
{
|
||||
return $this->delBase('redistributions.redistribution', $uuid);
|
||||
}
|
||||
|
||||
public function setRedistributionAction($uuid)
|
||||
{
|
||||
return $this->setBase('redistribution', 'redistributions.redistribution', $uuid);
|
||||
}
|
||||
|
||||
public function toggleCommunitylistAction($uuid)
|
||||
{
|
||||
return $this->toggleBase('communitylists.communitylist', $uuid);
|
||||
@@ -216,4 +241,10 @@ class BgpController extends ApiMutableModelControllerBase
|
||||
{
|
||||
return $this->toggleBase('peergroups.peergroup', $uuid);
|
||||
}
|
||||
|
||||
public function toggleRedistributionAction($uuid)
|
||||
{
|
||||
return $this->toggleBase('redistributions.redistribution', $uuid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+25
@@ -137,4 +137,29 @@ class Ospf6settingsController extends ApiMutableModelControllerBase
|
||||
{
|
||||
return $this->toggleBase('routemaps.routemap', $uuid);
|
||||
}
|
||||
public function searchRedistributionAction()
|
||||
{
|
||||
return $this->searchBase('redistributions.redistribution');
|
||||
}
|
||||
public function getRedistributionAction($uuid = null)
|
||||
{
|
||||
return $this->getBase('redistribution', 'redistributions.redistribution', $uuid);
|
||||
}
|
||||
public function addRedistributionAction()
|
||||
{
|
||||
return $this->addBase('redistribution', 'redistributions.redistribution');
|
||||
}
|
||||
public function delRedistributionAction($uuid)
|
||||
{
|
||||
return $this->delBase('redistributions.redistribution', $uuid);
|
||||
}
|
||||
public function setRedistributionAction($uuid)
|
||||
{
|
||||
return $this->setBase('redistribution', 'redistributions.redistribution', $uuid);
|
||||
}
|
||||
public function toggleRedistributionAction($uuid)
|
||||
{
|
||||
return $this->toggleBase('redistributions.redistribution', $uuid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+26
@@ -133,4 +133,30 @@ class OspfsettingsController extends ApiMutableModelControllerBase
|
||||
{
|
||||
return $this->toggleBase('routemaps.routemap', $uuid);
|
||||
}
|
||||
|
||||
public function searchRedistributionAction()
|
||||
{
|
||||
return $this->searchBase('redistributions.redistribution');
|
||||
}
|
||||
public function getRedistributionAction($uuid = null)
|
||||
{
|
||||
return $this->getBase('redistribution', 'redistributions.redistribution', $uuid);
|
||||
}
|
||||
public function addRedistributionAction()
|
||||
{
|
||||
return $this->addBase('redistribution', 'redistributions.redistribution');
|
||||
}
|
||||
public function delRedistributionAction($uuid)
|
||||
{
|
||||
return $this->delBase('redistributions.redistribution', $uuid);
|
||||
}
|
||||
public function setRedistributionAction($uuid)
|
||||
{
|
||||
return $this->setBase('redistribution', 'redistributions.redistribution', $uuid);
|
||||
}
|
||||
public function toggleRedistributionAction($uuid)
|
||||
{
|
||||
return $this->toggleBase('redistributions.redistribution', $uuid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,9 @@ class BgpController extends \OPNsense\Base\IndexController
|
||||
$this->view->formDialogEditBGPPeergroups = $this->getForm("dialogEditBGPPeergroups");
|
||||
$this->view->formGridEditBGPPeergroups = $this->getFormGrid("dialogEditBGPPeergroups");
|
||||
|
||||
$this->view->formDialogEditRedistribution = $this->getForm("dialogEditRedistribution");
|
||||
$this->view->formGridEditRedistribution = $this->getFormGrid("dialogEditRedistribution");
|
||||
|
||||
$this->view->pick('OPNsense/Quagga/bgp');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ class Ospf6Controller extends \OPNsense\Base\IndexController
|
||||
$this->view->formDialogEditRouteMaps = $this->getForm("dialogEditOSPF6RouteMaps");
|
||||
$this->view->formGridEditRouteMaps = $this->getFormGrid("dialogEditOSPF6RouteMaps");
|
||||
|
||||
$this->view->formDialogEditRedistribution = $this->getForm("dialogEditRedistribution");
|
||||
$this->view->formGridEditRedistribution = $this->getFormGrid("dialogEditRedistribution");
|
||||
|
||||
$this->view->pick('OPNsense/Quagga/ospf6');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,9 @@ class OspfController extends \OPNsense\Base\IndexController
|
||||
$this->view->formDialogEditRouteMaps = $this->getForm("dialogEditOSPFRouteMaps");
|
||||
$this->view->formGridEditRouteMaps = $this->getFormGrid("dialogEditOSPFRouteMaps");
|
||||
|
||||
$this->view->formDialogEditRedistribution = $this->getForm("dialogEditRedistribution");
|
||||
$this->view->formGridEditRedistribution = $this->getFormGrid("dialogEditRedistribution");
|
||||
|
||||
$this->view->pick('OPNsense/Quagga/ospf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,4 @@
|
||||
<type>checkbox</type>
|
||||
<help>Enable extended logging of BGP neighbor changes.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>bgp.redistribute</id>
|
||||
<label>Route Redistribution</label>
|
||||
<type>select_multiple</type>
|
||||
<help>Select routing sources to redistribute to other nodes.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
<form>
|
||||
<field>
|
||||
<id>redistribution.enabled</id>
|
||||
<label>Enabled</label>
|
||||
<type>checkbox</type>
|
||||
<grid_view>
|
||||
<width>6em</width>
|
||||
<type>boolean</type>
|
||||
<formatter>rowtoggle</formatter>
|
||||
</grid_view>
|
||||
</field>
|
||||
<field>
|
||||
<id>redistribution.redistribute</id>
|
||||
<label>Route Redistribution</label>
|
||||
<type>dropdown</type>
|
||||
<help>Select routing sources to redistribute to other nodes.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>redistribution.linkedRoutemap</id>
|
||||
<label>Route-Map</label>
|
||||
<type>dropdown</type>
|
||||
<help>Optional Route-map to apply to this redistribution.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>redistribution.description</id>
|
||||
<label>Description</label>
|
||||
<type>text</type>
|
||||
<help>Optional description for this redistribution.</help>
|
||||
<grid_view>
|
||||
<visible>false</visible>
|
||||
</grid_view>
|
||||
</field>
|
||||
</form>
|
||||
@@ -31,18 +31,6 @@
|
||||
<type>select_multiple</type>
|
||||
<help>Select the interfaces where no OSPF packets should be sent.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ospf.redistribute</id>
|
||||
<label>Route Redistribution</label>
|
||||
<type>select_multiple</type>
|
||||
<help>Select other routing sources to redistribute to other nodes.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ospf.redistributemap</id>
|
||||
<label>Redistribution Map</label>
|
||||
<type>dropdown</type>
|
||||
<help>Route Map to set for Redistribution, can be used to send a specific network as advertisement when it is defined in a Prefix List attached to a Route Map.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ospf.logadjacencychanges</id>
|
||||
<label>Log Adjacency Changes</label>
|
||||
|
||||
@@ -11,18 +11,6 @@
|
||||
<type>checkbox</type>
|
||||
<help>Register CARP status monitor. When no neighbors are found, consider this node less attractive. Requires syslog enabled with “Debugging” logging. Incompatible with “Enable CARP Failover”.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ospf6.redistribute</id>
|
||||
<label>Route Redistribution</label>
|
||||
<type>select_multiple</type>
|
||||
<help>Select other routing sources to redistribute to other nodes.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ospf6.redistributemap</id>
|
||||
<label>Redistribution Map</label>
|
||||
<type>dropdown</type>
|
||||
<help>Route Map to set for Redistribution, can be used to send a specific network as advertisement when it is defined in a Prefix List attached to a Route Map.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>ospf6.routerid</id>
|
||||
<label>Router ID</label>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<model>
|
||||
<mount>//OPNsense/quagga/bgp</mount>
|
||||
<description>BGP Routing configuration</description>
|
||||
<version>1.0.9</version>
|
||||
<version>1.1.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
@@ -37,18 +37,6 @@
|
||||
<default></default>
|
||||
<Required>N</Required>
|
||||
</networks>
|
||||
<redistribute type="OptionField">
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
<default></default>
|
||||
<OptionValues>
|
||||
<ospf>Open Shortest Path First (OSPF)</ospf>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<rip>Routing Information Protocol (RIP)</rip>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<neighbors>
|
||||
<neighbor type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
@@ -493,5 +481,36 @@
|
||||
</linkedRoutemapOut>
|
||||
</peergroup>
|
||||
</peergroups>
|
||||
<redistributions>
|
||||
<redistribution type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<description type="DescriptionField"/>
|
||||
<redistribute type="OptionField">
|
||||
<Required>Y</Required>
|
||||
<Default>connected</Default>
|
||||
<OptionValues>
|
||||
<ospf>Open Shortest Path First (OSPF)</ospf>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<rip>Routing Information Protocol (RIP)</rip>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<linkedRoutemap type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.quagga.bgp</source>
|
||||
<items>routemaps.routemap</items>
|
||||
<display>name</display>
|
||||
<group>name</group>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
</linkedRoutemap>
|
||||
</redistribution>
|
||||
</redistributions>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Copyright (C) 2025 Deciso B.V.
|
||||
* 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\Migrations;
|
||||
|
||||
use OPNsense\Base\BaseModelMigration;
|
||||
use OPNsense\Core\Config;
|
||||
|
||||
class M1_1_0 extends BaseModelMigration
|
||||
{
|
||||
public function run($model)
|
||||
{
|
||||
$config = Config::getInstance()->object();
|
||||
|
||||
if ($model->getNodeByReference('redistributions') === null) {
|
||||
$model->addChild('redistributions');
|
||||
}
|
||||
$redistributions = $model->getNodeByReference('redistributions.redistribution');
|
||||
|
||||
// We migrate multiple models at the same time
|
||||
$protocols = ['bgp', 'ospf', 'ospf6'];
|
||||
|
||||
foreach ($protocols as $protocol) {
|
||||
if (isset($config->OPNsense->quagga->{$protocol})) {
|
||||
$this->migrateRedistribute(
|
||||
$redistributions,
|
||||
$config->OPNsense->quagga->{$protocol},
|
||||
$protocol
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function migrateRedistribute($redistributions, $configNode, $protocol)
|
||||
{
|
||||
if (!$configNode || empty($configNode->redistribute)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$redistributeValues = explode(',', (string)$configNode->redistribute);
|
||||
$redistributemap = isset($configNode->redistributemap) ? (string)$configNode->redistributemap : '';
|
||||
|
||||
if ($redistributions === null) {
|
||||
$redistributions = $model->addChild('redistributions');
|
||||
}
|
||||
|
||||
// Collect existing redistribution values to prevent duplicates
|
||||
$existingRedistributions = [];
|
||||
foreach ($redistributions->iterateItems() as $existing) {
|
||||
if (!empty((string)$existing->redistribute)) {
|
||||
$existingRedistributions[] = (string)$existing->redistribute;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($redistributeValues as $value) {
|
||||
$value = trim($value);
|
||||
if (empty($value) || in_array($value, $existingRedistributions, true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Create a new redistribution entry
|
||||
$redistributionNode = $redistributions->add();
|
||||
$redistributionNode->enabled = '1';
|
||||
$redistributionNode->description = "Migrated route redistribution ($protocol)";
|
||||
$redistributionNode->redistribute = $value;
|
||||
$redistributionNode->linkedRoutemap = !empty($redistributemap) ? $redistributemap : '';
|
||||
}
|
||||
}
|
||||
|
||||
// Model is saved by 'run_migrations.php'
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<model>
|
||||
<mount>//OPNsense/quagga/ospf</mount>
|
||||
<description>OSPF Routing configuration</description>
|
||||
<version>1.0.5</version>
|
||||
<version>1.1.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
@@ -49,31 +49,6 @@
|
||||
<enable>/^(?!0).*$/</enable>
|
||||
</filters>
|
||||
</passiveinterfaces>
|
||||
<redistribute type="OptionField">
|
||||
<Required>N</Required>
|
||||
<multiple>Y</multiple>
|
||||
<default></default>
|
||||
<OptionValues>
|
||||
<bgp>Border Gateway Protocol (BGP)</bgp>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<rip>Routing Information Protocol (RIP)</rip>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<redistributemap type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.quagga.ospf</source>
|
||||
<items>routemaps.routemap</items>
|
||||
<display>name</display>
|
||||
<group>name</group>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
<Multiple>N</Multiple>
|
||||
<Required>N</Required>
|
||||
</redistributemap>
|
||||
<networks>
|
||||
<network type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
@@ -311,5 +286,36 @@
|
||||
</set>
|
||||
</routemap>
|
||||
</routemaps>
|
||||
<redistributions>
|
||||
<redistribution type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<description type="DescriptionField"/>
|
||||
<redistribute type="OptionField">
|
||||
<Required>Y</Required>
|
||||
<Default>connected</Default>
|
||||
<OptionValues>
|
||||
<ospf>Open Shortest Path First (OSPF)</ospf>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<rip>Routing Information Protocol (RIP)</rip>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<linkedRoutemap type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.quagga.ospf</source>
|
||||
<items>routemaps.routemap</items>
|
||||
<display>name</display>
|
||||
<group>name</group>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
</linkedRoutemap>
|
||||
</redistribution>
|
||||
</redistributions>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<model>
|
||||
<mount>//OPNsense/quagga/ospf6</mount>
|
||||
<description>OSPFv3 Routing configuration</description>
|
||||
<version>1.0.4</version>
|
||||
<version>1.1.0</version>
|
||||
<items>
|
||||
<enabled type="BooleanField">
|
||||
<default>0</default>
|
||||
@@ -11,25 +11,6 @@
|
||||
<default>0</default>
|
||||
<Required>Y</Required>
|
||||
</carp_demote>
|
||||
<redistribute type="OptionField">
|
||||
<multiple>Y</multiple>
|
||||
<OptionValues>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<redistributemap type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.quagga.ospf6</source>
|
||||
<items>routemaps.routemap</items>
|
||||
<display>name</display>
|
||||
<group>name</group>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
</redistributemap>
|
||||
<routerid type="TextField">
|
||||
<mask>/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/</mask>
|
||||
</routerid>
|
||||
@@ -224,5 +205,36 @@
|
||||
<set type="TextField"/>
|
||||
</routemap>
|
||||
</routemaps>
|
||||
<redistributions>
|
||||
<redistribution type="ArrayField">
|
||||
<enabled type="BooleanField">
|
||||
<default>1</default>
|
||||
<Required>Y</Required>
|
||||
</enabled>
|
||||
<description type="DescriptionField"/>
|
||||
<redistribute type="OptionField">
|
||||
<Required>Y</Required>
|
||||
<Default>connected</Default>
|
||||
<OptionValues>
|
||||
<ospf>Open Shortest Path First (OSPF)</ospf>
|
||||
<connected>Connected routes (directly attached subnet or host)</connected>
|
||||
<kernel>Kernel routes (not installed via the zebra RIB)</kernel>
|
||||
<rip>Routing Information Protocol (RIP)</rip>
|
||||
<static>Statically configured routes</static>
|
||||
</OptionValues>
|
||||
</redistribute>
|
||||
<linkedRoutemap type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
<source>OPNsense.quagga.ospf6</source>
|
||||
<items>routemaps.routemap</items>
|
||||
<display>name</display>
|
||||
<group>name</group>
|
||||
</template>
|
||||
</Model>
|
||||
<ValidationMessage>Related Route-Map item not found</ValidationMessage>
|
||||
</linkedRoutemap>
|
||||
</redistribution>
|
||||
</redistributions>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -95,9 +95,42 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
'del':'/api/quagga/bgp/delPeergroup/',
|
||||
'toggle':'/api/quagga/bgp/togglePeergroup/'
|
||||
});
|
||||
$("#{{formGridEditRedistribution['table_id']}}").UIBootgrid({
|
||||
'search':'/api/quagga/bgp/searchRedistribution',
|
||||
'get':'/api/quagga/bgp/getRedistribution/',
|
||||
'set':'/api/quagga/bgp/setRedistribution/',
|
||||
'add':'/api/quagga/bgp/addRedistribution/',
|
||||
'del':'/api/quagga/bgp/delRedistribution/',
|
||||
'toggle':'/api/quagga/bgp/toggleRedistribution/'
|
||||
});
|
||||
|
||||
const $header = $(".bootgrid-header[id*='{{formGridEditRedistribution['table_id']}}']");
|
||||
if ($header.length) {
|
||||
$header.find("div.actionBar").parent().prepend(
|
||||
'<td class="col-sm-2 theading-text">' +
|
||||
'<span class="fa fa-info-circle text-muted" style="margin-right: 5px;"></span>' +
|
||||
'<strong>{{ lang._("Route Redistribution") }}</strong>' +
|
||||
'</td>'
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Some trickery to make the redistribution grid look like its part of the base form */
|
||||
.bootgrid-header[id*='{{ formGridEditRedistribution['table_id'] }}'] {
|
||||
padding-left: 10px;
|
||||
}
|
||||
#{{ formGridEditRedistribution['table_id'] }}.bootgrid-table {
|
||||
margin-left: 25%;
|
||||
width: 75%;
|
||||
}
|
||||
.bootgrid-footer[id*='{{ formGridEditRedistribution['table_id'] }}'] {
|
||||
margin-left: 24%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Navigation bar -->
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
|
||||
@@ -112,6 +145,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<!-- Tab: General -->
|
||||
<div id="general" class="tab-pane fade in active">
|
||||
{{ partial("layout_partials/base_form",['fields':bgpForm,'id':'frm_bgp_settings'])}}
|
||||
{{ partial('layout_partials/base_bootgrid_table', formGridEditRedistribution)}}
|
||||
</div>
|
||||
<!-- Tab: Neighbors -->
|
||||
<div id="neighbors" class="tab-pane fade in">
|
||||
@@ -145,3 +179,4 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPCommunityLists,'id':formGridEditBGPCommunityLists['edit_dialog_id'],'label':lang._('Edit Community Lists')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPRouteMaps,'id':formGridEditBGPRouteMaps['edit_dialog_id'],'label':lang._('Edit Route Maps')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditBGPPeergroups,'id':formGridEditBGPPeergroups['edit_dialog_id'],'label':lang._('Edit Peer Groups')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditRedistribution,'id':formGridEditRedistribution['edit_dialog_id'],'label':lang._('Edit Route Redistribution')])}}
|
||||
|
||||
@@ -83,9 +83,42 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
'del':'/api/quagga/ospfsettings/delRoutemap/',
|
||||
'toggle':'/api/quagga/ospfsettings/toggleRoutemap/'
|
||||
});
|
||||
$("#{{formGridEditRedistribution['table_id']}}").UIBootgrid({
|
||||
'search':'/api/quagga/ospfsettings/searchRedistribution',
|
||||
'get':'/api/quagga/ospfsettings/getRedistribution/',
|
||||
'set':'/api/quagga/ospfsettings/setRedistribution/',
|
||||
'add':'/api/quagga/ospfsettings/addRedistribution/',
|
||||
'del':'/api/quagga/ospfsettings/delRedistribution/',
|
||||
'toggle':'/api/quagga/ospfsettings/toggleRedistribution/'
|
||||
});
|
||||
|
||||
const $header = $(".bootgrid-header[id*='{{formGridEditRedistribution['table_id']}}']");
|
||||
if ($header.length) {
|
||||
$header.find("div.actionBar").parent().prepend(
|
||||
'<td class="col-sm-2 theading-text">' +
|
||||
'<span class="fa fa-info-circle text-muted" style="margin-right: 5px;"></span>' +
|
||||
'<strong>{{ lang._("Route Redistribution") }}</strong>' +
|
||||
'</td>'
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Some trickery to make the redistribution grid look like its part of the base form */
|
||||
.bootgrid-header[id*='{{ formGridEditRedistribution['table_id'] }}'] {
|
||||
padding-left: 10px;
|
||||
}
|
||||
#{{ formGridEditRedistribution['table_id'] }}.bootgrid-table {
|
||||
margin-left: 25%;
|
||||
width: 75%;
|
||||
}
|
||||
.bootgrid-footer[id*='{{ formGridEditRedistribution['table_id'] }}'] {
|
||||
margin-left: 24%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Navigation bar -->
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
<li class="active"><a data-toggle="tab" href="#general">{{ lang._('General') }}</a></li>
|
||||
@@ -98,6 +131,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
<!-- Tab: General -->
|
||||
<div id="general" class="tab-pane fade in active">
|
||||
{{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_ospf_settings'])}}
|
||||
{{ partial('layout_partials/base_bootgrid_table', formGridEditRedistribution)}}
|
||||
</div>
|
||||
<!-- Tab: Networks -->
|
||||
<div id="networks" class="tab-pane fade in">
|
||||
@@ -121,3 +155,4 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditInterface,'id':formGridEditInterface['edit_dialog_id'],'label':lang._('Edit Interface')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditPrefixLists,'id':formGridEditPrefixLists['edit_dialog_id'],'label':lang._('Edit Prefix Lists')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditRouteMaps,'id':formGridEditRouteMaps['edit_dialog_id'],'label':lang._('Edit Route Maps')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditRedistribution,'id':formGridEditRedistribution['edit_dialog_id'],'label':lang._('Edit Route Redistribution')])}}
|
||||
|
||||
@@ -78,6 +78,14 @@
|
||||
'del':'/api/quagga/ospf6settings/delRoutemap/',
|
||||
'toggle':'/api/quagga/ospf6settings/toggleRoutemap/'
|
||||
});
|
||||
$("#{{formGridEditRedistribution['table_id']}}").UIBootgrid({
|
||||
'search':'/api/quagga/ospf6settings/searchRedistribution',
|
||||
'get':'/api/quagga/ospf6settings/getRedistribution/',
|
||||
'set':'/api/quagga/ospf6settings/setRedistribution/',
|
||||
'add':'/api/quagga/ospf6settings/addRedistribution/',
|
||||
'del':'/api/quagga/ospf6settings/delRedistribution/',
|
||||
'toggle':'/api/quagga/ospf6settings/toggleRedistribution/'
|
||||
});
|
||||
|
||||
// hook checkbox item with conditional options
|
||||
$("#ospf6\\.originate").change(function(){
|
||||
@@ -87,10 +95,33 @@
|
||||
$(".ospf6_originate").closest('tr').hide();
|
||||
}
|
||||
});
|
||||
|
||||
const $header = $(".bootgrid-header[id*='{{formGridEditRedistribution['table_id']}}']");
|
||||
if ($header.length) {
|
||||
$header.find("div.actionBar").parent().prepend(
|
||||
'<td class="col-sm-2 theading-text">' +
|
||||
'<span class="fa fa-info-circle text-muted" style="margin-right: 5px;"></span>' +
|
||||
'<strong>{{ lang._("Route Redistribution") }}</strong>' +
|
||||
'</td>'
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
/* Some trickery to make the redistribution grid look like its part of the base form */
|
||||
.bootgrid-header[id*='{{ formGridEditRedistribution['table_id'] }}'] {
|
||||
padding-left: 10px;
|
||||
}
|
||||
#{{ formGridEditRedistribution['table_id'] }}.bootgrid-table {
|
||||
margin-left: 25%;
|
||||
width: 75%;
|
||||
}
|
||||
.bootgrid-footer[id*='{{ formGridEditRedistribution['table_id'] }}'] {
|
||||
margin-left: 24%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Navigation bar -->
|
||||
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
|
||||
@@ -104,6 +135,7 @@
|
||||
<!-- Tab: General -->
|
||||
<div id="general" class="tab-pane fade in active">
|
||||
{{ partial("layout_partials/base_form",['fields':ospf6Form,'id':'frm_ospf6_settings'])}}
|
||||
{{ partial('layout_partials/base_bootgrid_table', formGridEditRedistribution)}}
|
||||
</div>
|
||||
<!-- Tab: Networks -->
|
||||
<div id="networks" class="tab-pane fade in">
|
||||
@@ -127,3 +159,4 @@
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditInterface,'id':formGridEditInterface['edit_dialog_id'],'label':lang._('Edit Interface')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditPrefixLists,'id':formGridEditPrefixLists['edit_dialog_id'],'label':lang._('Edit Prefix Lists')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditRouteMaps,'id':formGridEditRouteMaps['edit_dialog_id'],'label':lang._('Edit Route Maps')])}}
|
||||
{{ partial("layout_partials/base_dialog",['fields':formDialogEditRedistribution,'id':formGridEditRedistribution['edit_dialog_id'],'label':lang._('Edit Route Redistribution')])}}
|
||||
|
||||
@@ -150,11 +150,11 @@ router bgp {{ OPNsense.quagga.bgp.asnumber }}
|
||||
|
||||
{% for addressFamily in addressFamilies %}
|
||||
address-family {{ addressFamily }} unicast
|
||||
{% if helpers.exists('OPNsense.quagga.bgp.redistribute') and OPNsense.quagga.bgp.redistribute != '' %}
|
||||
{% for bgp_redistribute in OPNsense.quagga.bgp.redistribute.split(',') %}
|
||||
redistribute {{ bgp_redistribute }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% for redistribution in helpers.toList('OPNsense.quagga.bgp.redistributions.redistribution') %}
|
||||
{% if redistribution.enabled == '1' %}
|
||||
redistribute {{ redistribution.redistribute }}{% if redistribution.linkedRoutemap %} route-map {{ helpers.getUUID(redistribution.linkedRoutemap).name }}{% endif +%}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for network in networks[addressFamily] %}
|
||||
network {{ network }}
|
||||
{% endfor %}
|
||||
|
||||
@@ -37,11 +37,11 @@ router ospf6
|
||||
default-information originate{% if not helpers.empty('OPNsense.quagga.ospf6.originatealways') %} always {% endif %}{% if OPNsense.quagga.ospf6.originatemetric|default('') != '' %} metric {{ OPNsense.quagga.ospf6.originatemetric }}{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% if not helpers.empty('OPNsense.quagga.ospf6.redistribute')%}
|
||||
{% for line in OPNsense.quagga.ospf6.redistribute.split(',') %}
|
||||
{% if not helpers.empty('OPNsense.quagga.ospf6.redistributemap') %}{% set line = line + " route-map " + helpers.getUUID(OPNsense.quagga.ospf6.redistributemap).name %}{% endif %}
|
||||
redistribute {{ line }}
|
||||
{% endfor %}{% endif %}
|
||||
{% for redistribution in helpers.toList('OPNsense.quagga.ospf6.redistributions.redistribution') %}
|
||||
{% if redistribution.enabled == '1' %}
|
||||
redistribute {{ redistribution.redistribute }}{% if redistribution.linkedRoutemap %} route-map {{ helpers.getUUID(redistribution.linkedRoutemap).name }}{% endif +%}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if helpers.exists('OPNsense.quagga.ospf6.networks.network') %}
|
||||
{% for network in helpers.toList('OPNsense.quagga.ospf6.networks.network') %}
|
||||
{% if network.enabled == '1' %}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user