[libvirt] [PATCH] nwfilter: Add filter schema for nwfilter XML, extend domain XML schema

Daniel Veillard veillard at redhat.com
Tue Apr 6 13:10:11 UTC 2010


On Mon, Apr 05, 2010 at 12:53:19PM -0400, Stefan Berger wrote:
> This patch adds a relaxng nwfilter schema along with a test that
> verifies all the test output XML against the schema. The input XMLs
> contain a lot of intentional out-of-range values that make them fail the
> schema verification, so I am not verifying against those.
> 
> Signed-off-by: Stefan Berger <stefanb at us.ibm.com>
> Signed-off-by: Gerhard Stenzel <gerhard.stenzel at de.ibm.com>
> 
> ---
>  docs/schemas/Makefile.am  |    3 
>  docs/schemas/domain.rng   |   31 +
>  docs/schemas/nwfilter.rng |  783
> ++++++++++++++++++++++++++++++++++++++++++++++
>  libvirt.spec.in           |    1 
>  tests/Makefile.am         |    4 
>  tests/nwfilterschematest  |   11 
>  6 files changed, 831 insertions(+), 2 deletions(-)
> 
[...]
> +  <define name="addrMAC">
> +    <choice>
> +      <!-- variable -->
> +      <data type="string">
> +        <param name="pattern">[\\$]{1}[a-zA-Z0-9_]+</param>
> +      </data>
> +
> +      <data type="string">
> +        <param
> name="pattern">([a-fA-F0-9]{1,2}:){5}[a-fA-F0-9]{1,2}</param>
> +      </data>
> +    </choice>
> +  </define>

  Hum, can you explain why you get apparently 2 completely different
format values ranges here (and in a number of other types), I'm a bit
lost.

[...]
> Index: libvirt-acl/docs/schemas/domain.rng
> ===================================================================
> --- libvirt-acl.orig/docs/schemas/domain.rng
> +++ libvirt-acl/docs/schemas/domain.rng
> @@ -894,6 +894,11 @@
>        <optional>
>          <ref name="address"/>
>        </optional>
> +      <optional>
> +        <element name="filterref">
> +          <ref name="filterref-node-attributes"/>
> +        </element>
> +      </optional>
>      </interleave>
>    </define>
>    <!--
> @@ -1577,6 +1582,22 @@
>      </element>
>    </define>
>  
> +  <define name="filterref-node-attributes">
> +    <attribute name="filter">
> +      <data type="NCName"/>
> +    </attribute>
> +    <optional>
> +      <element name="parameter">
> +        <attribute name="name">
> +          <ref name="parameter-name"/>
> +        </attribute>
> +        <attribute name="value">
> +          <ref name="parameter-value"/>
> +        </attribute>
> +      </element>
> +    </optional>
> +  </define>
> +
>    <!--
>         Type library
>  
> @@ -1737,4 +1758,14 @@
>        <param name="pattern">[a-zA-Z0-9_\.\+\-/]+</param>
>      </data>
>    </define>
> +  <define name="parameter-name">
> +    <data type="string">
> +      <param name="pattern">[a-zA-Z0-9_]+</param>
> +    </data>
> +  </define>
> +  <define name="parameter-value">
> +    <data type="string">
> +      <param name="pattern">[a-zA-Z0-9_\.:]+</param>
> +    </data>
> +  </define>
>  </grammar>

I just find parameter-name/parameter-value a bit too generic names,
if you could make them more specific to the task, like
   filter-param-name / filter-param-value

but it's minor, and it's good to have updated schema and augmented
testing

ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list