Differences

This shows you the differences between two versions of the page.

Link to this comparison view

isrm:laboratoare:new:02a [2024/03/19 09:32]
mbarbulescu [[02b] Analiza PCAP cu tshark]
isrm:laboratoare:new:02a [2024/10/16 09:04] (current)
dragos.niculescu
Line 19: Line 19:
 ===== Instalare și configurare ===== ===== Instalare și configurare =====
  
-In cadrul laboratoarelor,​ vom folosi masina virtuala pe care o puteti descarca de [[https://​ocw.cs.pub.ro/​courses/​isrm/​mv|aici]]. Pe VM au fost deja executati pasii de configurare de mai jos. +In cadrul laboratoarelor,​ vom folosi masina virtuala pe care o puteti descarca de [[https://​ocw.cs.pub.ro/​courses/​isrm/​mv|aici]], sau urma instrucțiunilde ​de instalare ​specifice Linux
- + 
-<spoiler Pasi configurare masina virtuala>​ +
- +
-  * Dependențele necesare ''​ns-3''​ sunt descrise în [[https://​www.nsnam.org/​wiki/​Installation|pagina ​de instalare]]Pentru ISRM vom folosi următoarele pachete pe o distribuție Ubuntu: +
- +
-<code bash> +
-student@isrm-vm:​~$ sudo apt update +
-student@isrm-vm:​~$ sudo apt -y install libgsl-dev gsl-bin libgslcblas0 \ +
-    autoconf cvs bzr unrar \ +
-    sqlite sqlite3 libsqlite3-dev \ +
-    libxml2 libxml2-dev +
-</​code>​ +
- +
-<note tip> +
-Pe mașina virtuală de ISRM aveți deja toate pachetele instalate.  +
-</​note>​ +
- +
-   * Clonăm [[https://​gitlab.com/​nsnam/​ns-3-dev|codul sursă al simulatorului nsnam/​ns-3]] și ne mutăm pe versiunea 3.35: +
- +
-<code bash> +
-student@isrm-vm:​~$ git clone --branch ns-3.35 https://​gitlab.com/​nsnam/​ns-3-dev.git +
-student@isrm-vm:​~$ cd ~/​ns-3-dev +
-</​code>​ +
- +
-   * Clonăm [[https://​github.com/​isrm-lab/​ns3-labs|modelele din laborator (aici trebuie doar să fim pe master, ultimul commit)]]  +
- +
-<code bash> +
-student@isrm-vm:​~$ cd ~/​ns-3-dev/​examples +
-student@isrm-vm:​~$ git clone https://​github.com/​isrm-lab/​ns3-labs.git +
-student@isrm-vm:​~$ cd ~/​ns-3-dev/​examples/​ns3-labs && git log -1 +
-commit 5214caf7fbc39b280edf47154ed95f2fcca78a7c (HEAD -> master, origin/​master,​ origin/​HEAD) +
-</​code>​ +
- +
-   * Pentru a compila simulatorul împreună cu modelele de laborator, vom folosi sistemul de build ''​waf'':​  +
- +
-<code bash> +
-student@isrm-vm:​~/​ns-3-dev$ ./waf configure --build-profile=debug --enable-examples --enable-tests +
-student@isrm-vm:​~/​ns-3-dev$ ./waf build -j4 +
-</​code>​ +
- +
-<note tip> +
-Pentru a adăuga suport de C++17 și a beneficia de capabilitățile noi aduse de limbaj în cadrul simulărilor în pasul de configure putem seta variabila ''​CXXFLAGS''​ astfel: +
- +
-<code bash> +
-CXXFLAGS="​-std=c++17"​ ./waf -d debug --enable-examples --enable-tests configure +
-</​code>​ +
- +
-Versiunea de ''​g++''​ atât pe sistemele din laborator, cât și din mașina virtuală este ''​7.4.0''​ și are suport pentru C++17. +
- +
-E posibil ca cei de la ns-3 să fi hardcodat în folderul rădăcină în ''​wscript''​ standardul. E suficient să modificați linia următoare și puteți obține by default suportul pentru C++17: +
- +
-<code bash> +
-student@isrm-vm:​~/​ns-3-dev$ git diff wscript +
- +
-diff --git a/wscript b/wscript +
-index 4283a2899..c0dd18ccd 100644 +
---- a/wscript +
-+++ b/wscript +
-@@ -250,7 +250,7 @@ def options(opt):​ +
-                    dest='​enable_desmetrics'​) +
-     ​opt.add_option('​--cxx-standard',​ +
-                    help=('​Compile NS-3 with the given C++ standard'​),​ +
--                   ​type='​string',​ default='​-std=c++11',​ dest='​cxx_standard'​) +
-+                   ​type='​string',​ default='​-std=c++14',​ dest='​cxx_standard'​) +
- +
-     # options provided in subdirectories +
-     ​opt.recurse('​src'​) +
-</​code>​  +
-</​note>​ +
- +
-   * Validăm funcționarea corectă a buildului. Ultimul pas cu ''​test.py''​ este opțional, presupune rularea testelor unitare interne ale ns-3. Dacă primele două comenzi vă funcționează aveți un build stabil al simulatorului și putem începe să rulăm exemple de simulări.  +
- +
-<code bash> +
-student@isrm-vm:​~/​ns-3-dev$ ./waf --check-profile +
-Waf: Entering directory `/​home/​student/​ns-3-dev/​build'​ +
-Build profile: debug +
-student@isrm-vm:​~/​ns-3-dev$ ./waf --run hello-simulator +
-Waf: Entering directory `/​home/​student/​ns-3-dev/​build'​ +
-Waf: Leaving directory `/​home/​student/​ns-3-dev/​build'​ +
-Build commands will be stored in build/​compile_commands.json +
-'​build'​ finished successfully (2.256s) +
-Hello Simulator +
-student@isrm-vm:​~/​ns-3-dev$ ./test.py +
-(...) +
-'​build'​ finished successfully (1.799s) +
-(...) +
-92 of 92 tests passed (92 passed, 0 failed, 0 crashed, 0 valgrind errors) +
-</​code>​ +
- +
-Pentru a realiza grafice, trebuie sa instalam si pachetele de Python: +
-<code bash> +
-student@isrm-vm:​~$ sudo apt-get update +
-student@isrm-vm:​~$ sudo apt-get install python3-pip +
-student@isrm-vm:​~$ pip3 install matplotlib jupyter +
-student@isrm-vm:​~$ sudo ln -s ~/​.local/​bin/​jupyter-notebook /​usr/​bin/​jupyter-notebook +
-</​code>​ +
- +
-Pentru a lansa aplicatia de Jupyter Notebook, rulati urmatoarea comanda: +
- +
-<code bash> +
-student@isrm-vm:​~$ jupyter-notebook +
-</​code>​ +
- +
-</​spoiler>​+
 ===== Rulare exemple existente ===== ===== Rulare exemple existente =====
  
Line 136: Line 33:
  
 <code bash> <code bash>
-student@isrm-vm:​~/​ns3$ ./waf --run wifi-tcp+student@isrm-vm:​~/​ns3$ cd lab02 
 +student@isrm-vm:​lab02../ns3 run wifi-tcp ​--cwd .
 Waf: Entering directory `/​home/​student/​ns3/​build'​ Waf: Entering directory `/​home/​student/​ns3/​build'​
 Waf: Leaving directory `/​home/​student/​ns3/​build'​ Waf: Leaving directory `/​home/​student/​ns3/​build'​
Line 152: Line 50:
  
 <code bash> <code bash>
-student@isrm-vm:​~/ns3$ ./waf --run examples/​wireless/​wifi-tcp+student@isrm-vm:​lab02../ns3 run examples/​wireless/​wifi-tcp ​ --cwd .
 </​code>​ </​code>​
  
-Dacă vrem să transmitem parametrii în linia de comandă ​simulării ​(deoarece ''​wifi-tcp''​ suportă), o putem face cu ghilimele:+Această simulare are parametri expuși pe linia ei de comandă (nu a ns3): 
  
 <code bash> <code bash>
-student@isrm-vm:​~/ns3$ ./waf --run "​wifi-tcp --pcap --simulationTime=3"​+student@isrm-vm:​lab02../ns3 run "wifi-tcp --help" ​   
 +</​code>​ 
 + 
 +Dacă vrem să transmitem parametri în linia de comandă simulării, o putem face cu ghilimele:​ 
 + 
 +<code bash> 
 +student@isrm-vm:​lab02$ ../​ns3 ​run "​wifi-tcp --pcap --simulationTime=3" ​ --cwd .
 Waf: Entering directory `/​home/​student/​ns3/​build'​ Waf: Entering directory `/​home/​student/​ns3/​build'​
 Waf: Leaving directory `/​home/​student/​ns3/​build'​ Waf: Leaving directory `/​home/​student/​ns3/​build'​
Line 174: Line 78:
  
 <code bash> <code bash>
-student@isrm-vm:​~/ns3$ ls AccessPoint*.pcap Station*.pcap+student@isrm-vm:​lab02$ ls AccessPoint*.pcap Station*.pcap
 AccessPoint-0-0.pcap ​ Station-1-0.pcap AccessPoint-0-0.pcap ​ Station-1-0.pcap
 </​code>​ </​code>​
Line 211: Line 115:
  
 <code bash> <code bash>
-student@isrm-vm:​~/​ns3$ ./waf --command-template="​valgrind \+student@isrm-vm:​~/​ns3$ ./ns3 run --command-template="​valgrind \
     --leak-check=full --show-reachable=yes %s" \     --leak-check=full --show-reachable=yes %s" \
     --run wifi-tcp     --run wifi-tcp
Line 248: Line 152:
 ===== [00] Pregătirea mediului pentru viitoarele laboratoare ===== ===== [00] Pregătirea mediului pentru viitoarele laboratoare =====
  
-<note tip>​Codul sursă al laboratoarelor de ISRM este disponibil pe [[https://​github.com/​isrm-lab/​ns3-labs|Github]]. ​Dacă vreți să lucrați pe propriul calculator atunci trebuie să urmați acești pași: +<note tip>​Codul sursă al laboratoarelor de ISRM este disponibil pe [[https://​github.com/​isrm-lab/​ns3-labs|Github]].
- +
-<code bash> +
-# Clonați repo-ul ns-3-dev  +
-git clone --branch ns-3.35 https://​gitlab.com/​nsnam/​ns-3-dev.git +
- +
-# Clonați repo-ul ns-3-labs în folderul ns-3-dev/​examples +
-cd ns-3-dev/​examples +
-git clone https://​github.com/​isrm-lab/​ns3-labs.git +
- +
-# Rulați build-ul sistemului de ns3 +
-./waf configure --build-profile=debug --enable-examples --enable-tests +
-./waf build -j4 +
-</​code>​ +
 </​note>​ </​note>​
  
Line 268: Line 158:
  
 <code bash> <code bash>
-student@isrm-vm-2020:~$ cd ns-3-dev +student@isrm-vm:​~$ cd ns-3-dev 
-student@isrm-vm-2020:~$ student@isrm-vm-2020:​~/​ns-3-dev$ ./waf --run lab3+student@isrm-vm:​~/​ns-3-dev$ ./ns3 run lab3
 Waf: Entering directory `/​home/​student/​ns-3-dev/​build'​ Waf: Entering directory `/​home/​student/​ns-3-dev/​build'​
 Waf: Leaving directory `/​home/​student/​ns-3-dev/​build'​ Waf: Leaving directory `/​home/​student/​ns-3-dev/​build'​
Line 285: Line 175:
 </​code>​ </​code>​
  
 +  * Aflați parametrii specifici cu care poate fi rulat laboratorul 3. 
 +  * Ce face opțiunea --PrintGlobals,​ și ce parametri interesanți expune?
  
 ===== [01] Grafic throughput ===== ===== [01] Grafic throughput =====
Line 319: Line 211:
  
 <code bash> <code bash>
-student@isrm-vm-2020:~$ sudo apt-get install tshark+student@isrm-vm:​~$ sudo apt-get install tshark
 </​code>​ </​code>​
  
Line 331: Line 223:
  
 <code bash> <code bash>
-student@isrm-vm:​~/​ns-3-dev$ ./waf --run "​wifi-tcp --pcap=true"​+student@isrm-vm:​~/​ns-3-dev$ ./ns3 run "​wifi-tcp --pcap=true"​
 (...) (...)
 student@isrm-vm:​~/​ns-3-dev$ ls -al *.pcap student@isrm-vm:​~/​ns-3-dev$ ls -al *.pcap
Line 401: Line 293:
  
 <code bash> <code bash>
-./waf --run "lab3 --numberOfNodes=2 --payloadSize=1400 \+./ns3 run "lab3 --numberOfNodes=2 --payloadSize=1400 \
     --offeredRate=11Mbps --phyRate=DsssRate11Mbps --simulationTime=2 --tracing=true"​     --offeredRate=11Mbps --phyRate=DsssRate11Mbps --simulationTime=2 --tracing=true"​
 </​code>​ </​code>​
isrm/laboratoare/new/02a.1710833563.txt.gz · Last modified: 2024/03/19 09:32 by mbarbulescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0