summaryrefslogtreecommitdiff
path: root/meta/lib
diff options
context:
space:
mode:
authorFrancisco Pedraza <francisco.j.pedraza.gonzalez@intel.com>2016-02-19 16:05:41 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:32:33 +0000
commit72b336ad0d0a2994f00c57747686111a59fa8b29 (patch)
tree3e01150c2a56df2ccf5852660c0d8b4fea39f6dd /meta/lib
parent3f9b1658d745b536eff1017b2c74a9dff46b6f4a (diff)
downloadopenembedded-core-72b336ad0d0a2994f00c57747686111a59fa8b29.tar.gz
openembedded-core-72b336ad0d0a2994f00c57747686111a59fa8b29.tar.bz2
openembedded-core-72b336ad0d0a2994f00c57747686111a59fa8b29.zip
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. Signed-off-by: Francisco Pedraza <francisco.j.pedraza.gonzalez@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/utils/network.py8
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 @@
+import socket
+
+def get_free_port():
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.bind(('', 0))
+ addr = s.getsockname()
+ s.close()
+ return addr[1]