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