Esempio n. 1
0
def Trigger(tc):
    tc.skip = True
    req = api.Trigger_CreateExecuteCommandsRequest()
    for n in tc.nodes:
        os = api.GetNodeOs(n)
        if os not in tc.os:
            continue
        tc.skip = False
        cmd = "./pnsotest_%s.py --cfg blocksize.yml globals.yml --test %s" % (
            api.GetNodeOs(n), tc.args.test)
        if getattr(tc.args, "failtest", False):
            cmd += " --failure-test"

        api.Trigger_AddHostCommand(req, n, "dmesg -c > /dev/null")
        api.Trigger_AddHostCommand(req, n, cmd)
        # api.Trigger_AddHostCommand(req, n, "dmesg")
        if os == 'linux':
            for c in range(1, 5):
                api.Trigger_AddHostCommand(
                    req, n, "cat /sys/module/pencake/status/%d" % c)
        else:
            # api.Trigger_AddHostCommand(req, n, "cat /dev/pencake")
            api.Trigger_AddHostCommand(req, n, "dmesg")
        api.Trigger_AddHostCommand(req, n, "dmesg > dmesg.log")
        api.Logger.info("Running PNSO test %s" % cmd)

    if tc.skip is False:
        tc.resp = api.Trigger(req)
    return api.types.status.SUCCESS
Esempio n. 2
0
def addVxLAN(node, local_ip, remote_ip, vxlan_ip):
    if api.GetNodeOs(node) == host.OS_TYPE_BSD:
        return addBSDVxLAN(node, local_ip, remote_ip, vxlan_ip)
    elif api.GetNodeOs(node) == host.OS_TYPE_LINUX:
        return addLinuxVxLAN(node, local_ip, remote_ip, vxlan_ip)

    return api.types.status.FAILURE
Esempio n. 3
0
def GetHostInternalMgmtInterfaces(node, device = None):
    # Relay on IOTA infra to provide this information (dual-nic friendly API)
    if api.IsNaplesNode(node):
        interface_names = api.GetNaplesHostMgmtInterfaces(node, device)
        if interface_names:
            return interface_names

    interface_names = []

    req = api.Trigger_CreateExecuteCommandsRequest(serial = True)

    if api.GetNodeOs(node) == OS_TYPE_LINUX:
        pci_bdf_list = []
        #find pci bdf first for mgmt device which has deviceId as 1004
        cmd = "lspci -d :1004 | cut -d' ' -f1"
        api.Trigger_AddHostCommand(req, node, cmd)
        resp = api.Trigger(req)

        #find the interface name for all the pci_bdfs for all the mgmt interfaces
        pci_bdf_list = resp.commands[0].stdout.split("\n")

        for pci_bdf in pci_bdf_list:
            if (pci_bdf != ''):
                cmd = "ls /sys/bus/pci/devices/0000:" + pci_bdf + "/net/"

                req = api.Trigger_CreateExecuteCommandsRequest(serial = True)
                api.Trigger_AddHostCommand(req, node, cmd)
                resp = api.Trigger(req)

                for command in resp.commands:
                    #iface_name = None
                    iface_name = command.stdout
                    interface_names.append(iface_name.strip("\n"))
    elif api.GetNodeOs(node) == OS_TYPE_ESX:
        #For now hardcoding.
        return ["eth1"]
    elif api.GetNodeOs(node) == OS_TYPE_WINDOWS:
        entries = GetWindowsPortMapping(node)
        if len(entries) == 0:
            return []
        maxbus = 0
        name = ""
        for k, v in entries.items():
            if int(v["Bus"]) > maxbus:
                maxbus = int(v["Bus"])
                name = k

        return [name]
    else:
        cmd = "pciconf -l | grep chip=0x10041dd8 | cut -d'@' -f1 | sed \"s/ion/ionic/g\""
        api.Trigger_AddHostCommand(req, node, cmd)
        resp = api.Trigger(req)

        for command in resp.commands:
            iface_name = command.stdout
            interface_names.append(iface_name.strip("\n"))

    return interface_names
Esempio n. 4
0
def SetMACAddressCmd(node, interface, mac_addr):
    cmd = ""
    if api.GetNodeOs(node) == "linux":
        cmd = "ip link set dev " + interface + " address " + mac_addr
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " ether " + mac_addr
    else:
        assert (0)
    return cmd
Esempio n. 5
0
def GetMACAddress(node, interface):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip link show " + interface + " | grep ether | awk '{print $2}' "
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " | grep ether | awk '{print $2}'"
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return resp.commands[0].stdout.strip("\n")
Esempio n. 6
0
def DelIPRoute(node, interface, ip_addr):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip route del " + ip_addr + " dev " + interface
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "route del " + ip_addr + " -interface " + interface
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return resp.commands[0]
Esempio n. 7
0
def DeleteMcastMAC(node, interface, mcast_mac):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip maddr del " + mcast_mac + " dev " + interface
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "echo 'd " + interface + " " + mcast_mac + " ; q ;' | mtest"
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return resp.commands[0]
Esempio n. 8
0
def SetMACAddress(node, interface, mac_addr):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip link set dev " + interface + " address " + mac_addr
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " ether " + mac_addr
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return resp.commands[0]
Esempio n. 9
0
def getRxL4CsumBadStats(node, intf):
    if not node.IsNaples():
        return None
    
    if api.GetNodeOs(node.node_name) == host.OS_TYPE_BSD:
        return getBsdStats(node, intf, 'rxq[0-9]*.\.csum_l4_bad')
    elif api.GetNodeOs(node.node_name) == host.OS_TYPE_LINUX:
        return getLinuxStats(node, intf, 'rx_[0-9]*_csum_error')

    return None
Esempio n. 10
0
def getTxCsumStats(node, intf):
    if not node.IsNaples():
        return None
    
    if api.GetNodeOs(node.node_name) == host.OS_TYPE_BSD:
        return getBsdStats(node, intf, 'txq[0-9]*.\.csum')
    elif api.GetNodeOs(node.node_name) == host.OS_TYPE_LINUX:
        return getLinuxStats(node, intf, 'tx_[0-9]*_csum:')
    
    return None
Esempio n. 11
0
def setInterfaceMTU(node, interface, mtu):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip link set dev " + interface + " mtu " + str(mtu)
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " mtu " + str(mtu)
    else:
        assert (0)
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return resp.commands[0]
Esempio n. 12
0
def setInterfaceMTU(wl, mtu):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(wl.node_name) == "linux":
        cmd = "ip link set dev " + wl.interface + " mtu " + str(mtu)
    elif api.GetNodeOs(wl.node_name) == "freebsd":
        cmd = "ifconfig " + wl.interface + " mtu " + str(mtu)
    else:
        assert (0)
    api.Trigger_AddCommand(req, wl.node_name, wl.workload_name, cmd)
    resp = api.Trigger(req)
    return resp.commands[0]
Esempio n. 13
0
def getTSOIPv6Stats(node, intf):
    if not node.IsNaples():
        return None
    
    if api.GetNodeOs(node.node_name) == host.OS_TYPE_BSD:
        return getBsdStats(node, intf, 'txq[0-9]*.\.tso_ipv6')
    elif api.GetNodeOs(node.node_name) == host.OS_TYPE_LINUX:
        return getLinuxStats(node, intf, 'tx_tso')
    elif api.GetNodeOs(node.node_name) == host.OS_TYPE_WINDOWS:
        return getWindowsStats(node, intf, 'tx_[0-9]*_tso_packets') 
     
    return None
Esempio n. 14
0
def GetVlanID(node, interface):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip -d link show " + interface + " | grep vlan | cut -d. -f2 | awk '{print $3}' "
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " | grep vlan: | cut -d: -f2 | awk '{print $1}'"
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    vlan_id = resp.commands[0].stdout.strip("\n")
    if not vlan_id:
        vlan_id = "0"
    return int(vlan_id)
Esempio n. 15
0
def GetIPAddress(node, interface):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip -4 addr show " + interface + " | grep -oP '(?<=inet\\s)\\d+(\\.\\d+){3}' "
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " | grep inet | awk '{print $2}'"
    elif api.GetNodeOs(node) == "windows":
        cmd = "ip -4 address show " + interface + " | grep inet | awk '{print $2}' |  cut -d/ -f 1 "

    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return resp.commands[0].stdout.strip("\n")
Esempio n. 16
0
def DisablePromiscuous(node, interface):
    result = api.types.status.SUCCESS
    if api.GetNodeOs(node) == "linux":
        cmd = "ip link set dev " + interface + " promisc off"
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " -promisc"
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    if resp.commands[0].exit_code != 0:
        result = api.types.status.FAILURE
    return result
Esempio n. 17
0
def Setup(tc):
    tc.desc = '''
    Test        :   rdma_perftest_bw
    Opcode      :   Send, Read, Write
    Num QP      :   1, 2, ..., 1000
    Transport   :   RC
    MTU         :   4096
    RDMA CM     :   Yes, No
    modes       :   workload1 as server, workload2 as client
                    workload2 as server, workload1 as client
    '''

    tc.iota_path = api.GetTestsuiteAttr("driver_path")

    pairs = api.GetRemoteWorkloadPairs()
    # get workloads from each node
    tc.w = []
    tc.w.append(pairs[0][0])
    tc.w.append(pairs[0][1])

    tc.nodes = api.GetNaplesHostnames()
    tc.os = api.GetNodeOs(tc.nodes[0])

    if getattr(tc.iterators, 'transport', None) == 'UD':
        unames = api.GetTestsuiteAttr("unames")
        for name in unames:
            # skip, UD in user space is broken with ib_uverbs of older uek kernel
            m = re.match(r'^4\.14\.35-(\d+)\..*\.el7uek', name)
            if m and int(m.group(1)) < 1844:
                api.Logger.info("Skip UD perftest with uname %s" % (name, ))
                return api.types.status.IGNORED

    tc.devices = []
    tc.gid = []
    tc.ib_prefix = []

    for i in range(2):
        tc.devices.append(api.GetTestsuiteAttr(tc.w[i].ip_address + '_device'))
        tc.gid.append(api.GetTestsuiteAttr(tc.w[i].ip_address + '_gid'))
        if tc.w[i].IsNaples():
            tc.ib_prefix.append('cd ' + tc.iota_path + ' && ./run_rdma.sh  ')
        else:
            tc.ib_prefix.append('')

    if getattr(tc.iterators, 'tcpdump', None) == 'yes':
        for n in api.GetNaplesHostnames():
            if api.GetNodeOs(n) not in [host.OS_TYPE_BSD]:
                api.Logger.info("IGNORED: TCPDUMP tests on non-FreeBSD")
                return api.types.status.IGNORED

    return api.types.status.SUCCESS
Esempio n. 18
0
def getInterfaceMTU(node, interface):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip -d link show " + interface + " | grep mtu | cut -d'>' -f2 | awk '{print $2}' "
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "ifconfig " + interface + " | grep mtu | cut -d'>' -f2 | awk '{print $4}'"
    else:
        assert (0)
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    mtu = resp.commands[0].stdout.strip("\n")
    if not mtu:
        mtu = "0"
    return int(mtu)
Esempio n. 19
0
def debug_dump_interface_info(node, interface):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=False)
    cmd = "ifconfig " + interface
    api.Trigger_AddHostCommand(req, node, cmd)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip -d link show " + interface
        api.Trigger_AddHostCommand(req, node, cmd)
        cmd = "ip maddr show " + interface
        api.Trigger_AddHostCommand(req, node, cmd)
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "netstat -aI " + interface
        api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    return debug_dump_display_info(resp)
Esempio n. 20
0
def GetMcastMACAddress(node, interface):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    if api.GetNodeOs(node) == "linux":
        cmd = "ip maddr show " + interface + " | grep link | cut -d' ' -f3"
    elif api.GetNodeOs(node) == "freebsd":
        cmd = "netstat -f link -aI " + interface + " | grep -o -E '([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}'"
    api.Trigger_AddHostCommand(req, node, cmd)
    resp = api.Trigger(req)
    mcastMAC_list = list(
        filter(None, resp.commands[0].stdout.strip("\n").split("\n")))
    if api.GetNodeOs(node) == "freebsd":
        #TODO check if first MAC is unicast MAC and then pop instead of a blind pop?
        mcastMAC_list.pop(0)
    return mcastMAC_list
Esempio n. 21
0
def Get_TxVlanOffload_Status(wl):
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    if api.GetNodeOs(wl.node_name) == OS_TYPE_LINUX:
        cmd = "ethtool -k " + wl.interface + " | grep tx-vlan-offload"
    elif api.GetNodeOs(node) == OS_TYPE_BSD:
        cmd = "ifconfig " + wl.interface + " | grep options"
    else:
        api.Logger.info("Unknown os_type - %s" % api.GetNodeOs(wl.node_name))
        return api.types.status.FAILURE

    api.Trigger_AddCommand(req, wl.node_name, wl.workload_name, cmd)
    resp = api.Trigger(req)
    return resp
Esempio n. 22
0
def changeIntfMacAddr(node,
                      intf_mac_dict,
                      on_naples=False,
                      isRollback=False,
                      device_name=None):
    result = api.types.status.SUCCESS
    mac_offset = 200

    for intf, mac_addr in intf_mac_dict.items():
        if isRollback:
            mac_addr_str = mac_addr
        else:
            mac_addr_int = address_utils.convertMacStr2Dec(mac_addr)
            # New MAC = (int(Old_MAC)+ 30 + running_no)
            #TODO: Check what happens when we scale to 2k sub-if.
            mac_addr_int += mac_offset
            if api.GetNodeOs(node) == "linux":
                # In case of FreeBSD, hitting "PS-728". Based on its resolution, will remove OS check here.
                mac_offset += 1
            mac_addr_str = address_utils.formatMacAddr(mac_addr_int)

        if on_naples:
            cmd = naples_utils.SetMACAddress(node,
                                             intf,
                                             mac_addr_str,
                                             device_name=device_name)
        else:
            cmd = host_utils.SetMACAddress(node, intf, mac_addr_str)
        if cmd.exit_code != 0:
            api.Logger.critical("changeIntfMacAddr failed ", node, intf,
                                mac_addr_str)
            api.PrintCommandResults(cmd)
            result = api.types.status.FAILURE
    return result
Esempio n. 23
0
def ServerCmd(port = None, time=None, run_core=None, jsonOut=False, naples=False,
              server_ip=None):
    assert(port)
    nodes = api.GetWorkloadNodeHostnames()
    for node in nodes:
        os = api.GetNodeOs(node)
        break

    if os == "windows" and not naples:
        cmd = [api.WINDOWS_POWERSHELL_CMD + " \"iperf3.exe", "-s", "-p", str(port)]
    else:
        cmd = ["iperf3", "-s", "-p", str(port)]
        if naples:
            cmd = iper3_env + cmd

    if run_core:
        cmd.extend(["-A", str(run_core)])

    if time:
        cmd.extend(["-t", str(time)])

    if jsonOut:
        cmd.append("-J")

    # no periodic output
    cmd.extend(["-i", "0"])

    if os != "windows" or naples:
        return " ".join(cmd)
    else:
        return " ".join(cmd) + "\""
    if server_ip:
        cmd.extend(["-B", server_ip])

    return " ".join(cmd)
Esempio n. 24
0
def Main(step):
    if GlobalOptions.skip_setup:
        return api.types.status.SUCCESS

    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    api.ChangeDirectory("iperf")

    for naples_host in api.GetNaplesHostnames():
        if api.GetNodeOs(naples_host) == host.OS_TYPE_BSD:
            api.CopyToHost(naples_host, [IONIC_STATS_SCRIPT], "")
            api.Trigger_AddHostCommand(
                req, naples_host, "cp  ionic_stats.sh " + api.HOST_NAPLES_DIR)
        api.CopyToNaples(naples_host, [IPERF_BINARY],
                         "",
                         naples_dir="/usr/bin/")
        api.Trigger_AddNaplesCommand(
            req, naples_host, "ln -s /usr/bin/iperf3_aarch64 /usr/bin/iperf3")

    resp = api.Trigger(req)

    for cmd in resp.commands:
        api.PrintCommandResults(cmd)
        if cmd.exit_code != 0:
            result = api.types.status.FAILURE

    return api.types.status.SUCCESS
Esempio n. 25
0
def Setup(tc):

    tc.desc = '''
    Test        :   QoS Config teardown test
    Opcode      :   Config, Verify
    FC TYPE     :   1 (1=Link Level; 2=PFC)
    '''

    tc.nodes = api.GetNaplesHostnames()
    tc.os = api.GetNodeOs(tc.nodes[0])

    pairs = api.GetRemoteWorkloadPairs()
    # get workloads from each node
    tc.w = []
    tc.w.append(pairs[0][0])
    tc.w.append(pairs[0][1])

    tc.cmd_cookies = []

    tc.enable = 0
    tc.no_drop = 0
    # hardcode mtu to 1500 while deleting the user class as 0 is not allowed
    tc.mtu = 1500
    tc.wt = 0
    tc.pcp = 0
    tc.pfc_cos = 0

    tc.wt_configured = False
    tc.pcp_configured = False
    tc.pfc_cos_configured = False

    return api.types.status.SUCCESS
Esempio n. 26
0
def Setup(tc):
    api.Logger.info ("Driver compat test")
    if api.IsDryrun(): return api.types.status.SUCCESS

    tc.nodes = api.GetNaplesHostnames()
    tc.os = api.GetNodeOs(tc.nodes[0])

    tc.skip = False
    tc.driver_changed = False
    if tc.os == compat.OS_TYPE_BSD: # Not supportig BSD right now
        tc.skip = True
        return api.types.status.SUCCESS

    # Intention to test locally built FW with target-version driver
    tc.target_version = getattr(tc.iterators, 'release', 'latest')

    if compat.LoadDriver(tc.nodes, node_os, tc.target_version):
        tc.driver_changed = True

    if getattr(tc.args, 'type', 'local_only') == 'local_only': 
        tc.workload_pairs = api.GetLocalWorkloadPairs()
    else: 
        tc.workload_pairs = api.GetRemoteWorkloadPairs() 

    if len(tc.workload_pairs) == 0: 
        api.Logger.info("Skipping ping part of testcase due to no workload pairs.") 
        tc.skip = True

    return api.types.status.SUCCESS
Esempio n. 27
0
def Setup(tc):
    host = None
    for _node in api.GetNaplesHostnames():
        if api.IsNaplesNode(_node) and api.GetNodeOs(_node) == "linux":
            host = _node
            break

    if not host:
        api.Logger.error("Unable to find a Naples node with linux os")
        return api.types.status.ERROR

    tc.host = host
    tc.pf = api.GetNaplesHostInterfaces(host)[0]
    tc.num_vfs = GetSupportedVFs(tc.host, tc.pf)
    api.Logger.info("Host %s PF %s supports %d VFs" %
                    (tc.host, tc.pf, tc.num_vfs))

    if tc.num_vfs == 0:
        api.Logger.warn(
            "Max supported VFs on host %s is 0, expected non-zero" % host)
        return api.types.status.ERROR

    if CreateVFs(tc.host, tc.pf, tc.num_vfs) != api.types.status.SUCCESS:
        return api.types.status.ERROR

    return api.types.status.SUCCESS
Esempio n. 28
0
def checkDrv(node):
    os = api.GetNodeOs(node)
    hostCmd = ""
    if os == host.OS_TYPE_BSD:
        hostCmd = "pciconf -l | grep 0x10021dd8 | cut -d '@' -f 1 | grep ion"
    elif os == host.OS_TYPE_LINUX:
        hostCmd = "lspci  -kd 1dd8:1002 | grep ionic"
    elif os == host.OS_TYPE_WINDOWS:
        hostCmd = api.WINDOWS_POWERSHELL_CMD + ' Get-NetAdapter -InterfaceDescription *DSC*'
    else:
        api.Logger.error("Not supported on %s" % os)
        return api.types.status.FAILURE

    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)
    api.Trigger_AddHostCommand(req, node, hostCmd)
    resp = api.Trigger(req)
    if resp is None:
        api.Logger.error("Failed to run host cmd: %s on host: %s" %
                         (hostCmd, node))
        return api.types.status.FAILURE

    cmd = resp.commands[0]
    if cmd.exit_code != 0:
        api.Logger.error(
            "HOST CMD: %s failed on host: %s,"
            " exit code: %d  stdout: %s stderr: %s" %
            (hostCmd, node, cmd.exit_code, cmd.stdout, cmd.stderr))
        api.PrintCommandResults(cmd)
        return api.types.status.FAILURE

    api.Logger.info("PCI scan output:")
    api.Logger.info(f"    {cmd.stdout}")
    return api.types.status.SUCCESS
Esempio n. 29
0
def Setup(tc):

    tc.desc = '''
    Test        :   QoS Set classification type
    Opcode      :   Config, Verify
    '''

    tc.nodes = api.GetNaplesHostnames()
    tc.os = api.GetNodeOs(tc.nodes[0])

    pairs = api.GetRemoteWorkloadPairs()
    # get workloads from each node
    tc.w = []
    tc.w.append(pairs[0][0])
    tc.w.append(pairs[0][1])

    class_type = getattr(tc.args, 'class_type', None)

    if class_type == None:
        api.Logger.error("Mandatory argument class_type not passed")
        return api.types.status.FAILURE

    if int(class_type) != 1 and int(class_type) != 2:
        api.Logger.error(
            "Invalid argument class_type {} passed. Supported values are 1 (PCP) and 2 (DSCP)"
            .format(class_type))
        return api.types.status.FAILURE

    tc.class_type = class_type

    return api.types.status.SUCCESS
Esempio n. 30
0
def Trigger(tc):
    names = api.GetNaplesHostnames()
    name = names[0]
    if api.GetNodeOs(name) != "linux":
        return api.types.status.SUCCESS

    # Set up to run the macvlan offload test shellscript
    req = api.Trigger_CreateExecuteCommandsRequest(serial=True)

    # Get the workload interface information
    pairs = api.GetRemoteWorkloadPairs()
    pair = pairs[0]
    w1 = pair[0]
    w2 = pair[1]

    tc.cmd_descr = "Server: %s %s --> %s" % (w1.interface, w1.ip_address,
                                             w2.ip_address)
    api.Logger.info("Starting macvlan offload test from %s" % (tc.cmd_descr))

    basecmd = './%s %s %s %s' % (macvlan_test_script, w1.interface,
                                 w1.ip_address, w2.ip_address)
    api.Trigger_AddHostCommand(req, w1.node_name, basecmd, background=False)

    # Send the commands
    tc.resp = api.Trigger(req)

    return api.types.status.SUCCESS