예제 #1
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)
예제 #2
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)
예제 #3
0
def join_and_view_edge_config():
    #request.form[]
    url = 'http://localhost:'+str(server_port)+'/api/configuration/join'
    response = requests.get(url)
    device_status = device_config_db.get_device_status()
    device_id = device_config_db.get_device_id()
    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)