Re-organising

This commit is contained in:
Nico Schottelius 2019-07-28 16:27:53 +02:00
commit 58d7d91358
12 changed files with 257 additions and 43 deletions

15
bin/bind-mount.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
set -x
# Remove possible symlinks
rm -f ~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src
rm -f ~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4
mkdir -p ~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/
sudo mount --bind ~/master-thesis/netpfga/minip4/ \
~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/
mkdir -p ~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src
sudo mount --bind ~nico/master-thesis/p4src/ \
~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src

4
bin/bind-umount.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
sudo umount ~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/src
sudo umount ~/projects/P4-NetFPGA/contrib-projects/sume-sdnet-switch/projects/minip4/

13
bin/build-load-drivers.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
set -e
set -x
cd "$DRIVER_FOLDER"
# remove old/bad version
sudo modprobe -r sume_riffa || true
make clean
make all
sudo make install
sudo modprobe sume_riffa
lsmod | grep sume_riffa

View file

@ -0,0 +1 @@
sudo ip -6 neigh del 2001:db8:42::64 dev enp2s0f1

17
bin/delete_table_entries.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -x
read=yes
if [ $# -ge 1 ]; then
read=""
fi
for addr in $(seq 1 64); do
ip=2001:db8:42::$addr
echo "Next to ping: ${ip}"
if [ "$read" ]; then
read dummy
fi
ping6 -c1 "$ip"
done

82
bin/do-all-steps.sh Executable file
View file

@ -0,0 +1,82 @@
#!/bin/sh
set -e
set -x
echo "First source all variables and THEN run this script"
read something
SUFFIX=""
if [ $# -ge 1 ]; then
SUFFIX="-$1"
fi
LOG=~/master-thesis/netpfga/log/compile-$(date +%F-%H%M%S)$SUFFIX
(
# Step 1..3: create code
# Step 4:
date
cd $P4_PROJECT_DIR && make
# Step 5: sdnet simulation
date
cd $P4_PROJECT_DIR/nf_sume_sdnet_ip/SimpleSumeSwitch && ./vivado_sim.bash
expected_line=$(grep ^expected "$LOG" | sed -e 's/.*= <//' -e 's/.*= (//')
actual_line=$(grep ^actual "$LOG" | sed -e 's/.*= <//' -e 's/.*= (//')
# if [ -z "$expected_line" ]; then
# echo "Empty packet grep -- probably broken - aborting"
# exit 1
# fi
# Disabled -- seems not to be relevant in the end - 2019-07-28
# if [ "$expected_line" != "$actual_line" ]; then
# echo packet mismatch
# exit 1
# fi
# Step 6: calls ${SUME_SDNET}/bin/gen_config_writes.py and generates SOMETHING
date
cd $P4_PROJECT_DIR && make config_writes
# Step 7: copies directory SDNET_OUT_DIR to TARGET and copies other dirs
date
cd $P4_PROJECT_DIR && make uninstall_sdnet && make install_sdnet
# Step 8: copies "config_writes.py" to the current dir - related to step 6
date
cd $NF_DESIGN_DIR/test/sim_switch_default && make
# -------- FIX config_writes.py here: add " pass" or overwrite whole script
# Step 9: Run the SUME simulation
date
cd $SUME_FOLDER && ./tools/scripts/nf_test.py sim --major switch --minor default
# Step 10: long compile step
date
if [ "$something" = no ]; then
:
else
cd $NF_DESIGN_DIR && make
fi
# Step 11: (nothing to be done)
# Step 12:
date
cd $NF_DESIGN_DIR/bitfiles
mv simple_sume_switch.bit ${P4_PROJECT_NAME}.bit
cp $P4_PROJECT_DIR/testdata/config_writes.sh ./
# Step 13:
date
cd $NF_DESIGN_DIR/bitfiles/
# some scripts are, some scripts aren't executable...
chmod u+x $(pwd -P)/program_switch.sh
sudo bash -c ". $HOME/master-thesis/netpfga/bashinit && $(pwd -P)/program_switch.sh"
) 2>&1 | tee "$LOG"

View file

@ -0,0 +1,9 @@
#!/usr/bin/env python3
import ipaddress
for i in range(1,65):
addr = ipaddress.IPv4Address("10.0.0.{}".format(i))
ip_int = int(addr)
print("table_cam_add_entry realmain_v4_networks_0 realmain.set_egress_port {} => 1 {} {} 0 0".format(ip_int, i, i))

17
bin/ping_ipv6_addresses.sh Executable file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -x
read=yes
if [ $# -ge 1 ]; then
read=""
fi
for addr in $(seq 1 32); do
ip=2001:db8:42::$addr
echo "Next to ping: ${ip}"
if [ "$read" ]; then
read dummy
fi
ping6 -c1 "$ip"
done