schemas: add schema for nwfilter binding XML document

Reviewed-by: John Ferlan <jferlan@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2018-05-15 18:00:16 +01:00
parent 17b1ebf4ec
commit 41d619e99c
5 changed files with 84 additions and 54 deletions

View File

@ -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
@ -5407,22 +5408,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">
@ -6149,16 +6134,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>

View File

@ -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>
@ -246,22 +247,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'/>
@ -938,18 +923,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>

View File

@ -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>

View File

@ -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>

View File

@ -230,6 +230,7 @@ mymain(void)
"networkxml2xmlout", "networkxml2confdata");
DO_TEST_DIR("nodedev.rng", "nodedevschemadata");
DO_TEST_DIR("nwfilter.rng", "nwfilterxml2xmlout", "../examples/xml/nwfilter");
DO_TEST_DIR("nwfilterbinding.rng", "virnwfilterbindingxml2xmldata");
DO_TEST_DIR("secret.rng", "secretxml2xmlin");
DO_TEST_DIR("storagepool.rng", "storagepoolxml2xmlin", "storagepoolxml2xmlout",
"storagepoolschemadata");