From edc64e7fb63757a3779df12945ecefca9c462952 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 25 Jun 2025 17:35:01 +0100 Subject: op-mode: T7560: add support for virtual tag nodes for cases when commands need both fixed and variable arguments --- schema/op-mode-definition.rnc | 13 ++++++++++- schema/op-mode-definition.rng | 54 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 9 deletions(-) (limited to 'schema') diff --git a/schema/op-mode-definition.rnc b/schema/op-mode-definition.rnc index 46430daa4..2fcb2ddd8 100644 --- a/schema/op-mode-definition.rnc +++ b/schema/op-mode-definition.rnc @@ -60,6 +60,15 @@ standalone = element standalone help & command } +# Virtual tag nodes provide a way to add a variable argument +# to a command that also needs fixed arguments, +# like "show ip route" that can take "show ip route bgp" +# or a network and arguments after it, like "show ip route 10.0.0.0/8 longer-prefixes" +virtualTagNode = element virtualTagNode +{ + (properties? & children? & command?) +} + # Leaf nodes are terminal configuration nodes that can't have children, # but can have values. @@ -69,9 +78,11 @@ leafNode = element leafNode (command & properties) } -# Normal and tag nodes may have children +# Normal and tag nodes may have children: nodes, leaf nodes, or tag nodes. +# There can only be one virtual tag node child, though. children = element children { + (virtualTagNode? & (node | tagNode | leafNode)*) | (node | tagNode | leafNode)+ } diff --git a/schema/op-mode-definition.rng b/schema/op-mode-definition.rng index bfd5cb50a..d7a56c6b2 100644 --- a/schema/op-mode-definition.rng +++ b/schema/op-mode-definition.rng @@ -101,6 +101,27 @@ + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + +