8 This document is intended to aid those who want to modify the vsperf code. Or
9 to extend it - for example to add support for new traffic generators,
10 deployment scenarios and so on.
18 List all the cli options:
20 .. code-block:: console
24 Run all tests that have ``tput`` in their name - ``p2p_tput``, ``pvp_tput`` etc.:
26 .. code-block:: console
28 $ ./vsperf --tests 'tput'
30 As above but override default configuration with settings in '10_custom.conf'.
31 This is useful as modifying configuration directly in the configuration files
32 in ``conf/NN_*.py`` shows up as changes under git source control:
34 .. code-block:: console
36 $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf --tests 'tput'
38 Override specific test parameters. Useful for shortening the duration of tests
39 for development purposes:
41 .. code-block:: console
43 $ ./vsperf --test-params 'duration=10;rfc2544_trials=1;pkt_sizes=64' --tests 'pvp_tput'
48 This is a typical flow of control for a test.
56 The conf package contains the configuration files (``*.conf``) for all system
57 components, it also provides a ``settings`` object that exposes all of these
60 Settings are not passed from component to component. Rather they are available
61 globally to all components once they import the conf package.
63 .. code-block:: python
65 from conf import settings
67 log_file = settings.getValue('LOG_FILE_DEFAULT')
69 Settings files (``*.conf``) are valid python code so can be set to complex
70 types such as lists and dictionaries as well as scalar types:
72 .. code-block:: python
74 first_packet_size = settings.getValue('PACKET_SIZE_LIST')[0]
76 Configuration Procedure and Precedence
77 --------------------------------------
79 Configuration files follow a strict naming convention that allows them to be
80 processed in a specific order. All the .conf files are named ``NN_name.conf``,
81 where NN is a decimal number. The files are processed in order from 00_name.conf
82 to 99_name.conf so that if the name setting is given in both a lower and higher
83 numbered conf file then the higher numbered file is the effective setting as it
84 is processed after the setting in the lower numbered file.
86 The values in the file specified by ``--conf-file`` takes precedence over all
87 the other configuration files and does not have to follow the naming
94 ``conf.settings`` also loads configuration from the command line and from the environment.
96 VM, vSwitch, Traffic Generator Independence
97 ===========================================
99 VSPERF supports different vSwithes, Traffic Generators and VNFs by using
100 standard object-oriented polymorphism:
102 * Support for vSwitches is implemented by a class inheriting from IVSwitch.
103 * Support for Traffic Generators is implemented by a class inheriting from
105 * Support for VNF is implemented by a class inheriting from IVNF.
107 By dealing only with the abstract interfaces the core framework can support
108 many implementations of different vSwitches, Traffic Generators and VNFs.
113 .. code-block:: python
118 add_switch(switch_name)
119 del_switch(switch_name)
120 add_phy_port(switch_name)
121 add_vport(switch_name)
122 get_ports(switch_name)
123 del_port(switch_name, port_name)
124 add_flow(switch_name, flow)
125 del_flow(switch_name, flow=None)
130 .. code-block:: python
132 class ITrafficGenerator:
136 send_burst_traffic(traffic, numpkts, time, framerate)
138 send_cont_traffic(traffic, time, framerate)
139 start_cont_traffic(traffic, time, framerate)
140 stop_cont_traffic(self):
142 send_rfc2544_throughput(traffic, trials, duration, lossrate)
143 start_rfc2544_throughput(traffic, trials, duration, lossrate)
144 wait_rfc2544_throughput(self)
146 send_rfc2544_back2back(traffic, trials, duration, lossrate)
147 start_rfc2544_back2back(traffic, , trials, duration, lossrate)
148 wait_rfc2544_back2back()
150 Note ``send_xxx()`` blocks whereas ``start_xxx()`` does not and must be followed by a subsequent call to ``wait_xxx()``.
155 .. code-block:: python
159 monitor_path, shared_path_host,
160 shared_path_guest, guest_prompt)
164 execute_and_wait (command)
169 Controllers are used in conjunction with abstract interfaces as way of
170 decoupling the control of vSwtiches, VNFs and TrafficGenerators from other
173 The controlled classes provide basic primitive operations. The Controllers
174 sequence and co-ordinate these primitive operation in to useful actions. For
175 instance the vswitch_controller_PVP can be used to bring any vSwitch (that
176 implements the primitives defined in IVSwitch) into the configuration required
177 by the Phy-to-Phy Deployment Scenario.
179 In order to support a new vSwitch only a new implementation of IVSwitch needs
180 be created for the new vSwitch to be capable of fulfilling all the Deployment
181 Scenarios provided for by existing or future vSwitch Controllers.
183 Similarly if a new Deployment Scenario is required it only needs to be written
184 once as a new vSwitch Controller and it will immediately be capable of
185 controlling all existing and future vSwitches in to that Deployment Scenario.
187 Similarly the Traffic Controllers can be used to co-ordinate basic operations
188 provided by implementers of ITrafficGenerator to provide useful tests. Though
189 traffic generators generally already implement full test cases i.e. they both
190 generate suitable traffic and analyse returned traffic in order to implement a
191 test which has typically been predefined in an RFC document. However the
192 Traffic Controller class allows for the possibility of further enhancement -
193 such as iterating over tests for various packet sizes or creating new tests.
195 Traffic Controller's Role
196 -------------------------
198 .. image:: traffic_controller.png
201 Loader & Component Factory
202 --------------------------
204 The working of the Loader package (which is responsible for *finding* arbitrary
205 classes based on configuration data) and the Component Factory which is
206 responsible for *choosing* the correct class for a particular situation - e.g.
207 Deployment Scenario can be seen in this diagram.
209 .. image:: factory_and_loader.png
214 Vsperf uses a standard set of routing tables in order to allow tests to easily
215 mix and match Deployment Scenarios (PVP, P2P topology), Tuple Matching and
216 Frame Modification requirements.
218 .. code-block:: console
222 | Table 0 | table#0 - Match table. Flows designed to force 5 & 10
223 | | tuple matches go here.
229 +--------------+ table#1 - Routing table. Flows to route packets between
231 | Table 1 | The chosen port is communicated to subsequent tables by
232 | | setting the metadata value to the egress port number.
233 | | Generally this table is set-up by by the
234 +--------------+ vSwitchController.
238 +--------------+ table#2 - Frame modification table. Frame modification
239 | | flow rules are isolated in this table so that they can
240 | Table 2 | be turned on or off without affecting the routing or
241 | | tuple-matching flow rules. This allows the frame
242 | | modification and tuple matching required by the tests
243 | | in the VSWITCH PERFORMANCE FOR TELCO NFV test
244 +--------------+ specification to be independent of the Deployment
245 | Scenario set up by the vSwitchController.
250 | Table 3 | table#3 - Egress table. Egress packets on the ports
251 | | setup in Table 1.