Add results table
[tt2015.git] / a2 / 1cases.tex
1 \subsection{Preflight checklist}
2 Before actual certification is commenced we perform a manual test using a
3 checklist.
4 If any of the checks fail we immediately reject the product.
5 The checklist is given in the table below. All commands in \texttt{monospace}
6 are to be run in a terminal. Commands prefixed with a \texttt{\#} should be run
7 with root permissions. Commands prefixed with a \texttt{\$} should be run with
8 user permissions.
9
10 \begin{longtable}{|l|rp{.8\linewidth}|}
11 \hline
12 Check 1 & \multicolumn{2}{l|}{Get the SUT in a workable state.}\\
13 \hline
14 \multirow{3}{*}{Course of action}
15 & 1. & Import the VirtualBox image into VirtualBox.\\
16 & 2. & Boot the vm.\\
17 & 3. & Verify the SUT booted successfully and the network modules are
18 loaded.\\
19 \hline
20 Passed & \multicolumn{2}{l|}{\textit{Yes/No}}\\
21 \hline\hline
22 Check 2 & \multicolumn{2}{l|}{Verify the SUT is complete.}\\
23 \hline
24 \multirow{5}{*}{Course of action}
25 & 1. & Boot the SUT as in \emph{Check 1}.\\
26 & 2. & Verify the loopback device exists by running
27 \texttt{\$ ifconfig}.\\
28 & 3. & Verify the \emph{echo-server} is present on the system by running
29 \texttt{\$ file code/server/Main.java}\\
30 & 4. & Verify \emph{Scapy} is present on the system by running
31 \texttt{\$ scapy}.\\
32 & 5. & Verify all scripts used for testing are present on the system.\\
33 \hline
34 Passed & \multicolumn{2}{l|}{\textit{Yes/No}}\\
35 \hline\hline
36 Check 3 & \multicolumn{2}{l|}{Initialize the testing environment..}\\
37 \hline
38 \multirow{5}{*}{Course of action}
39 & 1. & Boot the SUT as in \emph{Check 1}.\\
40 & 2. & Setup iptables by executing
41 \texttt{\# code/iptables.sh}~\footnote{The IPTables script ensures
42 that the OS does not drop packets due to an the unknown source.}\\
43 & 3. & Navigate to the working directory by running
44 \texttt{\$ cd /home/student/tt2015}\\
45 & 4. & Compile the echo server by running
46 \texttt{\# cd code/server \&\& make \&\& cd -}\\
47 & 5. & Start the echo server by running
48 \texttt{\# cd code/server \&\& java Main}\\
49 \hline
50 Passed & \multicolumn{2}{l|}{\textit{Yes/No}}\\
51 \hline\hline
52 Check 4 & \multicolumn{2}{l|}{Test the tool environment.}\\
53 \hline
54 \multirow{3}{*}{Course of action}
55 & 1. & Initialize the SUT as in \emph{Check 3}\\
56 & 2. & Execute the test script by running
57 \texttt{\# code/client/helloworld.py}\\
58 & 3. & Verify the console displays a success message.\\
59 \hline
60 Passed & \multicolumn{2}{l|}{\textit{Yes/No}}\\
61 \hline\hline
62 Check 5 & \multicolumn{2}{l|}{All test inputs and scripts are present.}\\
63 \hline
64 \multirow{2}{*}{Course of action}
65 & 1. & Boot the SUT as in \emph{Check 1}.\\
66 & 2. & Verify that the test generation script is present by running
67 \texttt{\$ file code/client/test.py}\\
68 \hline
69 Passed & \multicolumn{2}{l|}{\textit{Yes/No}}\\
70 \hline
71 \caption{Preflight checklist\label{tbl:preflight}}
72 \end{longtable}
73
74 \subsection{Testing of SUT}
75 The SUT is a series of services for other computer programs with no end-user
76 facing interface. Therefore the SUT will be tested solely by calling it's
77 services through various automated scripts. An automated test suite will be
78 available which executes all these automated scripts and aggregates their
79 results to asses whether or not the SUT has passed the test.
80
81 The implementation of the SUT is tested using black box testing techniques. A
82 series of tests asses the correctness of the implementation with regards to the
83 TCP specification. These tests are specified in Table~\textbf{referentie naar
84 tests-tabel}. The test cases aim to cover the most interesting parts of the TCP
85 specification.
86
87 To cover the TCP specification as complete as possible while still maintaining
88 a feasible test suite the tests are divided into equivalence partitions. Below
89 these partitions are given.
90
91 \begin{enumerate}
92 \item \emph{Number of segments} in request~\footnote{A request is
93 considered establishing a connection (handshake) and a number of
94 payload segments}
95 \begin{enumerate}
96 \item 0 payload segments
97 \item 1 payload segments
98 \item n=small payload segments (1 byte)
99 \item n=big payload segments (65495 bytes)
100 \end{enumerate}
101 \item \emph{source port}
102 \begin{enumerate}
103 \item Correct
104 \item Incorrect
105 \end{enumerate}
106 \item \emph{destination port}
107 \begin{enumerate}
108 \item Correct
109 \item Incorrect
110 \end{enumerate}
111 \item Bit errors in \emph{payload}
112 \begin{enumerate}
113 \item Correct payload
114 \item Payload with bit flips that do not show in checksum
115 \item Payload with bit flips that do show in checksum
116 \end{enumerate}
117 \item \emph{checksum}
118 \begin{enumerate}
119 \item Correct
120 \item Incorrect
121 \end{enumerate}
122 \item \emph{Segment order}
123 \begin{enumerate}
124 \item Correct
125 \item Out of order
126 \item Missing Segments
127 \end{enumerate}
128 \end{enumerate}
129
130 These partitions were chosen since they correspond to key parts of the TCP
131 specification.
132
133 TCP segments are send over a TCP connection from a \emph{source} to a \emph{destination port}. Therefore segments which are received that have a
134 source or destination port set to an incorrect value should not be regarded
135 as segments belonging to the connection by the SUT.
136
137 TCP uses a \emph{checksum} to catch any error introduced in headers, when this
138 checksum does not match the actual computed checksum the SUT should
139 disregard the received segment.
140
141 The TCP checksum is also an inherently weak one, as it is simply the
142 bitwise negation of the addition, in ones complement arithmetic,
143 of all 16 bit words in the header and data of the segment (excluding the
144 checksum itself). Therefore any \emph{bit error} where the ones complement value
145 of one word
146 increases by one, and the value of another decreases by one, is undetected.
147 The SUT should exhibit the same behavior and accept packets where these type
148 of bit errors occur.
149
150 TCP guarantees that segments are delivered \emph{in order}
151 ,even when they are received
152 out of order and that missing segments are resend. The SUT should
153 exhibit the same behavior. If segments are received out of order it should
154 either reassemble them when the missing packet has arrived or request them to
155 be resend when the Missing segments should be re-requested (by ACK-ing
156 the correct sequence number).
157
158 \bigskip
159
160 Partitions 2 to 6 are tested using pairwise testing to keep the number of test
161 cases feasible. The pairs are then all *except some where it does not make sense
162 to do so) tested with the different request sizes of partition 1.
163
164 This is expressed in Table~\ref{tbl:testpairs}. In this table the first five
165 columns represent the different options for the partitions 2 to 6 of the above
166 enumeration. The last four columns are the different number segments as
167 described in the partition 1 of the above enumeration. These cells identify
168 individual test cases by a number. An \xmark in the cell indicates that this
169 test case can not be created as it is not possible with that number of segments
170 (eg. sending segments out of order when the number of segments is 1).
171
172 \setcounter{TCC}{1}
173 \begin{table}[H]
174 \centering
175 \begin{tabular}{|l|l|l|l|l|l||l|l|l|l|}
176 \hline
177 & \multicolumn{9}{c|}{\textbf{Partition}}\\
178 \hline
179 & 4 & 5 & 3 & 6 & 2 & 1a & 1b & 1c & 1d\\
180 \hline\hline
181 \multirow{9}{*}{Instance}
182 & a & a & a & a & a & \doTCC & \doTCC & \doTCC & \doTCC\\
183 & a & b & b & c & b & \xmark & \xmark & \doTCC & \doTCC\\
184 & c & a & b & a & b & \xmark & \xmark & \doTCC & \doTCC\\
185 & c & b & a & c & a & \xmark & \xmark & \doTCC & \doTCC\\
186 & b & a & b & c & a & \xmark & \xmark & \doTCC & \doTCC\\
187 & b & b & a & b & b & \xmark & \xmark & \doTCC & \doTCC\\
188 & c & b & b & a & b & \xmark & \doTCC & \doTCC & \doTCC\\
189 & b & b & b & a & b & \xmark & \doTCC & \doTCC & \doTCC\\
190 & a & b & b & b & a & \xmark & \xmark & \doTCC & \doTCC\\
191 \hline
192 \end{tabular}
193 \caption{Combinations of test cases}
194 \label{tbl:testpairs}
195 \end{table}
196
197 \subsection{Quality, completeness and coverage of tests}
198
199 The network packets used in testing are constructed from prerecorded, known to
200 be correct, network traffic. These packets are then modified with well used and
201 field tested tools. Due to this the chance of errors in the test cases is quite
202 low. However, no formal proof of correctness of the test cases is present, this
203 means that any defects found might not be the result of a fault in the SUT.
204 Therefore detected defects should only indicate there is a high chance that
205 there is a fault in the SUT and can not result directly in the conclusion that
206 there actually is one.
207
208 \bigskip
209
210 Due to the nature of black-box testing coverage of the code in the
211 implementation of the SUT is unknown. However completeness of the tests over
212 the specification of the SUT can be assessed.
213
214 \bigskip
215
216 Due to the clear and exhaustive specification of TCP the completeness of the
217 test suite can be clearly assessed.
218
219 As always, $100\%$ completeness is not feasible, therefore test cases are
220 carefully selected to cover the most interesting parts of the TCP specification
221 to ensure a complete but feasible test suite.
222
223 To further increase the coverage of the test suites tests are randomized. The
224 tests which test the handling of \emph{bit errors}, changes in the \emph{packet
225 order} and \emph{dropped packets} randomize where they introduce an error. The
226 test suite runs these tests multiple times to increase the likelihood that they
227 discover a fault which is only present when an error occurs in a certain
228 position.
229
230 To further decrease the number of tests needed test cases are divided into
231 equivalence partitions and the combination of cases as described in
232 Table~\ref{tbl:testpairs} ensures that all partitions are
233 covered and the number of individual tests is still feasible.
234
235
236 %
237 % wat ik ook probeer ik krijg de eerste collum
238 % zijn tekst niet verticaal gecentered
239 %
240
241
242 \subsection{Test suite}
243
244 Before executing the test suite the test environment has to be initialized.
245
246 \begin{enumerate}
247 \item Boot the vm using VirtualBox.
248 \item Setup iptables by executing \texttt{\# code/iptables.sh}
249 \item Navigate to the working directory by running
250 \texttt{\$ cd /home/student/tt2015}
251 \item Start the echo server by running
252 \texttt{\# cd code/server \&\& Java Main}
253 \end{enumerate}
254
255 \subsubsection{Preflight checks}
256 The we do the preflight checks as defined in Table~\ref{tbl:preflight}.
257
258 \subsubsection{Test Cases}
259 If the SUT passes the preflight checks the actual test cases can be executed.
260 Table~\ref{tbl:testcases} shows the expected results of each of the test cases
261 described in Table~\ref{table:testpairs}.
262
263 \setcounter{TCC}{1}
264 \begin{table}[H]
265 \centering
266 \begin{tabular}{|l|p{.7\linewidth}|}
267 \hline
268 Test number & Expected results\\
269 \hline\hline
270 \doTCC & An ACK\# of the send sequence number + 1.\\ \hline
271 \doTCC & An ACK\# of the sequence number of the last send segment + the
272 size of the payload of that segment.\\ \hline
273 \doTCC & An ACK\# of the sequence number of the last send segment + the
274 size of the payload of that segment.\\ \hline
275 \doTCC & An ACK\# of the sequence number of the last send segment + the
276 size of the payload of that segment.\\ \hline
277 \doTCC & The ACK\# for the SEQ\# of the first segments which is
278 corrupted is received for each consecutive segment send.\\
279 $\vdots$ & \\
280 \setcounter{TCC}{14}
281 \doTCC & The ACK\# for the SEQ\# of the first segments which is
282 corrupted is received for each consecutive segment send.\\ \hline
283 \doTCC & The segment is not attributed to the current connection
284 and therefore no ACK\# is received. \\ \hline
285 \doTCC & The ACK\# for the SEQ\# of the first segments which is
286 corrupted is received for each consecutive segment send.\\ \hline
287 \doTCC & The ACK\# for the SEQ\# of the first segments which is
288 corrupted is received for each consecutive segment send.\\ \hline
289 \doTCC & The segment is not attributed to the current connection
290 and therefore no ACK\# is received. \\ \hline
291 \doTCC & The ACK\# for the SEQ\# of the first segments which is
292 corrupted is received for each consecutive segment send.\\ \hline
293 \doTCC & The ACK\# for the SEQ\# of the first segments which is
294 corrupted is received for each consecutive segment send.\\ \hline
295 \doTCC & The ACK\# for the SEQ\# of the first segments which is
296 corrupted is received for each consecutive segment send.\\ \hline
297 \doTCC & The ACK\# for the SEQ\# of the first segments which is
298 corrupted is received for each consecutive segment send.\\ \hline
299 \hline
300 \end{tabular}
301 \caption{Expected results of test cases}
302 \label{table:preflightresults}
303 \end{table}
304
305 % Bij Ramons aanwezigheid
306 % Paul Vitero (linkerkant lange gang)
307 % verdieping Mercator
308
309 %Before every test case use the following steps to initialize the testing environment.
310 %
311 %\begin{enumerate}
312 %\item Boot the vm using VirtualBox.
313 %\item Setup iptables by executing \texttt{\# code/iptables.sh}
314 %\item Navigate to the working directory by running \texttt{\$ cd /home/student/tt2015}
315 %\item Start the echo server by running \texttt{\# cd code/server \&\& java Main}
316 %\end{enumerate}
317 %
318 %\begin{longtable}{|p{.2\linewidth}|p{.8\linewidth}|}
319 %\hline
320 %Nr & 1 \\\hline
321 %Title & Single valid request with 1byte payload. \\\hline
322 %Input & Generated packets. \\\hline
323 %Expected output & Packets echoed back by Echo-Server. \\\hline
324 %\multirow{2}{*}{Course of action}
325 %& 1. Use the steps listed above in order to start the SUT. \\
326 %& 2. Execute the script by running \texttt{\# code/client/tests/1.py} \\\hline
327 %Valid trace & Verify that the script prints 'Success'. \\\hline
328 %\hline
329 %
330 %Nr & 2 \\\hline
331 %Title & Single valid request with 65495bytes payload. \\\hline
332 %Input & Generated packets. \\\hline
333 %Expected output & Packets echoed back by Echo-Server. \\\hline
334 %\multirow{2}{*}{Course of action}
335 %& 1. Use the steps listed above in order to start the SUT. \\
336 %& 2. Execute the script by running \texttt{\# code/client/tests/2.py} \\\hline
337 %Valid trace & Verify that the script prints 'Success'. \\\hline
338 %\hline
339 %
340 %Nr & 3 \\\hline
341 %Title & 5 valid requests with 1byte payload. \\\hline
342 %Input & Generated packets. \\\hline
343 %Expected output & Packets echoed back by Echo-Server, in the same order as the client sent them. \\\hline
344 %\multirow{2}{*}{Course of action}
345 %& 1. Use the steps listed above in order to start the SUT. \\
346 %& 2. Execute the script by running \texttt{\# code/client/tests/3.py} \\\hline
347 %Valid trace & Verify that the script prints 'Success'. \\\hline
348 %\hline
349 %
350 %Nr & 4 \\\hline
351 %Title & 5 valid requests with 65495bytes payload. \\\hline
352 %Input & Generated packets with 65495bytes payload. \\\hline
353 %Expected output & Packets echoed back by Echo-Server, in the same order as the client sent them. \\\hline
354 %\multirow{2}{*}{Course of action}
355 %& 1. Use the steps listed above in order to start the SUT. \\
356 %& 2. Execute the script by running \texttt{\# code/client/tests/4.py} \\\hline
357 %Valid trace & Verify that the script prints 'Success'. \\\hline
358 %\hline
359 %
360 %Nr & 5 \\\hline
361 %Title & 5 valid requests with 1byte payload sent out of order. \\\hline
362 %Input & Generated packets with 1byte payload, two packets are swapped in position. \\\hline
363 %Expected output & All requests sent up to and including
364 %the swapped packet with the lowest sequence number, the remaining packets are dropped. \\\hline
365 %\multirow{2}{*}{Course of action}
366 %& 1. Use the steps listed above in order to start the SUT. \\
367 %& 2. Execute the script by running \texttt{\# code/client/tests/5.py} \\\hline
368 %Valid trace & Verify that the script prints 'Success'. \\\hline
369 %\hline
370 %\end{longtable}
371
372 %\begin{tabularx}{\linewidth}{| l | X|}
373 %\hline
374 %Nr & 1 \\\hline
375 %Title & Single valid request. \\\hline
376 %Input & Pcap file with prerecorded valid packets. \\\hline
377 %Expected output & Pcap file with valid response to request. \\\hline
378 %Course of action & \begin{enumerate}
379 % \item Execute \emph{./scripts/tests/case1-single-valid.sh}
380 % \item Load \emph{output/case1.pcap} with ...
381 %\end{enumerate} \\\hline
382 %Valid trace & \begin{enumerate}
383 % \item \textbf{Hier packets benoemen?}
384 %\end{enumerate} \\\hline
385 %\end{tabularx}
386 %
387 %\begin{tabularx}{\linewidth}{| l | X|}
388 % \hline
389 % Nr & 2 \\\hline
390 %Title & Single request with corrupted checksum. \\\hline
391 % Input & Pcap file used as \emph{test-case 1} input. \\\hline
392 % Expected output & No response from SUT, logs with rejected packets. \\\hline
393 % Course of action & \begin{enumerate}
394 % \item Load input pcap file into ....
395 % \item Corrupt checksum of loaded packets.
396 % \item Save resulting packets as pcap file.
397 % \item Load new pcap file into ...
398 % \item Replay new pcap file.
399 % \item Record SUT response using...
400 % \item Extract log with rejected packets.
401 % \item Save recorded packets as a pcap file.
402 % \item Analyze packets in resulting file.
403 % \end{enumerate} \\\hline
404 % Valid trace & \begin{enumerate}
405 % \item \textbf{Aangeven welke packets corrupted zijn?}
406 % \end{enumerate} \\\hline
407 %\end{tabularx}
408 %\end{table}