From 6a3d9065df08b9f955d1b5a5f72160d1040c84ed Mon Sep 17 00:00:00 2001 From: Amy Parker Date: Fri, 28 Jul 2023 15:31:03 -0700 Subject: [PATCH] ssvplwc: server-side implementation This patch implements the module for tests via ssvplwc. Signed-off-by: Amy Parker --- srv/test_modules/__init__.py | 4 +++- srv/test_modules/ssvplwc.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 srv/test_modules/ssvplwc.py diff --git a/srv/test_modules/__init__.py b/srv/test_modules/__init__.py index bb2d8a6..aebf57e 100644 --- a/srv/test_modules/__init__.py +++ b/srv/test_modules/__init__.py @@ -1,9 +1,11 @@ from . import ping from . import httpt +from . import ssvplwc modules = { "ping": ping.ping_t, - "http": httpt.http_t + "http": httpt.http_t, + "ssvplwc": ssvplwc.ssvplwc_t } diff --git a/srv/test_modules/ssvplwc.py b/srv/test_modules/ssvplwc.py new file mode 100644 index 0000000..3024f3e --- /dev/null +++ b/srv/test_modules/ssvplwc.py @@ -0,0 +1,11 @@ +import socket + + +def ssvplwc_t(srv: dict) -> bool: + try: + ss = socket.socket() + ss.connect((srv["ip"], int(srv["args"]))) + b = ss.recv(2048) + return b == b"ssvp-ok" + except ConnectionError: + return False