Setup testbed and running PTF tests for SONIC - mganugapati-auradine/sonic-buildimage GitHub Wiki
IP Address: 10.30.0.61
Username: auralink
Password: Aur@l1nk@1!
Skip this step if the image is already present at
/data/docker_images
.
git clone --recursive https://github.com/sonic-net/sonic-buildimage.git
cd sonic-buildimage
make configure PLATFORM=vs # Takes about 1 hour
make target/docker-ptf.gz
docker load < docker-ptf.gz
Skip this step if the image is already present at
/data/docker_images
.
git clone --recursive https://github.com/sonic-net/sonic-buildimage.git
cd sonic-buildimage
make configure PLATFORM=generic
make target/docker-sonic-mgmt.gz
docker load < docker-sonic-mgmt.gz
cd /data/
mkdir /data/<YOUR_DIR>
cd /data/<YOUR_DIR>
# Clone custom sonic-mgmt branch
git clone -b auralinks-202411 [email protected]:Auradine/sonic-mgmt.git
# Go to tests/scripts and run the following commands to refresh the vlan interfaces(delete/add).
./sonic-mgmt/tests/scripts/remove_add_vlan_interfaces_on_host.sh (IMPORTANT: Change the BASE_IF, START_VLAN_ID, END_VLAN_ID in this file if needed, make sure the vlan ids dont conflict)
# Launch container
docker run -it -d --name <CONTAINER_NAME>\
-v /var/run/docker.sock:/var/run/docker.sock \
-v $PWD:/var/AzDevOps \
docker-sonic-mgmt bash
# Enter container and switch to root
docker exec -it <CONTAINER_NAME> bash
sudo su
# Generate the SSH key and copy to the authorized_keys file on the same test server.
1. ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa(This step should be done inside the sonic-mgmt container)
2. Copy id_rsa.pub to ~/.ssh/authorized_keys "outside" the container
(This step could sound ridiculous but needed because the test server connects to itself).
# Navigate to sonic-mgmt repo
cd /var/AzDevOps/sonic-mgmt/ansible
-
Identify the management interface name on your Linux host:
ifconfig -a # Example: enp23s0f0np0
-
Run cleanup scripts:
./testbed-cli.sh -m veos -k ceos remove-topo <TOPO_NAME> ./password.txt -e ptf_imagetag=latest -vvvv
export DOCKER_PTF_IMAGE_NAME=docker-ptf:latest
./testbed-cli.sh -m veos -k ceos add-topo <TOPO_NAME> ./password.txt \
-e ptf_imagetag=latest -vvvv
WIP
1. Go inside the tests folder inside the sonic-mgmt repo.
2. Run test --> bash ./run_tests.sh -d upscalelab1-spine1 -f ../ansible/testbed.yaml -i ../ansible/veos -k debug -l debug -p logs -c "lldp/test_lldp_syncd.py::test_lldp_entry_table_after_syncd_orchagent" -n wistron_testbed_t0_ngty -e "--skip_sanity" -u
- Change working directory to your cloned sonic-mgmt repo:
cd sonic-mgmt
- Install gh on your laptop
- List all workflows that are available in the repo using:
gh workflow list
Please note: If your workflow is listed in above output, you can skip to Step 6.
- If you are on a private branch and this is the first time you are running the workflow, it is possible your workflow won't be listed here. If this is the case, temporarily add a
push
trigger for your workflow like below, commit it to.github/workflows/<workflowfile.yml>
on:
push:
branches:
- <branchname>
- You can remove the push trigger and commmit the file
- In order to trigger the workflow, run below command:
Without inputs:
gh workflow run <workflow-name> --ref=<branchname>
With inputs:
gh workflow run <workflow-name> --ref=<branchname> -F input1=value1 -F input2=value2
for i in $(seq 0 8 248); do
> port="Ethernet$i"
> desc="Description for $port"
> redis-cli -n 4 hset "PORT|$port" description "$desc"
> echo "Set description for $port"
> done
# Step 2: Create VLAN 105
sudo config vlan add 105
# Step 3: Assign IP to Vlan105
sudo config interface ip add Vlan105 10.30.5.1/24
# Step 4: Add Ethernet0 to VLAN 105 as untagged
sudo config vlan member add -u 105 Ethernet224
# Step 5: Enable DHCP relay feature (if not already enabled)
sudo config feature state dhcp_relay enabled
# Step 6: Add DHCP helper IP (replace with your server's IP)
sudo config dhcp_relay ipv4 helper add 105 10.30.5.74
# Step 7: Add route to the DHCP server
sudo ip route add 10.30.5.74 via 10.30.5.1 dev Vlan105