Skip to content

Software Defined Networking, Network Slicing, Traffic Classification, Flow Scheduling, Mininet, RYU.

Notifications You must be signed in to change notification settings

croidhuang/sdn_tc_fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdn_tc_fs

下載資料集

https://www.unb.ca/cic/datasets/vpn.html

分類器

安裝python3

https://www.python.org/downloads/
PATH記得打勾
PATH記得打勾
PATH記得打勾

安裝python所需的模組

pip3 install sklearn joblib numpy pandas matplotlib seaborn pydotplus imblearn lightgbm pyarrow fastparquet

預處理(輸入pcap, 輸出parquet)

開啟classifier/preprocessing_pcap.py
修改輸入輸出路徑
大約需要8小時,放心如果記憶體不足中斷,手動重新開始後處理完成過的檔案不會重複處理

訓練model(輸入parquet, 輸出model)

開啟classifier/train_test_sklearn.py
修改輸入輸出路徑
修改訓練類型
大約需要15分鐘,可以在最底下寫每次要的參數選項自動執行多次

將model儲存到流量排程的資料夾(安裝控制器ryu的位置)

ryu/ryu/app/ryu_customapp/models/

流量排程

安裝python3

sudo apt-get update
sudo apt-get install python3-pip

讓2和3共存(非必要步驟)

安裝python2
sudo apt install python2
確認尚未設定過
sudo update-alternatives --list python
取得路徑
ls /usr/bin/python*
設定優先
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2
確認完成設定
sudo update-alternatives --config python
python --version

安裝pip2
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
確認尚未設定過
sudo update-alternatives --list pip
取得路徑
pip --version
pip3 --vesrion
設定優先
sudo update-alternatives --install /usr/bin/pip pip pip路徑 1
sudo update-alternatives --install /usr/bin/pip pip pip3路徑 2
確認完成設定
sudo update-alternatives --config pip
pip --version

安裝所需的模組

scapy

安裝mininet

http://mininet.org/download/
git clone https://github.com/mininet/mininet
sudo PYTHON=python3 mininet/util/install.sh -a

安裝python所需的模組 (與分類器相同)

pip3 install sklearn joblib numpy pandas matplotlib seaborn pydotplus imblearn lightgbm pyarrow fastparquet

安裝ryu

https://ryu.readthedocs.io/en/latest/getting_started.html
git clone https://github.com/faucetsdn/ryu.git
sudo apt install python3-ryu

設定重播pcap參數

開啟exp_config/exp_config.py
修改設定
修改產生封包的開始時間:timestring
修改pcap路徑:PKT_FILE_LIST
修改select函數:SCHEDULER_TYPE
選擇性設定
修改pcap對應的傳送間隔:PKT_FILE_MAP
修改其他設定如執行時間及頻寬相關參數

執行mininet

sudo python3 mininet/custom/custom_example_7to7.py

執行ryu

ryu-manager ryu/ryu/app/simple_switch_13_slice.py

在mininet輸入

mininet> xterm h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14

在xterm執行

client

在h1執行
python3 pktgen/cs/client1.py
在h2執行
python3 pktgen/cs/client2.py
在h3執行
python3 pktgen/cs/client3.py
...
在h7執行
python3 pktgen/cs/client7.py

server

在h8執行
python3 pktgen/cs/server8.py
在h9執行
python3 pktgen/cs/server9.py
在h10執行
python3 pktgen/cs/server10.py
...
在h14執行
python3 pktgen/cs/server14.py

等待

等待讀取pcap直到出現ready
等待到設定的開始時間

執行中

用於紀錄throughput,依照設定的時間每個間隔儲存,檔案在home目錄

執行完成

用於計算latency,最後輸出client和server的收發時間,檔案在pktgen/timestamp目錄
注意,時間過長可能會耗盡記憶體,需要修改儲存方式

About

Software Defined Networking, Network Slicing, Traffic Classification, Flow Scheduling, Mininet, RYU.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages