Skip to content

Commit

Permalink
update jammy vm support
Browse files Browse the repository at this point in the history
Signed-off-by: sferna1 <santhosh.fernandes@gmail.com>
  • Loading branch information
sanfern committed Jul 11, 2023
1 parent 007e16b commit e2b0220
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 26 deletions.
30 changes: 19 additions & 11 deletions dev_environment/Vagrantfile
Expand Up @@ -25,6 +25,24 @@ Vagrant.configure("2") do |config|
end

l3af.vm.box = "ubuntu/focal64"
if cfg['host_l3afd_jammy'] == "true"
config.vm.provision "shell", privileged: false, inline: <<-EOF
echo "Vagrant Box jammy provisioned!"
EOF
l3af.vm.box = "ubuntu/jammy64"
else
l3af.vm.provision "shell", inline: <<-SHELL
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
chmod +x ubuntu-mainline-kernel.sh
sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/
sudo ubuntu-mainline-kernel.sh -i 5.15.0
apt --fix-broken -y install
SHELL

# restart after upgrade
l3af.vm.provision :reload
end

if cfg['traffic_mirroring'] == "true"
l3af.vm.network :private_network, ip: "192.168.10.40", :netmask => "255.255.255.0"
end
Expand All @@ -33,16 +51,6 @@ Vagrant.configure("2") do |config|

l3af.vm.synced_folder cfg['host_l3afd_code_dir'], "/home/vagrant/code/l3afd"

l3af.vm.provision "shell", inline: <<-SHELL
wget https://raw.githubusercontent.com/pimlie/ubuntu-mainline-kernel.sh/master/ubuntu-mainline-kernel.sh
chmod +x ubuntu-mainline-kernel.sh
sudo mv ubuntu-mainline-kernel.sh /usr/local/bin/
sudo ubuntu-mainline-kernel.sh -i 5.15.0
SHELL

# restart after upgrade
l3af.vm.provision :reload

# Add Grafana apt repo
l3af.vm.provision "shell", inline: <<-SHELL
sudo apt-get install -y apt-transport-https
Expand All @@ -61,7 +69,7 @@ Vagrant.configure("2") do |config|
curl \
exuberant-ctags \
flex \
gcc-8 \
gcc-9 \
gcc-multilib \
gnutls-bin \
grafana \
Expand Down
1 change: 1 addition & 0 deletions dev_environment/config.yaml
Expand Up @@ -7,3 +7,4 @@ configs:
host_l3af_debug_port: '38899'
host_l3afd_code_dir: '/code/l3afd'
traffic_mirroring: 'false'
host_l3afd_jammy: 'true'
7 changes: 5 additions & 2 deletions dev_environment/provision.sh
Expand Up @@ -29,7 +29,7 @@ if [ -d "/usr/src/linux" ]
then
echo "Directory /usr/src/linux exists."
else
git clone --branch v5.1 --depth 1 https://github.com/torvalds/linux.git /usr/src/linux
git clone --branch v5.15 --depth 1 https://github.com/torvalds/linux.git /usr/src/linux
fi
LINUX_SRC_DIR=/usr/src/linux
cd $LINUX_SRC_DIR
Expand Down Expand Up @@ -58,12 +58,15 @@ cd eBPF-Package-Repository
# declare an array variable
declare -a progs=("xdp-root" "ratelimiting" "connection-limit" "tc-root" "ipfix-flow-exporter" "traffic-mirroring")

# Distribution code name
distro=`cat /etc/os-release | grep UBUNTU_CODENAME | awk -F= '{print $2}'`

# now loop through the above array and build the L3AF eBPF programs
for prog in "${progs[@]}"
do
cd $prog
make
PROG_ARTIFACT_DIR=$BUILD_ARTIFACT_DIR/$prog/latest/focal
PROG_ARTIFACT_DIR=$BUILD_ARTIFACT_DIR/$prog/latest/$distro
mkdir -p $PROG_ARTIFACT_DIR
mv *.tar.gz $PROG_ARTIFACT_DIR
cd ../
Expand Down
15 changes: 2 additions & 13 deletions dev_environment/setup_linux_dev_env.sh
Expand Up @@ -8,17 +8,6 @@ if [[ $EUID -ne 0 ]]; then
exit 1
fi

# Make sure it is focal version 20.04
VER=$(uname -v | cut -d. -f1 | cut -d~ -f2)
VER2=$(lsb_release -sr | cut -d '.' -f1)

if [ "$VER" != "20" ]; then
if [ "$VER2" != "20" ]; then
echo "The Ubuntu version $VER i.e $VER2 is not supported by the script"
exit 1
fi
fi

# Check for kernel version 5.15
CURRENT_KERNEL_VERSION=$(uname -r | cut -d"." -f1-2)
CURRENT_KERNEL_MAJOR_VERSION=$(echo "${CURRENT_KERNEL_VERSION}" | cut -d"." -f1)
Expand Down Expand Up @@ -103,7 +92,7 @@ apt-get install -y bc \
curl \
exuberant-ctags \
flex \
gcc-8 \
gcc-9 \
gnutls-bin \
grafana \
jq \
Expand Down Expand Up @@ -190,7 +179,7 @@ if [ -d "/usr/src/linux" ];
then
echo "Linux source code already exists, skipping download"
else
git clone --branch v5.1 --depth 1 https://github.com/torvalds/linux.git /usr/src/linux
git clone --branch v5.15 --depth 1 https://github.com/torvalds/linux.git /usr/src/linux
fi

LINUX_SRC_DIR=/usr/src/linux
Expand Down

0 comments on commit e2b0220

Please sign in to comment.