def scan_ports_uncached(self): """ Return tester port pci/mac/interface information. """ self.ports_info = [] for (pci_bus, pci_id) in self.pci_devices_info: # ignore unknown card types if pci_id not in NICS.values(): self.logger.info("Tester: [000:%s %s] %s" % (pci_bus, pci_id, "unknow_nic")) continue addr_array = pci_bus.split(':') bus_id = addr_array[0] devfun_id = addr_array[1] intf = self.get_interface_name(bus_id, devfun_id) if "No such file" in intf: self.logger.info("Tester: [000:%s %s] %s" % (pci_bus, pci_id, "unknow_interface")) continue self.logger.info("Tester: [000:%s %s] %s" % (pci_bus, pci_id, intf)) macaddr = self.get_mac_addr(intf, bus_id, devfun_id) # store the port info to port mapping self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'intf': intf, 'mac': macaddr})
def scan_ports_uncached(self): """ Return tester port pci/mac/interface information. """ self.ports_info = [] for (pci_bus, pci_id) in self.pci_devices_info: # ignore unknown card types if pci_id not in NICS.values(): self.logger.info("Tester: [%s %s] %s" % (pci_bus, pci_id, "unknow_nic")) continue addr_array = pci_bus.split(':') domain_id = addr_array[0] bus_id = addr_array[1] devfun_id = addr_array[2] port = GetNicObj(self, domain_id, bus_id, devfun_id) intf = port.get_interface_name() if "No such file" in intf: self.logger.info("Tester: [%s %s] %s" % (pci_bus, pci_id, "unknow_interface")) continue self.logger.info("Tester: [%s %s] %s" % (pci_bus, pci_id, intf)) macaddr = port.get_mac_addr() ipv6 = port.get_ipv6_addr() ipv4 = port.get_ipv4_addr() # store the port info to port mapping self.ports_info.append({'port': port, 'pci': pci_bus, 'type': pci_id, 'intf': intf, 'mac': macaddr, 'ipv4': ipv4, 'ipv6': ipv6}) # return if port is not connect x3 if not port.get_interface2_name(): continue intf = port.get_interface2_name() self.logger.info("Tester: [%s %s] %s" % (pci_bus, pci_id, intf)) macaddr = port.get_intf2_mac_addr() ipv6 = port.get_ipv6_addr() # store the port info to port mapping self.ports_info.append({'port': port, 'pci': pci_bus, 'type': pci_id, 'intf': intf, 'mac': macaddr, 'ipv6': ipv6})
def get_nic_driver(pci_id): """ Return linux driver for specified pci device """ driverlist = dict(zip(NICS.values(), DRIVERS.keys())) try: driver = DRIVERS[driverlist[pci_id]] except Exception as e: driver = None return driver
def accepted_nic(pci_id): """ Return True if the pci_id is a known NIC card in the settings file and if it is selected in the execution file, otherwise it returns False. """ if pci_id not in NICS.values(): return False if nic is 'any': return True else: if pci_id == NICS[nic]: return True return False
def check_ports_available(self, pci_bus, pci_id): """ Check that whether auto scanned ports ready to use """ pci_addr = "%s:%s" % (pci_bus, pci_id) if self.nic == 'any': return True elif self.nic == 'cfg': if self.conf.check_port_available(pci_bus) is True: return True elif self.nic not in NICS.keys(): self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % self.nic) else: codename = NICS[self.nic] if pci_id == codename: return True return False
def config_execution(): global driver_name global suites global target global nic_type print('============================================================') print "Setting execution plan" if not dut_ip: print RED("Need to configure 'DUT&Tester crb' first!!!") return False # default execution driver_name = 'igb_uio' target = 'x86_64-native-linuxapp-gcc' targets = [ 'x86_64-native-linuxapp-gcc', 'x86_64-native-linuxapp-icc', 'i686-native-linuxapp-gcc', 'i686-native-linuxapp-icc', 'x86_64-native-bsdapp-gcc', 'x86_64-native-bsdapp-clang', 'arm64-armv8a-linuxapp-gcc', 'arm64-dpaa2-linuxapp-gcc', 'arm64-thunderx-linuxapp-gcc', 'arm64-xgene1-linuxapp-gcc' ] nic_type = 'cfg' exec_option = { 'prompt': 'Choose default or manually', 'type': 'choice', 'help': 'Gernerate execution file base on default or ' + 'manually configured', 'options': ['default execution file', 'manually configure execution file'], 'default': '0' } opt = Option(**exec_option) opt.parse_input() index = opt.choice if index == 0: autoexec_option = { 'prompt': 'Choose one of them', 'type': 'choice', 'help': 'Choose one of below reference ' + 'configuration file', 'options': executions, 'default': '3' } opt = Option(**autoexec_option) auto_execution = opt.parse_input() load_execution('executions/' + auto_execution) else: suites_option = { 'prompt': 'Choose suites to run', 'type': 'multichoice', 'help': 'Suites in DTS', 'options': suites, 'default': 'all' } opt = Option(**suites_option) suites = opt.parse_input() nics = ['cfg'] nics += NICS.keys() nic_option = { 'prompt': 'Choose one of nics', 'type': 'choice', 'help': 'Choose one of dpdk support NIC', 'options': nics, 'default': '0' } opt = Option(**nic_option) nic_type = opt.parse_input() target_option = { 'prompt': 'Choose target for execution', 'type': 'choice', 'help': 'Choose one of dpdk targets', 'options': targets, 'default': '0' } opt = Option(**target_option) target = opt.parse_input() driver_option = { 'prompt': 'Choose one of them', 'type': 'choice', 'help': 'Choose one of dpdk support driver', 'options': ['igb_uio', 'vfio-pci'], 'default': '0' } opt = Option(**driver_option) driver_name = opt.parse_input() return True
def get_nic_name(self, pci_id): for nic_name, pci in NICS.items(): if pci_id == pci: return nic_name raise ValueError(nic_name)