\section{Forwarding functional}
\label{chap:fwd-functional}

This tests aims at verifying simple forwarding capabilities of the switch. The configuration 
that should be used throughout all the tests in this section, unless explicitly stated.


\paragraph{Test setup}

Spirent tester (sTester) and WR Switch (wrSwitch) under test with ports connected in the following way
\begin{table}[ht!]
\begin{tabular}{ l  l l}
sTester-port:0  & to & wrSwitch-port:0  \\
sTester-port:1  & to & wrSwitch-port:17  \\
sTester-port:2  & to & wrSwitch-port:1  \\
sTester-port:3  & to & wrSwitch-port:16  \\
wrSwitch-port:2  & to & wrSwitch-port:3  \\
wrSwitch-port:4  & to & wrSwitch-port:5  \\
wrSwitch-port:6  & to & wrSwitch-port:7  \\
wrSwitch-port:8  & to & wrSwitch-port:9  \\
wrSwitch-port:10  & to & wrSwitch-port:11  \\
wrSwitch-port:12  & to & wrSwitch-port:13  \\
wrSwitch-port:14  & to & wrSwitch-port:16  \\
\end{tabular}
\end{table}

\paragraph{Switch Configuration}

Default configuration.

\paragraph{Tester Configuration}
\begin{table}[ht!]
\begin{tabular}{ l  l l l}
FRAME  & size   & 64bytes \\
       & load   & 10 \%   \\
       & number & 1000    \\
\end{tabular}
\end{table}

\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Unicast}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
No learning shall be performed before this tests.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Unicast -- one-to-one stream}

\paragraph{Description} 

Unicast forwarding.

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l l}
VLAN  & port 0:      & VID=0, & QMODE=unqualified\\
      & port 1:      & VID=0, & QMODE=unqualified\\
      & port 16:     & VID=0, & QMODE=unqualified\\
      & port 17:     & VID=0, & QMODE=unqualified\\
      & other ports: & VID=0, & QMODE=trunk (to avoid loops)\\
\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1D:        & no VLAN tag, dstMAC=unicast  \\
        &                &                  \\ 
TRAFFIC & send to:       & port 0, 1,16,17  \\
        & receive on:    & port 0, 1,16,17  \\
STREAMS & bi-directional & port 0  $<->$ port 1  \\
\end{tabular}
\end{table}


\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are received on port 1
\item All frames sent to port 1 are received on port 0
\item A limited number of frames from ports 0 and 1 received on ports 16 and 17 (unrecognized
      broadcast before learnt by RTUd)
\end{itemize*}

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Unicast -- many-to-many stream}

\paragraph{Description} 

Unicast forwarding.

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l l}
VLAN  & port 0:      & VID=0, & QMODE=unqualified\\
      & port 1:      & VID=0, & QMODE=unqualified\\
      & port 16:     & VID=0, & QMODE=unqualified\\
      & port 17:     & VID=0, & QMODE=unqualified\\
      & other ports: & VID=0, & QMODE=trunk (to avoid loops)\\
\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1D:         & no VLAN tag, dstMAC=unicast  \\
        &                 &                  \\ 
TRAFFIC & send to:        & port 0, 1,16,17  \\
        & receive on:     & port 0, 1,16,17  \\
STREAMS & uni-directional & port 0  $->$ port 1, 16, 17  \\
        & uni-directional & port 1  $->$ port 0, 16, 17  \\
        & uni-directional & port 16 $->$ port 0, 1,  17  \\
        & uni-directional & port 17 $->$ port 0, 1,  16  \\
\end{tabular}
\end{table}


\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are received on ports 1, 16, 17
\item All frames sent to port 17 are received on ports 0, 1, 16
\item All frames sent to port 1 are received on ports 0, 16, 17
\item All frames sent to port 16 are received on ports 0, 1, 17
\end{itemize*}

\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{VLANs}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
This tests serve the purpose of verifying that basic VLAN-related functions work.

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{VLAN-limited forwardng}

\paragraph{Description} 

The test verifies whether basic forwarding within VLAN works (i.e. frames are forwarded to
the ports only in the specified VLAN).

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l l}
VLAN  & port 0:      & VID=\{0, 1\}, & QMODE=trunk\\
      & port 1:      & VID=\{0, 1\}, & QMODE=trunk\\
      & other ports: & VID=0,        & QMODE=trunk\\
\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1Q:     & VID=1, PRIO=1, dstMAC=unicast \\
        &             &               \\ 
TRAFFIC & send to:    & port 0, 1        \\
        & receive on: & port 0, 1        \\
        & monitor:    & other ports   \\
\end{tabular}
\end{table}

\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are received only on port 1
\item All frames sent to port 1 are received only on port 0
\item All received frames are tagged with VID 1 and priority 1
\item No frames received on ports other than 0 \& 1
\item Pstats counters indcate proper priority
\end{itemize*}

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{VLAN separation of traffic}

\paragraph{Description} 

Verifies correct blocknig of Q-tagged frames

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l l}
VLAN  & port 0:      & VID=\{0, 1\}, & QMODE=unqualified\\
      & port 1:      & VID=0       , & QMODE=unqualified\\
      & other ports: & VID=0,      , & QMODE=unqualified\\
\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1Q:     & VID=1, PRIO=0, dstMAC=broadcast \\
        &             &               \\ 
TRAFFIC & send to:    & port 0, 1     \\
        & receive on: & port 0, 1     \\
        & monitor:    & other ports   \\
\end{tabular}
\end{table}

\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are dropped 
\item All frames sent to port 1 are received only on port 0 
\item All received frames are tagged with VID 1 and priority 0
\item No frames received on ports other than 0
\end{itemize*}

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Output priority queuing}

\paragraph{Description} 

Verify that frames with different priorities are queued properly - probably need to define
many STREAMS with traffic of different priorities between the same ports of Spirent tester.
It might be that Spirent has such tests.

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Per-VLAN prio override}

\paragraph{Description} 

Check whether overriding of priority per VLAN works - possibly by using HP detection or 
pStats counters. TODO

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Tagging}

\paragraph{Description} 

The test verifies whether tagging, untagging and basic forwarding within VLAN works 

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{l l l l l}
VLAN  & port 0:      & VID=\{0, 1\}, & QMODE=access,  FIX\_PRIO=1,  PRIO\_VAL=3, PVID=1\\
      & port 1:      & VID=\{0, 1\}, & QMODE=access,  FIX\_PRIO=1,  PRIO\_VAL=3, PVID=1\\
      & other ports: & VID=0,        & QMODE=trunk\\
\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1D:     & no VLAN tag, dstMAC=unicast \\
        &             &               \\ 
TRAFFIC & send to:    & port 0, 1       \\
        & receive on: & port 0, 1        \\
        & monitor:    & other ports   \\
\end{tabular}
\end{table}

\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are received only on port 1
\item All frames sent to port 1 are received only on port 0
\item All received frames are tagged with VID 1 and priority 3
\item No frames received on ports other than 0 \& 1
\end{itemize*}

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Untagging}

\paragraph{Description} 

The test verifies whether tagging, untagging and basic forwarding within VLAN works 

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{l l l l l}
VLAN  & port 0:      & VID=\{0, 1\}, & QMODE=trunk, VID-untagged=1\\
      & port 1:      & VID=\{0, 1\}, & QMODE=trunk, VID-untagged=1\\
      & other ports: & VID=0,        & QMODE=trunk\\
\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1Q:     & VID=1, PRIO=0 \\
        &             &               \\ 
TRAFFIC & send to:    & port 0,1      \\
        & receive on: & port 0,1      \\
        & monitor:    & other ports   \\
\end{tabular}
\end{table}

\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are received only on port 1
\item All frames sent to port 1 are received only on port 0
\item All received frames are untagged  (i.e. 802.1 with no VLAN tag)
\item No frames received on ports other than 0 \& 1
\end{itemize*}

\newpage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Snake}

\paragraph{Description} 

The test verifies whether tagging, untagging and basic forwarding within VLAN works 

\paragraph{Switch Configuration} 

\begin{table}[ht!]
\begin{tabular}{l l l l l}
VLAN  & port 0:      & VID=\{0, 1\}, & QMODE=access, FIX\_PRIO=0, PVID=1, VID-untagged=1\\
      & port 1:      & VID=\{0, 2\}, & QMODE=access, FIX\_PRIO=0, PVID=2, VID-untagged=2\\
      & port 2:      & VID=\{0, 2\}, & QMODE=access, FIX\_PRIO=0, PVID=2, VID-untagged=2\\
      & port 3:      & VID=\{0, 3\}, & QMODE=access, FIX\_PRIO=0, PVID=3, VID-untagged=3\\
      & port 4:      & VID=\{0, 3\}, & QMODE=access, FIX\_PRIO=0, PVID=3, VID-untagged=3\\
      & port 5:      & VID=\{0, 4\}, & QMODE=access, FIX\_PRIO=0, PVID=4, VID-untagged=4\\
      & port 6:      & VID=\{0, 4\}, & QMODE=access, FIX\_PRIO=0, PVID=4, VID-untagged=4\\
      & port 7:      & VID=\{0, 5\}, & QMODE=access, FIX\_PRIO=0, PVID=5, VID-untagged=5\\
      & port 8:      & VID=\{0, 5\}, & QMODE=access, FIX\_PRIO=0, PVID=5, VID-untagged=5\\
      & port 9:      & VID=\{0, 6\}, & QMODE=access, FIX\_PRIO=0, PVID=6, VID-untagged=6\\
      & port 10:     & VID=\{0, 6\}, & QMODE=access, FIX\_PRIO=0, PVID=6, VID-untagged=6\\
      & port 11:     & VID=\{0, 7\}, & QMODE=access, FIX\_PRIO=0, PVID=7, VID-untagged=7\\
      & port 12:     & VID=\{0, 7\}, & QMODE=access, FIX\_PRIO=0, PVID=7, VID-untagged=7\\
      & port 13:     & VID=\{0, 8\}, & QMODE=access, FIX\_PRIO=0, PVID=8, VID-untagged=8\\
      & port 14:     & VID=\{0, 8\}, & QMODE=access, FIX\_PRIO=0, PVID=8, VID-untagged=8\\
      & port 15:     & VID=\{0, 9\}, & QMODE=access, FIX\_PRIO=0, PVID=9, VID-untagged=9\\
      & port 16:     & VID=\{0, 9\}, & QMODE=access, FIX\_PRIO=0, PVID=9, VID-untagged=9\\
      & port 17:     & VID=\{0, 1\}, & QMODE=access, FIX\_PRIO=0, PVID=1, VID-untagged=1\\

\end{tabular}
\end{table}

\paragraph{Tester Configuration} 

\begin{table}[ht!]
\begin{tabular}{ l  l l }
FRAME   & 802.1D:     & no VLAN tag, dstMAC=broadcast \\
        &             &               \\ 
TRAFFIC & send to:    & port 0,1,2,3  \\
        & receive on: & port 0,1,2,3  \\
\end{tabular}
\end{table}

\paragraph{Test passed if}

\begin{itemize*}
\item All frames sent to port 0 are received only on port 17
\item All frames sent to port 17 are received only on port 0
\item All frames sent to port 1 are received only on port 16
\item All frames sent to port 16 are received only on port 1
\item All received frames are untagged  (i.e. 802.1 with no VLAN tag)
\end{itemize*}
