def setUp(self): """ Set up. """ self.iface = self.params.get("interface", default="") self.count = self.params.get("count", default="500") self.nping_count = self.params.get("nping_count", default="") self.peer_ip = self.params.get("peer_ip", default="") self.drop = self.params.get("drop_accepted", default="10") self.host_ip = self.params.get("host_ip", default="") self.option = self.params.get("option", default='') # Check if interface exists in the system interfaces = netifaces.interfaces() if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) if not self.peer_ip: self.cancel("peer ip should specify in input") self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) if not wait.wait_for(configure_network.is_interface_link_up, timeout=120, args=[self.iface]): self.cancel( "Link up of interface is taking longer than 120 seconds") self.peer_user = self.params.get("peer_user", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) if not self.peerinfo.set_mtu_peer(self.peer_interface, self.mtu): self.cancel("Failed to set mtu in peer") if not configure_network.set_mtu_host(self.iface, self.mtu): self.cancel("Failed to set mtu in host") # Install needed packages smm = SoftwareManager() detected_distro = distro.detect() pkgs = ['tcpdump', 'flex', 'bison', 'gcc', 'gcc-c++', 'nmap'] for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package Can not install" % pkg) if detected_distro.name == "SuSE": self.nmap = os.path.join(self.teststmpdir, 'nmap') nmap_download = self.params.get("nmap_download", default="https:" "//nmap.org/dist/" "nmap-7.80.tar.bz2") tarball = self.fetch_asset(nmap_download) self.version = os.path.basename(tarball.split('.tar')[0]) self.n_map = os.path.join(self.nmap, self.version) archive.extract(tarball, self.nmap) os.chdir(self.n_map) process.system('./configure ppc64le', shell=True) build.make(self.n_map) process.system('./nping/nping -h', shell=True)
def setUp(self): self.host_interface = self.params.get("interface", default=None) if not self.host_interface: self.cancel("User should specify host interface") interfaces = netifaces.interfaces() if self.host_interface not in interfaces: self.cancel("Interface is not available") self.peer_ip = self.params.get("peer_ip", default=None) if not self.peer_ip: self.cancel("User should specify peer IP") self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.host_interface) cmd = "ip addr show %s | sed -nr 's/.*inet ([^ ]+)."\ "*/\\1/p'" % self.host_interface self.cidr = process.system_output('%s' % cmd, shell=True).decode("utf-8") cmd = "route -n | grep %s | grep -w UG | awk "\ "'{ print $2 }'" % self.host_interface self.gateway = process.system_output('%s' % cmd, shell=True).decode("utf-8") cmd = "ip addr show %s | grep inet | grep brd | "\ "awk '{ print $4 }'" % self.host_interface self.broadcast = process.system_output('%s' % cmd, shell=True).decode("utf-8")
def ip_config(self): """ configuring ip for host and peer interfaces """ for (host_intf, net_id) in zip(self.host_intfs, self.net_ids): ip_addr = "%s.1.1.%s" % (net_id, self.host_ip.split('.')[-1]) configure_network.set_ip(ip_addr, self.netmask, host_intf) for (peer_intf, net_id) in zip(self.peer_intfs, self.net_ids): ip_addr = "%s.1.1.%s" % (net_id, self.peer_ip.split('.')[-1]) cmd = "ip addr add dev %s %s/%s" % (peer_intf, ip_addr, self.netmask) self.run_command(cmd) cmd = "ip link set dev %s up" % peer_intf self.run_command(cmd)
def setUp(self): ''' To check and install dependencies for the test ''' smm = SoftwareManager() pkgs = ["ethtool", "net-tools"] detected_distro = distro.detect() if detected_distro.name == "Ubuntu": pkgs.extend(["iputils-ping"]) elif detected_distro.name == "SuSE": pkgs.extend(["iputils"]) else: pkgs.extend(["iputils"]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) interfaces = netifaces.interfaces() interface = self.params.get("interface") if interface not in interfaces: self.cancel("%s interface is not available" % interface) self.iface = interface self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") self.peer = self.params.get("peer_ip") if not self.peer: self.cancel("No peer provided") if self.iface[0:2] == 'ib': configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Infiniband') else: configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Ethernet') if not HostInfo.ping_check(self, self.iface, self.peer, "5"): self.cancel("No connection to peer") self.args = self.params.get("arg", default='') self.elapse = self.params.get("action_elapse", default='') self.priv_test = self.params.get("privflag_test", default=False) if self.priv_test: cmd = "ethtool --show-priv-flags %s" % (self.iface) self.ret_val = process.run(cmd, shell=True, verbose=True, ignore_status=True) if self.ret_val.exit_status: self.cancel("Device Doesn't support Private flags")
def setUp(self): """ Set up """ if 'ppc64' not in process.system_output('uname -a', ignore_status=True, shell=True, sudo=True).decode("utf-8"): self.cancel("Platform does not support HTX tests") self.parameters() for ipaddr, interface in zip(self.ipaddr, self.host_intfs): configure_network.set_ip(ipaddr, self.netmask, interface) self.host_distro = distro.detect() self.login(self.peer_ip, self.peer_user, self.peer_password) self.get_ips() self.get_peer_distro()
def setUp(self): ''' To check and install dependencies for the test ''' self.peer = self.params.get("peer_ip", default="") self.user = self.params.get("user_name", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) self.session = Session(self.peer, user=self.user, password=self.peer_password) self.count = self.params.get("count", default="500000") smm = SoftwareManager() pkgs = ["net-tools"] detected_distro = distro.detect() if detected_distro.name == "Ubuntu": pkgs.extend(["openssh-client", "iputils-ping"]) elif detected_distro.name == "SuSE": pkgs.extend(["openssh", "iputils"]) else: pkgs.extend(["openssh-clients", "iputils"]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) if self.peer == "": self.cancel("peer ip should specify in input") cmd = "ip addr show | grep %s" % self.peer output = self.session.cmd(cmd) result = "" result = result.join(output.stdout.decode("utf-8")) self.peerif = result.split()[-1] if self.peerif == "": self.cancel("unable to get peer interface") cmd = "ip -f inet -o addr show %s | awk '{print $4}' | cut -d / -f1"\ % self.iface self.local_ip = process.system_output(cmd, shell=True).strip() if self.local_ip == "": self.cancel("unable to get local ip")
def setUp(self): ''' To check and install dependencies for the test ''' smm = SoftwareManager() pkgs = ["ethtool", "net-tools"] detected_distro = distro.detect() if detected_distro.name == "Ubuntu": pkgs.extend(["openssh-client", "iputils-ping"]) elif detected_distro.name == "SuSE": pkgs.extend(["openssh", "iputils"]) else: pkgs.extend(["openssh-clients", "iputils"]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) interfaces = netifaces.interfaces() interface = self.params.get("interface") if interface not in interfaces: self.cancel("%s interface is not available" % interface) self.iface = interface self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) if not wait.wait_for(configure_network.is_interface_link_up, timeout=120, args=[self.iface]): self.fail("Link up of interface is taking longer than 120 seconds") self.peer = self.params.get("peer_ip") if not self.peer: self.cancel("No peer provided") self.mtu = self.params.get("mtu", default=1500) self.peer_user = self.params.get("peer_user", default="root") self.peer_password = self.params.get("peer_password", '*', default=None) self.peerinfo = PeerInfo(self.peer, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer) self.mtu = self.params.get("mtu", default=1500) self.mtu_set() if not wait.wait_for(configure_network.is_interface_link_up, timeout=120, args=[self.iface]): self.fail("Link up of interface is taking longer than 120 seconds") if not configure_network.ping_check(self.iface, self.peer, "5"): self.cancel("No connection to peer")
def setUp(self): ''' To check and install dependencies for the test ''' sm = SoftwareManager() for pkg in ["ethtool", "net-tools"]: if not sm.check_installed(pkg) and not sm.install(pkg): self.cancel("%s package is need to test" % pkg) interfaces = netifaces.interfaces() self.iface = self.params.get("interface") if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) cmd = "basename /sys/class/net/%s/device/driver/module/drivers/*" % self.iface self.iface_type, self.driver = process.system_output( cmd, shell=True).decode("utf-8").split(':') self.businfo = self.get_bus_info(self.iface, self.iface_type)
def setUp(self): ''' To check and install dependencies for the test ''' self.host_interfaces = self.params.get("host_interfaces", default="").split(",") if not self.host_interfaces: self.cancel("user should specify host interfaces") smm = SoftwareManager() if distro.detect().name == 'Ubuntu': pkg = 'iputils-ping' else: pkg = 'iputils' if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("Package %s is needed to test" % pkg) self.peer_ips = self.params.get("peer_ips", default="").split(",") interfaces = netifaces.interfaces() for self.host_interface in self.host_interfaces: if self.host_interface not in interfaces: self.cancel("interface is not available") self.count = self.params.get("count", default="1000") self.ipaddr = self.params.get("host_ips", default="").split(",") self.netmask = self.params.get("netmask", default="") for ipaddr, interface in zip(self.ipaddr, self.host_interfaces): configure_network.set_ip(ipaddr, self.netmask, interface) self.peer_user = self.params.get("peer_user", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ips[0], peer_user=self.peer_user, peer_password=self.peer_password) for peer_ip in self.peer_ips: self.peer_interface = self.peerinfo.get_peer_interface(peer_ip) if not self.peerinfo.set_mtu_peer(self.peer_interface, self.mtu): self.cancel("Failed to set mtu in peer") for host_interface in self.host_interfaces: if not configure_network.set_mtu_host(host_interface, self.mtu): self.cancel("Failed to set mtu in host")
def setUp(self): """ Identify the network virtualized device. """ smm = SoftwareManager() for pkg in ["net-tools"]: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) interfaces = netifaces.interfaces() self.interface = self.params.get('interface') if self.interface not in interfaces: self.cancel("%s interface is not available" % self.interface) self.device = process.system_output( "ls -l /sys/class/net/ | \ grep %s | cut -d '/' -f \ 5" % self.interface, shell=True).decode("utf-8").strip() self.count = int(self.params.get('count', default="1")) self.peer_ip = self.params.get('peer_ip', default=None) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.interface)
def setUp(self): """ get parameters """ self.module = self.params.get('module', default=None) interfaces = netifaces.interfaces() self.ifaces = self.params.get("interface") if self.ifaces not in interfaces: self.cancel("%s interface is not available" % self.ifaces) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") self.peer = self.params.get("peer_ip") if not self.peer: self.cancel("No peer provided") self.param_name = self.params.get('module_param_name', default=None) self.param_value = self.params.get('module_param_value', default=None) self.sysfs_chk = self.params.get('sysfs_check_required', default=None) if self.ifaces[0:2] == 'ib': configure_network.set_ip(self.ipaddr, self.netmask, self.ifaces, interface_type='Infiniband') else: configure_network.set_ip(self.ipaddr, self.netmask, self.ifaces, interface_type='Ethernet') self.load_unload_sleep_time = 10 self.error_modules = [] self.mod_list = [] self.uname = linux_modules.platform.uname()[2] if self.built_in_module(self.module) is True: self.cancel("Module %s is Built-in Skipping " % self.module) if self.param_check() is False: self.cancel("Param %s is not Valid for Module %s" % (self.param_name, self.module))
def setUp(self): ''' To get all the parameter for the test ''' interfaces = netifaces.interfaces() interface = self.params.get("interface") if interface not in interfaces: self.cancel("%s interface is not available" % interface) self.iface = interface self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) self.peer = self.params.get("peer_ip") if not self.peer: self.cancel("No peer provided") if not HostInfo.ping_check(self, self.iface, self.peer, "2"): self.cancel("No connection to peer") self.switch_name = self.params.get("switch_name", '*', default="") self.userid = self.params.get("userid", '*', default="") self.password = self.params.get("password", '*', default="") self.port_id = self.params.get("port_id", default="") if not self.port_id: self.cancel("user should specify port id") self.switch_login(self.switch_name, self.userid, self.password)
def setUp(self): ''' check the availability of perftest package installed perftest package should be installed ''' smm = SoftwareManager() detected_distro = distro.detect() pkgs = ["perftest"] if detected_distro.name == "Ubuntu": pkgs.append('openssh-client') elif detected_distro.name == "SuSE": pkgs.append('openssh') else: pkgs.append('openssh-clients') for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") self.peer_ip = self.params.get("peer_ip", default="") self.peer_user = self.params.get("peer_user_name", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") if self.iface[0:2] == 'ib': configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Infiniband') else: configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Ethernet') self.session = Session(self.peer_ip, user=self.peer_user, password=self.peer_password) if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.ca_name = self.params.get("CA_NAME", default="mlx4_0") self.port = self.params.get("PORT_NUM", default="1") self.peer_ca = self.params.get("PEERCA", default="mlx4_0") self.peer_port = self.params.get("PEERPORT", default="1") self.tmo = self.params.get("TIMEOUT", default="600") self.tool_name = self.params.get("tool") if self.tool_name == "": self.cancel("should specify tool name") self.log.info("test with %s", self.tool_name) self.test_op = self.params.get("test_opt", default="") self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) if detected_distro.name == "Ubuntu": cmd = "service ufw stop" # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif detected_distro.name in ['rhel', 'fedora', 'redhat']: cmd = "systemctl stop firewalld" elif detected_distro.name == "SuSE": if detected_distro.version == 15: cmd = "systemctl stop firewalld" else: cmd = "rcSuSEfirewall2 stop" elif detected_distro.name == "centos": cmd = "service iptables stop" else: self.cancel("Distro not supported") if process.system(cmd, ignore_status=True, shell=True) != 0: self.cancel("Unable to disable firewall") output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel("Unable to disable firewall on peer")
def setUp(self): ''' To check and install dependencies for the test ''' detected_distro = distro.detect() smm = SoftwareManager() depends = [] # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon if detected_distro.name == "Ubuntu": depends.extend(["openssh-client", "iputils-ping"]) elif detected_distro.name in ["rhel", "fedora", "centos", "redhat"]: depends.extend(["openssh-clients", "iputils"]) else: depends.extend(["openssh", "iputils"]) for pkg in depends: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) self.mode = self.params.get("bonding_mode", default="") if 'setup' in str(self.name) or 'run' in str(self.name): if not self.mode: self.cancel("test skipped because mode not specified") interfaces = netifaces.interfaces() self.user = self.params.get("user_name", default="root") self.password = self.params.get("peer_password", '*', default="None") self.host_interfaces = self.params.get("bond_interfaces", default="").split(",") if not self.host_interfaces: self.cancel("user should specify host interfaces") self.peer_interfaces = self.params.get("peer_interfaces", default="").split(",") for self.host_interface in self.host_interfaces: if self.host_interface not in interfaces: self.cancel("interface is not available") self.peer_first_ipinterface = self.params.get("peer_ip", default="") if not self.peer_interfaces or self.peer_first_ipinterface == "": self.cancel("peer machine should available") self.ipaddr = self.params.get("host_ips", default="").split(",") self.netmask = self.params.get("netmask", default="") if 'setup' in str(self.name.name): for ipaddr, interface in zip(self.ipaddr, self.host_interfaces): configure_network.set_ip(ipaddr, self.netmask, interface) self.miimon = self.params.get("miimon", default="100") self.fail_over_mac = self.params.get("fail_over_mac", default="2") self.downdelay = self.params.get("downdelay", default="0") self.bond_name = self.params.get("bond_name", default="tempbond") self.net_path = "/sys/class/net/" self.bond_status = "/proc/net/bonding/%s" % self.bond_name self.bond_dir = os.path.join(self.net_path, self.bond_name) self.bonding_slave_file = "%s/bonding/slaves" % self.bond_dir self.bonding_masters_file = "%s/bonding_masters" % self.net_path self.peer_bond_needed = self.params.get("peer_bond_needed", default=False) self.peer_wait_time = self.params.get("peer_wait_time", default=5) self.sleep_time = int(self.params.get("sleep_time", default=5)) self.ib = False if self.host_interface[0:2] == 'ib': self.ib = True self.log.info("Bond Test on IB Interface? = %s", self.ib) self.session = Session(self.peer_first_ipinterface, user=self.user, password=self.password) self.setup_ip() self.err = []
def setUp(self): """ To check and install dependencies for the test """ self.peer_user = self.params.get("peer_user_name", default="root") self.peer_ip = self.params.get("peer_ip", default="") self.peer_password = self.params.get("peer_password", '*', default=None) interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) self.session = Session(self.peer_ip, user=self.peer_user, password=self.peer_password) smm = SoftwareManager() for pkg in ["gcc", "autoconf", "perl", "m4", "libtool"]: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) cmd = "%s install %s" % (smm.backend.base_command, pkg) output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel( "unable to install the package %s on peer machine " % pkg) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) if not self.peerinfo.set_mtu_peer(self.peer_interface, self.mtu): self.cancel("Failed to set mtu in peer") if not configure_network.set_mtu_host(self.iface, self.mtu): self.cancel("Failed to set mtu in host") self.iperf = os.path.join(self.teststmpdir, 'iperf') iperf_download = self.params.get("iperf_download", default="https:" "//excellmedia.dl.sourceforge.net/" "project/iperf2/iperf-2.0.13.tar.gz") tarball = self.fetch_asset(iperf_download, expire='7d') archive.extract(tarball, self.iperf) self.version = os.path.basename(tarball.split('.tar')[0]) self.iperf_dir = os.path.join(self.iperf, self.version) cmd = "scp -r %s %s@%s:/tmp" % (self.iperf_dir, self.peer_user, self.peer_ip) if process.system(cmd, shell=True, ignore_status=True) != 0: self.cancel("unable to copy the iperf into peer machine") cmd = "cd /tmp/%s;./configure ppc64le;make" % self.version output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel("Unable to compile Iperf into peer machine") self.iperf_run = str(self.params.get("IPERF_SERVER_RUN", default=0)) if self.iperf_run == '1': cmd = "/tmp/%s/src/iperf -s" % self.version cmd = self.session.get_raw_ssh_command(cmd) self.obj = SubProcess(cmd) self.obj.start() os.chdir(self.iperf_dir) process.system('./configure', shell=True) build.make(self.iperf_dir) self.iperf = os.path.join(self.iperf_dir, 'src') self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85")
def setUp(self): """ To check and install dependencies for the test """ self.peer_ip = self.params.get("peer_ip", default="") self.peer_user = self.params.get("peer_user_name", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) self.session = Session(self.peer_ip, user=self.peer_user, password=self.peer_password) smm = SoftwareManager() detected_distro = distro.detect() pkgs = ["gcc", "autoconf", "perl", "m4", "git-core", "automake"] if detected_distro.name == "Ubuntu": pkgs.extend(["libsctp1", "libsctp-dev", "lksctp-tools"]) else: pkgs.extend(["lksctp-tools", "lksctp-tools-devel"]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) cmd = "%s install %s" % (smm.backend.base_command, pkg) output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel( "unable to install the package %s on peer machine " % pkg) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) if not self.peerinfo.set_mtu_peer(self.peer_interface, self.mtu): self.cancel("Failed to set mtu in peer") if not configure_network.set_mtu_host(self.iface, self.mtu): self.cancel("Failed to set mtu in host") uperf_download = self.params.get("uperf_download", default="https:" "//github.com/uperf/uperf/" "archive/master.zip") tarball = self.fetch_asset("uperf.zip", locations=[uperf_download], expire='7d') archive.extract(tarball, self.teststmpdir) self.uperf_dir = os.path.join(self.teststmpdir, "uperf-master") cmd = "scp -r %s %s@%s:/tmp" % (self.uperf_dir, self.peer_user, self.peer_ip) if process.system(cmd, shell=True, ignore_status=True) != 0: self.cancel("unable to copy the uperf into peer machine") cmd = "cd /tmp/uperf-master;autoreconf -fi;./configure ppc64le;make" output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel("Unable to compile Uperf into peer machine") self.uperf_run = str(self.params.get("UPERF_SERVER_RUN", default=0)) if self.uperf_run == '1': cmd = "/tmp/uperf-master/src/uperf -s &" output = self.session.cmd(cmd) if not output.exit_status == 0: self.log.debug("Command %s failed %s", cmd, output) os.chdir(self.uperf_dir) process.system('autoreconf -fi', shell=True) process.system('./configure ppc64le', shell=True) build.make(self.uperf_dir) self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="85")
def setUp(self): """ To check and install dependencies for the test """ self.peer_user = self.params.get("peer_user_name", default="root") self.peer_ip = self.params.get("peer_ip", default="") self.peer_password = self.params.get("peer_password", '*', default="None") interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") configure_network.set_ip(self.ipaddr, self.netmask, self.iface) self.session = Session(self.peer_ip, user=self.peer_user, password=self.peer_password) smm = SoftwareManager() detected_distro = distro.detect() pkgs = ['gcc'] if detected_distro.name == "Ubuntu": pkgs.append('openssh-client') elif detected_distro.name == "SuSE": pkgs.append('openssh') else: pkgs.append('openssh-clients') for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) cmd = "%s install %s" % (smm.backend.base_command, pkg) output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel( "unable to install the package %s on peer machine " % pkg) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.timeout = self.params.get("TIMEOUT", default="600") self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) if not self.peerinfo.set_mtu_peer(self.peer_interface, self.mtu): self.cancel("Failed to set mtu in peer") if not configure_network.set_mtu_host(self.iface, self.mtu): self.cancel("Failed to set mtu in host") self.netperf_run = str(self.params.get("NETSERVER_RUN", default=0)) self.netperf = os.path.join(self.teststmpdir, 'netperf') netperf_download = self.params.get("netperf_download", default="https:" "//github.com/HewlettPackard/" "netperf/archive/netperf-2.7.0.zip") tarball = self.fetch_asset(netperf_download, expire='7d') archive.extract(tarball, self.netperf) self.version = "%s-%s" % ("netperf", os.path.basename(tarball.split('.zip')[0])) self.neperf = os.path.join(self.netperf, self.version) cmd = "scp -r %s %s@%s:/tmp/" % (self.neperf, self.peer_user, self.peer_ip) if process.system(cmd, shell=True, ignore_status=True) != 0: self.cancel("unable to copy the netperf into peer machine") cmd = "cd /tmp/%s;./configure ppc64le;make" % self.version output = self.session.cmd(cmd) if not output.exit_status == 0: self.fail("test failed because command failed in peer machine") os.chdir(self.neperf) process.system('./configure ppc64le', shell=True) build.make(self.neperf) self.perf = os.path.join(self.neperf, 'src', 'netperf') self.expected_tp = self.params.get("EXPECTED_THROUGHPUT", default="90") self.duration = self.params.get("duration", default="300") self.min = self.params.get("minimum_iterations", default="1") self.max = self.params.get("maximum_iterations", default="15") self.option = self.params.get("option", default='')
def setUp(self): ''' To check and install dependencies for the test ''' interfaces = netifaces.interfaces() self.flag = self.params.get("ext_flag", default="0") self.iface = self.params.get("interface", default="") self.peer_ip = self.params.get("peer_ip", default="") self.peer_user = self.params.get("peer_user_name", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") if self.iface[0:2] == 'ib': configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Infiniband') else: configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Ethernet') self.session = Session(self.peer_ip, user=self.peer_user, password=self.peer_password) if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.ca_name = self.params.get("CA_NAME", default="mlx4_0") self.gid = int(self.params.get("GID_NUM", default="0")) self.port = int(self.params.get("PORT_NUM", default="1")) self.peer_ca = self.params.get("PEERCA", default="mlx4_0") self.peer_gid = int(self.params.get("PEERGID", default="0")) self.peer_port = int(self.params.get("PEERPORT", default="1")) self.tmo = self.params.get("TIMEOUT", default="120") self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) smm = SoftwareManager() detected_distro = distro.detect() pkgs = [] if detected_distro.name == "Ubuntu": pkgs.extend(["ibverbs-utils", 'openssh-client']) cmd = "service ufw stop" # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif detected_distro.name in ['rhel', 'fedora', 'redhat']: pkgs.extend(["libibverbs", 'openssh-clients']) cmd = "systemctl stop firewalld" elif detected_distro.name == "SuSE": pkgs.append('openssh') if detected_distro.version == 15: cmd = "systemctl stop firewalld" else: cmd = "rcSuSEfirewall2 stop" elif detected_distro.name == "centos": pkgs.extend(['libibverbs', 'openssh-clients']) cmd = "service iptables stop" else: self.cancel("Distro not supported") if process.system(cmd, ignore_status=True, shell=True) != 0: self.cancel("Unable to disable firewall") output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel("Unable to disable firewall on peer") for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("%s package is need to test" % pkg) if process.system("ibstat", shell=True, ignore_status=True) != 0: self.cancel("infiniband adaptors not available") self.tool_name = self.params.get("tool") self.log.info("test with %s", self.tool_name) self.peer_iface = '' cmd = "ip addr show" output = self.session.cmd(cmd) for line in output.stdout.decode("utf-8").splitlines(): if self.peer_ip in line: self.peer_iface = line.split()[-1] break
def setUp(self): """ Setup and install dependencies for the test. """ self.test_name = "udaddy" self.basic = self.params.get("basic_option", default="None") self.ext = self.params.get("ext_option", default="None") self.flag = self.params.get("ext_flag", default="0") if self.basic == "None" and self.ext == "None": self.cancel("No option given") if self.flag == "1" and self.ext != "None": self.option = self.ext else: self.option = self.basic if process.system("ibstat", shell=True, ignore_status=True) != 0: self.cancel("MOFED is not installed. Skipping") detected_distro = distro.detect() pkgs = [] smm = SoftwareManager() if detected_distro.name == "Ubuntu": pkgs.extend(["openssh-client", "iputils-ping"]) elif detected_distro.name == "SuSE": pkgs.extend(["openssh", "iputils"]) else: pkgs.extend(["openssh-clients", "iputils"]) for pkg in pkgs: if not smm.check_installed(pkg) and not smm.install(pkg): self.cancel("Not able to install %s" % pkg) interfaces = netifaces.interfaces() self.iface = self.params.get("interface", default="") self.peer_ip = self.params.get("peer_ip", default="") self.peer_user = self.params.get("peer_user_name", default="root") self.peer_password = self.params.get("peer_password", '*', default="None") self.ipaddr = self.params.get("host_ip", default="") self.netmask = self.params.get("netmask", default="") if self.iface[0:2] == 'ib': configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Infiniband') else: configure_network.set_ip(self.ipaddr, self.netmask, self.iface, interface_type='Ethernet') self.session = Session(self.peer_ip, user=self.peer_user, password=self.peer_password) if self.iface not in interfaces: self.cancel("%s interface is not available" % self.iface) if self.peer_ip == "": self.cancel("%s peer machine is not available" % self.peer_ip) self.timeout = "2m" self.local_ip = netifaces.ifaddresses(self.iface)[AF_INET][0]['addr'] self.mtu = self.params.get("mtu", default=1500) self.peerinfo = PeerInfo(self.peer_ip, peer_user=self.peer_user, peer_password=self.peer_password) self.peer_interface = self.peerinfo.get_peer_interface(self.peer_ip) if detected_distro.name == "Ubuntu": cmd = "service ufw stop" # FIXME: "redhat" as the distro name for RHEL is deprecated # on Avocado versions >= 50.0. This is a temporary compatibility # enabler for older runners, but should be removed soon elif detected_distro.name in ['rhel', 'fedora', 'redhat']: cmd = "systemctl stop firewalld" elif detected_distro.name == "SuSE": if detected_distro.version == 15: cmd = "systemctl stop firewalld" else: cmd = "rcSuSEfirewall2 stop" elif detected_distro.name == "centos": cmd = "service iptables stop" else: self.cancel("Distro not supported") if process.system(cmd, ignore_status=True, shell=True) != 0: self.cancel("Unable to disable firewall") output = self.session.cmd(cmd) if not output.exit_status == 0: self.cancel("Unable to disable firewall on peer")