diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-07-21 22:08:22 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-07-25 15:36:44 +0200 |
commit | 3ee6030b98f8afdbc3a606ce458e11323e59b23c (patch) | |
tree | 51dc07c0ba371c4b075c3271773139bcd7e82772 /src/conf_mode/interfaces-bridge.py | |
parent | 92dd96726dd638593ab0794ab9b66cfb33b2ac67 (diff) | |
download | vyos-1x-3ee6030b98f8afdbc3a606ce458e11323e59b23c.tar.gz vyos-1x-3ee6030b98f8afdbc3a606ce458e11323e59b23c.zip |
vyos.configdict: T2653: add new reusable helper node_changed()
This can be used to see if a tagNode has been changed. It will return a list
of changed nodes.
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 7998a251a..9c43d1983 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -21,7 +21,7 @@ from netifaces import interfaces from vyos.config import Config from vyos.configdict import get_interface_dict -from vyos.configdiff import get_config_diff, Diff +from vyos.configdict import node_changed from vyos.configverify import verify_dhcpv6 from vyos.configverify import verify_vrf from vyos.ifconfig import BridgeIf @@ -34,13 +34,6 @@ from vyos import ConfigError from vyos import airbag airbag.enable() -def get_removed_members(conf): - D = get_config_diff(conf, key_mangling=('-', '_')) - D.set_level(conf.get_level()) - # get_child_nodes() will return dict_keys(), mangle this into a list with PEP448 - keys = D.get_child_nodes_diff(['member', 'interface'], expand_nodes=Diff.DELETE)['delete'].keys() - return list(keys) - def get_config(): """ Retrive CLI config as dictionary. Dictionary can never be empty, as at least the @@ -57,7 +50,7 @@ def get_config(): bridge = get_interface_dict(conf, base, ifname) # determine which members have been removed - tmp = get_removed_members(conf) + tmp = node_changed(conf, ['member', 'interface']) if tmp: if 'member' in bridge: bridge['member'].update({'interface_remove': tmp }) |