summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-06-11 23:46:33 +0300
committerDaniil Baturin <daniil@vyos.io>2020-06-11 23:46:33 +0300
commitd94fcc3ae312421e4658c21bb8dfd4847a1a8b48 (patch)
tree042c7608be7cd5494a355b34be727179c1deb011
parentf2f853d2d1ae118fdd7e1cac215bfa26f568e890 (diff)
downloadvyos-1x-d94fcc3ae312421e4658c21bb8dfd4847a1a8b48.tar.gz
vyos-1x-d94fcc3ae312421e4658c21bb8dfd4847a1a8b48.zip
T2588: add support for default values in the leaf node schema.
-rw-r--r--schema/interface_definition.rnc10
-rw-r--r--schema/interface_definition.rng20
2 files changed, 24 insertions, 6 deletions
diff --git a/schema/interface_definition.rnc b/schema/interface_definition.rnc
index 0ce8226cd..6647f5e11 100644
--- a/schema/interface_definition.rnc
+++ b/schema/interface_definition.rnc
@@ -57,14 +57,18 @@ tagNode = element tagNode
# but can have values.
# Leaf node may contain one or more valueConstraint tags
# If multiple valueConstraint tags are used, they work a logical OR
-# Leaf nodes can have "multi" attribute that indicated that it can have
-# more than one value
+# Leaf nodes can have "multi" attribute that indicated that it can have more than one value
+# It can also have a default value
leafNode = element leafNode
{
(ownerAttr? & nodeNameAttr),
- properties
+ (defaultValue? & properties)
}
+# Default value for leaf node, if applicable
+# It is used to generate default node state representation
+defaultValue = element defaultValue { text }
+
# Normal and tag nodes may have children
children = element children
{
diff --git a/schema/interface_definition.rng b/schema/interface_definition.rng
index bfd8d376f..22e886006 100644
--- a/schema/interface_definition.rng
+++ b/schema/interface_definition.rng
@@ -95,8 +95,8 @@
but can have values.
Leaf node may contain one or more valueConstraint tags
If multiple valueConstraint tags are used, they work a logical OR
- Leaf nodes can have "multi" attribute that indicated that it can have
- more than one value
+ Leaf nodes can have "multi" attribute that indicated that it can have more than one value
+ It can also have a default value
-->
<define name="leafNode">
<element name="leafNode">
@@ -106,7 +106,21 @@
</optional>
<ref name="nodeNameAttr"/>
</interleave>
- <ref name="properties"/>
+ <interleave>
+ <optional>
+ <ref name="defaultValue"/>
+ </optional>
+ <ref name="properties"/>
+ </interleave>
+ </element>
+ </define>
+ <!--
+ Default value for leaf node, if applicable
+ It is used to generate default node state representation
+ -->
+ <define name="defaultValue">
+ <element name="defaultValue">
+ <text/>
</element>
</define>
<!-- Normal and tag nodes may have children -->