def bvt_bigiq_post2(): """Handles requests from BIGIP teams for BIGIQ BVT. All the logic needed to translate the user input into what makes sense to us happens right here. """ HOOK_NAME = 'big-iq-bvt' CONFIG_FILE = 'config/shared/web_bvt_request_bigiq.yaml' data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url our_config = AttrDict(yaml.load(open(get_harness('bigiq-tmos')).read())) # Prepare placeholders in our config our_config.update({'stages': {'main': {'setup': {'install-bigips': {'parameters': {}}}}}}) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'atom': {'bigip': {}}, 'bvtinfo': {}}}) plugins = our_config.plugins # Set ATOM data plugins.atom.bigip.request_id = data.content.id plugins.atom.bigip.name = HOOK_NAME # Append submitter's email to recipient list if data.content.requestor.email: plugins.email.to.append(data.content.requestor.email) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters branch = data.content.build.branch version = data.content.build.version params['version'] = branch.name params['build'] = version.primary if int(version.level): params['hotfix'] = version.level params['custom hf iso'] = sanitize_atom_path(data.content.build.iso) else: params['custom iso'] = sanitize_atom_path(data.content.build.iso) params.product = 'bigip' # TODO: Remove this when bvtinfo goes offline # Set BVTInfo data plugins.bvtinfo.project = branch.name plugins.bvtinfo.build = version.old_build_number args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) args.append('--tc=stages.enabled:1') # For chuckanut++ args.append('--eval-attr=rank >= 5 and rank <= 10') args.append('--with-email') args.append('--with-atom') args.append('--with-bvtinfo') if not min_version_validator(params.build, params.version, params.hotfix, params.product, iso=data.content.build.iso, min_ver=CONFIG.supported): args.append('--with-atom-no-go=The requested product/version is not supported by this test suite.') args.append('--with-irack') # args.append('--with-qkview=never') args.append('{VENV}/%s' % CONFIG.paths.tc) # args.append('{VENV}/tests/firestone/functional/standalone/adc/api/') v = plugins.email.variables v.args = args v.project = data.content.build.branch.name v.version = data.content.build.version.version v.build = data.content.build.version.build # return dict(config=our_config, args=args) result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_bigiq_post(): """Handles requests from BIGIP teams for BIGIQ BVT. All the logic needed to translate the user input into what makes sense to us happens right here. """ BVTINFO_PROJECT_PATTERN = '(\D+)?(\d+\.\d+\.\d+)-?(eng-?\w*|hf\d+|hf-\w+)?' CONFIG_FILE = 'config/shared/web_bvt_request_bigiq.yaml' # For people who don't like to set the application/json header. data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url our_config = AttrDict(yaml.load(open(get_harness('bigiq-tmos')).read())) # Prepare placeholders in our config our_config.update({'stages': {'main': {'setup': {'install-bigips': {'parameters': {}}}}}}) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'bvtinfo': {'bigip': {}}}}) plugins = our_config.plugins # Set BVTInfo data plugins.bvtinfo.project = data['project'] plugins.bvtinfo.build = data['build'] plugins.bvtinfo.bigip.name = 'bigiq-bvt' # Append submitter's email to recipient list if data.get('submitted_by'): plugins.email.to.append(data['submitted_by']) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters match = re.match(BVTINFO_PROJECT_PATTERN, data['project']) if match: params['version'] = match.group(2) if match.group(3): params['hotfix'] = match.group(3) else: params['version'] = data['project'] params['build'] = data['build'] params['custom iso'] = data.get('custom_iso') params['custom hf iso'] = data.get('custom_hf_iso') params.product = 'bigip' if not min_version_validator(params.build, params.version, params.hotfix, params.product, min_ver=CONFIG.supported): # raise ValueError('Requested version not supported') bottle.response.status = 406 return dict(message='Requested version not supported') args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) args.append('--tc=stages.enabled:1') # For chuckanut++ args.append('--eval-attr=rank >= 5 and rank <= 10') args.append('--with-email') args.append('--with-bvtinfo') args.append('--with-irack') args.append('{VENV}/%s' % CONFIG.paths.tc) v = plugins.email.variables v.args = args v.project = data['project'] v.version = params.version v.build = params.build # return dict(config=our_config, args=args) result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_basic_post2(): """Handles EM BVT requests. """ HOOK_NAME = 'em-bvt' TESTS_DEBUG = 'tests/solar/bvt/integration/filesystem/' CONFIG_FILE = 'config/shared/web_bvt_request.yaml' data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url our_config = AttrDict(yaml.load(open(get_harness('em')).read())) # Prepare placeholders in our config our_config.update({'stages': {'main': {'setup': {'install-bigips': {'parameters': {}}}}}}) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'atom': {'bigip': {}}, 'bvtinfo': {}}}) plugins = our_config.plugins # Set ATOM data plugins.atom.bigip.request_id = data.content.id plugins.atom.bigip.name = HOOK_NAME # Append submitter's email to recipient list if data.content.requestor.email: plugins.email.to.append(data.content.requestor.email) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters branch = data.content.build.branch version = data.content.build.version params['version'] = branch.name params['build'] = version.primary if int(version.level): params['hotfix'] = version.level params['custom hf iso'] = sanitize_atom_path(data.content.build.iso) else: params['custom iso'] = sanitize_atom_path(data.content.build.iso) params.product = 'bigip' # TODO: Remove this when bvtinfo goes offline # Set BVTInfo data plugins.bvtinfo.project = branch.name plugins.bvtinfo.build = version.old_build_number args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) if data.get('debug'): args.append('--tc=stages.enabled:1') tests = [os.path.join('{VENV}', x) for x in re.split('\s+', (data.get('tests') or TESTS_DEBUG).strip())] args.extend(tests) else: args.append('--tc=stages.enabled:1') args.append('--eval-attr=rank > 0 and rank < 11') args.append('--with-email') args.append('--with-atom') args.append('--with-bvtinfo') if not min_version_validator(params.build, params.version, params.hotfix, params.product, iso=data.content.build.iso, min_ver=CONFIG.supported): args.append('--with-atom-no-go=The requested product/version is not supported by this test suite.') args.append('--with-irack') # args.append('--with-qkview=never') # args.append('{VENV}/tests/solar/bvt/') args.append('{VENV}/%s' % CONFIG.paths.em) v = plugins.email.variables v.args = args v.project = data.content.build.branch.name v.version = data.content.build.version.version v.build = data.content.build.version.build result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_basic_post(): """Handles requests from BIGIP teams. All the logic needed to translate the user input into what makes sense to us happens right here. """ BVTINFO_PROJECT_PATTERN = '(\D+)?(\d+\.\d+\.\d+)-?(eng-?\w*|hf\d+|hf-\w+)?' TESTS_DEBUG = 'tests/solar/bvt/integration/filesystem/' CONFIG_FILE = 'config/shared/web_bvt_request.yaml' # For people who don't like to set the application/json header. data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url # data = bottle.request.json # BUG: The iRack reservation-based picker is flawed. It'll always select # the nearest available harness, stacking all workers on just one. # with IrackInterface(address=CONFIG.irack.address, # timeout=30, # username=CONFIG.irack.username, # password=CONFIG.irack.apikey, # ssl=False) as irack: # config_dir = os.path.dirname(CONFIG_WEB_FILE) # harness_files = [os.path.join(config_dir, x) for x in CONFIG.web.harnesses] # our_config = RCMD.irack.pick_best_harness(harness_files, ifc=irack) our_config = AttrDict(yaml.load(open(get_harness('em')).read())) # Prepare placeholders in our config our_config.update({'stages': {'main': {'setup': {'install-bigips': {'parameters': {}}}}}}) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'bvtinfo': {}}}) plugins = our_config.plugins # Set BVTInfo data plugins.bvtinfo.project = data['project'] plugins.bvtinfo.build = data['build'] # Append submitter's email to recipient list if data.get('submitted_by'): plugins.email.to.append(data['submitted_by']) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters match = re.match(BVTINFO_PROJECT_PATTERN, data['project']) if match: params['version'] = match.group(2) if match.group(3): params['hotfix'] = match.group(3) else: params['version'] = data['project'] params['build'] = data['build'] params['custom iso'] = data.get('custom_iso') params['custom hf iso'] = data.get('custom_hf_iso') params.product = 'bigip' if not min_version_validator(params.build, params.version, params.hotfix, params.product, min_ver=CONFIG.supported): # raise ValueError('Requested version not supported') bottle.response.status = 406 return dict(message='Requested version not supported') args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) if data.get('debug'): args.append('--tc=stages.enabled:1') tests = [os.path.join('{VENV}', x) for x in re.split('\s+', (data.get('tests') or TESTS_DEBUG).strip())] args.extend(tests) else: args.append('--tc=stages.enabled:1') args.append('--eval-attr=rank > 0 and rank < 11') args.append('--with-email') args.append('--with-bvtinfo') args.append('--with-irack') args.append('{VENV}/%s' % CONFIG.paths.em) v = plugins.email.variables v.args = args v.project = data['project'] v.version = params.version v.build = params.build result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_bigiq_post2(): """Handles requests from BIGIP teams for BIGIQ BVT. All the logic needed to translate the user input into what makes sense to us happens right here. """ HOOK_NAME = 'big-iq-bvt' CONFIG_FILE = 'config/shared/web_bvt_request_bigiq.yaml' data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url our_config = AttrDict(yaml.load(open(get_harness('bigiq-tmos')).read())) # Prepare placeholders in our config our_config.update({ 'stages': { 'main': { 'setup': { 'install-bigips': { 'parameters': {} } } } } }) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'atom': {'bigip': {}}, 'bvtinfo': {}}}) plugins = our_config.plugins # Set ATOM data plugins.atom.bigip.request_id = data.content.id plugins.atom.bigip.name = HOOK_NAME # Append submitter's email to recipient list if data.content.requestor.email: plugins.email.to.append(data.content.requestor.email) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters branch = data.content.build.branch version = data.content.build.version params['version'] = branch.name params['build'] = version.primary if int(version.level): params['hotfix'] = version.level params['custom hf iso'] = sanitize_atom_path(data.content.build.iso) else: params['custom iso'] = sanitize_atom_path(data.content.build.iso) params.product = 'bigip' # TODO: Remove this when bvtinfo goes offline # Set BVTInfo data plugins.bvtinfo.project = branch.name plugins.bvtinfo.build = version.old_build_number args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) args.append('--tc=stages.enabled:1') # For chuckanut++ args.append('--eval-attr=rank >= 5 and rank <= 10') args.append('--with-email') args.append('--with-atom') args.append('--with-bvtinfo') if not min_version_validator(params.build, params.version, params.hotfix, params.product, iso=data.content.build.iso, min_ver=CONFIG.supported): args.append( '--with-atom-no-go=The requested product/version is not supported by this test suite.' ) args.append('--with-irack') # args.append('--with-qkview=never') args.append('{VENV}/%s' % CONFIG.paths.tc) # args.append('{VENV}/tests/firestone/functional/standalone/adc/api/') v = plugins.email.variables v.args = args v.project = data.content.build.branch.name v.version = data.content.build.version.version v.build = data.content.build.version.build # return dict(config=our_config, args=args) result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_basic_post2(): """Handles EM BVT requests. """ HOOK_NAME = 'em-bvt' TESTS_DEBUG = 'tests/solar/bvt/integration/filesystem/' CONFIG_FILE = 'config/shared/web_bvt_request.yaml' data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url our_config = AttrDict(yaml.load(open(get_harness('em')).read())) # Prepare placeholders in our config our_config.update({ 'stages': { 'main': { 'setup': { 'install-bigips': { 'parameters': {} } } } } }) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'atom': {'bigip': {}}, 'bvtinfo': {}}}) plugins = our_config.plugins # Set ATOM data plugins.atom.bigip.request_id = data.content.id plugins.atom.bigip.name = HOOK_NAME # Append submitter's email to recipient list if data.content.requestor.email: plugins.email.to.append(data.content.requestor.email) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters branch = data.content.build.branch version = data.content.build.version params['version'] = branch.name params['build'] = version.primary if int(version.level): params['hotfix'] = version.level params['custom hf iso'] = sanitize_atom_path(data.content.build.iso) else: params['custom iso'] = sanitize_atom_path(data.content.build.iso) params.product = 'bigip' # TODO: Remove this when bvtinfo goes offline # Set BVTInfo data plugins.bvtinfo.project = branch.name plugins.bvtinfo.build = version.old_build_number args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) if data.get('debug'): args.append('--tc=stages.enabled:1') tests = [ os.path.join('{VENV}', x) for x in re.split('\s+', ( data.get('tests') or TESTS_DEBUG).strip()) ] args.extend(tests) else: args.append('--tc=stages.enabled:1') args.append('--eval-attr=rank > 0 and rank < 11') args.append('--with-email') args.append('--with-atom') args.append('--with-bvtinfo') if not min_version_validator(params.build, params.version, params.hotfix, params.product, iso=data.content.build.iso, min_ver=CONFIG.supported): args.append( '--with-atom-no-go=The requested product/version is not supported by this test suite.' ) args.append('--with-irack') # args.append('--with-qkview=never') # args.append('{VENV}/tests/solar/bvt/') args.append('{VENV}/%s' % CONFIG.paths.em) v = plugins.email.variables v.args = args v.project = data.content.build.branch.name v.version = data.content.build.version.version v.build = data.content.build.version.build result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_bigiq_post(): """Handles requests from BIGIP teams for BIGIQ BVT. All the logic needed to translate the user input into what makes sense to us happens right here. """ BVTINFO_PROJECT_PATTERN = '(\D+)?(\d+\.\d+\.\d+)-?(eng-?\w*|hf\d+|hf-\w+)?' CONFIG_FILE = 'config/shared/web_bvt_request_bigiq.yaml' # For people who don't like to set the application/json header. data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url our_config = AttrDict(yaml.load(open(get_harness('bigiq-tmos')).read())) # Prepare placeholders in our config our_config.update({ 'stages': { 'main': { 'setup': { 'install-bigips': { 'parameters': {} } } } } }) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'bvtinfo': {'bigip': {}}}}) plugins = our_config.plugins # Set BVTInfo data plugins.bvtinfo.project = data['project'] plugins.bvtinfo.build = data['build'] plugins.bvtinfo.bigip.name = 'bigiq-bvt' # Append submitter's email to recipient list if data.get('submitted_by'): plugins.email.to.append(data['submitted_by']) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters match = re.match(BVTINFO_PROJECT_PATTERN, data['project']) if match: params['version'] = match.group(2) if match.group(3): params['hotfix'] = match.group(3) else: params['version'] = data['project'] params['build'] = data['build'] params['custom iso'] = data.get('custom_iso') params['custom hf iso'] = data.get('custom_hf_iso') params.product = 'bigip' if not min_version_validator(params.build, params.version, params.hotfix, params.product, min_ver=CONFIG.supported): # raise ValueError('Requested version not supported') bottle.response.status = 406 return dict(message='Requested version not supported') args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) args.append('--tc=stages.enabled:1') # For chuckanut++ args.append('--eval-attr=rank >= 5 and rank <= 10') args.append('--with-email') args.append('--with-bvtinfo') args.append('--with-irack') args.append('{VENV}/%s' % CONFIG.paths.tc) v = plugins.email.variables v.args = args v.project = data['project'] v.version = params.version v.build = params.build # return dict(config=our_config, args=args) result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)
def bvt_basic_post(): """Handles requests from BIGIP teams. All the logic needed to translate the user input into what makes sense to us happens right here. """ BVTINFO_PROJECT_PATTERN = '(\D+)?(\d+\.\d+\.\d+)-?(eng-?\w*|hf\d+|hf-\w+)?' TESTS_DEBUG = 'tests/solar/bvt/integration/filesystem/' CONFIG_FILE = 'config/shared/web_bvt_request.yaml' # For people who don't like to set the application/json header. data = AttrDict(json.load(bottle.request.body)) data._referer = bottle.request.url # data = bottle.request.json # BUG: The iRack reservation-based picker is flawed. It'll always select # the nearest available harness, stacking all workers on just one. # with IrackInterface(address=CONFIG.irack.address, # timeout=30, # username=CONFIG.irack.username, # password=CONFIG.irack.apikey, # ssl=False) as irack: # config_dir = os.path.dirname(CONFIG_WEB_FILE) # harness_files = [os.path.join(config_dir, x) for x in CONFIG.web.harnesses] # our_config = RCMD.irack.pick_best_harness(harness_files, ifc=irack) our_config = AttrDict(yaml.load(open(get_harness('em')).read())) # Prepare placeholders in our config our_config.update({ 'stages': { 'main': { 'setup': { 'install-bigips': { 'parameters': {} } } } } }) our_config.update({'plugins': {'email': {'to': [], 'variables': {}}}}) our_config.update({'plugins': {'bvtinfo': {}}}) plugins = our_config.plugins # Set BVTInfo data plugins.bvtinfo.project = data['project'] plugins.bvtinfo.build = data['build'] # Append submitter's email to recipient list if data.get('submitted_by'): plugins.email.to.append(data['submitted_by']) plugins.email.to.extend(CONFIG.web.recipients) # Set version and build in the install stage params = our_config.stages.main.setup['install-bigips'].parameters match = re.match(BVTINFO_PROJECT_PATTERN, data['project']) if match: params['version'] = match.group(2) if match.group(3): params['hotfix'] = match.group(3) else: params['version'] = data['project'] params['build'] = data['build'] params['custom iso'] = data.get('custom_iso') params['custom hf iso'] = data.get('custom_hf_iso') params.product = 'bigip' if not min_version_validator(params.build, params.version, params.hotfix, params.product, min_ver=CONFIG.supported): # raise ValueError('Requested version not supported') bottle.response.status = 406 return dict(message='Requested version not supported') args = [] args[:] = NOSETESTS_ARGS args.append('--tc-file={VENV}/%s' % CONFIG_FILE) if data.get('debug'): args.append('--tc=stages.enabled:1') tests = [ os.path.join('{VENV}', x) for x in re.split('\s+', ( data.get('tests') or TESTS_DEBUG).strip()) ] args.extend(tests) else: args.append('--tc=stages.enabled:1') args.append('--eval-attr=rank > 0 and rank < 11') args.append('--with-email') args.append('--with-bvtinfo') args.append('--with-irack') args.append('{VENV}/%s' % CONFIG.paths.em) v = plugins.email.variables v.args = args v.project = data['project'] v.version = params.version v.build = params.build result = nosetests.delay(our_config, args, data) # @UndefinedVariable link = app.router.build('status', task_id=result.id) return dict(status=result.status, id=result.id, link=link)