Exemplo n.º 1
0
def showIpIntConfigs(logs, process):
    if glb.valPrivExec() is FAIL:
        print "ERROR : CONTROL NOT AT PRIVEXEC MODE"
        print "ERROR : FUNCTION : \"showIpIntConfigs\" returning failure"
        return FAIL

    param_list = "ip interface brief"
    cmd = genCommand(logs, param_list)

    if cmn.execComnd(cmd, logs, process) is FAIL:
        return FAIL

    return SUCCESS
Exemplo n.º 2
0
def enableEIGRP(logs, process, as_num, ip, wildcard):
    if glb.valPrivExec() is FAIL:
        print "ERROR : CONTROL NOT AT PRIVEXEC MODE"
        print "ERROR : FUNCTION : \"enableEIGRP\" returning failure"
        return FAIL

    if globalConfMode(logs, process) is FAIL:
        print "ERROR : FUNCTION \'globalConfMode\' returned Failure"

    if confEIGRP(logs, process, as_num, ip, wildcard) is FAIL:
        print "ERROR : FUNCTION \'confEIGRP\' returned Failure"

    if extGlobalMode(logs, process) is FAIL:
        print "ERROR : FUNCTION \'extGlobalMode\' returned Failure"
Exemplo n.º 3
0
def chkPing(logs, process, ip):
    if glb.valPrivExec() is FAIL:
        print "ERROR : CONTROL NOT AT PRIVEXEC MODE"
        print "ERROR : FUNCTION : \"chkPing\" returning failure"
        return FAIL

    glb.initPingStat()
    cmd = "ping " + ip

    if cmn.execComnd(cmd, logs, process) is FAIL:
        return FAIL

    if glb.PING_STAT == 0:
        return FAIL
    else:
        return SUCCESS
Exemplo n.º 4
0
def intfConfigs(logs, process, slot, port, ip, mask):
    if glb.valPrivExec() is FAIL:
        print "ERROR : CONTROL NOT AT PRIVEXEC MODE"
        print "ERROR : FUNCTION : \"intfConfigs\" returning failure"
        return FAIL

    if globalConfMode(logs, process) is FAIL:
        print "ERROR : FUNCTION \'globalConfMode\' returned Failure"

    if intConfMode(logs, process, slot, port) is FAIL:
        print "ERROR : FUNCTION \'intConfMode\' returned Failure"

    if confIPAddress(logs, process, ip, mask) is FAIL:
        print "ERROR : FUNCTION \'confIPAddress\' returned Failure"

    if extGlobalMode(logs, process) is FAIL:
        print "ERROR : FUNCTION \'extGlobalMode\' returned Failure"
Exemplo n.º 5
0
def privExecMode(logs, session_list):
    glb.initPrivExec()
    buffertrack = ""

    for itr in range(1, len(session_list)):
        process = session_list[itr]
        process.stdin.write("\n")

        while True:
            opparser = process.stdout.read(1)
            sys.stdout.write(opparser)
            sys.stdout.flush()

            if opparser != '':
                buffertrack = buffertrack + str(opparser)

                if re.search('R\w#', buffertrack):
                    buffertrack = ""
                    glb.PRIV_EXECM = 1
                    break
    if glb.valPrivExec() is FAIL:
        print "ERROR : FAILED TO ENETER PRIV EXEC MODE"
        return FAIL
    return SUCCESS