Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)