Report: CSIT Framework Documentation
[csit.git] / docs / report / csit_framework_documentation / csit_design.rst
1 .. _csit-design:
2
3 CSIT Design
4 ===========
5
6 FD.io CSIT system design needs to meet continuously expanding
7 requirements of FD.io projects including VPP, related sub-systems (e.g.
8 plugin applications, DPDK drivers) and FD.io applications (e.g. DPDK
9 applications), as well as growing number of compute platforms running
10 those applications. With CSIT project scope and charter including both
11 FD.io continuous testing AND performance trending/comparisons, those
12 evolving requirements further amplify the need for CSIT framework
13 modularity, flexibility and usability.
14
15 Design Hierarchy
16 ----------------
17
18 CSIT follows a hierarchical system design with SUTs and DUTs at the
19 bottom level of the hierarchy, presentation level at the top level and a
20 number of functional layers in-between. The current CSIT system design
21 including CSIT framework is depicted in the figure below.
22
23 .. only:: latex
24
25     .. raw:: latex
26
27        \begin{figure}[H]
28        \centering
29            \includesvg[width=0.90\textwidth]{../_tmp/src/csit_framework_documentation/csit_design_picture}
30            \label{fig:csit_design_picture}
31        \end{figure}
32
33 .. only:: html
34
35     .. figure:: csit_design_picture.svg
36         :alt: FD.io CSIT system design
37         :align: center
38
39    *FD.io CSIT system design*
40
41 A brief bottom-up description is provided here:
42
43 #. SUTs, DUTs, TGs
44
45    - SUTs - Systems Under Test;
46    - DUTs - Devices Under Test;
47    - TGs - Traffic Generators;
48
49 #. Level-1 libraries - Robot and Python
50
51    - Lowest level CSIT libraries abstracting underlying test environment, SUT,
52      DUT and TG specifics;
53    - Used commonly across multiple L2 KWs;
54    - Performance and functional tests:
55
56      - L1 KWs (KeyWords) are implemented as RF libraries and Python
57        libraries;
58
59    - Performance TG L1 KWs:
60
61      - All L1 KWs are implemented as Python libraries:
62
63        - Support for TRex only today;
64        - CSIT IXIA drivers in progress;
65
66    - Performance data plane traffic profiles:
67
68      - TG-specific stream profiles provide full control of:
69
70        - Packet definition – layers, MACs, IPs, ports, combinations thereof
71          e.g. IPs and UDP ports;
72        - Stream definitions - different streams can run together, delayed,
73          one after each other;
74        - Stream profiles are independent of CSIT framework and can be used
75          in any T-rex setup, can be sent anywhere to repeat tests with
76          exactly the same setup;
77        - Easily extensible – one can create a new stream profile that meets
78          tests requirements;
79        - Same stream profile can be used for different tests with the same
80          traffic needs;
81
82    - Functional data plane traffic scripts:
83
84      - Scapy specific traffic scripts;
85
86 #. Level-2 libraries - Robot resource files:
87
88    - Higher level CSIT libraries abstracting required functions for executing
89      tests;
90    - L2 KWs are classified into the following functional categories:
91
92      - Configuration, test, verification, state report;
93      - Suite setup, suite teardown;
94      - Test setup, test teardown;
95
96 #. Tests - Robot:
97
98    - Test suites with test cases;
99    - Functional tests using VIRL environment:
100
101      - VPP;
102      - Honeycomb;
103      - NSH_SFC;
104
105    - Performance tests using physical testbed environment:
106
107      - VPP;
108      - DPDK-Testpmd;
109      - DPDK-L3Fwd;
110
111    - Tools:
112
113      - Documentation generator;
114      - Report generator;
115      - Testbed environment setup ansible playbooks;
116      - Operational debugging scripts;
117
118 Test Lifecycle Abstraction
119 --------------------------
120
121 A well coded test must follow a disciplined abstraction of the test
122 lifecycles that includes setup, configuration, test and verification. In
123 addition to improve test execution efficiency, the commmon aspects of
124 test setup and configuration shared across multiple test cases should be
125 done only once. Translating these high-level guidelines into the Robot
126 Framework one arrives to definition of a well coded RF tests for FD.io
127 CSIT. Anatomy of Good Tests for CSIT:
128
129 #. Suite Setup - Suite startup Configuration common to all Test Cases in suite:
130    uses Configuration KWs, Verification KWs, StateReport KWs;
131 #. Test Setup - Test startup Configuration common to multiple Test Cases: uses
132    Configuration KWs, StateReport KWs;
133 #. Test Case - uses L2 KWs with RF Gherkin style:
134
135    - prefixed with {Given} - Verification of Test setup, reading state: uses
136      Configuration KWs, Verification KWs, StateReport KWs;
137    - prefixed with {When} - Test execution: Configuration KWs, Test KWs;
138    - prefixed with {Then} - Verification of Test execution, reading state: uses
139      Verification KWs, StateReport KWs;
140
141 #. Test Teardown - post Test teardown with Configuration cleanup and
142    Verification common to multiple Test Cases - uses: Configuration KWs,
143    Verification KWs, StateReport KWs;
144 #. Suite Teardown - Suite post-test Configuration cleanup: uses Configuration
145    KWs, Verification KWs, StateReport KWs;
146
147 RF Keywords Functional Classification
148 -------------------------------------
149
150 CSIT RF KWs are classified into the functional categories matching the test
151 lifecycle events described earlier. All CSIT RF L2 and L1 KWs have been grouped
152 into the following functional categories:
153
154 #. Configuration;
155 #. Test;
156 #. Verification;
157 #. StateReport;
158 #. SuiteSetup;
159 #. TestSetup;
160 #. SuiteTeardown;
161 #. TestTeardown;
162
163 RF Keywords Naming Guidelines
164 -----------------------------
165
166 Readability counts: "..code is read much more often than it is written."
167 Hence following a good and consistent grammar practice is important when
168 writing :abbr:`RF (Robot Framework)` KeyWords and Tests. All CSIT test cases
169 are coded using Gherkin style and include only L2 KWs references. L2 KWs are
170 coded using simple style and include L2 KWs, L1 KWs, and L1 python references.
171 To improve readability, the proposal is to use the same grammar for both
172 :abbr:`RF (Robot Framework)` KW styles, and to formalize the grammar of English
173 sentences used for naming the :abbr:`RF (Robot Framework)` KWs. :abbr:`RF (Robot
174 Framework)` KWs names are short sentences expressing functional description of
175 the command. They must follow English sentence grammar in one of the following
176 forms:
177
178 #. **Imperative** - verb-object(s): *"Do something"*, verb in base form.
179 #. **Declarative** - subject–verb–object(s): *"Subject does something"*, verb in
180    a third-person singular present tense form.
181 #. **Affirmative** - modal_verb-verb-object(s): *"Subject should be something"*,
182    *"Object should exist"*, verb in base form.
183 #. **Negative** - modal_verb-Not-verb-object(s): *"Subject should not be
184    something"*, *"Object should not exist"*, verb in base form.
185
186 Passive form MUST NOT be used. However a usage of past participle as an
187 adjective is okay. See usage examples provided in the Coding guidelines
188 section below. Following sections list applicability of the above
189 grammar forms to different :abbr:`RF (Robot Framework)` KW categories. Usage
190 examples are provided, both good and bad.
191
192 Coding guidelines
193 -----------------
194
195 Coding guidelines can be found on `Design optimizations wiki page
196 <https://wiki.fd.io/view/CSIT/Design_Optimizations>`_.