Skip to content

Commit

Permalink
Merge branch 'master' into support_qos_kvm
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjiang-ms committed Dec 27, 2024
2 parents 3ba9da7 + 2a67d11 commit 09a507e
Show file tree
Hide file tree
Showing 99 changed files with 5,487 additions and 1,721 deletions.
38 changes: 20 additions & 18 deletions .azure-pipelines/baseline_test/baseline.test.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,26 @@ jobs:
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: dualtor_elastictest
displayName: "kvmtest-dualtor-t0 by Elastictest"
timeoutInMinutes: 240
continueOnError: false
pool: sonic-ubuntu-1c
steps:
- template: ../run-test-elastictest-template.yml
parameters:
TOPOLOGY: dualtor
MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
KVM_IMAGE_BRANCH: "master"
MGMT_BRANCH: "master"
BUILD_REASON: "BaselineTest"
RETRY_TIMES: "0"
STOP_ON_FAILURE: "False"
TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)
# Temporary skip dualtor test in baseline test for KVM dualtor test is not stable.
# Platform owner will work on it recently, planning to add back in 1 or 2 months.
# - job: dualtor_elastictest
# displayName: "kvmtest-dualtor-t0 by Elastictest"
# timeoutInMinutes: 240
# continueOnError: false
# pool: sonic-ubuntu-1c
# steps:
# - template: ../run-test-elastictest-template.yml
# parameters:
# TOPOLOGY: dualtor
# MIN_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
# MAX_WORKER: $(T0_DUALTOR_INSTANCE_NUM)
# COMMON_EXTRA_PARAMS: "--disable_loganalyzer "
# KVM_IMAGE_BRANCH: "master"
# MGMT_BRANCH: "master"
# BUILD_REASON: "BaselineTest"
# RETRY_TIMES: "0"
# STOP_ON_FAILURE: "False"
# TEST_PLAN_NUM: $(BASELINE_MGMT_PUBLIC_MASTER_TEST_NUM)

- job: multi_asic_elastictest
displayName: "kvmtest-multi-asic-t1-lag by Elastictest"
Expand Down
12 changes: 12 additions & 0 deletions .azure-pipelines/markers-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
steps:
- script: |
set -x
pip3 install natsort
python3 ./.azure-pipelines/markers_check/markers_check.py tests
if [[ $? -ne 0 ]]; then
echo "##vso[task.complete result=Failed;]Markers check fails."
exit 1
fi
displayName: "Markers Check"
Empty file.
70 changes: 70 additions & 0 deletions .azure-pipelines/markers_check/markers_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import re
import os
import sys
import logging

from natsort import natsorted


def collect_scripts_without_topology_markers():
"""
This function collects all test scripts under the folder 'tests/' and check the topology type marked in the script.
Returns:
List: A list of test scripts without the topology type marker.
"""
location = sys.argv[1]

# Recursively find all scripts starting with "test_" and ending with ".py"
# Note: The full path and name of files are stored in a list named "scripts"
scripts = []
for root, dirs, script in os.walk(location):
for s in script:
if s.startswith("test_") and s.endswith(".py"):
scripts.append(os.path.join(root, s))
scripts = natsorted(scripts)

# Open each script and search for regex pattern
pattern = re.compile(r"[^@]pytest\.mark\.topology\(([^\)]*)\)")

scripts_without_marker = []

for s in scripts:
has_markers = False
# Remove prefix from file name:
script_name = s[len(location) + 1:]
try:
with open(s, 'r') as script:
for line in script:
# Get topology type of script from marker `pytest.mark.topology`
match = pattern.search(line)
if match:
has_markers = True
break

if not has_markers:
scripts_without_marker.append(script_name)

except Exception as e:
raise Exception('Exception occurred while trying to get marker in {}, error {}'.format(s, e))

return scripts_without_marker


def main():
try:
scripts_without_marker = collect_scripts_without_topology_markers()

if scripts_without_marker:
for script in scripts_without_marker:
print("\033[31mPlease add mark `pytest.mark.topology` in script {}\033[0m".format(script))
sys.exit(1)

sys.exit(0)
except Exception as e:
logging.error(e)
sys.exit(2)


if __name__ == '__main__':
main()
25 changes: 17 additions & 8 deletions .azure-pipelines/pr_test_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ t0:
- bgp/test_bgp_route_neigh_learning.py
- l2/test_l2_configure.py
- srv6/test_srv6_basic_sanity.py
- pfcwd/test_pfcwd_all_port_storm.py
- pfcwd/test_pfcwd_function.py
- pfcwd/test_pfcwd_timer_accuracy.py
- pfcwd/test_pfcwd_warm_reboot.py

t0-2vlans:
- dhcp_relay/test_dhcp_relay.py
Expand Down Expand Up @@ -439,6 +443,9 @@ t1-lag:
- ipfwd/test_nhop_group.py
- restapi/test_restapi_vxlan_ecmp.py
- srv6/test_srv6_basic_sanity.py
- pfcwd/test_pfcwd_all_port_storm.py
- pfcwd/test_pfcwd_function.py
- pfcwd/test_pfcwd_timer_accuracy.py

multi-asic-t1-lag:
- bgp/test_bgp_bbr.py
Expand Down Expand Up @@ -471,22 +478,24 @@ dpu:
- dash/test_dash_vnet.py

onboarding_t0:
# We will add a batch of T0 control plane cases and fix the failed cases later
- pfcwd/test_pfcwd_all_port_storm.py
- pfcwd/test_pfcwd_function.py
- pfcwd/test_pfcwd_timer_accuracy.py
- pfcwd/test_pfcwd_warm_reboot.py
# - platform_tests/test_advanced_reboot.py
- lldp/test_lldp_syncd.py
# Flaky, we will triage and fix it later, move to onboarding to unblock pr check
- dhcp_relay/test_dhcp_relay_stress.py
- pc/test_lag_member_forwarding.py
- bgp/test_bgp_command.py
- generic_config_updater/test_mgmt_interface.py
- gnmi/test_gnmi_smartswitch.py
- gnmi/test_gnoi_killprocess.py


onboarding_t1:
- pc/test_lag_member_forwarding.py
- pfcwd/test_pfcwd_all_port_storm.py
- pfcwd/test_pfcwd_function.py
- pfcwd/test_pfcwd_timer_accuracy.py
- bgp/test_bgp_bbr_default_state.py
- bgp/test_bgp_command.py
- generic_config_updater/test_mgmt_interface.py
- gnmi/test_gnmi_smartswitch.py
- gnmi/test_gnoi_killprocess.py

specific_param:
t0-sonic:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/pr_cherrypick_prestep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,22 @@ jobs:
else
# Create PR to release branch
git push mssonicbld HEAD:cherry/$branch/${pr_id} -f
result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b "$body" 2>&1)
echo $result | grep "already exists" && { echo $result; return 0; }
echo $result | grep github.com || { echo $result; return 1; }
new_pr_rul=$(echo $result | grep github.com)
echo new_pr_rul: $new_pr_rul
result=$(gh pr create -R ${repository} -H mssonicbld:cherry/$branch/${pr_id} -B $branch -t "[action] [PR:$pr_id] $title" -b "$body" 2>&1 || true)
new_pr_url=$(echo $result | grep -Eo https://github.com/sonic-net/sonic-mgmt/pull/[0-9]*)
echo new_pr_url: $new_pr_url
# Add label to old PR
gh pr edit $pr_url --add-label "Created PR to $branch branch"
echo Add label Created PR to $branch branch
# Add comment to old PR
gh pr comment $pr_url --body "Cherry-pick PR to $branch: ${new_pr_rul}"
gh pr comment $pr_url --body "Cherry-pick PR to $branch: ${new_pr_url}"
echo Add comment to old PR
# Add label to new PR
gh pr edit $new_pr_rul --add-label "automerge"
gh pr edit $new_pr_url --add-label "automerge"
echo Add label automerge to new PR
# Add comment to new PR
gh pr comment $new_pr_rul --body "Original PR: ${pr_url}"
gh pr comment $new_pr_url --body "Original PR: ${pr_url}"
echo Add comment to new PR
fi
}
Expand Down
2 changes: 2 additions & 0 deletions ansible/config_sonic_basedon_testbed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,14 @@
vm_config: "{{ vm_topo_config }}"
port_alias: "{{ port_alias }}"
vlan_intfs: "{{ vlan_intfs }}"
vlan_config: "{{ vlan_config | default(None) }}"
delegate_to: localhost
when: "'dualtor' in topo or 'cable' in topo"

- name: gather mux cable information
mux_cable_facts:
topo_name: "{{ topo }}"
vlan_config: "{{ vlan_config | default(None) }}"
delegate_to: localhost
when: "'dualtor' in topo"

Expand Down
26 changes: 22 additions & 4 deletions ansible/golden_config_db/smartswitch_t1-28-lag.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"CHASSIS_MODULE": {
"DPU0": {
"admin_status": "down"
},
"DPU1": {
"admin_status": "down"
},
Expand All @@ -28,7 +25,7 @@
"DHCP_SERVER_IPV4": {
"bridge-midplane": {
"gateway": "169.254.200.254",
"lease_time": "600",
"lease_time": "31536000",
"mode": "PORT",
"netmask": "255.255.255.0",
"state": "enabled"
Expand Down Expand Up @@ -107,5 +104,26 @@
"bridge": "bridge-midplane",
"ip_prefix": "169.254.200.254/24"
}
},
"GNMI": {
"certs": {
"ca_crt": "/etc/sonic/telemetry/dsmsroot.cer",
"server_crt": "/etc/sonic/telemetry/streamingtelemetryserver.cer",
"server_key": "/etc/sonic/telemetry/streamingtelemetryserver.key"
},
"gnmi": {
"client_auth": "true",
"log_level": "2",
"port": "50052"
}
},
"STATIC_ROUTE": {
"default|10.2.0.1/32": {
"blackhole": "false",
"distance": "0",
"ifname": "",
"nexthop": "18.0.202.1",
"nexthop-vrf": "default"
}
}
}
Loading

0 comments on commit 09a507e

Please sign in to comment.