The High Level Design document of Alpine can be found here.
There are two flavours of Alpine. The Alpine Virtual Switch (AVS or ALViS) is made up of two containers - the Switchstack Container that runs the SONiC VM and an ASIC Simulation Container that runs the virtual ASIC. The SwitchStack Container hosts the VM on which the SONiC components run in their own containers.
The Alpine Virtual Switch-lite (AVS-lite) is a lightweight version of the AVS. It runs on a single container in which the SONiC components run as processes. The virtual ASIC also runs as a process.
- Clone the SONiC repo:
git clone https://github.com/sonic-net/sonic-buildimage.git
- Init
export NOJESSIE=1 NOSTRETCH=1 NOBUSTER=1 NOBULLSEYE=1 NOBOOKWORM=0 NOTRIXIE=0
cd sonic-buildimage
make init
- Configure
PLATFORM=alpinevs make configure
- Build
SONIC_BUILD_JOBS specifies the number of build tasks that run parallely. An ideal number depends on the resources in the build system but a value of 8 or 16 is reasonable for most systems.
SONIC_BUILD_JOBS=8 make target/sonic-alpinevs.img.gz
- Load the alpinevs container
docker load -i target/sonic-alpinevs-docker.tar.gz
Pre-requisite: A KVM enabled workstation (or VM) that can support VMs on it
Setup KNE cluster
kne deploy deploy/kne/kind-bridge.yaml
- Load alpinevs container image in KNE
kind load docker-image alpine-vs:latest --name kne
- Download Lemming
Install the dependencies, build the Lucius dataplane and load it
gh repo clone openconfig/lemming
cd lemming
bazel clean --expunge
bazel build --output_groups=+tarball //dataplane/standalone/lucius:image-tar
docker load -i bazel-bin/dataplane/standalone/lucius/image-tar/tarball.tar
kind load docker-image us-west1-docker.pkg.dev/openconfig-lemming/release/lucius:ga --name kne
- Create the two switch Alpine topology:
- Open the twodut-alpine-vs.pb.txt file and ensure that it points to the correct Alpine and Lucius images. You can find the name of the images from the output of 'docker images -a'. For example,
docker images -a | grep lucius
us-west1-docker.pkg.dev/openconfig-lemming/release/lucius:ga 01b58c448eaf 217MB 0B
docker images -a | grep alpine
alpine-vs:latest ebd8a4a5b357 5.04GB 0B
- Create the KNE topology. Run this from the src/deploy/kne directory.
kne create twodut-alpine-vs.pb.txt
Confirm that the alpine-ctl and alpine-dut are in running state.
kubectl get pods -A | grep alpine
twodut-alpine alpine-ctl 2/2 Running 0 16h
twodut-alpine alpine-dut 2/2 Running 0 16h
- Terminals
- [Terminal1] SSH to the AlpineVS DUT Switch VM inside the deployment:
ssh-keygen -f /tmp/id_rsa -N ""
#Set IPDUT var to the EXTERNAL-IP of "kubectl get svc -n twodut-alpine service-alpine-dut"
export IPDUT=kubectl get svc service-alpine-dut -n twodut-alpine -o jsonpath='{.status.loadBalancer.ingress[*].ip}'
ssh-copy-id -i /tmp/id_rsa.pub -oProxyCommand=none admin@$IPDUT
ssh -i /tmp/id_rsa -oProxyCommand=none admin@$IPDUT
- [Terminal2] SSH to the AlpineVS Control Switch VM inside the deployment:
ssh-keygen -f /tmp/id_rsa -N ""
#Set IPCTL var to the EXTERNAL-IP of "kubectl get svc -n twodut-alpine service-alpine-ctl"
export IPCTL=kubectl get svc service-alpine-ctl -n twodut-alpine -o jsonpath='{.status.loadBalancer.ingress[*].ip}'
ssh-copy-id -i /tmp/id_rsa.pub -oProxyCommand=none admin@$IPCTL
ssh -i /tmp/id_rsa -oProxyCommand=none admin@$IPCTL
Alternately, you can get the external ip addresses directly from kubectl and insert them in the ssh command
kubectl get services -A | grep alpine
twodut-alpine service-alpine-ctl LoadBalancer 10.96.215.178 192.168.8.51 22/TCP,9339/TCP,9559/TCP 16h
twodut-alpine service-alpine-dut LoadBalancer 10.96.195.3 192.168.8.50 22/TCP,9339/TCP,9559/TCP 16h
ssh admin@a.b.c.d -o ProxyCommand=none -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no
The password is set in your sonic-buildimage/rules/config. The default password is YourPaSsWoRd . You may want to change it to something easier.
- Useful commands
- Login to the host
kubectl exec -it -n twodut-alpine alpine-dut -- bash
- Dataplane logs
kubectl logs -n twodut-alpine alpine-dut -c dataplane
You can get the pre-built AlpineVS image in one of the following ways:
- Run the download script
On a Linux system, run the image download script
sudo apt install jq (if not already present)
get_official_build.sh
- Download the official image
Download from the AlpineVS official build or the sonic-buildimage official build The images are around 10GB and the download is often flaky. Running the download script is usually the easier option.
Extract the downloaded image archive and load the image into the Docker and KNE cluster:
docker load -i target/sonic-alpinevs-docker.tar.gz
kind load docker-image alpine-vs:latest --name kne
Then follow the steps in the Deploy section
Follow the steps 1 to 3 to clone and configure AlpineVS.
- Build
SONIC_BUILD_JOBS specifies the number of build tasks that run parallely. A value of 8 or 16 is reasonable for most systems.
SONIC_BUILD_JOBS=8 make target/docker-sonic-alpinevs.gz
- Load the alpinevs container
docker load -i target/docker-sonic-alpinevs.gz
Pre-requisite: A host with docker installed
Setup KNE cluster
kne deploy deploy/kne/kind-bridge.yaml
- Load alpinevs container image in KNE
kind load docker-image docker-sonic-alpine-vs:latest --name kne
Unlike AVS, AVS-lite does not need separate installation of Lemming.
- Create the two switch Alpine topology:
- Open the twodut-single-docker-alpinevs.txt file. Note that this is not the same topolgy file used for AVS. Ensure that it points to the correct Alpine image name. You can find the name of the image from the output of 'docker images -a'. For example,
docker images -a | grep alpine
docker-sonic-alpinevs:latest 172d5653b820 1.21GB 0B
- Create the KNE topology. Run this from the src/deploy/kne directory.
kne create twodut-single-docker-alpinevs.txt
Confirm that the alpine-ctl and alpine-dut are in running state.
kubectl get pods -A | grep alpine
docker-twodut-alpine docker-alpine-ctl 1/1 Running 0 3m10s
docker-twodut-alpine docker-alpine-dut 1/1 Running 0 3m10s
- Terminals
You can set up the SSH as described in the 'terminals' section under deploy but with slightly different namespace and service names.
kubectl get svc -n docker-twodut-alpine service-docker-alpine-dut
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service-docker-alpine-dut LoadBalancer 10.96.146.208 192.168.8.50 22/TCP,9339/TCP,9559/TCP 7m50s
kubectl get svc -n docker-twodut-alpine service-docker-alpine-ctl
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service-docker-alpine-ctl LoadBalancer 10.96.104.18 192.168.8.51 22/TCP,9339/TCP,9559/TCP 7m54s
Or more easily, get the external ip addresses directly from kubectl as above and insert them in the ssh command
ssh admin@a.b.c.d -o ProxyCommand=none -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o PreferredAuthentications=password -o PubkeyAuthentication=no
The password is set in your sonic-buildimage/rules/config. The default password is YourPaSsWoRd.
You can get the pre-built AlpineVS-lite image in one of the following ways:
- Run the download script
On a Linux system, run the image download script
sudo apt install jq (if not already present)
get_official_build.sh
- Download the official image
Download from the AlpineVS official build or the sonic-buildimage official build The images are around 10GB and the download is usually flaky. If download using the script is possible, that is the better option.
Extract the downloaded image archive and load the image into the Docker and KNE cluster:
docker load -i target/docker-sonic-alpinevs.gz
kind load docker-image docker-alpine-vs:latest --name kne
Then follow the steps in the Deploy section