diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2019-01-19 20:24:09 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2019-01-21 14:11:00 +0100 |
commit | 5254bb1550fd29484310a2e1cb94030a50dd815b (patch) | |
tree | 90147554ebd6e669b78bb1f5723972a83680412a /isisd/isis_dr.h | |
parent | Merge pull request #3625 from donaldsharp/clist_strlen (diff) | |
download | frr-5254bb1550fd29484310a2e1cb94030a50dd815b.tar.xz frr-5254bb1550fd29484310a2e1cb94030a50dd815b.zip |
python: make DEFPY provide the text token of fixed parameters
In the CLI code, each cmd_token has both a "text" field, containing
the full token text (e.g. "unicast"), and an "arg" field,
containing the original text entered by the user (which might be
an abbreviation, like "uni" instead of "unicast").
To avoid the need to handle abbreviations, the recommended pattern
for DEFUN commands is to use the "text" value of fixed parameters
and the "arg" value of everything else.
Using DEFPY, however, the CLI parameters are automagically turned
into C variables which are initialized under the hood (so that
they're conveniently ready for use). The problem is that this
initialization was always using the "arg" value of the parameters,
which was leading to problems like these:
debian# show ipv6 route isi
Unknown route type
debian#
debian# conf t
debian(config)# router isis 1
debian(config-router)# redistribute ipv4 st level-1
% Configuration failed.
Invalid value "st" in "protocol" element.
YANG path: /frr-isisd:isis/instance[area-tag='1']/redistribute/ipv4[protocol='st']/protocol
To fix these problems (and probably others too), make DEFPY commands
auto-detect the type of the input parameters and use either the
"arg" or "text" value from the cmd_tokens accordingly.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'isisd/isis_dr.h')
0 files changed, 0 insertions, 0 deletions