add socketutils 78/88178/1
authorDR695H <dr695h@att.com>
Tue, 21 May 2019 15:13:45 +0000 (11:13 -0400)
committerDR695H <dr695h@att.com>
Tue, 21 May 2019 15:17:40 +0000 (11:17 -0400)
socketuitls will let us replace rammbock fro simple libs

Change-Id: I20c44a214bc2e839cb1c261d0ef2f0dd06bcfb54
Issue-ID: TEST-155
Signed-off-by: DR695H <dr695h@att.com>
robotframework-onap/eteutils/SocketUtils.py [new file with mode: 0644]

diff --git a/robotframework-onap/eteutils/SocketUtils.py b/robotframework-onap/eteutils/SocketUtils.py
new file mode 100644 (file)
index 0000000..0214a13
--- /dev/null
@@ -0,0 +1,15 @@
+import socket
+
+
+class SocketUtils:
+    """SocketUtils is common resource for simple socket keywords."""
+
+    def __init__(self):
+        pass
+
+    def send_binary_data(self, host, port, data):
+        """ send raw bytes over tcp socket"""
+        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        # Connect to server and send data
+        sock.connect((host, int(port)))
+        sock.sendall(bytes(data))