aboutsummaryrefslogtreecommitdiffstats
path: root/docker
AgeCommit message (Expand)AuthorFilesLines
2018-02-28Switch from /home/opnfv/functest to /var/lib/xtestingCédric Ollivier1-2/+1
2018-02-28Remove obsolete Alpine packagesCédric Ollivier1-3/+1
2018-02-28Publish Dockerfile and samplesCédric Ollivier1-0/+17
2018-02-27Clean all OpenStack related modulesCédric Ollivier25-785/+0
2018-02-24Automatically download defcore.txtCédric Ollivier2-0/+8
2018-02-19Disable orchestra_clearwaterims in functest-vnfCédric Ollivier1-1/+1
2018-02-14Enable doctor-notificationCédric Ollivier1-1/+0
2018-02-13Test vnf in all os-nosdn-nofeature scenariosCédric Ollivier1-7/+7
2018-02-13Temporarily disable doctor-notificationCédric Ollivier2-1/+1
2018-02-06Disable orchestra_* testcasesCédric Ollivier1-0/+2
2018-02-05Increase Rally full criteriaCédric Ollivier1-1/+1
2018-02-01Install vEPC dependencies in DockerfileCédric Ollivier1-0/+9
2018-01-31Add tempest and rally in functest-featuresCédric Ollivier1-2/+21
2018-01-12Switch to absolute paths in DockerfilesCédric Ollivier2-4/+4
2018-01-03Modify cmd for parsershangxdy1-1/+1
2017-12-28Update Alpine to 3.7Cédric Ollivier1-1/+1
2017-12-21Enable orchestra testcases for Daisy onlyCédric Ollivier1-2/+2
2017-12-15Filter out orchestra for ssl enabled deploymentsMichael Polenchuk1-2/+2
2017-12-14[vyos_vrouter] Support https endpointsShuyaNakama1-1/+1
2017-12-11vEPC tests with juju as an VNF managersoumaya3-5/+36
2017-12-04Create a tox env to check yaml filesCédric Ollivier6-23/+35
2017-11-30Reorder Vnf testcasesCédric Ollivier1-14/+15
2017-11-30Filter installers for cloudify_vrouterCédric Ollivier1-1/+1
2017-11-27Create RobotFramework classCédric Ollivier2-6/+6
2017-11-24Enable Doctor testcase for F-releaseCédric Ollivier3-3/+2
2017-11-24Enable baro_tests testcase for F-releaseCédric Ollivier3-3/+2
2017-11-23Remove iniparse and urllib3 dependenciesCédric Ollivier4-2/+13
2017-11-22Remove prepare_envJose Lausuch6-6/+6
2017-11-21Fix rally db issueLinda Wang3-3/+6
2017-11-20Enable sdnvpn testcase for F-releaseCédric Ollivier3-3/+2
2017-11-16Enable sfc testcase for F-releaseCédric Ollivier3-3/+2
2017-11-15Remove Domino and Promise testcasesCédric Ollivier5-46/+2
2017-11-14Remove $BRANCH in healthcheck/DockerfileCédric Ollivier1-3/+0
2017-11-13Move rally and tempest in functest-restapiCédric Ollivier4-25/+36
2017-11-13Remove rally and tempest from core/DockerfileLinda Wang3-12/+38
2017-11-10Add BRANCH as Docker build argCédric Ollivier2-0/+6
2017-11-09Remove the former DockerfileCédric Ollivier6-387/+0
2017-11-07Merge "Fix the format of getting upper-constraints"Cedric Ollivier5-5/+5
2017-11-07Fix the format of getting upper-constraintsLinda Wang5-5/+5
2017-11-06Move fds to features tierLinda Wang4-23/+23
2017-11-05Define thirdparty-requirements.txt for functest-parserCédric Ollivier2-8/+7
2017-11-05Allow building containers from a gerrit changeCédric Ollivier1-2/+4
2017-11-05Update Functest to OpenStack stable/pikeCédric Ollivier9-45/+38
2017-10-30Update Rally to 0.10Cédric Ollivier3-8/+19
2017-10-20Get the right git commit ids for ubuntu imageLinda Wang1-4/+4
2017-10-18Switch from BashFeature to Feature of bgpvpn testcaseJose Lausuch1-4/+2
2017-10-14Update project field of fds testcase to fastdatastacksjuraj.linkes1-1/+1
2017-10-13Force requests===2.13.0Cédric Ollivier6-16/+26
2017-10-13Get the right git commit idsCédric Ollivier2-8/+8
2017-10-11Merge "Fix fail of vRouter on Orange POD"Morgan Richomme1-2/+1
"p">("%(asctime)s - %(name)s - " "%(levelname)s - %(message)s") ch.setFormatter(formatter) logger.addHandler(ch) REPO_PATH=os.environ['repos_dir']+'/functest/' if not os.path.exists(REPO_PATH): logger.error("Functest repository directory not found '%s'" % REPO_PATH) exit(-1) sys.path.append(REPO_PATH + "testcases/") import functest_utils with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() HOME = os.environ['HOME']+"/" ####todo: #SCENARIOS_DIR = REPO_PATH + functest_yaml.get("general"). \ # get("directories").get("dir_rally_scn") SCENARIOS_DIR = REPO_PATH + "testcases/VIM/OpenStack/CI/rally_cert/" ### TEMPLATE_DIR = SCENARIOS_DIR + "scenario/templates" SUPPORT_DIR = SCENARIOS_DIR + "scenario/support" ###todo: FLAVOR_NAME = "m1.tiny" USERS_AMOUNT = 2 TENANTS_AMOUNT = 3 ITERATIONS_AMOUNT = 10 CONCURRENCY = 4 ### RESULTS_DIR = functest_yaml.get("general").get("directories"). \ get("dir_rally_res") TEST_DB = functest_yaml.get("results").get("test_db_url") FLOATING_NETWORK = functest_yaml.get("general"). \ get("openstack").get("neutron_public_net_name") PRIVATE_NETWORK = functest_yaml.get("general"). \ get("openstack").get("neutron_private_net_name") GLANCE_IMAGE_NAME = functest_yaml.get("general"). \ get("openstack").get("image_name") GLANCE_IMAGE_FILENAME = functest_yaml.get("general"). \ get("openstack").get("image_file_name") GLANCE_IMAGE_FORMAT = functest_yaml.get("general"). \ get("openstack").get("image_disk_format") GLANCE_IMAGE_PATH = functest_yaml.get("general"). \ get("directories").get("dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME CINDER_VOLUME_TYPE_NAME = "volume_test" def push_results_to_db(payload): url = TEST_DB + "/results" installer = functest_utils.get_installer_type(logger) scenario = functest_utils.get_scenario(logger) pod_name = functest_utils.get_pod_name(logger) # TODO pod_name hardcoded, info shall come from Jenkins params = {"project_name": "functest", "case_name": "Rally", "pod_name": pod_name, "installer": installer, "version": scenario, "details": payload} headers = {'Content-Type': 'application/json'} r = requests.post(url, data=json.dumps(params), headers=headers) logger.debug(r) def get_task_id(cmd_raw): """ get task id from command rally result :param cmd_raw: :return: task_id as string """ taskid_re = re.compile('^Task +(.*): started$') for line in cmd_raw.splitlines(True): line = line.strip() match = taskid_re.match(line) if match: return match.group(1) return None def task_succeed(json_raw): """ Parse JSON from rally JSON results :param json_raw: :return: Bool """ rally_report = json.loads(json_raw) for report in rally_report: if report is None or report.get('result') is None: return False for result in report.get('result'): if result is None or len(result.get('error')) > 0: return False return True def build_task_args(test_file_name): task_args = {'service_list': [test_file_name]} task_args['smoke'] = args.smoke task_args['image_name'] = GLANCE_IMAGE_NAME task_args['flavor_name'] = FLAVOR_NAME task_args['glance_image_location'] = GLANCE_IMAGE_PATH task_args['floating_network'] = FLOATING_NETWORK task_args['netid'] = functest_utils.get_network_id(client_dict['neutron'], PRIVATE_NETWORK).encode('ascii', 'ignore') task_args['tmpl_dir'] = TEMPLATE_DIR task_args['sup_dir'] = SUPPORT_DIR task_args['users_amount'] = USERS_AMOUNT task_args['tenants_amount'] = TENANTS_AMOUNT task_args['iterations'] = ITERATIONS_AMOUNT task_args['concurrency'] = CONCURRENCY return task_args def get_output(proc): result = "" if args.verbose: while proc.poll() is None: line = proc.stdout.readline() print line.replace('\n', '') result += line else: while proc.poll() is None: line = proc.stdout.readline() if "Load duration" in line or \ "started" in line or \ "finished" in line or \ " Preparing" in line or \ "+-" in line or \ "|" in line: result += line elif "test scenario" in line: result += "\n" + line elif "Full duration" in line: result += line + "\n\n" logger.info("\n" + result) return result def run_task(test_name): # # the "main" function of the script who launch rally for a task # :param test_name: name for the rally test # :return: void # logger.info('Starting test scenario "{}" ...'.format(test_name)) task_file = '{}task.yaml'.format(SCENARIOS_DIR) if not os.path.exists(task_file): logger.error("Task file '%s' does not exist." % task_file) exit(-1) test_file_name = '{}opnfv-{}.yaml'.format(SCENARIOS_DIR + "scenario/", test_name) if not os.path.exists(test_file_name): logger.error("The scenario '%s' does not exist." % test_file_name) exit(-1) logger.debug('Scenario fetched from : {}'.format(test_file_name)) cmd_line = "rally task start --abort-on-sla-failure " + \ "--task {} ".format(task_file) + \ "--task-args \"{}\" ".format(build_task_args(test_name)) logger.debug('running command line : {}'.format(cmd_line)) p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True) output = get_output(p) task_id = get_task_id(output) logger.debug('task_id : {}'.format(task_id)) if task_id is None: logger.error("failed to retrieve task_id") exit(-1) # check for result directory and create it otherwise if not os.path.exists(RESULTS_DIR): logger.debug('does not exists, we create it'.format(RESULTS_DIR)) os.makedirs(RESULTS_DIR) # write html report file report_file_name = '{}opnfv-{}.html'.format(RESULTS_DIR, test_name) cmd_line = "rally task report {} --out {}".format(task_id, report_file_name) logger.debug('running command line : {}'.format(cmd_line)) os.popen(cmd_line) # get and save rally operation JSON result cmd_line = "rally task results %s" % task_id logger.debug('running command line : {}'.format(cmd_line)) cmd = os.popen(cmd_line) json_results = cmd.read() with open('{}opnfv-{}.json'.format(RESULTS_DIR, test_name), 'w') as f: logger.debug('saving json file') f.write(json_results) with open('{}opnfv-{}.json' .format(RESULTS_DIR, test_name)) as json_file: json_data = json.load(json_file) # Push results in payload of testcase if args.report: logger.debug("Push result into DB") push_results_to_db(json_data) """ parse JSON operation result """ if task_succeed(json_results): logger.info('Test scenario: "{}" OK.'.format(test_name) + "\n") else: logger.info('Test scenario: "{}" Failed.'.format(test_name) + "\n") def main(): # configure script if not (args.test_name in tests): logger.error('argument not valid') exit(-1) creds_nova = functest_utils.get_credentials("nova") nova_client = novaclient.Client('2',**creds_nova) creds_neutron = functest_utils.get_credentials("neutron") neutron_client = neutronclient.Client(**creds_neutron) creds_keystone = functest_utils.get_credentials("keystone") keystone_client = keystoneclient.Client(**creds_keystone) glance_endpoint = keystone_client.service_catalog.url_for(service_type='image', endpoint_type='publicURL') glance_client = glanceclient.Client(1, glance_endpoint, token=keystone_client.auth_token) creds_cinder = functest_utils.get_credentials("cinder") cinder_client = cinderclient.Client('2',creds_cinder['username'], creds_cinder['api_key'], creds_cinder['project_id'], creds_cinder['auth_url'], service_type="volume") client_dict['neutron'] = neutron_client volume_types = functest_utils.list_volume_types(cinder_client, private=False) if not volume_types: volume_type = functest_utils.create_volume_type(cinder_client, \ CINDER_VOLUME_TYPE_NAME) if not volume_type: logger.error("Failed to create volume type...") exit(-1) else: logger.debug("Volume type '%s' created succesfully..." \ % CINDER_VOLUME_TYPE_NAME) else: logger.debug("Using existing volume type(s)...") image_id = functest_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME) if image_id == '': logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, \ GLANCE_IMAGE_PATH)) image_id = functest_utils.create_glance_image(glance_client,\ GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH) if not image_id: logger.error("Failed to create the Glance image...") exit(-1) else: logger.debug("Image '%s' with ID '%s' created succesfully ." \ % (GLANCE_IMAGE_NAME, image_id)) else: logger.debug("Using existing image '%s' with ID '%s'..." \ % (GLANCE_IMAGE_NAME,image_id)) if args.test_name == "all": for test_name in tests: if not (test_name == 'all' or test_name == 'vm'): run_task(test_name) else: print(args.test_name) run_task(args.test_name) logger.debug("Deleting image '%s' with ID '%s'..." \ % (GLANCE_IMAGE_NAME, image_id)) if not functest_utils.delete_glance_image(nova_client, image_id): logger.error("Error deleting the glance image") if not volume_types: logger.debug("Deleting volume type '%s'..." \ % CINDER_VOLUME_TYPE_NAME) if not functest_utils.delete_volume_type(cinder_client, volume_type): logger.error("Error in deleting volume type...") if __name__ == '__main__': main()