Ejemplo n.º 1
0
def bvt_verifyChapMod(c):
    FailFlag = False
    tolog("<b>Verify chap -a mod</b>")
    c, ssh = ssh_conn()
    chapId = findChapId(c)
    if len(chapId) != 0:
        result = SendCmdpassword(c,
                                 'chap -a mod -s "name=testModifyName" -i 0',
                                 '111122221111')
        c.close()
        c, ssh = ssh_conn()
        checkResult = SendCmd(c, 'chap')
        if "Error (" in result or 'testModifyName' not in checkResult:
            FailFlag = True
            tolog(
                '\n<font color="red">Fail: chap -a mod -s "name=testModifyName" -i 0</font>'
            )
    else:
        tolog('\n<font color="red">Fail: CHAP record not found </font>')

    c.close()
    ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 2
0
Archivo: date.py Proyecto: FengZiQ/cli
def verifyDateInvalidParameters(c):
    FailFlag = False
    tolog("<b>Verify date invalid parameters</b>")

    c, ssh = ssh_conn()

    command = [
        'date test', 'date -a test', 'date -a mod -d 2017/13/30',
        'date -a mod -d 2017/05/33', 'date -a mod -t 24:00:00',
        'date -a mod -t 00:61:00', 'date -a mod -t 00:00:61'
    ]

    for com in command:
        tolog('<b> Verify ' + com + '</b>')

        result = SendCmd(c, com)

        if "Error (" not in result or "Invalid setting parameters" not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: ' + com + ' </font>')

    if FailFlag:
        tolog(
            '\n<font color="red">Fail: Verify date invalid parameters </font>')
        tolog(Fail)
    else:
        tolog('\n<font color="green">Pass</font>')
        tolog(Pass)

    return FailFlag
Ejemplo n.º 3
0
def bvt_verifyChapList(c):
    FailFlag = False
    tolog("<b>Verify chap -a list</b>")
    c, ssh = ssh_conn()
    chapId = findChapId(c)
    if len(chapId) != 0:
        result = SendCmd(c, 'chap -a list')
        if "Error (" in result or 'ChapId:' not in result or 'Name:' not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: chap -a list</font>')
        tolog('<b>Verify chap -a list -i chap id</b>')
        for i in chapId:
            result = SendCmd(c, 'chap -a list -i ' + i)
            if 'ChapId:' not in result or 'Name:' not in result or i not in result:
                FailFlag = True
                tolog('\n<font color="red">Fail: chap -a list -i ' + i +
                      '</font>')
    else:
        result = SendCmd(c, 'chap -a list')
        if 'CHAP record not found' not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: chap -a list</font>')

    # c.close()
    # ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 4
0
def verifyDateMod(c):
    FailFlag = False
    tolog("<b>Verify date -a mod </b>")
    # yyyy/mm/dd where month's range is 1-12 and day's range is 1-31.
    # hh:mm:ss where hour's range is 0-23, minute's and seconds'range are 0-59
    SendCmd(c, 'date -a mod -d 2018/01/01 -t 08:08:08')
    c, ssh = ssh_conn()
    time.sleep(10)
    checkResult = SendCmd(c, 'date')
    if '2018-01-01' not in checkResult or '08:08:' not in checkResult:
        FailFlag = True
        tolog('\n<font color="red">Fail: date -a mod -d 2018/01/01 -t 08:08:08 </font>')

    d = time.strftime('%Y/%m/%d', time.localtime(time.time()))
    t = time.strftime('%H:%M:%S', time.localtime(time.time()))
    SendCmd(c, 'date -a mod -d ' + d + ' -t ' + t)
    # c, ssh = ssh_conn()
    # time.sleep(10)
    checkResult = SendCmd(c, 'date')
    if d.split('/')[0] + '-' + d.split('/')[1] + '-' + d.split('/')[2] not in checkResult or t not in checkResult:
        FailFlag = True
        tolog('\n<font color="red">Fail: date -a mod -d ' + d + ' -t ' + t + ' </font>')

    if FailFlag:
        tolog('\n<font color="red">Fail: Verify date -a mod </font>')
        tolog(Fail)
    else:
        tolog('\n<font color="green">Pass</font>')
        tolog(Pass)
Ejemplo n.º 5
0
Archivo: date.py Proyecto: FengZiQ/cli
def verifyDateMissingParameters(c):
    FailFlag = False
    tolog("<b>Verify date missing parameters</b>")

    c, ssh = ssh_conn()

    command = ['date -a mod -d', 'date -a mod -t']

    for com in command:
        tolog('<b> Verify ' + com + '</b>')

        result = SendCmd(c, com)

        if "Error (" not in result or "Missing parameter" not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: ' + com + ' </font>')

    if FailFlag:
        tolog(
            '\n<font color="red">Fail: Verify date missing parameters </font>')
        tolog(Fail)
    else:
        tolog('\n<font color="green">Pass</font>')
        tolog(Pass)

    return FailFlag
Ejemplo n.º 6
0
def modifyAndVerifyRedundancyType(c):
    checkResult = ''
    result = tuple()
    FailFlag = False
    # LUN affinity should be disabled before the following execution
    # in new DS, LUN affinity is enabled and cannot be changed.

    tolog("Modify and Verify RedundancyType setting: ")
    lunaffinityresult = SendCmd(c, "ctrl -v")
    if "LUNAffinity: Enabled" in lunaffinityresult:
        SendCmd(c, "ctrl -a mod -s \"lunaffinity=disable\"")

    for i in range(2):

        # determine the original Redundancy type
        OrigResult = SendCmd(c, "subsys -v")
        if "RedundancyType: Active-Active" in OrigResult:
            OrigRedundancyType = "Active-Active"
        else:
            OrigRedundancyType = "Active-Standby"

        if OrigRedundancyType == "Active-Active":
            result = SendCmd(
                c, 'subsys -a mod -s "redundancytype=active-standby"')
        else:
            result = SendCmd(
                c, 'subsys -a mod -s "redundancytype=active-active"')

        checkResult = SendCmd(c, "shutdown -a restart")
        from time import sleep
        sleep(200)
        from ssh_connect import ssh_conn

        cnew, sshnew = ssh_conn()
        RewResult = SendCmd(cnew, "subsys -v")
        if "RedundancyType: Active-Active" in RewResult:
            NewRedundancyType = "Active-Active"
        else:
            NewRedundancyType = "Active-Standby"

        if not ("Cachemirroring and RedundancyType setting change will take effect on next"
                in result and 'Error' not in checkResult):
            FailFlag = True

        if not (OrigRedundancyType not in RewResult):
            tolog(Failprompt + NewRedundancyType)
            FailFlag = True
        c = cnew

    if FailFlag:
        tolog('Modify and Verify RedundancyType setting fail')
        tolog(Fail)
    else:
        tolog('Modify and Verify RedundancyType setting pass')
        tolog(Pass)
    sshnew.close()
Ejemplo n.º 7
0
def bvt_verifyDateHelp(c):
    FailFlag = False
    tolog("Verify date -h ")
    c, ssh = ssh_conn()
    result = SendCmd(c, 'date -h')
    if 'Error (' in result or 'date' not in result:
        FailFlag = True
        tolog('Fail: date -h ')

    return FailFlag
Ejemplo n.º 8
0
def bvt_verifyDateList(c):
    FailFlag = False
    tolog("Verify date -a list ")
    c, ssh = ssh_conn()
    result = SendCmd(c, 'date -a list')
    if 'Error (' in result or 'SystemDate:' not in result:
        FailFlag = True
        tolog('Fail: date -a list ')

    return FailFlag
Ejemplo n.º 9
0
def modifyAndVerifyCachemirroring(c):
    # modify the cachemirroring from enabled to disabled
    # modify the cachemirroring from disabled to enabled
    checkResult = ''
    result = tuple()
    FailFlag = False
    # LUN affinity should be disabled before the following execution

    tolog("Modify and Verify Cachemirroring setting: ")

    for i in range(2):

        # determine the original Redundancy type
        OrigResult = SendCmd(c, "subsys -v")
        if "CacheMirroring: Enabled" in OrigResult:
            Cachemirroring = "Enabled"
        else:
            RCachemirroring = "Disabled"

        if Cachemirroring == "Enabled":
            result = SendCmd(c, 'subsys -a mod -s "cachemirroring=disable"')
        else:
            result = SendCmd(c, 'subsys -a mod -s "cachemirroring=enable"')

        checkResult = SendCmd(c, "shutdown -a restart")
        from time import sleep
        from ssh_connect import ssh_conn
        sleep(200)
        cnew, sshnew = ssh_conn()

        RewResult = SendCmd(cnew, "subsys -v")

        if "CacheMirroring: Enabled" in RewResult:
            Cachemirroring = "Enabled"
        else:
            Cachemirroring = "Disabled"

        if not ("Cachemirroring and RedundancyType setting change will take effect on next"
                in result and 'Error' not in checkResult):
            FailFlag = True
        if not (Cachemirroring not in OrigResult):
            tolog(Failprompt + Cachemirroring)
            FailFlag = True
        c = cnew

    if FailFlag:
        tolog('Modify and Verify Cachemirroring setting fail')
        tolog(Fail)
    else:
        tolog('Modify and Verify Cachemirroring setting pass')
        tolog(Pass)
    sshnew.close()
Ejemplo n.º 10
0
def bvt_verifyDateInvalidOption(c):
    FailFlag = False
    tolog("Verify date invalid option")
    c, ssh = ssh_conn()
    command = ['date -x', 'date -a list -x', 'date -a mod -x']
    for com in command:
        tolog(' Verify ' + com + '')
        result = SendCmd(c, com)
        if "Error (" not in result or "Invalid option" not in result:
            FailFlag = True
            tolog('Fail: ' + com + ' ')

    return FailFlag
Ejemplo n.º 11
0
def bvt_verifyChapHelp(c):
    FailFlag = False
    tolog("<b> Verify chap -h </b>")
    c, ssh = ssh_conn()
    result = SendCmd(c, 'chap -h')
    if "Error (" in result or 'chap' not in result:
        FailFlag = True
        tolog('\n<font color="red">Fail: chap -h </font>')

    c.close()
    ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 12
0
def bvt_verifyChapSpecifyErrorId(c):
    FailFlag = False
    tolog("<b> Verify chap specify error Id </b>")
    c, ssh = ssh_conn()
    result = SendCmd(c, 'chap -a del -i 4')
    if 'Error (' not in result:
        FailFlag = True
        tolog('\n<font color="red">Fail: chap -a del -i 4 </font>')

    c.close()
    ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 13
0
def verifyDateHelp(c):
    FailFlag = False
    tolog("<b>Verify date -h </b>")
    c, ssh = ssh_conn()
    result = SendCmd(c, 'date -h')
    if 'Error (' in result or 'date' not in result:
        FailFlag = True
        tolog('\n<font color="red">Fail: date -h </font>')
    if FailFlag:
        tolog('\n<font color="red">Fail: Verify date -h </font>')
        tolog(Fail)
    else:
        tolog('\n<font color="green">Pass</font>')
        tolog(Pass)
Ejemplo n.º 14
0
def bvt_verifyChapMissingParameters(c):
    FailFlag = False
    tolog("<b>Verify chap missing parameters</b>")
    c, ssh = ssh_conn()
    command = [
        'chap -i', 'chap -a list -i ', 'chap -a add -s ', 'chap -a mod -i',
        'chap -a del -i'
    ]
    for com in command:
        tolog('<b> Verify ' + com + '</b>')
        result = SendCmd(c, com)
        if "Error (" not in result or "Missing parameter" not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: ' + com + ' </font>')

    return FailFlag
Ejemplo n.º 15
0
def bvt_verifyChapDel(c):
    FailFlag = False
    tolog("<b>Verify chap -a del</b>")
    c, ssh = ssh_conn()
    ChapId = findChapId(c)
    for i in ChapId:
        result = SendCmd(c, 'chap -a del -i ' + i)
        if 'Error (' in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: chap -a del -i ' + i + '</font>')

    c.close()
    ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 16
0
def verifyDateInvalidOption(c):
    FailFlag = False
    tolog("<b>Verify date invalid option</b>")
    c, ssh = ssh_conn()
    command = ['date -x', 'date -a list -x', 'date -a mod -x']
    for com in command:
        tolog('<b> Verify ' + com + '</b>')
        result = SendCmd(c, com)
        if "Error (" not in result or "Invalid option" not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: ' + com + ' </font>')
    if FailFlag:
        tolog('\n<font color="red">Fail: Verify date invalid option </font>')
        tolog(Fail)
    else:
        tolog('\n<font color="green">Pass</font>')
        tolog(Pass)
Ejemplo n.º 17
0
def bvt_verifyChapInvalidOption(c):
    FailFlag = False
    tolog("<b>Verify chap invalid option</b>")
    c, ssh = ssh_conn()
    command = [
        'chap -x', 'chap -a list -x', 'chap -a add -x', 'chap -a mod -x',
        'chap -a del -x'
    ]
    for com in command:
        tolog('<b> Verify ' + com + '</b>')
        result = SendCmd(c, com)
        if "Error (" not in result or "Invalid option" not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: ' + com + ' </font>')

    c.close()
    ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 18
0
def bvt_verifyChapInvalidParameters(c):
    FailFlag = False
    tolog("<b>Verify chap invalid parameters</b>")
    c, ssh = ssh_conn()
    command = [
        'chap test', 'chap -a test', 'chap -a add -s test',
        'chap -a mod -i test', 'chap -a del -i test'
    ]
    for com in command:
        tolog('<b> Verify ' + com + '</b>')
        result = SendCmd(c, com)
        if "Error (" not in result or "Invalid setting parameters" not in result:
            FailFlag = True
            tolog('\n<font color="red">Fail: ' + com + ' </font>')

    c.close()
    ssh.close()
    time.sleep(3)

    return FailFlag
Ejemplo n.º 19
0
def bvt_verifyDateMod(c):
    FailFlag = False
    tolog("Verify date -a mod ")
    # yyyy/mm/dd where month's range is 1-12 and day's range is 1-31.
    # hh:mm:ss where hour's range is 0-23, minute's and seconds'range are 0-59
    SendCmd(c, 'date -a mod -d 2018/01/01 -t 08:08:08')
    c, ssh = ssh_conn()
    time.sleep(10)
    checkResult = SendCmd(c, 'date')
    if '2018-01-01' not in checkResult or '08:08:' not in checkResult:
        FailFlag = True
        tolog('Fail: date -a mod -d 2018/01/01 -t 08:08:08 ')

    d = time.strftime('%Y/%m/%d', time.localtime(time.time()))
    t = time.strftime('%H:%M:%S', time.localtime(time.time()))
    SendCmd(c, 'date -a mod -d ' + d + ' -t ' + t)
    # c, ssh = ssh_conn()
    # time.sleep(10)
    checkResult = SendCmd(c, 'date')
    if d.split('/')[0] + '-' + d.split('/')[1] + '-' + d.split('/')[2] not in checkResult or t not in checkResult:
        FailFlag = True
        tolog('Fail: date -a mod -d ' + d + ' -t ' + t + ' ')

    return FailFlag
Ejemplo n.º 20
0
            FailFlag = True
            tolog('Fail:' + com)

    return FailFlag


def bvt_verifyPcieMissingParameters(c):
    FailFlag = False
    tolog("Verify pcie missing parameters")
    command = ['pcie -a ']
    for com in command:
        tolog(' Verify ' + com)
        result = SendCmd(c, com)
        if "Error (" not in result or "Missing parameter" not in result:
            FailFlag = True
            tolog('Fail:' + com)

    return FailFlag


if __name__ == "__main__":
    start = time.clock()
    c, ssh = ssh_conn()
    bvt_verifyPcie(c)
    bvt_verifyPcielist(c)
    bvt_verifyPcieInvalidOption(c)
    bvt_verifyPcieInvalidParameters(c)
    bvt_verifyPcieMissingParameters(c)
    ssh.close()
    elasped = time.clock() - start
    print "Elasped %s" % elasped
Ejemplo n.º 21
0
def getnetMinfo(c):
    # the old hyperion net -v
    # ActiveCtrlId: 1                        Port: 1
    # MaxSupportedSpeed: 100Mbps             LinkStatus: Up
    #
    # ProtocolFamily: IPv4(Enabled)          DHCP: Disabled
    # IP: 10.84.2.146
    # IPMask: 255.255.255.0
    # DNS: 225.0.0.0
    # Gateway: 10.84.2.1
    # MAC: 00:01:55:59:EA:9D
    # WakeOnLAN: Enabled
    #
    # ProtocolFamily: IPv6(Enabled)          DHCP: Disabled
    # IP: 2017::1
    # IPMask: ffff::
    # DNS: 2017::3
    # Gateway: 2017::9
    # MAC: 00:01:55:59:EA:9D
    # WakeOnLAN: Enabled

    from ssh_connect import ssh_conn
    c, ssh = ssh_conn()
    import json

    a = SendCmd(c, "net -m")

    #     -------------------------------------------------------------------------------
    # CtrlId: 1                              Port: 1
    # ProtocolFamily: IPv4(Enabled)          DHCP: Disabled
    # IP: 10.0.0.3
    # IPMask: 255.0.0.0
    # DNS: 0.0.0.0
    # Gateway: 0.0.0.0
    # MAC: 00:01:55:59:EA:9D
    #
    # CtrlId: 1                              Port: 1
    # ProtocolFamily: IPv6(Enabled)          DHCP: Disabled
    # IP: 2001::1
    # IPMask: ffff::
    # DNS: ::
    # Gateway: ::
    # MAC: 00:01:55:59:EA:9D
    #
    #
    # -------------------------------------------------------------------------------
    # Controller 2 information not accessible
    #

    b = a.split("\r\n")
    for i in range(5):
        for item in b:
            if not ("ProtocolFamily" in item or "IP" in item or "DNS" in item
                    or "Gateway" in item or "MAC" in item):
                b.remove(item)

    net_m_ipv4_list = b[:7]
    net_m_ipv6_list = b[7:]

    #net_v_ipv4_list
    #print "v6 list", net_v_ipv6_list
    net_m_ipv4_dict = {}
    net_m_ipv6_dict = {}

    for each in net_m_ipv4_list:
        if "ProtocolFamily" in each:
            lista = each.split("          ")
            for eacha in lista:
                key = eacha.split(": ")[0]
                value = eacha.split(": ")[1]
                net_m_ipv4_dict[key] = value
        else:
            key = each.split(": ")[0]
            value = each.split(": ")[1]
            net_m_ipv4_dict[key] = value

    for each in net_m_ipv6_list:
        if "ProtocolFamily" in each:
            lista = each.split("         ")
            for eacha in lista:
                key = eacha.split(": ")[0]
                value = eacha.split(": ")[1]
                net_m_ipv6_dict[key] = value
        else:
            key = each.split(": ")[0]
            value = each.split(": ")[1]
            net_m_ipv6_dict[key] = value
    return net_m_ipv4_dict, net_m_ipv6_dict