esds/manual/manual.tex

179 lines
6 KiB
TeX
Raw Normal View History

2022-09-12 10:45:38 +02:00
\documentclass[11pt]{article}
% Packages
\usepackage{fullpage}
\usepackage{minted}
\usepackage{booktabs}
\usepackage{xspace}
\usepackage{graphicx}
2022-09-13 19:19:34 +02:00
\usepackage{makecell}
2022-09-12 10:45:38 +02:00
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{svg}
2022-09-12 13:22:46 +02:00
\usepackage[most]{tcolorbox}
% Packages setups
\graphicspath{{./assets}}
2022-09-12 10:45:38 +02:00
% Commands
\newcommand{\stateoff}{"\textit{off}"\xspace}
\newcommand{\stateon}{"\textit{on}"\xspace}
2022-09-12 11:28:20 +02:00
\newcommand{\version}{\InputIfFileExists{version}{}{version}}
2022-09-13 16:32:15 +02:00
\newcommand*{\addsource}[2]{\vspace{0.3cm}\begin{tcolorbox}[breakable,enhanced,arc=1.4mm,arc is angular,title=\textbf{\small#1}]\inputminted[breaklines,fontsize=\scriptsize]{#2}{#1}\end{tcolorbox}}
2022-09-13 19:19:34 +02:00
\newenvironment{tabminted}[1]
2022-09-13 19:56:22 +02:00
{\VerbatimEnvironment\begin{minipage}{2.65in}\begin{tcolorbox}[frame empty]\begin{minted}{#1}}
2022-09-13 19:19:34 +02:00
{\end{minted}\end{tcolorbox}\end{minipage}}
2022-09-12 10:45:38 +02:00
% Document
\begin{document}
% Title page
\makeatletter
\begin{titlepage}
\begin{center}
\Huge
2022-09-12 11:28:20 +02:00
\textbf{\fontsize{90}{60}\selectfont User Manual\\}
\vspace{0.6cm}
2022-09-12 13:22:46 +02:00
\textbf{\LARGE --- ESDS v\version --- \\}
2022-09-12 11:28:20 +02:00
{\Large \today}
\vspace{2cm}
2022-09-12 10:45:38 +02:00
{\includesvg[scale=0.8]{../icon.svg}}
2022-09-12 13:22:46 +02:00
\vspace{1.5cm}
2022-09-12 10:45:38 +02:00
\LARGE
\textbf{ESDS an Extensible Simulator for Distributed Systems\\}
2022-09-12 13:22:46 +02:00
\vspace{1cm}
2022-09-12 11:28:20 +02:00
\textit{Written by Loic Guegan and Issam Raïs}
2022-09-12 10:45:38 +02:00
\end{center}
\end{titlepage}
\pagebreak
\section{Architecture of ESDS}
\begin{figure}[!h]
\centering
\includegraphics[scale=0.5]{components.pdf}
\caption{Simulation architecture used by ESDS}
\label{architecture}
\end{figure}
2022-09-13 16:32:15 +02:00
ESDS simulator comprises two major components: 1) The Simulation Orchestrator (SO) 2) The Simulated
2022-09-12 10:45:38 +02:00
Nodes (SN). This architecture is depicted in Figure \ref{architecture}. The SO is the main process
2022-09-13 16:32:15 +02:00
in charge of implementing the simulation main loop. It instantiates the network (e.g bandwidths and
latencies), collects and processes the events (e.g communications,turn on/off). On the other hand,
nodes are threads that implement the node behaviors.
2022-09-12 13:22:46 +02:00
2022-09-13 19:19:34 +02:00
\section{Getting started}
2022-09-12 13:22:46 +02:00
To run a simulation, at least 2 files are required: 1) a platform file 2) a node implementation
2022-09-13 16:32:15 +02:00
source code. The platform file defines the simulated network platform (network links and
performances etc.) and sets various simulation parameters. The node implementation source code
provides the logic of the simulated nodes.
2022-09-12 13:22:46 +02:00
\subsection{Platform file}
2022-09-13 19:19:34 +02:00
\label{sec:firstsimulation:platform}
2022-09-13 16:32:15 +02:00
Platform files are written in YAML and contains 3 sections namely: 1) \textit{general} 2)
\textit{nodes} 3) \textit{interfaces}. The \textit{general} section is optional but all the other
sections must be present. Here is an example of a simple platform file to simulate 2 wireless nodes:
2022-09-12 13:22:46 +02:00
\addsource{assets/platform.yaml}{yaml}
\subsection{Node implementation file}
2022-09-13 16:32:15 +02:00
Nodes implementations are written using python. Here is the implementation of the node mentioned in
the last \verb|platform.yaml| file:
2022-09-12 13:22:46 +02:00
\addsource{assets/node.py}{python}
\subsection{Execution}
2022-09-13 16:32:15 +02:00
\label{sec:firstsimulation:execution}
2022-09-12 13:22:46 +02:00
To execute our first simulation, the following command should be executed from the same folder
that contains \verb|platform.yaml| and \verb|node.py|:
\begin{verbatim}
> esds run platform.yaml
\end{verbatim}
Here is the output of the simulation:
\verbatiminput{assets/output.txt}
2022-09-13 16:32:15 +02:00
In this case, simulation tooks $0.002s$ and $10$ bytes were sent on the wlan0 interface from node 0
(src=n0) to node 1 (src=n1).
\subsection{Custom orchestrator instantiation}
Instead of using a \verb|platform.yaml| file, it is possible to instantiate manually the esds
orchestrator. To do so, you need to implement that procedure in a python file. Here is and example
that performs the exact same simulation presented in Section \ref{sec:firstsimulation:execution} but
with a custom instantiation of the orchestrator:
\addsource{assets/orchestrator.py}{python}
Next we can run the simulation:
\begin{verbatim}
> ./orchestrator.py
\end{verbatim}
2022-09-12 10:45:38 +02:00
2022-09-13 19:19:34 +02:00
\section{Platform file}
As explain in Section \ref{sec:firstsimulation:platform}, esds platform files comprise 3 sections:
\begin{enumerate}
\item \textbf{general:} to settings up esds
\item \textbf{nodes:} to configure the simulated nodes
\item \textbf{interfaces:} to create network the interfaces available for each nodes
\end{enumerate}
Lets see in details the format of each section.
\subsection{General}
2022-09-13 19:56:22 +02:00
This section is used to settings up the overall parameters of esds. Table \ref{keywords:general} reference all the keywords for this section of the platform file.
2022-09-13 19:19:34 +02:00
\begin{table}[]
\centering
2022-09-13 19:56:22 +02:00
\begin{tabular}{m{0.25\textwidth}m{0.3\textwidth}p{0.4\textwidth}}
2022-09-13 19:19:34 +02:00
\toprule
\textbf{Keyword} & \textbf{Description} & \textbf{Example} \\ \midrule
2022-09-13 19:56:22 +02:00
\textbf{interferences} & Turn on/off interferences detection during wireless communications &
2022-09-13 19:19:34 +02:00
\begin{tabminted}{yaml}
interferences: on
\end{tabminted}
\\ \cmidrule{1-3}
2022-09-13 19:56:22 +02:00
\textbf{debug} & Turn on/off esds debugging mode (generate a debug file) &
2022-09-13 19:19:34 +02:00
\begin{tabminted}{yaml}
debug: on
\end{tabminted}
\\ \cmidrule{1-3}
2022-09-13 19:56:22 +02:00
\textbf{debug\_file} & Specify the file to use as output for the debugging &
2022-09-13 19:19:34 +02:00
\begin{tabminted}{yaml}
debug_file: "./myfile.txt"
2022-09-13 19:56:22 +02:00
\end{tabminted}
\\ \cmidrule{1-3}
\textbf{breakpoints} & Specify a list of simulated time (in seconds) at which esds should interrupt and call the specified callback &
\begin{tabminted}{yaml}
breakpoints: [5, 6, 7]
\end{tabminted}
\\ \cmidrule{1-3}
\textbf{breakpoints\_every} & Specify an interval of time (in seconds) at which esds will interrupt and call the specified callback &
\begin{tabminted}{yaml}
breakpoints_every: 5
\end{tabminted}
\\ \cmidrule{1-3}
\textbf{breakpoints\_callback} & Tell esds where how to reach the callback used during breakpoints &
\begin{tabminted}{yaml}
breakpoints_callback:
file: "platform_callback.py"
callback: "callback"
2022-09-13 19:19:34 +02:00
\end{tabminted}
\\ \bottomrule
\end{tabular}
\caption{Usable keywords in the general section of a esds platform file.}
\label{keywords:general}
\end{table}
2022-09-12 10:45:38 +02:00
2022-09-13 19:19:34 +02:00
\end{document}
2022-09-12 10:45:38 +02:00