summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-03-27 22:43:26 +0200
committerChristian Breunig <christian@breunig.cc>2023-03-27 22:47:02 +0200
commitd9fa39a370c06d8add22a7018d14984e5ac14fc8 (patch)
tree7e6734779ca330e3425a20424ffac8e0d13912a9
parent35126e6b41b212aafb2784dee7577b0682bb3af5 (diff)
downloadvyos-1x-d9fa39a370c06d8add22a7018d14984e5ac14fc8.tar.gz
vyos-1x-d9fa39a370c06d8add22a7018d14984e5ac14fc8.zip
bgp: T5114: add "neighbor path-attribute discard"
-rw-r--r--data/templates/frr/bgpd.frr.j23
-rw-r--r--interface-definitions/include/bgp/neighbor-path-attribute.xml.i21
-rw-r--r--interface-definitions/include/bgp/protocol-common-config.xml.i2
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py8
4 files changed, 34 insertions, 0 deletions
diff --git a/data/templates/frr/bgpd.frr.j2 b/data/templates/frr/bgpd.frr.j2
index 5170a12ba..346eb3996 100644
--- a/data/templates/frr/bgpd.frr.j2
+++ b/data/templates/frr/bgpd.frr.j2
@@ -74,6 +74,9 @@
{% if config.password is vyos_defined %}
neighbor {{ neighbor }} password {{ config.password }}
{% endif %}
+{% if config.path_attribute.discard is vyos_defined %}
+ neighbor {{ neighbor }} path-attribute discard {{ config.path_attribute.discard }}
+{% endif %}
{% if config.port is vyos_defined %}
neighbor {{ neighbor }} port {{ config.port }}
{% endif %}
diff --git a/interface-definitions/include/bgp/neighbor-path-attribute.xml.i b/interface-definitions/include/bgp/neighbor-path-attribute.xml.i
new file mode 100644
index 000000000..f4f2fcfa9
--- /dev/null
+++ b/interface-definitions/include/bgp/neighbor-path-attribute.xml.i
@@ -0,0 +1,21 @@
+<!-- include start from bgp/neighbor-path-attribute.xml.i -->
+<node name="path-attribute">
+ <properties>
+ <help>Manipulate path attributes from incoming UPDATE messages</help>
+ </properties>
+ <children>
+ <leafNode name="discard">
+ <properties>
+ <help>Drop specified attributes from incoming UPDATE messages</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Attribute number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp/protocol-common-config.xml.i b/interface-definitions/include/bgp/protocol-common-config.xml.i
index aa9cd5850..2bf2fdfc3 100644
--- a/interface-definitions/include/bgp/protocol-common-config.xml.i
+++ b/interface-definitions/include/bgp/protocol-common-config.xml.i
@@ -1005,6 +1005,7 @@
#include <include/bgp/neighbor-local-as.xml.i>
#include <include/bgp/neighbor-local-role.xml.i>
#include <include/bgp/neighbor-override-capability.xml.i>
+ #include <include/bgp/neighbor-path-attribute.xml.i>
#include <include/bgp/neighbor-passive.xml.i>
#include <include/bgp/neighbor-password.xml.i>
#include <include/bgp/peer-group.xml.i>
@@ -1511,6 +1512,7 @@
#include <include/bgp/neighbor-local-as.xml.i>
#include <include/bgp/neighbor-local-role.xml.i>
#include <include/bgp/neighbor-override-capability.xml.i>
+ #include <include/bgp/neighbor-path-attribute.xml.i>
#include <include/bgp/neighbor-passive.xml.i>
#include <include/bgp/neighbor-password.xml.i>
#include <include/bgp/neighbor-shutdown.xml.i>
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index d024ea92a..c366b4e89 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -55,6 +55,7 @@ neighbor_config = {
'route_map_out' : route_map_out,
'no_send_comm_ext' : '',
'addpath_all' : '',
+ 'p_attr_discard' : '123',
},
'192.0.2.2' : {
'bfd_profile' : bfd_profile,
@@ -129,6 +130,7 @@ peer_group_config = {
'cap_over' : '',
'ttl_security' : '5',
'disable_conn_chk' : '',
+ 'p_attr_discard' : '250',
},
'bar' : {
'remote_as' : '111',
@@ -264,6 +266,8 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.assertIn(f' no neighbor {peer} send-community extended', frrconfig)
if 'addpath_all' in peer_config:
self.assertIn(f' neighbor {peer} addpath-tx-all-paths', frrconfig)
+ if 'p_attr_discard' in peer_config:
+ self.assertIn(f' neighbor {peer} path-attribute discard {peer_config["p_attr_discard"]}', frrconfig)
if 'addpath_per_as' in peer_config:
self.assertIn(f' neighbor {peer} addpath-tx-bestpath-per-AS', frrconfig)
if 'advertise_map' in peer_config:
@@ -417,6 +421,8 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.cli_set(base_path + ['neighbor', peer, 'ttl-security', 'hops', peer_config["ttl_security"]])
if 'update_src' in peer_config:
self.cli_set(base_path + ['neighbor', peer, 'update-source', peer_config["update_src"]])
+ if 'p_attr_discard' in peer_config:
+ self.cli_set(base_path + ['neighbor', peer, 'path-attribute', 'discard', peer_config["p_attr_discard"]])
if 'route_map_in' in peer_config:
self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'route-map', 'import', peer_config["route_map_in"]])
if 'route_map_out' in peer_config:
@@ -535,6 +541,8 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.cli_set(base_path + ['peer-group', peer_group, 'graceful-restart', 'restart-helper'])
if 'disable_conn_chk' in config:
self.cli_set(base_path + ['peer-group', peer_group, 'disable-connected-check'])
+ if 'p_attr_discard' in config:
+ self.cli_set(base_path + ['peer-group', peer_group, 'path-attribute', 'discard', config["p_attr_discard"]])
# Conditional advertisement
if 'advertise_map' in config: