diff options
Diffstat (limited to 'qtip')
-rw-r--r-- | qtip/ansible_library/modules/nettest.py | 83 | ||||
-rw-r--r-- | qtip/cli/commands/cmd_project.py | 14 | ||||
-rw-r--r-- | qtip/scripts/quickstart.sh | 9 |
3 files changed, 101 insertions, 5 deletions
diff --git a/qtip/ansible_library/modules/nettest.py b/qtip/ansible_library/modules/nettest.py new file mode 100644 index 00000000..5f141c95 --- /dev/null +++ b/qtip/ansible_library/modules/nettest.py @@ -0,0 +1,83 @@ +#!/usr/bin/python + +############################################################### +# Copyright (c) 2018 ZTE Corporation and Others +# taseer94@gmail.com +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +import contrib.nettest_client.nettest_client as qtip_nettest +from ansible.module_utils.basic import AnsibleModule + + +ANSIBLE_METADATA = {'metadata_version': '1.0', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: nettest +short_description: execute Spirent testcases +description: + - Use this module to execute network performance benchmarking +version_added: "1.0" +author: "Taseer Ahmed" +''' + +RETURN = ''' +ansible_facts: + description: network benchmark tests + returned: success + type: dictionary + contains: + result: +''' + +EXAMPLES = ''' +--- +- hosts: apex-undercloud + tasks: + - name: execute network performance test + nettest: + name: s1, + stack_type: stcv, + public_network_name: public, + stcv_affinity: True, + stcv_image: STCv-4.80.2426, + stcv_flavor: small.shared, + lab_server_ip: 10.61.67.53, + license_server_ip: 10.140.88.61 +''' + + +def main(): + module = AnsibleModule( + argument_spec=dict( + public_network_name=dict(type='str'), + stcv_image=dict(type='str'), + stcv_flavor=dict(type='str'), + lab_server_ip=dict(type='str'), + license_server_ip=dict(type='str') + ) + ) + + public_network_name = module.params['public_network_name'] + stcv_image = module.params['stcv_image'] + stcv_flavor = module.params['stcv_flavor'] + lab_server_ip = module.params['lab_server_ip'] + license_server_ip = module.params['license_server_ip'] + + module.exit_json(changed=True, + ansible_facts=qtip_nettest.run(public_network_name, + stcv_image, + stcv_flavor, + lab_server_ip, + license_server_ip)) + + +if __name__ == '__main__': + main() diff --git a/qtip/cli/commands/cmd_project.py b/qtip/cli/commands/cmd_project.py index 2836fa69..11fa63e5 100644 --- a/qtip/cli/commands/cmd_project.py +++ b/qtip/cli/commands/cmd_project.py @@ -59,7 +59,16 @@ def cli(): help='Host configured for ssh client or IP addresses and domain name') @click.option('--scenario', help='OPNFV scenario') -def create(project_name, project_template, pod_name, installer_type, installer_host, scenario): +@click.option('--sut', + prompt='System Under Test type', + help='Type of system can be vnf') +def create(project_name, + project_template, + pod_name, + installer_type, + installer_host, + scenario, + sut): qtip_generator_role = os.path.join(utils.QTIP_ANSIBLE_ROLES, 'qtip-generator') extra_vars = { 'qtip_package': utils.QTIP_PACKAGE, @@ -69,7 +78,8 @@ def create(project_name, project_template, pod_name, installer_type, installer_h 'pod_name': pod_name, 'installer_type': installer_type, 'installer_host': installer_host, - 'scenario': scenario + 'scenario': scenario, + 'sut': sut } os.system("ANSIBLE_ROLES_PATH={roles_path} ansible-playbook" " -i {hosts}" diff --git a/qtip/scripts/quickstart.sh b/qtip/scripts/quickstart.sh index b430aa3f..22257f5b 100644 --- a/qtip/scripts/quickstart.sh +++ b/qtip/scripts/quickstart.sh @@ -13,7 +13,8 @@ set -o pipefail set -x usage(){ - echo "usage: $0 -q <qtip_test_suite> -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario> -r <report_url>" >&2 + echo "usage: $0 -q <qtip_test_suite> -t <installer_type> -i <installer_ip> -p <pod_name> -s <scenario> -r <report_url> + -u <sut>" >&2 } verify_connectivity(){ @@ -30,7 +31,7 @@ verify_connectivity(){ } #Getoptions -while getopts ":t:i:p:s:r:he" optchar; do +while getopts ":t:i:p:s:r:u:he" optchar; do case "${optchar}" in q) test_suite=${OPTARG} ;; t) installer_type=${OPTARG} ;; @@ -38,6 +39,7 @@ while getopts ":t:i:p:s:r:he" optchar; do p) pod_name=${OPTARG} ;; s) scenario=${OPTARG} ;; r) testapi_url=${OPTARG} ;; + u) sut=${OPTARG} ;; h) usage exit 0 ;; @@ -55,6 +57,7 @@ test_suite=${test_suite:-$TEST_SUITE} pod_name=${pod_name:-$NODE_NAME} scenario=${scenario:-$SCENARIO} testapi_url=${testapi_url:-$TESTAPI_URL} +sut=${sut:-node} # we currently support fuel, apex and mcp if [[ ! "$installer_type" =~ (fuel|apex|mcp) ]]; then @@ -76,7 +79,7 @@ esac cd /home/opnfv qtip create --project-template ${test_suite} --pod-name ${pod_name} --installer-type ${installer_type} \ ---installer-host ${installer_ip} --scenario ${scenario} ${test_suite} +--installer-host ${installer_ip} --scenario ${scenario} --sut ${sut} ${test_suite} cd ${test_suite} |