summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-27 20:05:35 +0100
committerGitHub <noreply@github.com>2020-10-27 20:05:35 +0100
commitec099db69f5841e5fff1cbe1d5f8570155946a54 (patch)
tree9dca3abc9206a7a21ab86f487c58ab2574d267fc
parent174ae56c6f498d4c02647608704f009f2c0fc7b9 (diff)
parent50970e1e66c263b78cb9ce090d4883893e91beff (diff)
downloadvyos-1x-ec099db69f5841e5fff1cbe1d5f8570155946a54.tar.gz
vyos-1x-ec099db69f5841e5fff1cbe1d5f8570155946a54.zip
Merge pull request #584 from sever-sever/T2387_oct
bgp: T2387: Fix XML sheme for new bgp and bgp.py handler
-rw-r--r--data/templates/frr/bgp.frr.tmpl2
-rw-r--r--interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i1
-rw-r--r--interface-definitions/protocols-bgp.xml.in7
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py11
4 files changed, 8 insertions, 13 deletions
diff --git a/data/templates/frr/bgp.frr.tmpl b/data/templates/frr/bgp.frr.tmpl
index d011a1e85..02bac3bf7 100644
--- a/data/templates/frr/bgp.frr.tmpl
+++ b/data/templates/frr/bgp.frr.tmpl
@@ -14,7 +14,7 @@ router bgp {{ asn }}
{%- if type == "ipv4_unicast" %}
!
address-family ipv4 unicast
-{# need to check #}
+{#- need to check #}
{%- if 'aggregate_address' in bgp_afi[type] %}
{%- for ip in bgp_afi[type].aggregate_address %}
{%- if ( ('as_set' and 'summary_only') in bgp_afi[type].aggregate_address[ip] ) %}
diff --git a/interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i b/interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i
index f1a61d669..155817838 100644
--- a/interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i
+++ b/interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i
@@ -267,7 +267,6 @@
<leafNode name="unsuppress-map">
<properties>
<help>Route-map to selectively unsuppress suppressed IPv4-routes</help>
- <valueless/>
</properties>
</leafNode>
<leafNode name="weight">
diff --git a/interface-definitions/protocols-bgp.xml.in b/interface-definitions/protocols-bgp.xml.in
index 3a4600753..e1469d6ad 100644
--- a/interface-definitions/protocols-bgp.xml.in
+++ b/interface-definitions/protocols-bgp.xml.in
@@ -342,7 +342,6 @@
<leafNode name="description">
<properties>
<help>Description for this neighbor</help>
- <valueless/>
</properties>
</leafNode>
<leafNode name="disable-capability-negotiation">
@@ -916,12 +915,6 @@
</tagNode>
</children>
</node>
- <leafNode name="enforce-first-as">
- <properties>
- <help>Require first AS in the path to match peer AS number</help>
- <valueless/>
- </properties>
- </leafNode>
<node name="graceful-restart">
<properties>
<help>Graceful restart capability parameters</help>
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index 1978adff5..957f72ed5 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -33,7 +33,7 @@ def get_config():
base = ['protocols', 'nbgp']
bgp = conf.get_config_dict(base, key_mangling=('-', '_'))
if not conf.exists(base):
- return None
+ bgp = {}
from pprint import pprint
pprint(bgp)
@@ -44,10 +44,16 @@ def verify(bgp):
if not bgp:
return None
+ # Check if declared more than one ASN
+ for asn in bgp['nbgp'].items():
+ if len(bgp['nbgp']) > 1:
+ raise ConfigError('Only one bgp ASN process can be definded')
+
return None
def generate(bgp):
if not bgp:
+ bgp['new_frr_config'] = ''
return None
# render(config) not needed, its only for debug
@@ -58,9 +64,6 @@ def generate(bgp):
return None
def apply(bgp):
- if bgp is None:
- return None
-
# Save original configration prior to starting any commit actions
bgp['original_config'] = frr.get_configuration(daemon='bgpd')
bgp['modified_config'] = frr.replace_section(bgp['original_config'], bgp['new_frr_config'], from_re='router bgp .*')