def verify_client_run(self, exp_iface, env): """Verify the interface assigned by running a libdaos client. Args: exp_iface (str): expected interface to check. env (bool): add OFI_INTERFACE variable to exported variables of client command. Returns: bool: returns status """ clients = self.agent_managers[0].hosts # Get counter values for hfi devices before and after port_info_before = self.get_port_cnt(clients, "port_rcv_data") # get the dmg config file for daos_racer dmg = self.get_dmg_command() # Let's run daos_racer as a client daos_racer = DaosRacerCommand(self.bin, clients[0], dmg) daos_racer.get_params(self) # Update env_name list to add OFI_INTERFACE if needed. if env: daos_racer.update_env_names(["OFI_INTERFACE"]) # Setup the environment and logfile log_file = "daos_racer_{}_{}.log".format(exp_iface, env) # Add FI_LOG_LEVEL to get more info on device issues racer_env = daos_racer.get_environment(self.server_managers[0], log_file) racer_env["FI_LOG_LEVEL"] = "info" racer_env["D_LOG_MASK"] = "INFO,object=ERR,placement=ERR" daos_racer.set_environment(racer_env) # Run client daos_racer.run() # Verify output and port count to check what iface CaRT init with. port_info_after = self.get_port_cnt(clients, "port_rcv_data") self.log.info("Client interface port_rcv_data counters") msg_format = "%16s %9s %9s %9s %s" self.log.info(msg_format, "Host(s)", "Interface", "Before", "After", "Difference") self.log.info(msg_format, "-" * 16, "-" * 9, "-" * 9, "-" * 9, "-" * 9) no_traffic = set() for interface in sorted(port_info_before): for host in sorted(port_info_before[interface]): before = port_info_before[interface][host][1]["port_rcv_data"] try: after = port_info_after[interface][host][1]["port_rcv_data"] diff = int(after) - int(before) if diff <= 0: no_traffic.add(interface) except (KeyError, ValueError) as error: after = "Error" diff = "Unknown - {}".format(error) no_traffic.add(interface) self.log.info(msg_format, host, interface, before, after, diff) # Read daos.log to verify device used and prevent false positives self.assertTrue(self.get_log_info(clients, exp_iface, env, get_log_file(log_file))) # If we don't see data going through the device, fail for interface in no_traffic: self.log.info("No client traffic seen through device: %s", interface) return len(no_traffic) != len(self.interfaces)
def verify_client_run(self, exp_iface, env): """Verify the interface assigned by running a libdaos client. Args: exp_iface (str): expected interface to check. env (bool): add OFI_INTERFACE variable to exported variables of client command. Returns: bool: returns status """ hfi_map = {"ib0": "hfi1_0", "ib1": "hfi1_1"} # Get counter values for hfi devices before and after cnt_before = self.get_port_cnt(self.hostlist_clients, hfi_map[exp_iface], "port_rcv_data") # get the dmg config file for daos_racer dmg = self.get_dmg_command() # Let's run daos_racer as a client daos_racer = DaosRacerCommand(self.bin, self.hostlist_clients[0], dmg) daos_racer.get_params(self) # Update env_name list to add OFI_INTERFACE if needed. if env: daos_racer.update_env_names(["OFI_INTERFACE"]) # Setup the environment and logfile logf = "daos_racer_{}_{}.log".format(exp_iface, env) # Add FI_LOG_LEVEL to get more info on device issues racer_env = daos_racer.get_environment(self.server_managers[0], logf) racer_env["FI_LOG_LEVEL"] = "info" daos_racer.set_environment(racer_env) # Run client daos_racer.run() # Verify output and port count to check what iface CaRT init with. cnt_after = self.get_port_cnt(self.hostlist_clients, hfi_map[exp_iface], "port_rcv_data") diff = 0 for cnt_b, cnt_a in zip(cnt_before.values(), cnt_after.values()): diff = int(cnt_a) - int(cnt_b) self.log.info("Port [%s] count difference: %s", exp_iface, diff) # Read daos.log to verify device used and prevent false positives self.assertTrue( self.get_log_info(self.hostlist_clients, exp_iface, env, get_log_file(logf))) # If we don't see data going through the device, fail status = True if diff <= 0: self.log.info("No traffic seen through device: %s", exp_iface) status = False else: status = True return status