Add test cases for new ways to access variables in filters

This patch adds a couple of XML parser / schema validator test cases
for the new 'ways' to access variables via index or iterator.
This commit is contained in:
Stefan Berger 2012-01-11 06:42:37 -05:00 committed by Stefan Berger
parent 64484d550d
commit 0c42e1d9aa
7 changed files with 84 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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);
}