Skip to content
Snippets Groups Projects
Commit 1c7156ac authored by Johnny Molander's avatar Johnny Molander
Browse files

Added changes to Readme.md

parent aadcd672
No related branches found
No related tags found
No related merge requests found
# Hardware-In-the-Loop (HIL) network simulation for supporting electrical power grid sub-stations # Hardware-In-the-Loop (HIL) network simulation for supporting electrical power grid sub-stations
This is the NS3 applications from my master thesis that were made in the spring of 2021. The master thesis developed a working verison of DPDK enhanced ns-3, capable of supporting multiple NIC. This is the ns-3 applications from my master thesis that were made in the spring of 2021. The master thesis developed a working verison of DPDK enhanced ns-3, capable of supporting multiple NIC.
____ ____
Alterations to the source code are made in the folder “/ns-3.33/src/fd-net-device/” to: Alterations to the ns-3 source code are made in the folder “/ns-3.33/src/fd-net-device/” to:
dpdk-net-device.cc/.h dpdk-net-device.cc/.h
...@@ -15,61 +14,69 @@ fd-net-device.cc/.h ...@@ -15,61 +14,69 @@ fd-net-device.cc/.h
fd-net-device-helper.cc/.h fd-net-device-helper.cc/.h
____ ____
## HowTo guide for running the thesis simulations
## Setting the Ubuntu Environment ### Setting the Ubuntu Environment
The OS used in the thesis was Ubuntu 20.04. The OS used in the thesis was Ubuntu 20.04.
1. First download this repository to your Ubuntu computer. It contain altered ns-3.33. 1. First download this repository to your Ubuntu computer. It contain altered ns-3.33.
2. Install DPDK by using the apt-get command below. 2. Install DPDK by using the apt-get command below.
* DPDK version used in the thesis was 20.11, so to prevent any compatibility issue, I recomend using that version. * DPDK version used in the thesis was 20.11, so to prevent any compatibility issue, I recomend using this version.
* DPDK can manually be downloaded from [Downloads](https://core.dpdk.org/download/) * DPDK can manually be downloaded from [Downloads](https://core.dpdk.org/download/)
* Check that your NIC is supported by DPDK [Supported HW](https://core.dpdk.org/supported/) * Check that your NIC is supported by DPDK [Supported HW](https://core.dpdk.org/supported/)
```js ```sh
sudo apt-get install dpdk sudo apt-get install dpdk
``` ```
* Make sure you can run the following from the commandline terminal: * Make sure you can run the following from the commandline terminal:
```js ```sh
sudo dpdk-devbind sudo dpdk-devbind
``` ```
* If not, add the dpdk commands to path. * If not, add the dpdk commands to path.
3. Alter the GRUB bootloader configuration file to enable hugepages and set driver parameters. The alteration is made by changing the GRUB_CMDLINE_LINUX_DEFAULT parameter in the file “/etc/default/grub”. The provided parameter is my entire parameter setting. 3. Alter the GRUB bootloader configuration file to enable hugepages and set driver parameters. This is done by changing the GRUB_CMDLINE_LINUX_DEFAULT parameter in the file “/etc/default/grub”. The provided parameter was my entire parameter setting.
* "maybe-ubiquity" was present by default. * "maybe-ubiquity" was present by default.
* The hugepages set 1GB hugepage by default and enables 1 hugepage. Tests showed that the application only used 1 hugepage. Set more if needed, but the more you set the more memory will be unavailable by your OS. * The hugepage parameters set 1GB hugepage by default and enables 1 hugepage. Tests showed that the application only used 1 hugepage. Set more if needed, but the more you set the more memory will be unavailable by your OS when mounting (see step 5).
* *iommu* parameters are for enabling the vfio-pci (and uio_igb if wanted) driver that was used by DPDK in the thesis. * *iommu* parameters are for enabling the vfio-pci (and uio_igb) driver that was used by DPDK in the thesis.
* *isolcpus* isolate logical cpu cores and prevents the OS from using the logical cores. Add the cores you would like to use in your application here. The thesis used logical cores 4, 5, 10 and 11 that was used to run the DPDK application on. * *isolcpus* isolate logical cpu cores and prevents the OS from using the logical cores. Add the cores you would like to use in your application here. The thesis used logical cores 4, 5, 10 and 11 that was used to run the DPDK application on.
* Use ```lscpu``` to see how many logical cpu cores your computer have.
```js ```sh
GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity default_hugepagesz=1G hugepagesz=1G hugepages=1 iommu=pt iommu=on intel_iommu=on isolcpus=4,10,5,11" GRUB_CMDLINE_LINUX_DEFAULT="maybe-ubiquity default_hugepagesz=1G hugepagesz=1G hugepages=1 iommu=pt iommu=on intel_iommu=on isolcpus=4,10,5,11"
``` ```
4. Update GRUB. 4. Update GRUB.
```js ```sh
sudo update-grub sudo update-grub
``` ```
OR
```sh
sudo update-grub2
```
5. Create a folder you will mount your hugepage(s) on. 5. Create a folder you will mount your hugepage(s) on.
```js ```sh
mkdir /mnt/huge mkdir /mnt/huge
``` ```
6. Mount hugepages by default by adding the following line at the bottom of the file “/etc/fstab”. 6. Mount hugepages by default on startup by adding the following line at the bottom of the file “/etc/fstab”.
```js ```sh
nodev /mnt/huge hugetlbfs defaults 0 0 nodev /mnt/huge hugetlbfs defaults 0 0
``` ```
7. Restart the computer. 7. Restart the computer.
## Build ns-3 ### Build ns-3
**NOTE:** You must have a c++ compiler and python version >=3.5. **NOTE:** You must have a c++ compiler and python version >=3.5.
...@@ -77,13 +84,13 @@ nodev /mnt/huge hugetlbfs defaults 0 0 ...@@ -77,13 +84,13 @@ nodev /mnt/huge hugetlbfs defaults 0 0
2. Configure the ns3 *waf* builder. 2. Configure the ns3 *waf* builder.
```js ```sh
./waf configure --build-profile=optimized --enable-examples --enable-tests --enable-sudo ./waf configure --build-profile=optimized --enable-examples --enable-tests --enable-sudo
``` ```
3. Build ns-3 by running: 3. Build ns-3 by running:
```js ```sh
./waf ./waf
``` ```
...@@ -91,31 +98,35 @@ nodev /mnt/huge hugetlbfs defaults 0 0 ...@@ -91,31 +98,35 @@ nodev /mnt/huge hugetlbfs defaults 0 0
4. Try to run a sample ns-3 application with: 4. Try to run a sample ns-3 application with:
```js ```sh
sudo ./waf --run first sudo ./waf --run first
``` ```
## Running DpdkOneNode ### Running DpdkOneNode
**The examples from the thesis are located in /ns-3.33/scratch/** **The examples from the thesis are located in /ns-3.33/scratch/**
The simulation used in the thesis was dpdkOneNode.cc The simulation used in the thesis was ```dpdkOneNode.cc```
1. To run dpdkOneNode some parameters might need to be changed: 1. To run dpdkOneNode some parameters might need to be changed:
* dpdkDriver: refer to the PCI-address of your NIC to be used in the simulation * dpdkDriver: refer to the PCI-address of your NIC to be used in the simulation
* You can use this command in the terminal to get more info about the PCI addresses.
```sh
dpdk-devbind.py -s
```
* lCorelist: Should be the same as you chose to isolate in the GRUB parameter *isolcpus* as it tells the DPDK what cores to use in te simulation * lCorelist: Should be the same as you chose to isolate in the GRUB parameter *isolcpus* as it tells the DPDK what cores to use in te simulation
* firstLCore: Sets the logical core of the first NIC you would like to handle incoming traffic on. Must be part of lCorelist. * firstLCore: Sets the logical core of the first NIC you would like to handle incoming traffic on. Must be part of lCorelist.
* secLCore: Sets the logical core of the second NIC you would like to handle incoming traffic on. Must be part of lCorelist. * secLCore: Sets the logical core of the second NIC you would like to handle incoming traffic on. Must be part of lCorelist.
2. The dpdkOneNode accept input parameter 2. The dpdkOneNode accept input parameter
* pcap: Boolean if you want to write pcap files from the node in the simulation to file * ```pcap```: Boolean if you want to write pcap files from the node in the simulation to file
* routeTable: Boolean if you want to write routing table of the node to file. * ```routeTable``` Boolean if you want to write routing table of the node to file.
* runTime: Sets how long you would like the simulation to run in seconds. * ```runTime```: Sets how long you would like the simulation to run in seconds.
3. Example of running dpdkOneNode for 30 seconds, writing both pcap and routing tables to file: 3. Example of running dpdkOneNode for 30 seconds, writing both pcap and routing tables to file:
```js ```sh
sudo ./waf --run "dpdkOneNode --runTime=30 --pcap --routeTable" sudo ./waf --run "dpdkOneNode --runTime=30 --pcap --routeTable"
``` ```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment