예제 #1
0
def view_edge_configuration():
    device_status = device_config_db.get_device_status()
    register_list = device_config_db.get_register_list()
    print('Device status: ', device_status)
    return render_template('edge_config.html',
                            device_status=device_status,
                            register_list=register_list)
예제 #2
0
def register_and_view_edge_config():
    register_type = request.form['register_type']
    category = request.form['category']
    attributes = request.form['attributes']
    cache = request.form['cache']
    segment = request.form['segment']
    collisionAvoid = request.form['collisionAvoid']

    str_to_hash = '{}{}{}'.format(register_type, category, attributes)
    register_hash = hash_util.get_hash(str_to_hash)

    url = 'http://localhost:'+str(server_port)+'/api/configuration/register'
    json_data = {
        'register_list':[
            {
                'index':1,
                'hash':register_hash,
                'registerType':register_type,
                'category':category,
                'attributes':attributes,
                'cache':cache,
                'segment':segment,
                'collisionAvoid':collisionAvoid
            }
        ]
    }

    response = requests.post(url, json=json_data)
    device_status = device_config_db.get_device_status()
    register_list = device_config_db.get_register_list()
    print('Device status: ', device_status)
    print('Register List in DB:',register_list)
    return render_template('edge_config.html',
                            device_status=device_status,
                            register_list=register_list)
예제 #3
0
def query_and_view_edge_util():
    queryType = request.form['queryType']
    category = request.form['category']
    order = request.form['order']
    desc = request.form['desc']
    limit = request.form['limit']
    requirements = request.form['requirements']
    additionalFields = request.form['additionalFields']

    device_id = device_config_db.get_device_id()

    url = 'http://localhost:'+str(server_port)+'/api/utilization/query'
    json_data = {
        'query':{
            'queryID':1,
            'queryType':queryType,
            'category':category,
            'order':order,
            'desc':desc,
            'limit':limit,
            'requirements':requirements,
            'additionalFields':additionalFields
        },
        'DeviceID':device_id
    }
    response = requests.post(url, json=json_data)

    device_status = device_config_db.get_device_status()
    return render_template('edge_util.html',
                            device_status=device_status)
예제 #4
0
def run_qos_interpreter_and_view_result():
    service_type = request.form['service_type']
    service_name = request.form['service_name']
    requirements = request.form['requirements']

    json_data = {
        'service_type': service_type,
        'service_name': service_name,
        'requirements': json.loads(requirements)
    }

    device_id = device_config_db.get_device_id()
    device_status = device_config_db.get_device_status()

    temp_result = qos_interpreter.interpret(json_data)
    output_result = []

    if ('delay' in temp_result.keys()):
        output_result.append(temp_result['delay'])
    if ('jitter' in temp_result.keys()):
        output_result.append(temp_result['jitter'])
    if ('bandwidth' in temp_result.keys()):
        output_result.append(temp_result['bandwidth'])
    if ('lossrate' in temp_result.keys()):
        output_result.append(temp_result['lossrate'])

    return render_template('qos_interpreter.html',
                           interpreted=True,
                           device_status=device_status,
                           input_desc=json_data,
                           output_result=output_result)
예제 #5
0
def leave_and_view_edge_config():
    #request.form[]
    url = 'http://localhost:'+str(server_port)+'/api/configuration/leave'
    response = requests.get(url)
    device_status = device_config_db.get_device_status()
    device_id = device_config_db.get_device_id()
    print('Device status: ', device_status)
    return render_template('edge_config.html',
                            device_status=device_status,
                            register_list=None)
예제 #6
0
def view_qos_interpreter_form():
    device_status = device_config_db.get_device_status()
    print('Device status: ', device_status)
    return render_template('qos_interpreter.html',
                            interpreted=False,
                            device_status=device_status)
예제 #7
0
def view_edge_utilization():
    device_status = device_config_db.get_device_status()
    return render_template('edge_util.html',
                            device_status=device_status)