mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
nwfilter: More XML parser test cases
This patch adds a couple more nwfilter test cases for the XML parser tests.
This commit is contained in:
parent
98caf6db76
commit
b5cc01ef2e
15
tests/nwfilterxml2xmlin/icmp-direction-test.xml
Normal file
15
tests/nwfilterxml2xmlin/icmp-direction-test.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<filter name='testcase'>
|
||||
<uuid>f4b3f745-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>
|
15
tests/nwfilterxml2xmlin/icmp-direction2-test.xml
Normal file
15
tests/nwfilterxml2xmlin/icmp-direction2-test.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<filter name='testcase'>
|
||||
<uuid>d6b1a2af-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>
|
10
tests/nwfilterxml2xmlin/icmp-direction3-test.xml
Normal file
10
tests/nwfilterxml2xmlin/icmp-direction3-test.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<filter name='testcase'>
|
||||
<uuid>d6b1a2af-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>
|
14
tests/nwfilterxml2xmlin/ipt-no-macspoof-test.xml
Normal file
14
tests/nwfilterxml2xmlin/ipt-no-macspoof-test.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<filter name='testcase'>
|
||||
<uuid>5c6d49af-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>
|
12
tests/nwfilterxml2xmlout/icmp-direction-test.xml
Normal file
12
tests/nwfilterxml2xmlout/icmp-direction-test.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<filter name='testcase' chain='root'>
|
||||
<uuid>f4b3f745-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>
|
12
tests/nwfilterxml2xmlout/icmp-direction2-test.xml
Normal file
12
tests/nwfilterxml2xmlout/icmp-direction2-test.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<filter name='testcase' chain='root'>
|
||||
<uuid>d6b1a2af-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>
|
9
tests/nwfilterxml2xmlout/icmp-direction3-test.xml
Normal file
9
tests/nwfilterxml2xmlout/icmp-direction3-test.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<filter name='testcase' chain='root'>
|
||||
<uuid>d6b1a2af-def6-2898-9f8d-4a74e3c39558</uuid>
|
||||
<rule action='accept' direction='out' priority='500'>
|
||||
<icmp/>
|
||||
</rule>
|
||||
<rule action='drop' direction='inout' priority='600'>
|
||||
<all/>
|
||||
</rule>
|
||||
</filter>
|
9
tests/nwfilterxml2xmlout/ipt-no-macspoof-test.xml
Normal file
9
tests/nwfilterxml2xmlout/ipt-no-macspoof-test.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<filter name='testcase' chain='root'>
|
||||
<uuid>5c6d49af-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>
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user