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