Re: [libvirt] [PATCH] nwfilter: More XML parser test cases

2010-04-09 Thread Daniel Veillard
On Thu, Apr 08, 2010 at 09:33:38PM -0400, Stefan Berger wrote:
 This patch adds a couple more nwfilter test cases for the XML parser tests.
 
 Signed-off-by: Stefan Berger stef...@us.ibm.com

  More tests is good :-)

ACK,

Daniel

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] nwfilter: More XML parser test cases

2010-04-08 Thread Stefan Berger
This patch adds a couple more nwfilter test cases for the XML parser tests.

Signed-off-by: Stefan Berger stef...@us.ibm.com

Index: libvirt-acl/tests/nwfilterxml2xmlin/ipt-no-macspoof-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlin/ipt-no-macspoof-test.xml
@@ -0,0 +1,14 @@
+filter name='testcase'
+  uuid5c6d49af-b071-6127-b4ec-6f8ed4b55335/uuid
+  rule action='drop' direction='inout'
+ !-- should use $MAC for MAC address, but tests would depend on VM's
+  MAC address --
+ all match='no' srcmacaddr='12:34:56:78:9a:bc'/
+  /rule
+
+  rule action='drop' direction='in'
+ !-- not accepting incoming traffic from a certain MAC address --
+ all match='no' srcmacaddr='aa:aa:aa:aa:aa:aa'/
+  /rule
+
+/filter
Index: libvirt-acl/tests/nwfilterxml2xmltest.c
===
--- libvirt-acl.orig/tests/nwfilterxml2xmltest.c
+++ libvirt-acl/tests/nwfilterxml2xmltest.c
@@ -114,6 +114,10 @@ mymain(int argc, char **argv)
 
 DO_TEST(ref-test);
 DO_TEST(ref-rule-test);
+DO_TEST(ipt-no-macspoof-test);
+DO_TEST(icmp-direction-test);
+DO_TEST(icmp-direction2-test);
+DO_TEST(icmp-direction3-test);
 
 return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
 }
Index: libvirt-acl/tests/nwfilterxml2xmlout/ipt-no-macspoof-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlout/ipt-no-macspoof-test.xml
@@ -0,0 +1,9 @@
+filter name='testcase' chain='root'
+  uuid5c6d49af-b071-6127-b4ec-6f8ed4b55335/uuid
+  rule action='drop' direction='inout' priority='500'
+all match='no' srcmacaddr='12:34:56:78:9a:bc'/
+  /rule
+  rule action='drop' direction='in' priority='500'
+all match='no' srcmacaddr='aa:aa:aa:aa:aa:aa'/
+  /rule
+/filter
Index: libvirt-acl/tests/nwfilterxml2xmlin/icmp-direction-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlin/icmp-direction-test.xml
@@ -0,0 +1,15 @@
+filter name='testcase'
+uuidf4b3f745-d23d-2ee6-218a-d5671611229b/uuid
+!-- allow incoming ICMP Echo Reply --
+rule action='accept' direction='in' priority='500'
+icmp type='0'/
+/rule
+!-- allow outgoing ICMP Echo Request --
+rule action='accept' direction='out' priority='500'
+icmp type='8'/
+/rule
+!-- drop all other ICMP traffic --
+rule action='drop' direction='inout' priority='600'
+icmp/
+/rule
+/filter
Index: libvirt-acl/tests/nwfilterxml2xmlout/icmp-direction-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlout/icmp-direction-test.xml
@@ -0,0 +1,12 @@
+filter name='testcase' chain='root'
+  uuidf4b3f745-d23d-2ee6-218a-d5671611229b/uuid
+  rule action='accept' direction='in' priority='500'
+icmp type='0'/
+  /rule
+  rule action='accept' direction='out' priority='500'
+icmp type='8'/
+  /rule
+  rule action='drop' direction='inout' priority='600'
+icmp/
+  /rule
+/filter
Index: libvirt-acl/tests/nwfilterxml2xmlin/icmp-direction2-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlin/icmp-direction2-test.xml
@@ -0,0 +1,15 @@
+filter name='testcase'
+uuidd6b1a2af-def6-2898-9f8d-4a74e3c39558/uuid
+!-- allow incoming ICMP Echo Request --
+rule action='accept' direction='in' priority='500'
+icmp type='8'/
+/rule
+!-- allow outgoing ICMP Echo Reply --
+rule action='accept' direction='out' priority='500'
+icmp type='0'/
+/rule
+!-- drop all other ICMP traffic --
+rule action='drop' direction='inout' priority='600'
+icmp/
+/rule
+/filter
Index: libvirt-acl/tests/nwfilterxml2xmlout/icmp-direction2-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlout/icmp-direction2-test.xml
@@ -0,0 +1,12 @@
+filter name='testcase' chain='root'
+  uuidd6b1a2af-def6-2898-9f8d-4a74e3c39558/uuid
+  rule action='accept' direction='in' priority='500'
+icmp type='8'/
+  /rule
+  rule action='accept' direction='out' priority='500'
+icmp type='0'/
+  /rule
+  rule action='drop' direction='inout' priority='600'
+icmp/
+  /rule
+/filter
Index: libvirt-acl/tests/nwfilterxml2xmlin/icmp-direction3-test.xml
===
--- /dev/null
+++ libvirt-acl/tests/nwfilterxml2xmlin/icmp-direction3-test.xml
@@ -0,0 +1,10 @@
+filter name='testcase'
+uuidd6b1a2af-def6-2898-9f8d-4a74e3c39558/uuid
+rule action='accept' direction='out' priority='500'
+icmp/
+/rule
+!-- drop all other traffic --
+rule action='drop' direction='inout' priority='600'
+all/
+/rule
+/filter
Index: