iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 17
1
Software Development

菸酒生 - Software Defined Network系列 第 17

P4 Hello World (V1Model)

Source Map : P4 Tutorial

Let's start !
每個語言 都會有個 Hello World
https://ithelp.ithome.com.tw/upload/images/20201002/20111516m4JBCj8f8L.png

但會 Hello World 不一定會那個語言 但至少是一個開始 XD
先 focus 圖中紅框部分

a wire that connects port 1 to port 2

parser 不需要 extract 任何封包中header。
packet 會被傳到 MyVerifyChecksum() 的 block , 但進這個 block 不會做事。

而 當 packet 到達 MyIngress() block,P4 program 會檢查 packet 是到達哪個 port,藉由 讀取 ingress_port field 再決定 packet 送往哪個 port。
https://ithelp.ithome.com.tw/upload/images/20201002/20111516cehNgEro6N.png

at the end of the program we instantiate the switch
https://ithelp.ithome.com.tw/upload/images/20201002/201115165XFTY1clUd.png

所以 由 這個 Hello World example 知 :

主要做的事:
當封包(packet) 如果 從 port 1 進來 就會 從 port 2 出去
當封包(packet) 如果 從 port 2 進來 就會 從 port 1 出去

但是呢 ... 有兩個缺點

  1. port 1 port 2 之間的連接為 hardcoded
  2. 在 P4 program 編譯後 是無法改變的

之後會 有更具彈性的做法 請待下回揭曉 ...


Tomorrow's TODO : 逐步完成/理解 basic.p4


上一篇
[番外篇二] 網管筆記 : 分享器設定
下一篇
[番外篇三] 網管筆記 : Switch 接法
系列文
菸酒生 - Software Defined Network30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言