75ba30e3fcc44a9eebfc4caaedb91678016220f5
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / README
1 ##
2 ## Copyright (c) 2010-2019 Intel Corporation
3 ##
4 ## Licensed under the Apache License, Version 2.0 (the "License");
5 ## you may not use this file except in compliance with the License.
6 ## You may obtain a copy of the License at
7 ##
8 ##     http://www.apache.org/licenses/LICENSE-2.0
9 ##
10 ## Unless required by applicable law or agreed to in writing, software
11 ## distributed under the License is distributed on an "AS IS" BASIS,
12 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ## See the License for the specific language governing permissions and
14 ## limitations under the License.
15 ##
16
17 rapid (Rapid Automated Performance Indication for Dataplane)
18 ************************************************************
19
20 rapid is a set of files offering an easy way to do a sanity check of the
21 dataplane performance of an OpenStack or container environment.
22
23 In case of OpenStack, copy the files in a directory on a machine that can run the OpenStack CLI
24 commands and that can reach the networks to connect to the VMs.
25
26 You will need an image that has the PROX tool installed.
27 A good way to do this is to use the packer tool to build an image for a target of your choice.
28 You can also build this image manually by executing all the commands described in the deploycentostools.sh.
29 The default name of the qcow2 file is rapidVM.qcow2
30
31 When using the packer tool, the first step is to upload an
32 existing CentOS cloud image from the internet into OpenStack.
33 Check out: https://cloud.centos.org/centos/7/images/
34 You should now create proper clouds.yaml file so Packer can connect to your OpenStack.
35 Sample clouds.yaml could look like this:
36
37 client:
38   force_ipv4: true
39 clouds:
40   overcloud:
41     verify:    False
42     interface: "public"
43     auth:
44       username:         "admin"
45       password:         "your_password"
46       project_name:     "admin"
47       tenant_name:      "admin"
48       auth_url:         "https://192.168.1.1:5000/v3"
49       user_domain_name: "Default"
50       domain_name:      "Default"
51     identity_api_version: "3"
52
53 Packer could be run from docker image, you will need to create following alias:
54
55 alias packer='docker run -it -v "$PWD":/root/project -w /root/project hashicorp/packer:light $@'
56
57
58 There are 2 files: centos.json and deploycentostools.sh, allowing you to create
59 an image automatically. Run
60   # packer build centos.json
61 Edit centos.json to reflect the settings of your environment: The following fields need to
62 be the ID's of your system:
63   - "source_image_name": Needs to be the name of the Centos cloud image
64   - "flavor": Needs to be the ID or name of the flavor existing in your OpenStack environment that will be used
65     to start the VM in which we will install all tools
66   - "networks": ID of the network that will be used for the VM
67   - "use_floating_ip": true or false
68   - "floating_ip_network": ID of the floating ip network in case floating ip are being used
69   - "security_groups": ID or name of the security group being used
70
71 Refer to Packer docs for more details:
72 https://www.packer.io/docs/builders/openstack.html
73
74 Note that this procedure is not only installing the necessary tools to run PROX,
75 but also does some system optimizations (tuned). Check deploycentostools.sh for more details.
76
77 Now you can run the createrapid.py file. Use help for more info on the usage:
78   # ./createrapid.py --help
79
80 createrapid.py will use the OpenStack CLI to create the flavor, key-pair, network, image,
81 servers, ...
82 It will create a <STACK>.env file containing all info that will be used by runrapid.py
83 to actually run the tests. Logging can be found in the CREATE<STACK>.log file
84 You can use floating IP addresses by specifying the floating IP network
85 --floating_network NETWORK
86 or directly connect through the INTERNAL_NETWORK by using the following parameter:
87 --floating_network NO
88 /etc/resolv.conf will contain DNS info from the "best" interface. Since we are
89 deploying VMs with multiple interface on different networks, this info might be
90 taken from the "wrong" network (e.g. the dataplane network).
91
92 Now you can run the runrapid.py file. Use help for more info on the usage:
93   # ./runrapid.py --help
94 The script will connect to all machines that have been instantiated and it will launch
95 PROX in all machines. This will be done through the admin IP assigned to the machines.
96 Once that is done it will connect to the PROX tcp socket and start sending
97 commands to run the actual test.
98 Make sure the security groups allow for tcp access (ssh & prox port).
99 It will print test results on the screen while running.
100 The actual test that is running is described in <TEST>.test.
101
102 Notes about prox_user_data.sh script:
103 - The script contains commands that will be executed using cloud-init at
104   startup of the VMs.
105 - huge pages are allocated for DPDK on node 0 (hard-coded) in the VM.
106
107 Note on using SRIOV ports:
108 Before running createrapid, make sure the network, subnet and ports are already created
109 This can be done as follows (change the parameters to your needs):
110 openstack network create --share --external --provider-network-type flat --provider-physical-network physnet2 fast-network
111 openstack subnet create --network  fast-network  --subnet-range 20.20.20.0/24 --gateway none fast-subnet
112 openstack port create --network fast-network --vnic-type direct --fixed-ip subnet=fast-subnet Port1
113 openstack port create --network fast-network --vnic-type direct --fixed-ip subnet=fast-subnet Port2
114 openstack port create --network fast-network --vnic-type direct --fixed-ip subnet=fast-subnet Port3
115 Make sure to use the network and subnet in the createrapid parameters list. Port1, Port2 and Port3
116 are being used in the *.env file.
117
118 Note when doing tests using the gateway functionality on OVS:
119 When a GW VM is sending packets on behalf of another VM (e.g. the generator), we need to make sure the OVS
120 will allow those packets to go through. Therefore you need to the IP address of the generator in the
121 "allowed address pairs" of the GW VM.
122
123 Note when doing tests using encryption on OVS:
124 Your OVS configuration might block encrypted packets. To allow packets to go through,
125 you can disable port_security. You can do this by using the following commands
126 neutron port-update xxxxxx --no-security-groups
127 neutron port-update xxxxxx --port_security_enabled=False
128
129 An example of the env file generated by createrapid.py can be found below.
130 Note that this file can be created manually in case the stack is created in a
131 different way (not using the createrapid.py). This can be useful in case you are
132 not using OpenStack as a VIM or when using special configurations that cannot be
133 achieved using createrapid.py. Fields needed for runrapid are:
134 * all info in the [Mx] sections
135 * the key information in the [ssh] section
136 * the total_number_of_vms information in the [rapid] section
137
138 [rapid]
139 loglevel = DEBUG
140 version = 19.6.30
141 total_number_of_machines = 3
142
143 [M1]
144 name = rapid-VM1
145 admin_ip = 10.25.1.109
146 dp_ip = 10.10.10.4
147 dp_mac = fa:16:3e:25:be:25
148
149 [M2]
150 name = rapid-VM2
151 admin_ip = 10.25.1.110
152 dp_ip = 10.10.10.7
153 dp_mac = fa:16:3e:72:bf:e8
154
155 [M3]
156 name = rapid-VM3
157 admin_ip = 10.25.1.125
158 dp_ip = 10.10.10.15
159 dp_mac = fa:16:3e:69:f3:e7
160
161 [ssh]
162 key = prox
163
164 [Varia]
165 vim = OpenStack
166 stack = rapid
167 vms = rapidVMs.vms
168 image = rapidVM
169 image_file = rapidVM.qcow2
170 dataplane_network = dataplane-network
171 subnet = dpdk-subnet
172 subnet_cidr = 10.10.10.0/24
173 internal_network = admin_internal_net
174 floating_network = admin_floating_net