Page MenuHomeVyOS Platform

multi nodes defined in XML are not properly represented as list in get_config_dict()
Closed, ResolvedPublicBUG

Description

Support for list representation of <multi/> nodes was fixed a very long time back. Meaning when calling get_config_dict() it must always retunr a list even if there's only one element on that <multi/> node.

T5010 brought up a corner case where this does not work.

This can be reproduced by:

set protocols bgp address-family l2vpn-evpn vni 100070 route-target both 1:2
set protocols bgp address-family l2vpn-evpn vni 100070 route-target export 70:10070
set protocols bgp address-family l2vpn-evpn vni 100070 route-target export 20:20
set protocols bgp address-family l2vpn-evpn vni 100070 route-target import 70:10070
set protocols bgp system-as 100

Which will generate a config dict of e.g.:

{'address_family': {'l2vpn_evpn': {'vni': {'100070': {'route_target': {'both': '1:2', 'export': ['70:100070', '20:20'], 'import': '70:100070'}}}}},
 'system_as': '100'}

One can cleary see if export is specified two times -> list, whereas import specified only once -> string (both use the same XML data and are <multi/> nodes. This goes back to the issue in T3234 and seems that the replacement of str -> list is dependent on the nesting depth according to @jestabro

Details

Difficulty level
Normal (likely a few hours)
Version
vyos-1.4-rolling-202304231929-amd64.iso
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

Merged T5178 into this one; cf. the description there for background of the issue.

Test case above produces:

{'address-family': {'l2vpn-evpn': {'vni': {'100070': {'route-target': {'both': ['1:2'],
      'export': ['70:10070', '20:20'],
      'import': ['70:10070']}}}}},
 'system-as': '100'}
jestabro moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.