net/frr: Route-Map match Prefix-List (#1002)

This commit is contained in:
Michael
2018-12-14 17:13:39 +01:00
committed by Franco Fichtner
parent 147e344d87
commit d06cf1bbf6
5 changed files with 36 additions and 4 deletions
@@ -137,7 +137,7 @@ class BgpController extends ApiMutableModelControllerBase
{
return $this->searchBase(
'routemaps.routemap',
array("enabled", "name", "action", "id", "match", "set")
array("enabled", "name", "action", "id", "match", "match2", "set")
);
}
@@ -29,12 +29,20 @@
<type>select_multiple</type>
<style>tokenize</style>
<allownew>true</allownew>
<help>Select the AS-Path list</help>
<help>Select the AS-Path List.</help>
</field>
<field>
<id>routemap.match2</id>
<label>Prefix List</label>
<type>select_multiple</type>
<style>tokenize</style>
<allownew>true</allownew>
<help>Select the Prefix List.</help>
</field>
<field>
<id>routemap.set</id>
<label>Set</label>
<type>text</type>
<help>Free text field for your set, please be careful! You can set e.g. "local-prefernce 300" or "community 1:1" (http://www.nongnu.org/quagga/docs/docs-multi/Route-Map-Set-Command.html#Route-Map-Set-Command)</help>
<help>Free text field for your set, please be careful! You can set e.g. "local-preference 300" or "community 1:1" (http://www.nongnu.org/quagga/docs/docs-multi/Route-Map-Set-Command.html#Route-Map-Set-Command)</help>
</field>
</form>
@@ -1,7 +1,7 @@
<model>
<mount>//OPNsense/quagga/bgp</mount>
<description>BGP Routing configuration</description>
<version>1.0.1</version>
<version>1.0.2</version>
<items>
<enabled type="BooleanField">
<default>0</default>
@@ -219,6 +219,18 @@
<Multiple>Y</Multiple>
<Required>N</Required>
</match>
<match2 type="ModelRelationField">
<Model>
<template>
<source>OPNsense.quagga.bgp</source>
<items>prefixlists.prefixlist</items>
<display>name</display>
</template>
</Model>
<ValidationMessage>Related item not found</ValidationMessage>
<Multiple>N</Multiple>
<Required>N</Required>
</match2>
<set type="TextField">
<default></default>
<Required>Y</Required>
@@ -139,6 +139,7 @@ POSSIBILITY OF SUCH DAMAGE.
<th data-column-id="action" data-type="string" data-visible="true">{{ lang._('Action') }}</th>
<th data-column-id="id" data-type="string" data-visible="true">{{ lang._('ID') }}</th>
<th data-column-id="match" data-type="string" data-visible="true">{{ lang._('AS Path List') }}</th>
<th data-column-id="match2" data-type="string" data-visible="true">{{ lang._('Prefix List') }}</th>
<th data-column-id="set" data-type="string" data-visible="true">{{ lang._('Set') }}</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>
@@ -191,6 +191,17 @@ route-map {{ routemap.name }} {{ routemap.action }} {{ routemap.id }}
{% if routemap.set != '' %}
set {{ routemap.set }}
{% endif %}
{% if routemap.match2|default("") != "" %}
{% for prefixlist in routemap.match2.split(",") %}
{% set prefixlist_data = helpers.getUUID(prefixlist) %}
{% if 'match2' in routemap and routemap.match2 != '' %}
match ip address prefix-list {{ prefixlist_data.name }}
{% endif %}
{% endfor %}
{% endif %}
{% if routemap.set != '' %}
set {{ routemap.set }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}