1*49cdfc7eSAndroid Build Coastguard Worker# LTP Network Tests 2*49cdfc7eSAndroid Build Coastguard Worker 3*49cdfc7eSAndroid Build Coastguard Worker## Single Host Configuration 4*49cdfc7eSAndroid Build Coastguard Worker 5*49cdfc7eSAndroid Build Coastguard WorkerIt's the default configuration (if the `RHOST` environment variable is not 6*49cdfc7eSAndroid Build Coastguard Workerdefined). LTP adds `ltp_ns` network namespace and auto-configure `veth` pair 7*49cdfc7eSAndroid Build Coastguard Workeraccording to LTP network environment variables. 8*49cdfc7eSAndroid Build Coastguard Worker 9*49cdfc7eSAndroid Build Coastguard Worker## Two Host Configuration 10*49cdfc7eSAndroid Build Coastguard Worker 11*49cdfc7eSAndroid Build Coastguard WorkerThis setup requires the `RHOST` environment variable to be set properly and 12*49cdfc7eSAndroid Build Coastguard Workerconfigured SSH access to a remote host. 13*49cdfc7eSAndroid Build Coastguard Worker 14*49cdfc7eSAndroid Build Coastguard WorkerThe `RHOST` variable must be set to the hostname of the server (test management 15*49cdfc7eSAndroid Build Coastguard Workerlink) and public key setup or login without password is required. 16*49cdfc7eSAndroid Build Coastguard Worker 17*49cdfc7eSAndroid Build Coastguard WorkerSSH server needs to be configured to allow root login and use Public Key 18*49cdfc7eSAndroid Build Coastguard WorkerAuthentication (`PermitRootLogin yes` and `PubkeyAuthentication yes` in 19*49cdfc7eSAndroid Build Coastguard Worker`/etc/ssh/sshd_config`). 20*49cdfc7eSAndroid Build Coastguard Worker 21*49cdfc7eSAndroid Build Coastguard WorkerSome of the network stress tests which hasn't been ported to network API were 22*49cdfc7eSAndroid Build Coastguard Workerdesigned to be tested with `rsh` via `LTP_RSH` environment variable. Now it's 23*49cdfc7eSAndroid Build Coastguard Workerby default used `ssh`, for details see `testcases/network/stress/README`. 24*49cdfc7eSAndroid Build Coastguard Worker 25*49cdfc7eSAndroid Build Coastguard Worker## Server Services Configuration 26*49cdfc7eSAndroid Build Coastguard WorkerTests have various external dependencies, exit with `TCONF` when not installed. 27*49cdfc7eSAndroid Build Coastguard WorkerSome tests require additional setup. 28*49cdfc7eSAndroid Build Coastguard Worker 29*49cdfc7eSAndroid Build Coastguard Worker### FTP and telnet setup 30*49cdfc7eSAndroid Build Coastguard WorkerFTP stress tests and telnet server tests require environment variables `RHOST` 31*49cdfc7eSAndroid Build Coastguard Worker(remote machine), `RUSER` (remote user) and `PASSWD` (remote password). NOTE: 32*49cdfc7eSAndroid Build Coastguard Worker`RHOST` will imply two host configuration for other tests. 33*49cdfc7eSAndroid Build Coastguard Worker 34*49cdfc7eSAndroid Build Coastguard WorkerIf `RUSER` is set to `root`, either of these steps is required: 35*49cdfc7eSAndroid Build Coastguard Worker 36*49cdfc7eSAndroid Build Coastguard Worker* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing 37*49cdfc7eSAndroid Build Coastguard Worker"root" string. This file lists all those users who are not given access to do ftp 38*49cdfc7eSAndroid Build Coastguard Workeron the current system. 39*49cdfc7eSAndroid Build Coastguard Worker 40*49cdfc7eSAndroid Build Coastguard Worker* If you don’t want to do the previous step, put following entry into `/root/.netrc`: 41*49cdfc7eSAndroid Build Coastguard Worker``` 42*49cdfc7eSAndroid Build Coastguard Workermachine <remote_server_name> 43*49cdfc7eSAndroid Build Coastguard Workerlogin root 44*49cdfc7eSAndroid Build Coastguard Workerpassword <remote_root_password> 45*49cdfc7eSAndroid Build Coastguard Worker``` 46*49cdfc7eSAndroid Build Coastguard Worker 47*49cdfc7eSAndroid Build Coastguard Worker### HTTP setup 48*49cdfc7eSAndroid Build Coastguard WorkerHTTP stress tests require configured and running web server (Apache2, Nginx, etc.). 49*49cdfc7eSAndroid Build Coastguard Worker 50*49cdfc7eSAndroid Build Coastguard Worker### NFS setup 51*49cdfc7eSAndroid Build Coastguard WorkerNFS tests require running NFS server, enable and start `nfs-server.service` 52*49cdfc7eSAndroid Build Coastguard Worker(Debian/Ubuntu and openSUSE/SLES: `nfs-kernel-server` package, others: 53*49cdfc7eSAndroid Build Coastguard Worker`nfs-server` package). 54*49cdfc7eSAndroid Build Coastguard Worker 55*49cdfc7eSAndroid Build Coastguard WorkerThere is no detection whether service is running, test will simply fail without 56*49cdfc7eSAndroid Build Coastguard Workerwarning. 57*49cdfc7eSAndroid Build Coastguard Worker 58*49cdfc7eSAndroid Build Coastguard Worker### TI-RPC / Sun RPC setup 59*49cdfc7eSAndroid Build Coastguard WorkerTI-RPC (or glibc legacy Sun RPC) tests require running rpcbind (or portmap on 60*49cdfc7eSAndroid Build Coastguard Workerold distributions), enable and start `rpcbind.service`. 61*49cdfc7eSAndroid Build Coastguard Worker 62*49cdfc7eSAndroid Build Coastguard Worker## LTP setup 63*49cdfc7eSAndroid Build Coastguard WorkerInstall LTP testsuite (see INSTALL). In case of two hosts configuration, LTP 64*49cdfc7eSAndroid Build Coastguard Workerneeds to be installed the same exact location and `LTPROOT` and `PATH` 65*49cdfc7eSAndroid Build Coastguard Workerenvironment variables set on *both* client and server machines. This is 66*49cdfc7eSAndroid Build Coastguard Workerrequired because some tests expect to find server files in certain locations. 67*49cdfc7eSAndroid Build Coastguard Worker 68*49cdfc7eSAndroid Build Coastguard WorkerExample for the default prefix `/opt/ltp`: 69*49cdfc7eSAndroid Build Coastguard Worker 70*49cdfc7eSAndroid Build Coastguard Worker```sh 71*49cdfc7eSAndroid Build Coastguard Workerexport LTPROOT="/opt/ltp"; export PATH="$LTPROOT/testcases/bin:$PATH" 72*49cdfc7eSAndroid Build Coastguard Worker``` 73*49cdfc7eSAndroid Build Coastguard Worker 74*49cdfc7eSAndroid Build Coastguard Worker## Running the tests 75*49cdfc7eSAndroid Build Coastguard WorkerThe network tests are executed by running the network.sh script: 76*49cdfc7eSAndroid Build Coastguard Worker 77*49cdfc7eSAndroid Build Coastguard Worker```sh 78*49cdfc7eSAndroid Build Coastguard WorkerTEST_VARS ./network.sh OPTIONS 79*49cdfc7eSAndroid Build Coastguard Worker``` 80*49cdfc7eSAndroid Build Coastguard WorkerWhere 81*49cdfc7eSAndroid Build Coastguard Worker* `TEST_VARS` - non-default network parameters 82*49cdfc7eSAndroid Build Coastguard Worker* `OPTIONS` - test group(s), use `-h` to see available ones. 83*49cdfc7eSAndroid Build Coastguard Worker 84*49cdfc7eSAndroid Build Coastguard WorkerDefault values for all LTP network parameters are set in `testcases/lib/tst_net.sh`. 85*49cdfc7eSAndroid Build Coastguard WorkerNetwork stress parameters are documented in `testcases/network/stress/README`. 86*49cdfc7eSAndroid Build Coastguard Worker 87*49cdfc7eSAndroid Build Coastguard WorkerTests which use `tst_netload_compare()` test also performance. They can fail on 88*49cdfc7eSAndroid Build Coastguard Workeroverloaded SUT. To ignore performance failure and test only the network functionality, 89*49cdfc7eSAndroid Build Coastguard Workerset `LTP_NET_FEATURES_IGNORE_PERFORMANCE_FAILURE=1` environment variable. 90*49cdfc7eSAndroid Build Coastguard Worker 91*49cdfc7eSAndroid Build Coastguard Worker## Dependencies 92*49cdfc7eSAndroid Build Coastguard Worker 93*49cdfc7eSAndroid Build Coastguard WorkerSome network tests which use `tst_ping()` function require `ping` with `-I` support, 94*49cdfc7eSAndroid Build Coastguard Workerwhich is not supported by `ping` from [inetutils](https://www.gnu.org/software/inetutils/). 95*49cdfc7eSAndroid Build Coastguard WorkerUse `ping` from [iputils](https://github.com/iputils/iputils/) or from [BusyBox](https://busybox.net/) 96*49cdfc7eSAndroid Build Coastguard Worker(configured with `CONFIG_FEATURE_IPV6=y` `CONFIG_FEATURE_FANCY_PING=y`). 97*49cdfc7eSAndroid Build Coastguard Worker 98*49cdfc7eSAndroid Build Coastguard Worker## Debugging 99*49cdfc7eSAndroid Build Coastguard WorkerBoth single and two host configurations support debugging via 100*49cdfc7eSAndroid Build Coastguard Worker`TST_NET_RHOST_RUN_DEBUG=1` environment variable. 101