[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH V3 2/2] tests/test-filter-mirror:add filter-mirr
From: |
Jason Wang |
Subject: |
Re: [Qemu-devel] [PATCH V3 2/2] tests/test-filter-mirror:add filter-mirror unit test |
Date: |
Mon, 15 Feb 2016 13:54:06 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
On 02/04/2016 03:43 PM, Zhang Chen wrote:
> From: ZhangChen <address@hidden>
>
> Using qtest qmp interface to implement following cases:
> 1) add/remove filter-mirror
> 2) add a filter-mirror then delete the netdev
> 3) add/remove more than one filter-mirrors
> 4) add more than one filter-mirrors and then delete the netdev
The steps here is rather similar to test-netfilter.c. Let's try to
generalize them instead of duplicating codes.
> 5) add filter-mirror with:
> -object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0
>
> then inject packet from the socket connected to qtest-bn0,
> filter-mirror will copy and mirror the packet to mirror0.
> we read packet from mirror0 and then compare to what we inject.
> del filter-mirror.
>
> we start qemu with:
> -netdev socket,id=qtest-bn0,listen=127.0.0.1:9005
> -device e1000,netdev=qtest-bn0,id=qtest-e0
> -chardev socket,id=mirror0,host=127.0.0.1,port=9003,server,nowait
> -chardev socket,id=mirror1,host=127.0.0.1,port=9004,server,nowait
Hardcoded port is not good here since it may cause false positive
(consider the tests may be trigged by lots of automated script both
upstream and downstream). A better solution is using socketpair(2) and
passing pre-created fd(s) to file chardev.
>
> Signed-off-by: zhangchen <address@hidden>
> Signed-off-by: Wen Congyang <address@hidden>
>
[...]