xref: /third_party/ltp/testcases/network/README.md (revision f08c3bdf)
1f08c3bdfSopenharmony_ci# LTP Network Tests
2f08c3bdfSopenharmony_ci
3f08c3bdfSopenharmony_ci## Single Host Configuration
4f08c3bdfSopenharmony_ci
5f08c3bdfSopenharmony_ciIt's the default configuration (if the `RHOST` environment variable is not
6f08c3bdfSopenharmony_cidefined). LTP adds `ltp_ns` network namespace and auto-configure `veth` pair
7f08c3bdfSopenharmony_ciaccording to LTP network environment variables.
8f08c3bdfSopenharmony_ci
9f08c3bdfSopenharmony_ci## Two Host Configuration
10f08c3bdfSopenharmony_ci
11f08c3bdfSopenharmony_ciThis setup requires the `RHOST` environment variable to be set properly and
12f08c3bdfSopenharmony_ciconfigured SSH access to a remote host.
13f08c3bdfSopenharmony_ci
14f08c3bdfSopenharmony_ciThe `RHOST` variable must be set to the hostname of the server (test management
15f08c3bdfSopenharmony_cilink) and public key setup or login without password is required.
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ciSSH server needs to be configured to allow root login and use Public Key
18f08c3bdfSopenharmony_ciAuthentication (`PermitRootLogin yes` and `PubkeyAuthentication yes` in
19f08c3bdfSopenharmony_ci`/etc/ssh/sshd_config`).
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_ciSome of the network stress tests which hasn't been ported to network API were
22f08c3bdfSopenharmony_cidesigned to be tested with `rsh` via `LTP_RSH` environment variable. Now it's
23f08c3bdfSopenharmony_ciby default used `ssh`, for details see `testcases/network/stress/README`.
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ci## Server Services Configuration
26f08c3bdfSopenharmony_ciTests have various external dependencies, exit with `TCONF` when not installed.
27f08c3bdfSopenharmony_ciSome tests require additional setup.
28f08c3bdfSopenharmony_ci
29f08c3bdfSopenharmony_ci### FTP and telnet setup
30f08c3bdfSopenharmony_ciFTP stress tests and telnet server tests require environment variables `RHOST`
31f08c3bdfSopenharmony_ci(remote machine), `RUSER` (remote user) and `PASSWD` (remote password). NOTE:
32f08c3bdfSopenharmony_ci`RHOST` will imply two host configuration for other tests.
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_ciIf `RUSER` is set to `root`, either of these steps is required:
35f08c3bdfSopenharmony_ci
36f08c3bdfSopenharmony_ci* In `/etc/ftpusers` (or `/etc/vsftpd.ftpusers`), comment the line containing
37f08c3bdfSopenharmony_ci"root" string. This file lists all those users who are not given access to do ftp
38f08c3bdfSopenharmony_cion the current system.
39f08c3bdfSopenharmony_ci
40f08c3bdfSopenharmony_ci* If you don’t want to do the previous step, put following entry into `/root/.netrc`:
41f08c3bdfSopenharmony_ci```
42f08c3bdfSopenharmony_cimachine <remote_server_name>
43f08c3bdfSopenharmony_cilogin root
44f08c3bdfSopenharmony_cipassword <remote_root_password>
45f08c3bdfSopenharmony_ci```
46f08c3bdfSopenharmony_ci
47f08c3bdfSopenharmony_ci### HTTP setup
48f08c3bdfSopenharmony_ciHTTP stress tests require configured and running web server (Apache2, Nginx, etc.).
49f08c3bdfSopenharmony_ci
50f08c3bdfSopenharmony_ci### NFS setup
51f08c3bdfSopenharmony_ciNFS tests require running NFS server, enable and start `nfs-server.service`
52f08c3bdfSopenharmony_ci(Debian/Ubuntu and openSUSE/SLES: `nfs-kernel-server` package, others:
53f08c3bdfSopenharmony_ci`nfs-server` package).
54f08c3bdfSopenharmony_ci
55f08c3bdfSopenharmony_ciThere is no detection whether service is running, test will simply fail without
56f08c3bdfSopenharmony_ciwarning.
57f08c3bdfSopenharmony_ci
58f08c3bdfSopenharmony_ci### TI-RPC / Sun RPC setup
59f08c3bdfSopenharmony_ciTI-RPC (or glibc legacy Sun RPC) tests require running rpcbind (or portmap on
60f08c3bdfSopenharmony_ciold distributions), enable and start `rpcbind.service`.
61f08c3bdfSopenharmony_ci
62f08c3bdfSopenharmony_ci## LTP setup
63f08c3bdfSopenharmony_ciInstall LTP testsuite (see INSTALL). In case of two hosts configuration, LTP
64f08c3bdfSopenharmony_cineeds to be installed the same exact location and `LTPROOT` and `PATH`
65f08c3bdfSopenharmony_cienvironment variables set on *both* client and server machines. This is
66f08c3bdfSopenharmony_cirequired because some tests expect to find server files in certain locations.
67f08c3bdfSopenharmony_ci
68f08c3bdfSopenharmony_ciExample for the default prefix `/opt/ltp`:
69f08c3bdfSopenharmony_ci
70f08c3bdfSopenharmony_ci```sh
71f08c3bdfSopenharmony_ciexport LTPROOT="/opt/ltp"; export PATH="$LTPROOT/testcases/bin:$PATH"
72f08c3bdfSopenharmony_ci```
73f08c3bdfSopenharmony_ci
74f08c3bdfSopenharmony_ci## Running the tests
75f08c3bdfSopenharmony_ciThe network tests are executed by running the network.sh script:
76f08c3bdfSopenharmony_ci
77f08c3bdfSopenharmony_ci```sh
78f08c3bdfSopenharmony_ciTEST_VARS ./network.sh OPTIONS
79f08c3bdfSopenharmony_ci```
80f08c3bdfSopenharmony_ciWhere
81f08c3bdfSopenharmony_ci* `TEST_VARS` - non-default network parameters
82f08c3bdfSopenharmony_ci* `OPTIONS` - test group(s), use `-h` to see available ones.
83f08c3bdfSopenharmony_ci
84f08c3bdfSopenharmony_ciDefault values for all LTP network parameters are set in `testcases/lib/tst_net.sh`.
85f08c3bdfSopenharmony_ciNetwork stress parameters are documented in `testcases/network/stress/README`.
86f08c3bdfSopenharmony_ci
87f08c3bdfSopenharmony_ci## Debugging
88f08c3bdfSopenharmony_ciBoth single and two host configurations support debugging via
89f08c3bdfSopenharmony_ci`TST_NET_RHOST_RUN_DEBUG=1` environment variable.
90