Add pod.yaml files for Apex
[yardstick.git] / docs / testing / user / userguide / 05-yardstick_plugin.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International
2 .. License.
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, Ericsson AB, Huawei Technologies Co.,Ltd and others.
5
6 ===================================
7 Installing a plug-in into Yardstick
8 ===================================
9
10
11 Abstract
12 ========
13
14 Yardstick provides a ``plugin`` CLI command to support integration with other
15 OPNFV testing projects. Below is an example invocation of Yardstick plugin
16 command and Storperf plug-in sample.
17
18
19 Installing Storperf into Yardstick
20 ==================================
21
22 Storperf is delivered as a Docker container from
23 https://hub.docker.com/r/opnfv/storperf/tags/.
24
25 There are two possible methods for installation in your environment:
26
27 * Run container on Jump Host
28 * Run container in a VM
29
30 In this introduction we will install Storperf on Jump Host.
31
32
33 Step 0: Environment preparation
34 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
35
36 Running Storperf on Jump Host
37 Requirements:
38
39 * Docker must be installed
40 * Jump Host must have access to the OpenStack Controller API
41 * Jump Host must have internet connectivity for downloading docker image
42 * Enough floating IPs must be available to match your agent count
43
44 Before installing Storperf into yardstick you need to check your openstack
45 environment and other dependencies:
46
47 1. Make sure docker is installed.
48 2. Make sure Keystone, Nova, Neutron, Glance, Heat are installed correctly.
49 3. Make sure Jump Host have access to the OpenStack Controller API.
50 4. Make sure Jump Host must have internet connectivity for downloading docker image.
51 5. You need to know where to get basic openstack Keystone authorization info, such as
52    OS_PASSWORD, OS_PROJECT_NAME, OS_AUTH_URL, OS_USERNAME.
53 6. To run a Storperf container, you need to have OpenStack Controller environment
54    variables defined and passed to Storperf container. The best way to do this is to
55    put environment variables in a "storperf_admin-rc" file. The storperf_admin-rc
56    should include credential environment variables at least:
57
58 * OS_AUTH_URL
59 * OS_USERNAME
60 * OS_PASSWORD
61 * OS_PROJECT_NAME
62 * OS_PROJECT_ID
63 * OS_USER_DOMAIN_ID
64
65 *Yardstick* has a "prepare_storperf_admin-rc.sh" script which can be used to
66 generate the "storperf_admin-rc" file, this script is located at
67 test/ci/prepare_storperf_admin-rc.sh
68
69 ::
70
71   #!/bin/bash
72   # Prepare storperf_admin-rc for StorPerf.
73   AUTH_URL=${OS_AUTH_URL}
74   USERNAME=${OS_USERNAME:-admin}
75   PASSWORD=${OS_PASSWORD:-console}
76
77   # OS_TENANT_NAME is still present to keep backward compatibility with legacy
78   # deployments, but should be replaced by OS_PROJECT_NAME.
79   TENANT_NAME=${OS_TENANT_NAME:-admin}
80   PROJECT_NAME=${OS_PROJECT_NAME:-$TENANT_NAME}
81   PROJECT_ID=`openstack project show admin|grep '\bid\b' |awk -F '|' '{print $3}'|sed -e 's/^[[:space:]]*//'`
82   USER_DOMAIN_ID=${OS_USER_DOMAIN_ID:-default}
83
84   rm -f ~/storperf_admin-rc
85   touch ~/storperf_admin-rc
86
87   echo "OS_AUTH_URL="$AUTH_URL >> ~/storperf_admin-rc
88   echo "OS_USERNAME="$USERNAME >> ~/storperf_admin-rc
89   echo "OS_PASSWORD="$PASSWORD >> ~/storperf_admin-rc
90   echo "OS_PROJECT_NAME="$PROJECT_NAME >> ~/storperf_admin-rc
91   echo "OS_PROJECT_ID="$PROJECT_ID >> ~/storperf_admin-rc
92   echo "OS_USER_DOMAIN_ID="$USER_DOMAIN_ID >> ~/storperf_admin-rc
93
94
95 The generated "storperf_admin-rc" file will be stored in the root directory. If
96 you installed *Yardstick* using Docker, this file will be located in the
97 container. You may need to copy it to the root directory of the Storperf
98 deployed host.
99
100 Step 1: Plug-in configuration file preparation
101 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
102
103 To install a plug-in, first you need to prepare a plug-in configuration file in
104 YAML format and store it in the "plugin" directory. The plugin configration file
105 work as the input of yardstick "plugin" command. Below is the Storperf plug-in
106 configuration file sample:
107 ::
108
109   ---
110   # StorPerf plugin configuration file
111   # Used for integration StorPerf into Yardstick as a plugin
112   schema: "yardstick:plugin:0.1"
113   plugins:
114     name: storperf
115   deployment:
116     ip: 192.168.23.2
117     user: root
118     password: root
119
120 In the plug-in configuration file, you need to specify the plug-in name and the
121 plug-in deployment info, including node ip, node login username and password.
122 Here the Storperf will be installed on IP 192.168.23.2 which is the Jump Host
123 in my local environment.
124
125 Step 2: Plug-in install/remove scripts preparation
126 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
127
128 In "yardstick/resource/scripts" directory, there are two folders: a "install"
129 folder and a "remove" folder. You need to store the plug-in install/remove
130 scripts in these two folders respectively.
131
132 The detailed installation or remove operation should de defined in these two
133 scripts. The name of both install and remove scripts should match the plugin-in
134 name that you specified in the plug-in configuration file.
135
136 For example, the install and remove scripts for Storperf are both named to
137 "storperf.bash".
138
139 Step 3: Install and remove Storperf
140 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
141
142 To install Storperf, simply execute the following command::
143
144   # Install Storperf
145   yardstick plugin install plugin/storperf.yaml
146
147 removing Storperf from yardstick
148 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149
150 To remove Storperf, simply execute the following command::
151
152   # Remove Storperf
153   yardstick plugin remove plugin/storperf.yaml
154
155 What yardstick plugin command does is using the username and password to log
156 into the deployment target and then execute the corresponding install or remove
157 script.