def manage_creds():
  slas={}

  try:
    access_token = iam_blueprint.session.token['access_token']
    slas = sla.get_slas(access_token, settings.orchestratorConf['slam_url'], settings.orchestratorConf['cmdb_url'])

  except Exception as e:
        flash("Error retrieving SLAs list: \n" + str(e), 'warning')

  return render_template('service_creds.html', slas=slas)
Ejemplo n.º 2
0
def configure():

    access_token = iam_blueprint.session.token['access_token']

    selected_tosca = request.args['selected_tosca']

    slas = sla.get_slas(access_token)

    return render_template('createdep.html',
                           template=toscaInfo[selected_tosca],
                           selectedTemplate=selected_tosca,
                           slas=slas)
Ejemplo n.º 3
0
def getslas():

  slas={}

  try:
    access_token = iam_blueprint.token['access_token']
    slas = sla.get_slas(access_token)

  except Exception as e:
        flash("Error retrieving SLAs list: \n" + str(e), 'warning')

  return render_template('sla.html', slas=slas)
Ejemplo n.º 4
0
def getslas():

    slas = {}
    try:
        access_token = iam_blueprint.session.token['access_token']
        slas = sla.get_slas(access_token,
                            settings.orchestratorConf['slam_url'],
                            settings.orchestratorConf['cmdb_url'])
    except Exception as e:
        flash("Error retrieving SLAs list: \n" + str(e), category='danger')

    return render_template('sla.html', slas=slas)
def configure():

    access_token = iam_blueprint.session.token['access_token']

    selected_tosca = request.args['selected_tosca']

    slas = sla.get_slas(access_token, settings.orchestratorConf['slam_url'], settings.orchestratorConf['cmdb_url'], toscaInfo[selected_tosca]["deployment_type"])

    app.logger.debug("Template: " + json.dumps(toscaInfo[selected_tosca]))

    return render_template('createdep.html',
                           template=toscaInfo[selected_tosca],
                           selectedTemplate=selected_tosca,
                           slas=slas)
Ejemplo n.º 6
0
def configure(selected_module):

    # Parse form
    toscaname = request.args.get('toscaname', default='default')
    hardware = request.args.get('hardware', default='cpu')
    docker_tag = request.args.get('docker_tag', default='cpu')
    docker_tags = ['cpu']
    run = request.args.get('run', default='deepaas')
    find_slas = request.args.get('slas', default='true')

    # Update TOSCA conf
    selected_tosca = modules[selected_module]['toscas'][toscaname]
    tosca_info = toscaInfo[selected_tosca]
    try:
        tosca_info = deepcopy(tosca_info)
        # in case we choose any of common tosca (with no docker repo assigned), use module repo
        tosca_info['inputs']['docker_image'].setdefault(
            'default',
            modules[selected_module]['sources']['docker_registry_repo'])
        docker_tags = modules[selected_module]['docker_tags']
        if docker_tag not in docker_tags:
            docker_tag = docker_tags[0]

        tosca_info = utils.update_conf(conf=tosca_info,
                                       hardware=hardware,
                                       docker_tag=docker_tag,
                                       run=run)
    except Exception as e:
        print(e)
        flash(
            """Error updating the parameters according to the selectable form. This tosca template might have some
        hardcoded options.""",
            category='warning')
    app.logger.debug("Template: " + json.dumps(tosca_info))
    form_conf = {
        'toscaname': {
            'selected': toscaname,
            'available': list(modules[selected_module]['toscas'].keys())
        },
        'hardware': {
            'selected': hardware,
            'available': ['CPU', 'GPU']
        },
        'docker_tag': {
            'selected': docker_tag,
            'available': docker_tags
        },
        'run': {
            'selected': run,
            'available': ['DEEPaaS', 'JupyterLab']
        }
    }

    # Getting slas: If user comes from the general form in the config (ie. find_slas=='false') and slas have already
    # been calculated, we skip this (very slow) step to improve UX
    global slas
    access_token = iam_blueprint.session.token['access_token']
    if not slas or find_slas == 'true':
        try:
            slas = sla.get_slas(access_token,
                                settings.orchestratorConf['slam_url'],
                                settings.orchestratorConf['cmdb_url'])
        except Exception as e:
            print(e)
            flash(
                "Error retrieving the infrastructure provider's list. You probably won't be able to create "
                "your request correctly. Please report the problem to {}.".
                format(app.config.get('SUPPORT_EMAIL')),
                category='danger')
            slas = None

    return render_template('createdep.html',
                           template=tosca_info,
                           selectedTemplate=selected_tosca,
                           selected_module=selected_module,
                           form_conf=form_conf,
                           slas=slas)