diff options
author | Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> | 2016-02-19 16:05:41 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:32:58 +0000 |
commit | 00a6f5afebb495d98993270f18ff2dcec266be57 (patch) | |
tree | fe0940f329c58dff847822bd64b42b3d8e2e861d | |
parent | 3f7aa6fc5d018747e8d3bc8d6038215c36c9ef54 (diff) | |
download | poky-00a6f5afebb495d98993270f18ff2dcec266be57.tar.gz |
oeqa/utils: added new network module
A network module was added, and will contain network utility funcions for now.
with get_free_port that returns available network port in the system.
(From OE-Core rev: 72b336ad0d0a2994f00c57747686111a59fa8b29)
Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/utils/network.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/network.py b/meta/lib/oeqa/utils/network.py new file mode 100644 index 0000000000..2768f6c5db --- /dev/null +++ b/meta/lib/oeqa/utils/network.py | |||
@@ -0,0 +1,8 @@ | |||
1 | import socket | ||
2 | |||
3 | def get_free_port(): | ||
4 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
5 | s.bind(('', 0)) | ||
6 | addr = s.getsockname() | ||
7 | s.close() | ||
8 | return addr[1] | ||