示例#1
0
def extGlobalMode(logs, process):
    if cmn.execComnd("exit", logs, process) is FAIL:
        return FAIL

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

    return SUCCESS
示例#2
0
def confIPAddress(logs, process, ip, mask):
    cmd = "ip address " + ip + " " + mask + " "
    if cmn.execComnd(cmd, logs, process) is FAIL:
        return FAIL

    cmd = "no shutdown "
    if cmn.execComnd(cmd, logs, process) is FAIL:
        return FAIL

    return SUCCESS
示例#3
0
def confOSPF(logs, process, ip, wildcard):
    network = "network "
    glb.initRouterConf()
    if cmn.execComnd("router ospf 1", logs, process) is FAIL:
        return FAIL

    if glb.valRouterConf() is FAIL:
        print "ERROR : FAILED TO ENTER ROUTER CONF MODE"
        return FAIL

    network = network + ip + " " + wildcard + " area 0"
    if cmn.execComnd(network, logs, process) is FAIL:
        return FAIL

    return SUCCESS
示例#4
0
def confEIGRP(logs, process, as_num, ip, wildcard):
    router_eigrp = "router eigrp "
    router_eigrp.append(str(as_num))
    network = "network "
    glb.initRouterConf()
    if cmn.execComnd(router_eigrp, logs, process) is FAIL:
        return FAIL

    if glb.valRouterConf() is FAIL:
        print "ERROR : FAILED TO ENTER ROUTER CONF MODE"
        return FAIL

    network = network + ip + " " + wildcard
    if cmn.execComnd(network, logs, process) is FAIL:
        return FAIL

    return SUCCESS
示例#5
0
def globalConfMode(logs, process):
    glb.initGlbExec()
    if cmn.execComnd("configure terminal", logs, process) is FAIL:
        return FAIL

    if glb.valGlbExec() is FAIL:
        print "ERROR : FAILED TO ENTER GLOBAL EXEC MODE"
        return FAIL
    return SUCCESS
示例#6
0
def confRIP(logs, process, ip):
    network = "network "
    glb.initRouterConf()
    if cmn.execComnd("router rip", logs, process) is FAIL:
        return FAIL

    if glb.valRouterConf() is FAIL:
        print "ERROR : FAILED TO ENTER ROUTER CONF MODE"
        return FAIL

    if cmn.execComnd("version 2", logs, process) is FAIL:
        return FAIL

    network = network + ip
    if cmn.execComnd(network, logs, process) is FAIL:
        return FAIL

    if cmn.execComnd("no auto-summary", logs, process) is FAIL:
        return FAIL

    return SUCCESS
示例#7
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
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
示例#9
0
def intConfMode(logs, process, slot, port):
    glb.initInfConf()
    cmd = ""
    list_cmd = ['interface fastethernet ']
    list_cmd.append(str(slot))
    list_cmd.append("/")
    list_cmd.append(str(port))
    cmd = ''.join(list_cmd)

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

    if glb.valInfConf is FAIL:
        "ERROR : FAILED TO ENTER INTERFACE CONF MODE"
        return FAIL

    return SUCCESS