This patch adds a couple of XML parser / schema validator test cases for the new 'ways' to access variables via index or iterator. --- tests/nwfilterxml2xmlin/iter-test1.xml | 6 ++++++ tests/nwfilterxml2xmlin/iter-test2.xml | 23 +++++++++++++++++++++++ tests/nwfilterxml2xmlin/iter-test3.xml | 13 +++++++++++++ tests/nwfilterxml2xmlout/iter-test1.xml | 6 ++++++ tests/nwfilterxml2xmlout/iter-test2.xml | 21 +++++++++++++++++++++ tests/nwfilterxml2xmlout/iter-test3.xml | 12 ++++++++++++ tests/nwfilterxml2xmltest.c | 3 +++ 7 files changed, 84 insertions(+) Index: libvirt-acl/tests/nwfilterxml2xmlin/iter-test1.xml =================================================================== --- /dev/null +++ libvirt-acl/tests/nwfilterxml2xmlin/iter-test1.xml @@ -0,0 +1,6 @@ +<filter name='testcase' chain='root'> + <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid> + <rule action='accept' direction='out'> + <tcp srcipaddr='$A' srcportstart='$B' dscp='2'/> + </rule> +</filter> Index: libvirt-acl/tests/nwfilterxml2xmlin/iter-test2.xml =================================================================== --- /dev/null +++ libvirt-acl/tests/nwfilterxml2xmlin/iter-test2.xml @@ -0,0 +1,23 @@ +<filter name='testcase' chain='root'> + <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid> + <rule action='accept' direction='out'> + <tcp srcipaddr='$A' srcportstart='$B[@0]' dscp='1'/> + </rule> + <rule action='accept' direction='out'> + <udp srcipaddr='$A[@1]' srcportstart='$B[@2]' dscp='2'/> + </rule> + <rule action='accept' direction='out'> + <sctp srcipaddr='$A[@1]' srcportstart='$B[@2]' dstportstart='$C[@2]' + dscp='3'/> + </rule> + <rule action='accept' direction='out'> + <tcp srcipaddr='$A[@1]' srcportstart='$B[@2]' dstportstart='$C[@3]' + dscp='4'/> + </rule> + <rule action='accept' direction='out'> + <udp srcipaddr='$A[@1]' dstipaddr='$A[@2]' dscp='5'/> + </rule> + <rule action='accept' direction='out'> + <sctp srcipaddr='$A' dstipaddr='$A' dscp='6'/> + </rule> +</filter> Index: libvirt-acl/tests/nwfilterxml2xmlin/iter-test3.xml =================================================================== --- /dev/null +++ libvirt-acl/tests/nwfilterxml2xmlin/iter-test3.xml @@ -0,0 +1,13 @@ +<filter name='testcase' chain='root'> + <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid> + <rule action='accept' direction='out'> + <tcp srcipaddr='$A[ 0]' srcportstart='$B[ @0 ] ' dscp='1'/> + </rule> + <rule action='accept' direction='out'> + <udp srcipaddr='$A[1 ]' srcportstart='$B[ @2 ]' dscp='2'/> + </rule> + <rule action='accept' direction='out'> + <sctp srcipaddr='$A[ 1 ] ' srcportstart='$B[2 ] ' dstportstart='$C[ 2 ]' + dscp='3'/> + </rule> +</filter> Index: libvirt-acl/tests/nwfilterxml2xmlout/iter-test1.xml =================================================================== --- /dev/null +++ libvirt-acl/tests/nwfilterxml2xmlout/iter-test1.xml @@ -0,0 +1,6 @@ +<filter name='testcase' chain='root'> + <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid> + <rule action='accept' direction='out' priority='500'> + <tcp srcipaddr='$A' dscp='2' srcportstart='$B'/> + </rule> +</filter> Index: libvirt-acl/tests/nwfilterxml2xmlout/iter-test2.xml =================================================================== --- /dev/null +++ libvirt-acl/tests/nwfilterxml2xmlout/iter-test2.xml @@ -0,0 +1,21 @@ +<filter name='testcase' chain='root'> + <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid> + <rule action='accept' direction='out' priority='500'> + <tcp srcipaddr='$A' dscp='1' srcportstart='$B'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <udp srcipaddr='$A[@1]' dscp='2' srcportstart='$B[@2]'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <sctp srcipaddr='$A[@1]' dscp='3' srcportstart='$B[@2]' dstportstart='$C[@2]'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <tcp srcipaddr='$A[@1]' dscp='4' srcportstart='$B[@2]' dstportstart='$C[@3]'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <udp srcipaddr='$A[@1]' dstipaddr='$A[@2]' dscp='5'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <sctp srcipaddr='$A' dstipaddr='$A' dscp='6'/> + </rule> +</filter> Index: libvirt-acl/tests/nwfilterxml2xmlout/iter-test3.xml =================================================================== --- /dev/null +++ libvirt-acl/tests/nwfilterxml2xmlout/iter-test3.xml @@ -0,0 +1,12 @@ +<filter name='testcase' chain='root'> + <uuid>5c6d49af-b071-6127-b4ec-6f8ed4b55335</uuid> + <rule action='accept' direction='out' priority='500'> + <tcp srcipaddr='$A[0]' dscp='1' srcportstart='$B'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <udp srcipaddr='$A[1]' dscp='2' srcportstart='$B[@2]'/> + </rule> + <rule action='accept' direction='out' priority='500'> + <sctp srcipaddr='$A[1]' dscp='3' srcportstart='$B[2]' dstportstart='$C[2]'/> + </rule> +</filter> Index: libvirt-acl/tests/nwfilterxml2xmltest.c =================================================================== --- libvirt-acl.orig/tests/nwfilterxml2xmltest.c +++ libvirt-acl/tests/nwfilterxml2xmltest.c @@ -153,6 +153,9 @@ mymain(void) DO_TEST("chain_prefixtest1", true); /* derived from arp-test */ DO_TEST("attr-value-test", false); + DO_TEST("iter-test1", false); + DO_TEST("iter-test2", false); + DO_TEST("iter-test3", false); return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE); } -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list