aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahothan <ahothan@cisco.com>2019-04-13 09:31:08 -0700
committerahothan <ahothan@cisco.com>2019-04-13 09:31:08 -0700
commitaed21dc7520fa195f6131c78d15c222970b7fab7 (patch)
treea8215c02783df89090a740a223bdec5ff6fc68bf
parent8ae0abbe6ecc32af01d755a3f3eab38bfa631b6b (diff)
Remove socketio from python client
Change-Id: I5c5e0e24621b450c05f1f94fd34eab9e101c75b6 Signed-off-by: ahothan <ahothan@cisco.com>
-rw-r--r--client/client.py36
-rw-r--r--client/nfvbench_client.py5
-rw-r--r--client/requirements.txt6
-rw-r--r--docs/testing/user/userguide/faq.rst2
-rw-r--r--docs/testing/user/userguide/server.rst50
5 files changed, 7 insertions, 92 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
diff --git a/docs/testing/user/userguide/faq.rst b/docs/testing/user/userguide/faq.rst
index 9da2e90..9a1a7da 100644
--- a/docs/testing/user/userguide/faq.rst
+++ b/docs/testing/user/userguide/faq.rst
@@ -24,7 +24,7 @@ Yes.
Can I drive NFVbench using a REST interface?
--------------------------------------------
-NFVbench can run in server mode and accept HTTP or WebSocket/SocketIO events to run any type of measurement (fixed rate run or NDR_PDR run)
+NFVbench can run in server mode and accept HTTP requests to run any type of measurement (fixed rate run or NDR_PDR run)
with any run configuration.
Can I run NFVbench on a Cisco UCS-B series blade?
diff --git a/docs/testing/user/userguide/server.rst b/docs/testing/user/userguide/server.rst
index fc56dfc..52645ad 100644
--- a/docs/testing/user/userguide/server.rst
+++ b/docs/testing/user/userguide/server.rst
@@ -18,7 +18,7 @@ Example request:
.. code-block:: bash
- curl -XGET '127.0.0.1:7556/echo' -H "Content-Type: application/json" -d '{"nfvbench": "test"}'
+ curl -XGET '127.0.0.1:7555/echo' -H "Content-Type: application/json" -d '{"nfvbench": "test"}'
Response:
{
"nfvbench": "test"
@@ -84,44 +84,6 @@ If there is already an NFVBench running then it will return:
"status": "ERROR"
}
-WebSocket/SocketIO events
--------------------------
-
-List of SocketIO events supported:
-
-Client to Server
-^^^^^^^^^^^^^^^^
-
-start_run:
-
- sent by client to start a new run with the configuration passed in argument (JSON).
- The configuration can be any valid NFVbench configuration passed as a JSON document (see "NFVbench configuration JSON parameter" below)
-
-Server to Client
-^^^^^^^^^^^^^^^^
-
-run_interval_stats:
-
- sent by server to report statistics during a run
- the message contains the statistics {'time_ms': time_ms, 'tx_pps': tx_pps, 'rx_pps': rx_pps, 'drop_pct': drop_pct}
-
-ndr_found:
-
- (during NDR-PDR search)
- sent by server when the NDR rate is found
- the message contains the NDR value {'rate_pps': ndr_pps}
-
-ndr_found:
-
- (during NDR-PDR search)
- sent by server when the PDR rate is found
- the message contains the PDR value {'rate_pps': pdr_pps}
-
-
-run_end:
-
- sent by server to report the end of a run
- the message contains the complete results in JSON format
NFVbench configuration JSON parameter
-------------------------------------
@@ -385,7 +347,7 @@ Finally, the status request returns a "OK" status along with the full results (t
Example of interaction with the NFVbench server using a python CLI app (nfvbench_client)
----------------------------------------------------------------------------------------
-The module client/client.py contains an example of python class that can be used to control the NFVbench server from a python app using HTTP or WebSocket/SocketIO.
+The module client/client.py contains an example of python class that can be used to control the NFVbench server from a python app using HTTP.
The module client/nfvbench_client.py has a simple main application to control the NFVbench server from CLI.
The "nfvbench_client" wrapper script can be used to invoke the client front end (this wrapper is pre-installed in the NFVbench container)
@@ -407,11 +369,3 @@ use the default NFVbench configuration but do not generate traffic (no_traffic p
...
[root@sjc04-pod3-mgmt ~]#
-
-The http interface is used unless --use-socketio is defined.
-
-Example of invocation using Websocket/SocketIO, execute NFVbench using the default configuration but with a duration of 5 seconds and a fixed rate run of 5kpps.
-
-.. code-block:: bash
-
- [root@sjc04-pod3-mgmt ~]# docker exec -it nfvbench nfvbench_client -c '{"duration":5,"rate":"5kpps"}' --use-socketio http://127.0.0.1:7555 >results.json