Example #1
0
    def restore_interfaces_linux(self):
        """
        Restore Linux interfaces.
        """
        for port in self.ports_info:
            pci_bus = port['pci']
            pci_id = port['type']
            # get device driver
            driver = dts.get_nic_driver(pci_id)
            if driver is not None and self.isMellanox == False:
                # unbind device driver
                addr_array = pci_bus.split(':')
                bus_id = addr_array[0]
                devfun_id = addr_array[1]

                self.send_expect('echo 0000:%s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind'
                                 % (pci_bus, bus_id, devfun_id), '# ')
                #bind to linux kernel driver
                self.send_expect('modprobe %s' % driver, '# ')
                self.send_expect('echo 0000:%s > /sys/bus/pci/drivers/%s/bind'
                                 % (pci_bus, driver), '# ')
                itf = self.get_interface_name(addr_array[0], addr_array[1])
                self.send_expect("ifconfig %s up" % itf, "# ")
            else:
                self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" % (pci_bus, pci_id))
Example #2
0
    def restore_interfaces_linux(self):
        """
        Restore Linux interfaces.
        """
        for port in self.ports_info:
            pci_bus = port['pci']
            pci_id = port['type']
            # get device driver
            driver = dts.get_nic_driver(pci_id)
            if driver is not None:
                # unbind device driver
                addr_array = pci_bus.split(':')
                bus_id = addr_array[0]
                devfun_id = addr_array[1]
                #print addr_array
                #self.send_expect('echo 0000:%s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind'
                #                 % (pci_bus, bus_id, devfun_id), '# ')
                # bind to linux kernel driver
                #self.send_expect('modprobe %s' % driver, '# ')
                #self.send_expect('echo 0000:%s > /sys/bus/pci/drivers/%s/bind'
                #                 % (pci_bus, driver), '# ')

                itf = self.get_interface_name(addr_array[0], addr_array[1])
                self.send_expect("ifconfig %s up" % itf, "# ")
            else:
                self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" %
                                 (pci_bus, pci_id))
Example #3
0
    def wirespeed(self, nic, frame_size, num_ports):
        """
        Calculate bit rate. It is depended for NICs
        """
        bitrate = 1000.0  # 1Gb ('.0' forces to operate as float)
        if self.nic == "any" or self.nic == "cfg":
            driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
            nic = self.get_nic_name(self.dut.ports_info[0]['type'])
        else:
            driver = self.get_nic_driver(self.nic)
            nic = self.nic

        if driver == "ixgbe":
            bitrate *= 10  # 10 Gb NICs
        elif nic == "avoton2c5":
            bitrate *= 2.5  # 2.5 Gb NICs
        elif nic in ["fortville_spirit", "fortville_spirit_single"]:
            bitrate *= 40
        elif nic == 'fortville_eagle':
            bitrate *= 10

        return bitrate * num_ports / 8 / (frame_size + 20)
Example #4
0
    def wirespeed(self, nic, frame_size, num_ports):
        """
        Calculate bit rate. It is depended for NICs
        """
        bitrate = 1000.0  # 1Gb ('.0' forces to operate as float)
        if self.nic == "any" or self.nic == "cfg":
            driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
            nic = self.get_nic_name(self.dut.ports_info[0]['type'])
        else:
            driver = self.get_nic_driver(self.nic)
            nic = self.nic

        if driver == "ixgbe":
            bitrate *= 10  # 10 Gb NICs
        elif nic == "avoton2c5":
            bitrate *= 2.5  # 2.5 Gb NICs
        elif nic in ["fortville_spirit", "fortville_spirit_single"]:
            bitrate *= 40
        elif nic == 'fortville_eagle':
            bitrate *= 10

        return bitrate * num_ports / 8 / (frame_size + 20)