Page MenuHomeVyOS Platform

get_config_dict() no_tag_node_value_mangle has no effect
Resolved (N/A)PublicBUG

Description

To reproduce:

set high-availability vrrp group IPv4_VLAN10 authentication password 'xxxxxx'
set high-availability vrrp group IPv4_VLAN10 authentication type 'ah'
set high-availability vrrp group IPv4_VLAN10 interface 'eth1.10'
set high-availability vrrp group IPv4_VLAN10 preempt-delay '180'
set high-availability vrrp group IPv4_VLAN10 priority '200'
set high-availability vrrp group IPv4_VLAN10 virtual-address '192.168.10.1/24'
set high-availability vrrp group IPv4_VLAN10 vrid '10'
>>> from vyos.config import Config
>>> conf = Config()
>>> base = ['high-availability', 'vrrp']
>>> vrrp = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True, no_tag_node_value_mangle=True)
>>> import pprint
>>> pprint.pprint(vrrp)
{'group': {'IPv4_VLAN10': {'authentication': {'password': 'xxxxxx',
                                              'type': 'ah'},
                           'interface': 'eth1.10',
                           'preempt_delay': '180',
                           'priority': '200',
                           'virtual_address': ['192.168.10.1/24'],
                           'vrid': '10'},
           'IPv4_VLAN75': {'authentication': {'password': 'xxxxxx',
                                              'type': 'ah'},
                           'interface': 'eth1.75',
                           'preempt_delay': '180',
                           'priority': '200',
                           'virtual_address': ['192.168.75.1/24'],
                           'vrid': '75'},
           'IPv4_VLAN98': {'authentication': {'password': 'xxxxxx',
                                              'type': 'ah'},
                           'interface': 'eth1.98',
                           'preempt_delay': '181',
                           'priority': '200',
                           'virtual_address': ['192.168.98.1/24'],
                           'vrid': '98'},
           'IPv4_VLAN99': {'authentication': {'password': 'xxxxxx',
                                              'type': 'ah'},
                           'interface': 'eth1.99',
                           'preempt_delay': '180',
                           'priority': '200',
                           'virtual_address': ['192.168.99.1/24'],
                           'vrid': '99'},
           'IPv4_XS4ALL': {'authentication': {'password': 'xxxxxx',
                                              'type': 'ah'},
                           'interface': 'eth0',
                           'preempt_delay': '180',
                           'priority': '200',
                           'virtual_address': ['192.168.84.192/25'],
                           'vrid': '1'}},
 'sync_group': {'VLAN': {'member': ['IPv4_VLAN10',
                                    'IPv4_VLAN75',
                                    'IPv4_VLAN98',
                                    'IPv4_VLAN99']}}}

Details

Difficulty level
Normal (likely a few hours)
Version
1.3.0-epa1
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

c-po triaged this task as Unbreak Now! priority.
c-po created this task.
jestabro renamed this task from get_config_dict() o_tag_node_value_mangle has no effect to get_config_dict() no_tag_node_value_mangle has no effect.Sep 30 2021, 9:34 PM
jestabro changed the task status from Open to Confirmed.Sep 30 2021, 9:50 PM

A few quick tests would suggest that this is specific to vrrp: though not exhaustive, of course, several examples of setting tag-node values in paths other than vrrp work as expected.

Note that the set commands above have already mangled the name --- no_tag_node_value_mangle is there to preserve names as follows:

set high-availability vrrp group IPv4-VLAN10 authentication password 'xxxxxx'
set high-availability vrrp group IPv4-VLAN10 authentication type 'ah'
set high-availability vrrp group IPv4-VLAN10 interface 'eth1.10'
set high-availability vrrp group IPv4-VLAN10 preempt-delay '180'
set high-availability vrrp group IPv4-VLAN10 priority '200'
set high-availability vrrp group IPv4-VLAN10 virtual-address '192.168.10.1/24'
set high-availability vrrp group IPv4-VLAN10 vrid '10'

With and without no_tag_node_value_mangle:

>>> from vyos.config import Config
>>> conf = Config()
>>> vrrp = conf.get_config_dict(base, key_mangling=('-','_'))
>>> import pprint
>>> pprint.pprint(vrrp)
{'vrrp': {'group': {'IPv4_VLAN10': {'authentication': {'password': 'xxxxxx',
                                                       'type': 'ah'},
                                    'interface': 'eth1.10',
                                    'preempt_delay': '180',
                                    'priority': '200',
                                    'virtual_address': ['192.168.10.1/24'],
                                    'vrid': '10'}}}}
>>> vrrp = conf.get_config_dict(base, key_mangling=('-','_'), no_tag_node_value_mangle=True) 
>>> pprint.pprint(vrrp)
{'vrrp': {'group': {'IPv4-VLAN10': {'authentication': {'password': 'xxxxxx',
                                                       'type': 'ah'},
                                    'interface': 'eth1.10',
                                    'preempt_delay': '180',
                                    'priority': '200',
                                    'virtual_address': ['192.168.10.1/24'],
                                    'vrid': '10'}}}}