aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/client.py36
-rw-r--r--client/nfvbench_client.py5
-rw-r--r--client/requirements.txt6
3 files changed, 4 insertions, 43 deletions
diff --git a/client/client.py b/client/client.py
index 5cbc733..b1be69c 100644
--- a/client/client.py
+++ b/client/client.py
@@ -17,8 +17,6 @@
import requests
import time
-from socketIO_client import SocketIO
-
class TimeOutException(Exception):
pass
@@ -32,42 +30,14 @@ class NfvbenchClient(object):
"""Python client class to control a nfvbench server
The nfvbench server must run in background using the --server option.
- Since HTML pages are not required, the path to pass to --server can be
- any directory on the host.
"""
- def __init__(self, nfvbench_url, use_socketio):
+ def __init__(self, nfvbench_url):
"""Client class to send requests to the nfvbench server
Args:
nfvbench_url: the URL of the nfvbench server (e.g. 'http://127.0.0.1:7555')
"""
self.url = nfvbench_url
- self.use_socketio = use_socketio
-
- def socketio_send(self, send_event, receive_event, config, timeout):
- class Exec(object):
- socketIO = None
- socketio_result = None
-
- def close_socketio(result):
- Exec.socketio_result = result
- Exec.socketIO.disconnect()
-
- def on_response(*args):
- close_socketio(args[0])
-
- def on_error(*args):
- raise NfvbenchException(args[0])
-
- Exec.socketIO = SocketIO(self.url)
- Exec.socketIO.on(receive_event, on_response)
- Exec.socketIO.on('error', on_error)
- Exec.socketIO.emit(send_event, config)
- Exec.socketIO.wait(seconds=timeout)
-
- if timeout and not Exec.socketio_result:
- raise TimeOutException()
- return Exec.socketio_result
def http_get(self, command, config):
url = self.url + '/' + command
@@ -102,8 +72,6 @@ class NfvbenchClient(object):
TimeOutException: the request timed out (and might still being executed
by the server)
"""
- if self.use_socketio:
- return self.socketio_send('echo', 'echo', config, timeout)
return self.http_get('echo', config)
def run_config(self, config, timeout=300, poll_interval=5):
@@ -132,8 +100,6 @@ class NfvbenchClient(object):
the exception contains the description of the failure.
TimeOutException: the request timed out but will still be executed by the server.
"""
- if self.use_socketio:
- return self.socketio_send('start_run', 'run_end', config, timeout)
res = self.http_post('start_run', config)
if res['status'] != 'PENDING':
raise NfvbenchException(res['error_message'])
diff --git a/client/nfvbench_client.py b/client/nfvbench_client.py
index 3973b9c..c528df8 100644
--- a/client/nfvbench_client.py
+++ b/client/nfvbench_client.py
@@ -54,9 +54,6 @@ def main():
action='store',
help='time (seconds) to wait for NFVbench result',
metavar='<config>')
- parser.add_argument('--use-socketio', dest='use_socketio',
- action='store_true',
- help='NFVbench config to echo (json format)')
parser.add_argument('url', help='nfvbench server url (e.g. http://10.0.0.1:5000)')
opts = parser.parse_args()
@@ -64,7 +61,7 @@ def main():
print('at least one of -f or -c or -e required')
sys.exit(-1)
- nfvbench = NfvbenchClient(opts.url, opts.use_socketio)
+ nfvbench = NfvbenchClient(opts.url)
# convert JSON into a dict
try:
timeout = int(opts.timeout)
diff --git a/client/requirements.txt b/client/requirements.txt
index 80fc402..84ced9c 100644
--- a/client/requirements.txt
+++ b/client/requirements.txt
@@ -1,7 +1,5 @@
#
#
backports.ssl-match-hostname==3.5.0.1 # via websocket-client
-requests==2.13.0 # via socketio-client
-six==1.10.0 # via socketio-client, websocket-client
-socketIO-client==0.7.2
-websocket-client==0.40.0 # via socketio-client
+requests==2.13.0
+six==1.10.0 # via websocket-client