diff options
author | Qiang Dai <Qiang.Dai@spirent.com> | 2018-03-20 12:06:49 +0800 |
---|---|---|
committer | Qiang Dai <Qiang.Dai@spirent.com> | 2018-03-20 14:12:49 +0800 |
commit | cac362e165249d59179af9647525256d0b3f5456 (patch) | |
tree | 8c19fdabb3dd68ae9138dd46fcf6a6615c46ee4b /contrib/nettest | |
parent | 7caa49f07b45f24c22aeade51985bf8efbd6c222 (diff) |
add nettest client code and some bugfix
1. add nettest client code
2. provide get testcase result file interface
3. delete useless code to avoid produce userdata file
4. modify throughput parameter to shrink test time
Change-Id: I88edccab326381aadb6f7a64a6005e461325055b
Signed-off-by: Qiang Dai <Qiang.Dai@spirent.com>
Diffstat (limited to 'contrib/nettest')
-rw-r--r-- | contrib/nettest/nettest/rest_server.py | 10 | ||||
-rw-r--r-- | contrib/nettest/nettest/rfc2544test.py | 10 | ||||
-rw-r--r-- | contrib/nettest/nettest/stcv_stack.py | 9 |
3 files changed, 14 insertions, 15 deletions
diff --git a/contrib/nettest/nettest/rest_server.py b/contrib/nettest/nettest/rest_server.py index ee13c91b..3558b9ac 100644 --- a/contrib/nettest/nettest/rest_server.py +++ b/contrib/nettest/nettest/rest_server.py @@ -7,9 +7,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +import os import logging -from flask import Flask, abort, jsonify, request +from flask import Flask, abort, jsonify, request, send_from_directory from flask_cors import CORS from flask_restful import Api, Resource, fields from flask_restful_swagger import swagger @@ -23,6 +24,13 @@ api = swagger.docs(Api(app), apiVersion="1.0") stcv_master = NetTestMaster() +@app.route("/tc_results/<tc_id>", methods=["GET"]) +def download_result_file(tc_id): + directory = os.getcwd() + "/tc_results/rfc2544/" + tc_id + files = os.listdir(directory) + return send_from_directory(directory, files[0], as_attachment=True) + + @swagger.model class StackRequestModel: resource_fields = { diff --git a/contrib/nettest/nettest/rfc2544test.py b/contrib/nettest/nettest/rfc2544test.py index 688b4d12..3764b357 100644 --- a/contrib/nettest/nettest/rfc2544test.py +++ b/contrib/nettest/nettest/rfc2544test.py @@ -200,14 +200,14 @@ class StcRfc2544Test: default_additional_params = { "AcceptableFrameLoss": 0.0, - "Duration": 60, + "Duration": 30, "FrameSizeList": 64, "LearningMode": 'AUTO', "NumOfTrials": 1, - "RateInitial": 99.0, - "RateLowerLimit": 99.0, - "RateStep": 10.0, - "RateUpperLimit": 99.0, + # "RateInitial": 99.0, + # "RateLowerLimit": 99.0, + # "RateStep": 10.0, + # "RateUpperLimit": 99.0, "Resolution": 1.0, "SearchMode": 'BINARY', "TrafficPattern": 'PAIR' diff --git a/contrib/nettest/nettest/stcv_stack.py b/contrib/nettest/nettest/stcv_stack.py index 6e69f479..7c1d4336 100644 --- a/contrib/nettest/nettest/stcv_stack.py +++ b/contrib/nettest/nettest/stcv_stack.py @@ -20,9 +20,6 @@ from keystoneauth1 import session class StcvStack(object): STCV_CONFIG_FILE = 'stcv_config_file' STCV_HEAT_FILE = './heat_2stcv.yaml' - STCV_USER_DATA = '''#cloud-config - spirent: - ntp: ''' def __init__(self, name, **kwargs): self.logger = logging.getLogger(__name__) @@ -63,12 +60,6 @@ class StcvStack(object): self._heat_client = heatclient.Client("1", session=sess) def _make_parameters(self): - user_data = self.STCV_USER_DATA + self.ntp_server_ip - file_path = os.getcwd() + '/' + self.STCV_CONFIG_FILE - fd = open(file_path, 'w') - fd.writelines(user_data) - fd.close() - return { 'public_net_name': self.pub_net_name, 'stcv_image': self.stcv_image, |