Page MenuHomeVyOS Platform

OSPF: route-map names containing a hypen are not "found"
Closed, ResolvedPublicBUG

Description

The introduction of key_mangling=('-', '_') when working with get_config_dict() caused more harm then good.

The main reason here is that Jinja2 does not support working with the . operator on a dictionary key which contains a hyphen.

Imagine a dictionary:

{'area': {'0': {'network': ['172.18.201.0/24', '172.18.254.201/32']},
          'area-type': {}},
 'auto-cost': {'reference-bandwidth': '100'},
 'interface': {'eth0': {'authentication': {'md5': {'key-id': {'10': {'md5-key': 'vyos'}}}},
                            'dead-interval': '40',
                            'hello-interval': '10',
                            'priority': '1',
                            'retransmit-interval': '5',
                            'transmit-delay': '1',
 'log-adjacency-changes': {'detail': {}},
 'parameters': {'abr-type': 'cisco', 'router-id': '172.18.254.201'},
 'passive-interface': ['default'],
 'passive-interface-exclude': ['eth0.201'],
 'redistribute': {},
 'timers': {'throttle': {'spf': {'delay': '200',
                                 'initial-holdtime': '1000',
                                 'max-holdtime': '10000'}}}}

In Jinja2 you can access key like: {{ interface.eth0.priority }} which will give you 1, but you can not use this syntax (.) when accessing keys containing a hyphen, you instead must use: {{ interface.eth0['dead-interval'] }}

Worth noticing: https://blog.networktocode.com/post/Exploring-Jinja-Variable-Syntax-in-Ansible/

Also mentioned here: https://forum.vyos.io/t/vyos-1-4-set-protocols-ospf-route-map-ospf-in-broken/6906/6

Details

Difficulty level
Unknown (require assessment)
Version
1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

c-po changed the task status from Open to In progress.Thu, Apr 8, 11:03 AM
c-po claimed this task.
c-po triaged this task as High priority.
c-po updated the task description. (Show Details)
c-po updated the task description. (Show Details)
c-po moved this task from Need Triage to In Progress on the VyOS 1.4 Sagitta board.