crosvm: factorize net device creation code
crosvm: factorize net device creation code

Some of the network creation device is copy/pasted across functions.
Since we are going to add one more of these functions, make sure we stop
repeating it by consolidating it into a single function that takes a
device creation closure as parameter.

BUG=None
TEST=Successfully created a network interface using `--host_ip`,
`--netmask` and `--mac`.

Change-Id: Id0d01ffd14f2b827fb54cf68878b015682f39df2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3327803
Reviewed-by: Chirantan Ekbote <35787c0e27de5c48735e07f8324823b765e8bcbc@chromium.org>
Tested-by: kokoro <2ac7b1f3fa578934c95181d4272be0d3bca00121@google.com>
Commit-Queue: Alexandre Courbot <301cd6a3ea50a894b4b51e385c5eb12b9a4ffc0c@chromium.org>

google/crosvm,google/crosvm,google/crosvm,google/crosvm