====== Intel Tofino ====== * https://www.intel.com/content/www/us/en/products/details/network-io/intelligent-fabric-processors.html -- **Tofino & P4 Studio** * https://networkbuilders.intel.com/university/programs-offered * https://networkbuilders.intel.com/university/membership-benefits === Ressources (SDK, etc.): === * https://github.com/barefootnetworks/Open-Tofino -- **Open-Tofino** * https://www.intel.com/content/www/us/en/resources-documentation/developer.html#panel-top-resources|most-popular * https://www.intel.com/content/www/us/en/developer/overview.html (P4 Studio, nach neuesten Filtern) ===== Use SDK P4studio ===== # select the desired version of Barefoot SDE (is already set in ~/.profile) source ~/tools/set_sde.bash # setup Virtual Ethernet (veth) interfaces # only necessary once, if Virtual interfaces not exist (check via ifconfig) sudo $SDE_INSTALL/bin/veth_setup.sh # 1. compile [1.Shell] ~/tools/p4_build.sh ~/labs/01-simple_l3/p4src/simple_l3.p4 # 2. run tofino-model [1. Shell] $SDE/run_tofino_model.sh -p simple_l3 # 3. run the driver (bf_switchd) [2. Shell] $SDE/run_switchd.sh -p simple_l3 # 4. bfshell-Access oder Python Script [3. Shell] $SDE/run_bfshell.sh #oder ein Python Skript starten ~/bf-sde-9.9.1/run_bfshell.sh -b ~/labs/lab_1112/02-simple_l3_acl/bfrt_python/basic_setup.py -i #scapy (run in separte terminal - 4. Shell) >>> sendp(Ether()/IP(dst='5.5.5.5')/UDP()/'abcdefg', iface="veth1") # sniff packets (numerically, Hex and ASCII output, veth0-Interface) sudo tcpdump -v -n -XX -i veth0 ===== Install SDK ===== ==== VM: ==== # decompress SDK in home directory of user tar -xzvf /home/p4/bf-sde-9.9.1.tgz cd bf-sde-9.9.1/p4studio/ # install p4studio (detailled instructions below), requires 4-8GB of RAM (otherwise build error) ./p4studio interactive #or if profile already exists: ./p4studio profile apply profiles/user-profile.yaml # decompress ica-tools in home directory of user tar -xvzf /home/p4/ica-tools.tgz ==== Switch (EdgeCore Wedge100bf): ==== #nicht klar, ob das notwendig ist - pfad zum *.tgz angeben im 'p4studio interactive' reicht eigentlich aus! tar -xzvf bf-reference-bsp-9.9.1.tgz export BSP=/home/user/bf-reference-bsp-9.9.1 cd $BSP ./extract_all.sh user@wedge100bf:~/bf-reference-bsp-9.9.1/bf-platforms-9.9.1/platforms/accton-bf$ ./install_pltfm_deps.sh export SDE=/home/user/bf-sde-9.9.1/ user@wedge100bf:~/bf-sde-9.9.1/p4studio$ ./p4studio interactive Do you want to install dependencies? [Y/n]: Y Do you want to build switch-p4-16? [y/N]: y Please provide the profile to build switch with (x1_tofino, x2_tofino, y1_tofino2, y2_tofino2, y3_tofino2, z2_tofino2, z2_tofino3, y2_tofino3) [x1_tofino]: Do you want to build bf-diags? [y/N]: y Do you want to build P4-14 examples? [y/N]: n Do you want to build P4-16 examples? [Y/n]: Please provide architecture for bf-diags and p4-examples (tofino, tofino2, tofino2m, tofino2h, tofino3, all) [tofino]: Do you want to build for HW? [y/N]: y Do you want to build BSP? [y/N]: y Please provide the path to BSP: /home/user/bf-reference-bsp-9.9.1 Do you want to use custom kernel headers? [y/N]: Do you want to enable P4Runtime? [y/N]: Created profile: global-options: asic: true features: bf-diags: {} bf-platforms: bsp-path: /home/user/bf-reference-bsp-9.9.1.tgz p4-examples: - p4-16-programs switch: profile: x1_tofino architectures: - tofino Do you want to write it to a file? [y/N]: y Please provide the profile filename - [Example:profiles/my-profile.yaml]: profiles/user-profile.yaml Do you want to continue building SDE? [y/N]: y Source packages to install: - bridge - libcli - thrift - grpc Configuration options: ✓ asic ✓ switch ✓ bf-diags ✓ tofino ✗ tofino2 ✗ tofino2m ✗ tofino2h ✗ tofino3 Targets to build: - p4-16-programs - x1_tofino ==== USB-Stick mounten ==== sudo mount -t vfat /dev/sdb1 /media/USB-Disk -o uid=1000,gid=1000,utf8,dmask=027,fmask=137 ==== Variablen setzen ==== export SDE=/home/user/bf-sde-9.9.1/ cd bf-sde-9.9.1/; . ~/tools/set_sde.bash # oder source ~/tools/set_sde.bash sudo $SDE_INSTALL/bin/bf_kdrv_mod_load $SDE_INSTALL # lädt den User-Mode-Driver (ICA 1131) Die Variablen werden derzeit über die ''.profile''-Datei beim Einloggen gesetzt (führt zu Fehlermeldung, falls Kerneldriver bereits geladen) ==== P4 Programm starten ==== ./run_switchd.sh -p diag # startet bf_shell, exit mit Ctrl-\: Ctrl-AltGr-ß / Ctrl-Alt-Umschalt-7 ./run_switchd.sh -p simple # startet simple.p4 bfshell> ucli qspf show pm show port-add 1/0 10G NONE port-add 1/1 10G NONE port-add 1/2 10G NONE port-add 1/3 10G NONE port-enb 1/- ---- ===== EdgeCore AS 4610 (172.16.1.8) ===== Default Login für baseboxd\\ **login:** basebox **password:** b-isdn sudo client_drivshell port xe3 AN=on #Auto-negotion ausschalten (nur notwendig auf AS4610!) 0-Auto, 2-Disabled port-add 1/0 10G NONE port-add 1/1 10G NONE port-add 1/2 10G NONE port-add 1/3 10G NONE an-set 1/0 0 an-set 1/1 0 an-set 1/2 2 an-set 1/3 2 port-enb 1/- pm show port-dis 1/3 port-enb 1/3 ==== AS4610 VLAN Konfig ==== #ip link show #brctl show bridge vlan show sudo systemctl restart systemd-networkd ===== agema-ag5648: ===== sudo client_drivshell port xe0-xe3 an=on btw, you can also use the port numbers, e.g. sudo client_drivshell port 1-4 an=on sudo client_drivshell port xe1 AN=on sudo client_drivshell port xe0 AN=on Enable=true sudo client_drivshell port xe1 AN=on #zuerst AN=off !!! sudo ip link set port1 up sudo client_drivshell port xe0 AN=off SP=10000 sudo client_drivshell port xe0 AN=on SP=10000 sudo client_drivshell port xe1 AN=on SP=10000 sudo client_drivshell port xe2 AN=on SP=10000 sudo client_drivshell port xe3 AN=on SP=10000 #dannach können alle ports aktiviert werden sudo client_drivshell port xe1 AN=on SP=10000 sudo ip link set port2 up