From 54c36e435049ed8f7f248adab171cb114eab1e10 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sat, 25 Feb 2023 22:40:12 +0100 Subject: tunnel: T5034: migrate "multicast enable" CLI node to enable-multicast Tunnel interface multicast settings can be "enabled or disabled". As we prefer valueless nodes, and the linux kernel default is "disabled" we should add a set interfaces tunnel tunXX enable-multicast command --- python/vyos/ifconfig/tunnel.py | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'python/vyos/ifconfig') diff --git a/python/vyos/ifconfig/tunnel.py b/python/vyos/ifconfig/tunnel.py index f776240a1..b7bf7d982 100644 --- a/python/vyos/ifconfig/tunnel.py +++ b/python/vyos/ifconfig/tunnel.py @@ -83,11 +83,6 @@ class TunnelIf(Interface): 'convert': enable_to_on, 'shellcmd': 'ip link set dev {ifname} multicast {value}', }, - 'allmulticast': { - 'validate': lambda v: assert_list(v, ['enable', 'disable']), - 'convert': enable_to_on, - 'shellcmd': 'ip link set dev {ifname} allmulticast {value}', - }, } } @@ -162,14 +157,9 @@ class TunnelIf(Interface): """ Get a synthetic MAC address. """ return self.get_mac_synthetic() - def set_multicast(self): - """ Set multicast """ - if self.config.get('multicast', 'disable') == 'enable': - cmd = 'ip link set dev {ifname} multicast on' - else: - cmd = 'ip link set dev {ifname} multicast off' - - self._cmd(cmd.format(**self.config)) + def set_multicast(self, enable): + """ Change the MULTICAST flag on the device """ + return self.set_interface('multicast', enable) def update(self, config): """ General helper function which works on a dictionary retrived by @@ -179,8 +169,10 @@ class TunnelIf(Interface): # Adjust iproute2 tunnel parameters if necessary self._change_options() - # Add multicast - self.set_multicast() + # IP Multicast + tmp = dict_search('enable_multicast', config) + value = 'enable' if (tmp != None) else 'disable' + self.set_multicast(value) # call base class first super().update(config) -- cgit v1.2.3