virttest.virsh: Modify net_dumpxml() for virsh net-list test

Introduce an extra parameter to the function, an
output file. If it is passed, write the output of
the command to a file. This is necessary for the
virsh net-list test.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
libvirt: Add new test virsh net-list

Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com>