Running xpSaiApp standalone

Running on HW

Build for ARM:

user@node09:~$ git clone git@gitlab.larch:openlan/sai-marvell-api.git 
user@node09:~$ cd sai-marvell-api
user@node09:~$ git submodule update --init --recursive
user@node09:~/sai-marvell-api$ ./build_in_docker.sh -t aarch64
user@node09:~/sai-marvell-api$ cd build/
user@node09:~/sai-marvell-api/build$ ./build_xpSaiApp_pkg.sh 

Copy package to the arm device:

user@node09:~/sai-marvell-api/build$ scp ../dist/xpSaiApp_2024-09-14.tgz admin@<board_ip>:

Turn off the process monitoring daemon to prevent the container from being restarted and stop the syncd:

admin@sonic:~$ docker exec -ti syncd bash
root@sonic:/# supervisorctl stop supervisor-proc-exit-listener
root@sonic:/# supervisorctl stop syncd

Copy xpSaiApp to the syncd container

admin@sonic:~$ docker cp xpSaiApp_2024-09-14.tgz syncd:/root/
admin@sonic:~$ docker exec -ti syncd bash
root@sonic:/# cd /root/
root@sonic:~# tar -xzvf xpSaiApp_2024-09-14.tgz

Run xpSaiApp with correct SAI*.xml:

root@sonic:~# cd /root/xpSaiApp/; ./dist/xpSaiApp -P /usr/share/sonic/hwsku/SAI-AC5X-LN-48x1G-6x25G.xml -u

How to apply changes to platform XML files:

user@node09:~/sai-marvell-api$ vim EZB/Lanaotek/ln3848g/ASK-Board-ac5x-ln-48x1G-6x25G.xml
user@node09:~/sai-marvell-api$ cd EZB
user@node09:~/sai-marvell-api/EZB$ ./recalc_hash.py -d Lanaotek/ln3848g/
# copy both updated *xml and *md5 files to the target device 
user@node09:~/sai-marvell-api$ scp EZB/Lanaotek/ln3848g/ASK-Board-ac5x-ln-48x1G-6x25G.* admin@<board_ip>:

Running WM

Go to AMD server and build sai:

user@node10:~$ git clone git@gitlab.larch:openlan/sai-marvell-api.git 
user@node10:~$ cd sai-marvell-api
user@node10:~/sai-marvell-api$ git submodule update --init --recursive
user@node10:~/sai-marvell-api$ ./build_in_docker.sh -s

As a result, xpSaiApp will be built.

user@node10:~/sai-marvell-api$ ls -l dist/xpSaiApp 
lrwxrwxrwx 1 user user 15 Nov 20 16:43 dist/xpSaiApp -> native/xpSaiApp

Use the generated docker build image to run xpS

user@node10:~/sai-marvell-api$ docker run --rm=true --init --privileged --name $(whoami)_xpsai -v ./:/root/sai-marvell-api --tmpfs /tmp sai-build-$(whoami):latest /bin/bash -c "echo 'Started'; sleep infinity"

Go to the container:

user@node10:~$ docker exec -ti $(whoami)_xpsai bash

Inside the container build and run slanConnector and bring up tap interfaces

cd demo/slanConnector/pss_unix_utils/                        
make                               
./slanConnector_Linux -D            
sudo ./slanTunTapLinux -D -n slan00
sudo ./slanTunTapLinux -D -n slan01
sudo ./slanTunTapLinux -D -n slan02
sudo ./slanTunTapLinux -D -n slan03
sudo ./slanTunTapLinux -D -n slan04
sudo ./slanTunTapLinux -D -n slan05
sudo ifconfig tap0 up              
sudo ifconfig tap1 up              
sudo ifconfig tap2 up              
sudo ifconfig tap3 up
sudo ifconfig tap4 up
sudo ifconfig tap5 up    

Select the Packet Processor you want to simulate and run xpSaiApp:

# Aldrin2:
root@bda3b28f8b74:~/sai-marvell-api$ ./dist/xpSaiApp -P EZB/simulation/aldrin2/SAI-ALD2_48x10G-6x100G.xml -G iniFiles/aldrin2_A0_pss_wm.ini -u
# Aldrin3M:
root@bda3b28f8b74:~/sai-marvell-api$ ./dist/xpSaiApp -P EZB/simulation/aldrin3m/SAI-ALD3M_12x25G-2x100G.xml -G iniFiles/aldrin3m_A0_wm.ini -u

xpSaiApp CLI usage example:

# setting admin state for ports 3,4:
sai
port
# 281474976710659 = 0x1000000000003 is panel port 3
sai_set_port_attribute 281474976710659 SAI_PORT_ATTR_ADMIN_STATE 1
sai_set_port_attribute 281474976710660 SAI_PORT_ATTR_ADMIN_STATE 1

# Creating VLAN 75 and adding ports 28,29 to it:
vlan
sai_create_vlan 9288674231451648 75
vlan_id_out = 10696049115004929
# 16325548649218076 = 0x3A00000000001C # port 28
# 16325548649218077 = 0x3A00000000001D # port 29
sai_create_vlan_member 9288674231451648 10696049115004929 16325548649218076 1