Пример #1
0
def render_delete():
    devicename = request.args.get('device', '')
    peername = request.args.get('peername', '')
    peerasn = request.args.get('peerasn', '')
    peerip = request.args.get('peerip', '')
    peergroup = request.args.get('peergroup', '')
    ix = request.args.get('ixname', '')
    pfxlimit = 0
    md5 = ''

    devices = main.parse_config()
    for device in devices:
        if device[0] == devicename:
            vendor = device[1].split(', ')[0]
            username = device[1].split(', ')[1]
            password = device[1].split(', ')[2]

    #try:
    main.netconfedit(devicename, vendor, username, password, 'del', peergroup,
                     peerasn, peerip, pfxlimit, md5)
    return render_template('deleted.html',
                           peername=peername,
                           peerasn=peerasn,
                           peerip=peerip,
                           ix=ix)
Пример #2
0
def render_update_peer():
    devices = main.parse_config()
    peername = request.args.get('peername', '')
    peerasn = request.args.get('peerasn', '')
    peerip = request.args.get('peerip', '')
    peergroup = request.args.get('peergroup', '')
    devicename = request.args.get('device', '')
    ix = request.args.get('ixname', '')
    pfxlimit = request.args.get('pfxlimit', '')
    md5 = request.args.get('md5', '')

    if devicename is not '':
        for device in devices:
            if device[0] == devicename:
                vendor = device[1].split(', ')[0]
                username = device[1].split(', ')[1]
                password = device[1].split(', ')[2]

    #try:
    main.netconfedit(devicename, vendor, username, password, 'update',
                     peergroup, peerasn, peerip, pfxlimit, md5)
    return render_template('updated.html',
                           peername=peername,
                           peerasn=peerasn,
                           peerip=peerip,
                           ix=ix,
                           peergroup=peergroup,
                           pfxlimit=pfxlimit,
                           md5=md5)
Пример #3
0
def render_ixdetails():
    devicename = request.args.get('device', '')
    if devicename is not '':
        devices = main.parse_config()
        for device in devices:
            if device[0] == devicename:
                vendor = device[1].split(', ')[0]
                username = device[1].split(', ')[1]
                password = device[1].split(', ')[2]
                ix = request.args.get('ixname', '')
                router_data = main.get_cached_data_for_gui(
                    devicename, vendor, username, password)

                return render_template('index.html', devices=devices, device=devicename, \
                  ixes=router_data[2], ix=ix, asn=router_data[0][4], \
                  name=router_data[0][5])
Пример #4
0
def render_router():
    devicename = request.args.get('device', '')
    if devicename is not '':
        devices = main.parse_config()
        for device in devices:
            if device[0] == devicename:
                vendor = device[1].split(', ')[0]
                username = device[1].split(', ')[1]
                password = device[1].split(', ')[2]
                router_data = main.get_cached_data_for_gui(
                    devicename, vendor, username, password)

                return render_template('index.html', devices=devices, device=devicename, \
                       ixes=router_data[2], asn=router_data[0][4], name=router_data[0][5])

        return "Unknown router: %s !" % devicename

    return 'No devicename given'
Пример #5
0
def render_home():
    devices = main.parse_config()
    return render_template('index.html', devices=devices)