[tests] rework test suite link port allocation
Logic is to try to configure a link with port X and if it fails, try the next
port. This avoids port collisions between services and knet test suite.
Please note that the implementation in test-common.c is NOT super clean.
There is still some redundant code in there that is left on purpose.
There is another branch, not yet merged, that implements functional testing
framework that does heavy use of those functions.
We will clean test-common.c as we port the functional testing branch and make
it ready for merging.
For now, this is good enough to have a more stable test suite.
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>