added ECMP exercise for May 2016 P4 workshop
This commit is contained in:
10
examples/.gitignore
vendored
10
examples/.gitignore
vendored
@@ -1,10 +0,0 @@
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
||||
# Emacs
|
||||
*~
|
||||
|
||||
# Compiled JSON
|
||||
*.json
|
||||
|
||||
*.pcap
|
||||
@@ -55,9 +55,9 @@ build the code once all the dependencies have been installed:
|
||||
|
||||
You need to tell us where you cloned the `bmv2` and `p4c-bm` repositories
|
||||
:). Please update the values of the shell variables `BMV2_PATH` and
|
||||
`P4C_BM_PATH` in the `env.sh` file - located in this directory. Note that if you
|
||||
cloned both repositories in the same directory as this one (`tutorials`), you
|
||||
will not need to change the value of the variables.
|
||||
`P4C_BM_PATH` in the `env.sh` file - located in the root directory of this
|
||||
repository. Note that if you cloned both repositories in the same directory as
|
||||
this one (`tutorials`), you will not need to change the value of the variables.
|
||||
|
||||
You will also need to run the `veth_setup.sh` script included in this directory
|
||||
as `sudo` to setup the veth interfaces needed by the switch.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/TLV_parsing.p4 --json TLV_parsing.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch TLV_parsing.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH TLV_parsing.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc \
|
||||
--pcap &
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/action_profile.p4 --json action_profile.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch action_profile.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH action_profile.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc \
|
||||
--pcap &
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -25,7 +25,9 @@ SWITCH_PATH=$BMV2_PATH/targets/simple_switch/simple_switch
|
||||
CLI_PATH=$BMV2_PATH/tools/runtime_CLI.py
|
||||
|
||||
$P4C_BM_SCRIPT p4src/axon.p4 --json axon.json
|
||||
# This gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo PYTHONPATH=$PYTHONPATH:$BMV2_PATH/mininet/ python topo.py \
|
||||
--behavioral-exe $BMV2_PATH/targets/simple_switch/simple_switch \
|
||||
--behavioral-exe $SWITCH_PATH \
|
||||
--json axon.json \
|
||||
--cli $CLI_PATH
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/copy_to_cpu.p4 --json copy_to_cpu.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch copy_to_cpu.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH copy_to_cpu.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc \
|
||||
--pcap &
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/counter.p4 --json counter.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch counter.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH counter.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc \
|
||||
--pcap &
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
# ---------------- EDIT THIS ------------------
|
||||
BMV2_PATH=$THIS_DIR/../../bmv2
|
||||
# e.g. BMV2_PATH=$THIS_DIR/../bmv2
|
||||
P4C_BM_PATH=$THIS_DIR/../../p4c-bmv2
|
||||
# e.g P4C_BM_PATH=$THIS_DIR/../p4c-bm
|
||||
# ---------------- END ------------------
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/meter.p4 --json meter.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch meter.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH meter.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc \
|
||||
--pcap &
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/register.p4 --json register.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch register.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH register.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc \
|
||||
--pcap
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -30,8 +30,9 @@ CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
# process back in the foreground
|
||||
set -m
|
||||
$P4C_BM_SCRIPT p4src/resubmit.p4 --json resubmit.json
|
||||
sudo echo "sudo" > /dev/null
|
||||
sudo $BMV2_PATH/targets/simple_switch/simple_switch resubmit.json \
|
||||
# This gets root permissions, and gives libtool the opportunity to "warm-up"
|
||||
sudo $SWITCH_PATH >/dev/null 2>&1
|
||||
sudo $SWITCH_PATH resubmit.json \
|
||||
-i 0@veth0 -i 1@veth2 -i 2@veth4 -i 3@veth6 -i 4@veth8 \
|
||||
--nanolog ipc:///tmp/bm-0-log.ipc --log-console \
|
||||
--pcap &
|
||||
|
||||
@@ -21,7 +21,7 @@ fi
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
P4C_BM_SCRIPT=$P4C_BM_PATH/p4c_bm/__main__.py
|
||||
|
||||
@@ -46,8 +46,10 @@ sysctl net.ipv6.conf.$intf0.disable_ipv6=1
|
||||
sysctl net.ipv6.conf.$intf1.disable_ipv6=1
|
||||
|
||||
$P4C_BM_SCRIPT p4src/simple_nat.p4 --json simple_nat.json
|
||||
# This gives libtool the opportunity to "warm-up"
|
||||
$SWITCH_PATH >/dev/null 2>&1
|
||||
PYTHONPATH=$PYTHONPATH:$BMV2_PATH/mininet/ python topo.py \
|
||||
--behavioral-exe $BMV2_PATH/targets/simple_switch/simple_switch \
|
||||
--behavioral-exe $SWITCH_PATH \
|
||||
--json simple_nat.json \
|
||||
--cli $CLI_PATH \
|
||||
--thrift-port 22222
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
source $THIS_DIR/../env.sh
|
||||
source $THIS_DIR/../../env.sh
|
||||
|
||||
CLI_PATH=$BMV2_PATH/targets/simple_switch/sswitch_CLI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user