Example #1
0
def by_onu_del(form):
    try:
        olt_iface = escape(form.getvalue('olt_iface', ''))
        onu_num = escape(form.getvalue('onu_num', ''))
        save = escape(form.getvalue('save_conf', ''))
        #
        onu_del(olt_iface, onu_num, save)
        #
    except Exception as msg: show_except(msg)
Example #2
0
def by_onu_add(form):
    try:
        onu_str = escape(form.getvalue('onu_string', ''))
        olt_iface, onu_sn = onu_str.split(':')
        #
        onu_num = escape(form.getvalue('onu_num', ''))
        onu_type = escape(form.getvalue('onu_type', ''))
        vlan = escape(form.getvalue('vlan', ''))
        desc = escape(form.getvalue('desc', 'None'))
        save = escape(form.getvalue('save_conf', ''))
        #
        onu_add(olt_iface, onu_num, onu_sn, vlan, onu_type, desc, save)
        #
    except Exception as msg: show_except(msg)
Example #3
0
def telnet_exec(host, cmds, timeout=2):
    try:
        telnet = Telnet()
        host, port = host
        #telnet.debuglevel = 1
        telnet.open(host, port)
        #
        for item in cmds:
            telnet.write(item.encode() + b'\x0d\x0a')
            sleep(timeout)
            #
        else: telnet.close()
        #
    except Exception as msg: print show_except(msg)