diff options
author | Christian Breunig <christian@breunig.cc> | 2025-02-24 20:54:25 +0100 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2025-02-24 20:54:25 +0100 |
commit | 216e80b61881a13c502f44c5d32fd7603b6ffe60 (patch) | |
tree | 08a92ec479f854e0e098fb4e54d1cb8b7a46ea22 /src/migration-scripts/lldp/2-to-3 | |
parent | 5d9d232fd93ad5bf89ba44a2d0ec3b196599fa74 (diff) | |
download | vyos-1x-216e80b61881a13c502f44c5d32fd7603b6ffe60.tar.gz vyos-1x-216e80b61881a13c502f44c5d32fd7603b6ffe60.zip |
lldp: T7165: add support to enable only rx or tx on specific interface
LLDP is a stateless protocol which does not necessitate sending to receive
advertisements. There are multiple scenarios such as provider peering links in
which it is advantageous to receive LLDP but not disclose internal information
to the provider.
Add new CLI command:
* set service lldp interface <name> mode [disable|rx-tx|rx|tx]
The default is unchanged and will be rx-tx.
Furthermore if an interface has an explicit LLDP disable configured under
"set service lldp interface <name> disable" this will be migrated to
"set service lldp interface <name> mode disable"
Diffstat (limited to 'src/migration-scripts/lldp/2-to-3')
-rw-r--r-- | src/migration-scripts/lldp/2-to-3 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/migration-scripts/lldp/2-to-3 b/src/migration-scripts/lldp/2-to-3 new file mode 100644 index 000000000..93090756c --- /dev/null +++ b/src/migration-scripts/lldp/2-to-3 @@ -0,0 +1,31 @@ +# Copyright 2025 VyOS maintainers and contributors <maintainers@vyos.io> +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this library. If not, see <http://www.gnu.org/licenses/>. + +# T7165: Migrate LLDP interface disable to 'mode disable' + +from vyos.configtree import ConfigTree + +base = ['service', 'lldp'] + +def migrate(config: ConfigTree) -> None: + interface_base = base + ['interface'] + if not config.exists(interface_base): + # Nothing to do + return + + for interface in config.list_nodes(interface_base): + if config.exists(interface_base + [interface, 'disable']): + config.delete(interface_base + [interface, 'disable']) + config.set(interface_base + [interface, 'mode'], value='disable') |