Reviewed-by: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
docs/schemas/domaincommon.rng | 27 +-----------------
docs/schemas/nwfilter.rng | 29 +------------------
docs/schemas/nwfilter_params.rng | 32 +++++++++++++++++++++
docs/schemas/nwfilterbinding.rng | 49 ++++++++++++++++++++++++++++++++
tests/virschematest.c | 1 +
5 files changed, 84 insertions(+), 54 deletions(-)
create mode 100644 docs/schemas/nwfilter_params.rng
create mode 100644 docs/schemas/nwfilterbinding.rng
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4a454dddb4..3f0c780ef3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5,6 +5,7 @@
<include href='storagecommon.rng'/>
<include href='networkcommon.rng'/>
<include href='cputypes.rng'/>
+ <include href='nwfilter_params.rng'/>
<!--
description and title element, may be placed anywhere under the root
@@ -5394,22 +5395,6 @@
</element>
</define>
- <define name="filterref-node-attributes">
- <attribute name="filter">
- <data type="NCName"/>
- </attribute>
- <zeroOrMore>
- <element name="parameter">
- <attribute name="name">
- <ref name="filter-param-name"/>
- </attribute>
- <attribute name="value">
- <ref name="filter-param-value"/>
- </attribute>
- </element>
- </zeroOrMore>
- </define>
-
<define name="deviceBoot">
<element name="boot">
<attribute name="order">
@@ -6136,16 +6121,6 @@
<param name="pattern">[a-zA-Z0-9_\.\+\-/]+</param>
</data>
</define>
- <define name="filter-param-name">
- <data type="string">
- <param name="pattern">[a-zA-Z0-9_]+</param>
- </data>
- </define>
- <define name="filter-param-value">
- <data type="string">
- <param name="pattern">[a-zA-Z0-9_\.:]+</param>
- </data>
- </define>
<define name="spaprvioReg">
<data type="string">
<param name="pattern">(0x)?[0-9a-fA-F]{1,16}</param>
diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng
index cca6ff2954..05a79da112 100644
--- a/docs/schemas/nwfilter.rng
+++ b/docs/schemas/nwfilter.rng
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns=""
xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href='basictypes.rng'/>
+ <include href='nwfilter_params.rng'/>
<start>
<ref name="filter"/>
</start>
@@ -245,22 +246,6 @@
</optional>
</define>
- <define name="filterref-node-attributes">
- <attribute name="filter">
- <data type="NCName"/>
- </attribute>
- <zeroOrMore>
- <element name="parameter">
- <attribute name="name">
- <ref name="filter-param-name"/>
- </attribute>
- <attribute name="value">
- <ref name="filter-param-value"/>
- </attribute>
- </element>
- </zeroOrMore>
- </define>
-
<define name="rule-node-attributes">
<attribute name="action">
<ref name='action-type'/>
@@ -937,18 +922,6 @@
</choice>
</define>
- <define name="filter-param-name">
- <data type="string">
- <param name="pattern">[a-zA-Z0-9_]+</param>
- </data>
- </define>
-
- <define name="filter-param-value">
- <data type="string">
- <param name="pattern">[a-zA-Z0-9_\.:]+</param>
- </data>
- </define>
-
<define name='action-type'>
<choice>
<value>drop</value>
diff --git a/docs/schemas/nwfilter_params.rng b/docs/schemas/nwfilter_params.rng
new file mode 100644
index 0000000000..a3e7b35b6f
--- /dev/null
+++ b/docs/schemas/nwfilter_params.rng
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!-- network-related definitions used in multiple grammars -->
+<grammar
xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+
+ <define name="filterref-node-attributes">
+ <attribute name="filter">
+ <data type="NCName"/>
+ </attribute>
+ <zeroOrMore>
+ <element name="parameter">
+ <attribute name="name">
+ <ref name="filter-param-name"/>
+ </attribute>
+ <attribute name="value">
+ <ref name="filter-param-value"/>
+ </attribute>
+ </element>
+ </zeroOrMore>
+ </define>
+
+ <define name="filter-param-name">
+ <data type="string">
+ <param name="pattern">[a-zA-Z0-9_]+</param>
+ </data>
+ </define>
+ <define name="filter-param-value">
+ <data type="string">
+ <param name="pattern">[a-zA-Z0-9_\.:]+</param>
+ </data>
+ </define>
+
+</grammar>
diff --git a/docs/schemas/nwfilterbinding.rng b/docs/schemas/nwfilterbinding.rng
new file mode 100644
index 0000000000..9c8e5a83cf
--- /dev/null
+++ b/docs/schemas/nwfilterbinding.rng
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<grammar
xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- domain-related definitions used in multiple grammars -->
+ <include href='basictypes.rng'/>
+ <include href='nwfilter_params.rng'/>
+
+ <start>
+ <ref name="filterbinding"/>
+ </start>
+
+ <define name="filterbinding">
+ <element name="filterbinding">
+ <interleave>
+ <element name="owner">
+ <element name="name">
+ <text/>
+ </element>
+ <element name="uuid">
+ <ref name="UUID"/>
+ </element>
+ </element>
+
+ <element name="portdev">
+ <attribute name="name"/>
+ <empty/>
+ </element>
+
+ <optional>
+ <element name="linkdev">
+ <attribute name="name"/>
+ <empty/>
+ </element>
+ </optional>
+
+ <element name="mac">
+ <attribute name="address">
+ <ref name="uniMacAddr"/>
+ </attribute>
+ <empty/>
+ </element>
+
+ <element name="filterref">
+ <ref name="filterref-node-attributes"/>
+ </element>
+ </interleave>
+ </element>
+ </define>
+
+</grammar>
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 2d35833919..5bae022111 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -230,6 +230,7 @@ mymain(void)
"networkxml2xmlout", "networkxml2confdata");
DO_TEST_DIR("nodedev.rng", "nodedevschemadata");
DO_TEST_DIR("nwfilter.rng", "nwfilterxml2xmlout");
+ DO_TEST_DIR("nwfilterbinding.rng",
"virnwfilterbindingxml2xmldata");
DO_TEST_DIR("secret.rng", "secretxml2xmlin");
DO_TEST_DIR("storagepool.rng", "storagepoolxml2xmlin",
"storagepoolxml2xmlout",
"storagepoolschemadata");
--
2.17.0