From 4660f3c32725aa92d6f7c9973bb46ef68d74b3e4 Mon Sep 17 00:00:00 2001
From: Zhu Huankai <zhuhuankai1@huawei.com>
Date: Tue, 18 May 2021 10:11:48 +0800
Subject: [PATCH] README: update readme

Update Preparation and add Log module.

Signed-off-by: Zhu Huankai <zhuhuankai1@huawei.com>
---
 tests/hydropper/README.cn.md | 214 ++++++++++++++++++----------------
 tests/hydropper/README.md    | 218 +++++++++++++++++++----------------
 2 files changed, 234 insertions(+), 198 deletions(-)

diff --git a/tests/hydropper/README.cn.md b/tests/hydropper/README.cn.md
index 8d397cf..eddd072 100644
--- a/tests/hydropper/README.cn.md
+++ b/tests/hydropper/README.cn.md
@@ -1,98 +1,116 @@
-# Hydropper：
-hydropper是一个基于pytest的轻量级测试框架，在其基础上封装了虚拟化的相关测试原子，用于stratovirt的黑盒测试。当前hydropper已经提供了一些测试用例，可以帮助开发人员发现和定位stratovirt的问题。
-
-## 如何开始
-
-
-### 环境准备
-requirements.txt里面包含了python3依赖包。
-
-- pytest>5.0.0
-- aexpect>1.5.0
-- retrying
-
-你可以通过下面的命令来安装这些包：
-```sh
-$ pip install -r config/requirements.txt
-```
-
-网络依赖包：
-```sh
-$ yum install nmap
-$ yum install iperf3
-```
-
-### 参数配置
-请在config目录下的config.ini里配置参数和对应路径，通常的用例都需要配置好kernel和rootfs：
-```ini
-[env.params]
-...
-VM_USERNAME = <usrname>
-VM_PASSWORD = <passwd>
-...
-[stratovirt.params]
-...
-STRATOVIRT_VMLINUX = /path/to/kernel
-STRATOVIRT_ROOTFS = /path/to/rootfs
-...
-```
-
-请在config.ini中配置好IP_PREFIX和IP_3RD，这两项表示虚拟机IPv4地址的前24位，
-最后8位会由hydropper来自动配置。请注意虚拟机需要和主机在同一网段。
-```ini
-[network.params]
-# such as 'IP_PREFIX.xxx.xxx'
-IP_PREFIX = xxx.xxx
-# such as 'xxx.xxx.IP_3RD.xxx'
-IP_3RD = xxx
-```
-
-### 运行测试用例
-你可以hydropper目录下通过以下的命令来执行用例：
-```sh
-# 执行所有用例
-$ pytest
-
-# 执行所有带有关键字microvm的用例
-$ pytest -k microvm
-
-# 执行test_microvm_cmdline中的全部用例
-$ pytest testcases/microvm/functional/test_microvm_cmdline.py
-
-# 执行test_microvm_with_json用例
-$ pytest testcases/microvm/functional/test_microvm_cmdline.py::test_microvm_with_json
-```
-
-### 增加测试用例
-在testcases目录下的microvm目录里来增加自定义的用例。你可以新增一个python文件或者是在已存在的python文件里新增一个新的函数，文件名和函数名都必须形如test_*：
-```python
-test_microvm_xxx.py
-def test_microvm_xxx()
-```
-
-我们已经预置了一些虚拟机对象，用户可以通过生成它们的实例来对虚拟机测试：
-```python
-def test_microvm_xxx(microvm):
-    test_vm = microvm
-    test_vm.launch()
-```
-
-另外，Fixture也可以帮助我们来更好的编写用例，用户可以参照以下方式来使用Fixture：
-```python
-# 标记该函数为system用例
-@pytest.mark.system
-def test_microvm_xxx(microvm):
-    test_vm = microvm
-    test_vm.launch()
-```
-
-现在你可以使用pytest -m system来执行所有的“system”用例了。
-
-用户可以使用basic_config()函数，来配置一些虚拟机的参数：
-```python
-# 设置虚拟机配置4个VCPU和4G内存
-def test_microvm_xxx(microvm):
-    test_vm = microvm
-    test_vm.basic_config(vcpu_count=4, mem_size='4G')
-    test_vm.launch()
-```
\ No newline at end of file
+# Hydropper：
+hydropper是一个基于pytest的轻量级测试框架，在其基础上封装了虚拟化的相关测试原子，用于stratovirt的黑盒测试。当前hydropper已经提供了一些测试用例，可以帮助开发人员发现和定位stratovirt的问题。
+
+## 如何开始
+
+### 环境准备
+1. 请确保你的openEuler系统已经安装python3。
+
+2. requirements.txt里面包含了hydropper的依赖包。
+
+- pytest>5.0.0
+- aexpect>1.5.0
+- retrying
+
+你可以通过下面的命令来安装这些包：
+```sh
+$ pip3 install -r requirements.txt
+```
+
+3. 请在你的openEuler系统上安装下列网络依赖包，以支持用例执行：
+
+```sh
+$ yum install nmap
+$ yum install iperf3
+```
+
+4. 网络配置（可参考以下模板）：
+
+```sh
+brctl addbr strato_br0
+ifconfig strato_br0 up
+ifconfig strato_br0 1.1.1.1
+```
+
+5. 构建测试镜像请参考 docs/IMAGE_BUILD.md。
+
+### 参数配置
+请在config目录下的config.ini里配置参数和对应路径，通常的用例都需要配置好kernel和rootfs：
+```ini
+[env.params]
+...
+VM_USERNAME = <usrname>
+VM_PASSWORD = <passwd>
+...
+[stratovirt.params]
+...
+STRATOVIRT_VMLINUX = /path/to/kernel
+STRATOVIRT_ROOTFS = /path/to/rootfs
+...
+```
+
+请在config.ini中配置好IP_PREFIX和IP_3RD，这两项表示虚拟机IPv4地址的前24位，
+最后8位会由hydropper来自动配置。请注意虚拟机需要和主机在同一网段。
+
+```ini
+[network.params]
+# such as 'IP_PREFIX.xxx.xxx'
+IP_PREFIX = 1.1
+# such as 'xxx.xxx.IP_3RD.xxx'
+IP_3RD = 1
+```
+
+### 运行测试用例
+你可以在hydropper目录下通过以下的命令来执行用例：
+```sh
+# 执行所有用例
+$ pytest
+
+# 执行所有带有关键字microvm的用例
+$ pytest -k microvm
+
+# 执行test_microvm_cmdline中的全部用例
+$ pytest testcases/microvm/functional/test_microvm_cmdline.py
+
+# 执行test_microvm_with_json用例
+$ pytest testcases/microvm/functional/test_microvm_cmdline.py::test_microvm_with_json
+```
+
+### 增加测试用例
+在testcases目录下的microvm目录里来增加自定义的用例。你可以新增一个python文件或者是在已存在的python文件里新增一个新的函数，文件名和函数名都必须形如test_*：
+```python
+test_microvm_xxx.py
+def test_microvm_xxx()
+```
+
+我们已经预置了一些虚拟机对象，用户可以通过生成它们的实例来对虚拟机测试：
+```python
+def test_microvm_xxx(microvm):
+    test_vm = microvm
+    test_vm.launch()
+```
+
+另外，Fixture也可以帮助我们来更好的编写用例，用户可以参照以下方式来使用Fixture：
+```python
+# 标记该函数为system用例
+@pytest.mark.system
+def test_microvm_xxx(microvm):
+    test_vm = microvm
+    test_vm.launch()
+```
+
+现在你可以使用pytest -m system来执行所有的“system”用例了。
+
+用户可以使用basic_config()函数，来配置一些虚拟机的参数：
+```python
+# 设置虚拟机配置4个VCPU和4G内存
+def test_microvm_xxx(microvm):
+    test_vm = microvm
+    test_vm.basic_config(vcpu_count=4, mem_size='4G')
+    test_vm.launch()
+```
+
+### 日志
+
+- pytest默认日志路径：/var/log/pytest.log
+- stratovirt默认日志路径：/var/log/stratovirt
\ No newline at end of file
diff --git a/tests/hydropper/README.md b/tests/hydropper/README.md
index 3bdb169..6b87764 100644
--- a/tests/hydropper/README.md
+++ b/tests/hydropper/README.md
@@ -1,100 +1,118 @@
-# Hydropper：
-Hydropper is a lightweight test framework based on pytest. It encapsulates virtualization-related test atoms and is used for stratovirt black-box tests.Hydropper has provided some test cases to help Developers find and locate Stratovirt problems.
-
-## How to start
-
-
-### Preparation
-The requirements.txt file contains the Python3 dependency package.
-
-- pytest>5.0.0
-- aexpect>1.5.0
-- retrying
-
-You can install these packages by running the following commands:
-```sh
-$ pip install -r config/requirements.txt
-```
-
-Network dependency package:
-```sh
-$ yum install nmap
-$ yum install iperf3
-```
-
-### Parameter configuration
-Set parameters and corresponding paths in the config/config.ini. Generally, the kernel and rootfs must be configured for test cases.
-```ini
-[env.params]
-...
-VM_USERNAME = <usrname>
-VM_PASSWORD = <passwd>
-...
-[stratovirt.params]
-...
-STRATOVIRT_VMLINUX = /path/to/kernel
-STRATOVIRT_ROOTFS = /path/to/rootfs
-...
-```
-
-Configure IP_PREFIX and IP_3RD in the "config.ini" file,
-which indicate the first 24 bits of the VM IPv4 address,
-The last 8 bits are automatically configured by the hydropper.
-Note that the VM and the host must be in the same network segment.
-```ini
-[network.params]
-# such as 'IP_PREFIX.xxx.xxx'
-IP_PREFIX = xxx.xxx
-# such as 'xxx.xxx.IP_3RD.xxx'
-IP_3RD = xxx
-```
-
-### Run testcases
-You can run the following commands in the hydroper directory to execute cases:
-```sh
-# Run all cases
-$ pytest
-
-# Run all cases with the keyword microvm
-$ pytest -k microvm
-
-# Run all cases in test_microvm_cmdline.py
-$ pytest testcases/microvm/functional/test_microvm_cmdline.py
-
-# Run test_microvm_with_json
-$ pytest testcases/microvm/functional/test_microvm_cmdline.py::test_microvm_with_json
-```
-
-### Add new testcases
-Add customized cases to the microvm directory under testcases.You can add a python file or add a function to an existing python file.The file name and function name must be in the format of test_*.
-```python
-test_microvm_xxx.py
-def test_microvm_xxx()
-```
-
-We have preset some virtual machine objects. You can test the virtual machine by generating their instances：
-```python
-def test_microvm_xxx(microvm):
-    test_vm = microvm
-    test_vm.launch()
-```
-
-In addition, Fixture is useful to write testcases.You can use Fixture in the following ways:
-```python
-# Mark the tag to system
-@pytest.mark.system
-def test_microvm_xxx(microvm):
-    test_vm = microvm
-    test_vm.launch()
-```
-
-Now you can use the pytest -m system command to run all the "system" cases.
-
-You can use the basic_config() function to configure VM parameters：
-```python
-# Configure four vCPUs and 4 GB memory for the VM.
-def test_microvm_xxx(microvm):
-    test_vm = microvm
-    test_vm.basic_config(vcpu_count=4, mem_size='4G')
-    test_vm.launch()
-```
\ No newline at end of file
+# Hydropper：
+Hydropper is a lightweight test framework based on pytest. It encapsulates virtualization-related test atoms and is used for stratovirt black-box tests.Hydropper has provided some test cases to help Developers find and locate Stratovirt problems.
+
+## How to start
+
+
+### Preparation
+1. Ensure that python3 has been installed on your openEuler system.
+
+2. The requirements.txt file contains the Python3 dependency package.
+
+- pytest>5.0.0
+- aexpect>1.5.0
+- retrying
+
+You can install these packages by running the following commands:
+```sh
+$ pip3 install -r requirements.txt
+```
+
+3. Network dependency package:
+```sh
+$ yum install nmap
+$ yum install iperf3
+```
+
+4. Network configuration（template）
+
+```sh
+brctl addbr strato_br0
+ifconfig strato_br0 up
+ifconfig strato_br0 1.1.1.1
+```
+
+5. For details about how to build a test image, see docs/IMAGE_BUILD.md.
+
+### Parameter configuration
+Set parameters and corresponding paths in the config/config.ini. Generally, the kernel and rootfs must be configured for test cases.
+```ini
+[env.params]
+...
+VM_USERNAME = <usrname>
+VM_PASSWORD = <passwd>
+...
+[stratovirt.params]
+...
+STRATOVIRT_VMLINUX = /path/to/kernel
+STRATOVIRT_ROOTFS = /path/to/rootfs
+...
+```
+
+Configure IP_PREFIX and IP_3RD in the "config.ini" file,
+which indicate the first 24 bits of the VM IPv4 address,
+The last 8 bits are automatically configured by the hydropper.
+Note that the VM and the host must be in the same network segment.
+
+```ini
+[network.params]
+# such as 'IP_PREFIX.xxx.xxx'
+IP_PREFIX = 1.1
+# such as 'xxx.xxx.IP_3RD.xxx'
+IP_3RD = 1
+```
+
+### Run testcases
+You can run the following commands in the hydroper directory to execute cases:
+```sh
+# Run all cases
+$ pytest
+
+# Run all cases with the keyword microvm
+$ pytest -k microvm
+
+# Run all cases in test_microvm_cmdline.py
+$ pytest testcases/microvm/functional/test_microvm_cmdline.py
+
+# Run test_microvm_with_json
+$ pytest testcases/microvm/functional/test_microvm_cmdline.py::test_microvm_with_json
+```
+
+### Add new testcases
+Add customized cases to the microvm directory under testcases.You can add a python file or add a function to an existing python file.The file name and function name must be in the format of test_*.
+```python
+test_microvm_xxx.py
+def test_microvm_xxx()
+```
+
+We have preset some virtual machine objects. You can test the virtual machine by generating their instances：
+```python
+def test_microvm_xxx(microvm):
+    test_vm = microvm
+    test_vm.launch()
+```
+
+In addition, Fixture is useful to write testcases.You can use Fixture in the following ways:
+```python
+# Mark the tag to system
+@pytest.mark.system
+def test_microvm_xxx(microvm):
+    test_vm = microvm
+    test_vm.launch()
+```
+
+Now you can use the pytest -m system command to run all the "system" cases.
+
+You can use the basic_config() function to configure VM parameters：
+```python
+# Configure four vCPUs and 4 GB memory for the VM.
+def test_microvm_xxx(microvm):
+    test_vm = microvm
+    test_vm.basic_config(vcpu_count=4, mem_size='4G')
+    test_vm.launch()
+```
+
+### Log
+
+- pytest default log path: /var/log/pytest.log
+- stratovirt default log path: /var/log/stratovirt
\ No newline at end of file
-- 
2.27.0

