Skip to content

Commit 95b979d

Browse files
authored
[202012][TestbedV2]Migrate t0 and t1-lag to TestbedV2 (#12383) (#12454)
* [TestbedV2]Migrate t0 and t1-lag to TestbedV2 (#12383) signed-off-by: [email protected] Migrate the t0 and t1-lag test jobs in buildimage repo to TestbedV2. Why I did it Migrate the t0 and t1-lag test jobs in buildimage repo to TestbedV2. How I did it Migrate the t0 and t1-lag test jobs in buildimage repo to TestbedV2. Remove ceos type setting Use 202012 branch as sonic-mgmt branch * Modify template to use 202012 branch
1 parent 4bbfcf0 commit 95b979d

File tree

2 files changed

+218
-12
lines changed

2 files changed

+218
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
parameters:
2+
- name: TOPOLOGY
3+
type: string
4+
5+
- name: POLL_INTERVAL
6+
type: number
7+
default: 10
8+
9+
- name: POLL_TIMEOUT
10+
type: number
11+
default: 36000
12+
13+
- name: MIN_WORKER
14+
type: number
15+
default: 1
16+
17+
- name: MAX_WORKER
18+
type: number
19+
default: 2
20+
21+
- name: TEST_SET
22+
type: string
23+
default: ""
24+
25+
- name: DEPLOY_MG_EXTRA_PARAMS
26+
type: string
27+
default: ""
28+
29+
- name: MGMT_BRANCH
30+
type: string
31+
default: master
32+
33+
steps:
34+
- script: |
35+
set -ex
36+
# always use the test plan script from master branch.
37+
wget -O ./.azure-pipelines/test_plan.py https://raw.githubusercontent.com/sonic-net/sonic-mgmt/master/.azure-pipelines/test_plan.py
38+
wget -O ./.azure-pipelines/pr_test_scripts.yaml https://raw.githubusercontent.com/sonic-net/sonic-mgmt/${{ parameters.MGMT_BRANCH }}/.azure-pipelines/pr_test_scripts.yaml
39+
displayName: Download TestbedV2 scripts
40+
41+
- script: |
42+
set -ex
43+
pip install PyYAML
44+
rm -f new_test_plan_id.txt
45+
python ./.azure-pipelines/test_plan.py create -t ${{ parameters.TOPOLOGY }} -o new_test_plan_id.txt --min-worker ${{ parameters.MIN_WORKER }} --max-worker ${{ parameters.MAX_WORKER }} --test-set ${{ parameters.TEST_SET }} --kvm-build-id $(KVM_BUILD_ID) --deploy-mg-extra-params "${{ parameters.DEPLOY_MG_EXTRA_PARAMS }}" --mgmt-branch ${{ parameters.MGMT_BRANCH }}
46+
TEST_PLAN_ID=`cat new_test_plan_id.txt`
47+
48+
echo "Created test plan $TEST_PLAN_ID"
49+
echo "Check https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID for test plan status"
50+
echo "##vso[task.setvariable variable=TEST_PLAN_ID]$TEST_PLAN_ID"
51+
env:
52+
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
53+
TENANT_ID: $(TESTBED_TOOLS_MSAL_TENANT_ID)
54+
CLIENT_ID: $(TESTBED_TOOLS_MSAL_CLIENT_ID)
55+
CLIENT_SECRET: $(TESTBED_TOOLS_MSAL_CLIENT_SECRET)
56+
displayName: Trigger test
57+
58+
- script: |
59+
set -ex
60+
echo "Lock testbed"
61+
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to [email protected]"
62+
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID"
63+
# When "LOCK_TESTBED" finish, it changes into "PREPARE_TESTBED"
64+
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --timeout 43200 --expected-states PREPARE_TESTBED EXECUTING KVMDUMP FINISHED CANCELLED FAILED
65+
env:
66+
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
67+
displayName: Lock testbed
68+
timeoutInMinutes: 240
69+
70+
- script: |
71+
set -ex
72+
echo "Prepare testbed"
73+
echo "Preparing the testbed(add-topo, deploy-mg) may take 15-30 minutes. Before the testbed is ready, the progress of the test plan keeps displayed as 0, please be patient(We will improve the indication in a short time)"
74+
echo "If the progress keeps as 0 for more than 1 hour, please cancel and retry this pipeline"
75+
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to [email protected]"
76+
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID"
77+
# When "PREPARE_TESTBED" finish, it changes into "EXECUTING"
78+
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --timeout 2400 --expected-states EXECUTING KVMDUMP FINISHED CANCELLED FAILED
79+
env:
80+
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
81+
displayName: Prepare testbed
82+
timeoutInMinutes: 40
83+
84+
- script: |
85+
set -ex
86+
echo "Run test"
87+
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to [email protected]"
88+
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID"
89+
# When "EXECUTING" finish, it changes into "KVMDUMP", "FAILED", "CANCELLED" or "FINISHED"
90+
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --timeout 18000 --expected-states KVMDUMP FINISHED CANCELLED FAILED
91+
env:
92+
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
93+
displayName: Run test
94+
timeoutInMinutes: 300
95+
96+
- script: |
97+
set -ex
98+
echo "KVM dump"
99+
echo "TestbedV2 is just online and might not be stable enough, for any issue, please send email to [email protected]"
100+
echo "Runtime detailed progress at https://www.testbed-tools.org/scheduler/testplan/$TEST_PLAN_ID"
101+
# When "KVMDUMP" finish, it changes into "FAILED", "CANCELLED" or "FINISHED"
102+
python ./.azure-pipelines/test_plan.py poll -i "$(TEST_PLAN_ID)" --timeout 43200 --expected-states FINISHED CANCELLED FAILED
103+
condition: succeededOrFailed()
104+
env:
105+
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
106+
displayName: KVM dump
107+
timeoutInMinutes: 20
108+
109+
- script: |
110+
set -ex
111+
echo "Try to cancel test plan $TEST_PLAN_ID, cancelling finished test plan has no effect."
112+
python ./.azure-pipelines/test_plan.py cancel -i "$(TEST_PLAN_ID)"
113+
condition: always()
114+
env:
115+
TESTBED_TOOLS_URL: $(TESTBED_TOOLS_URL)
116+
TENANT_ID: $(TESTBED_TOOLS_MSAL_TENANT_ID)
117+
CLIENT_ID: $(TESTBED_TOOLS_MSAL_CLIENT_ID)
118+
CLIENT_SECRET: $(TESTBED_TOOLS_MSAL_CLIENT_SECRET)
119+
displayName: Finalize running test plan

azure-pipelines.yml

+99-12
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ stages:
7878
dependsOn: BuildVS
7979
condition: and(succeeded(), and(ne(stageDependencies.BuildVS.outputs['vs.SetVar.SKIP_VSTEST'], 'YES'), in(dependencies.BuildVS.result, 'Succeeded', 'SucceededWithIssues')))
8080
variables:
81+
- group: Testbed-Tools
8182
- name: inventory
8283
value: veos_vtb
8384
- name: testbed_file
@@ -135,7 +136,8 @@ stages:
135136
pool: sonictest
136137
displayName: "kvmtest-t0-part1"
137138
timeoutInMinutes: 300
138-
139+
condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES'))
140+
continueOnError: false
139141
steps:
140142
- template: .azure-pipelines/run-test-template.yml
141143
parameters:
@@ -149,7 +151,8 @@ stages:
149151
pool: sonictest
150152
displayName: "kvmtest-t0-part2"
151153
timeoutInMinutes: 300
152-
154+
condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES'))
155+
continueOnError: false
153156
steps:
154157
- template: .azure-pipelines/run-test-template.yml
155158
parameters:
@@ -159,37 +162,121 @@ stages:
159162
tbtype: t0
160163
section: part-2
161164

165+
- job: t0_testbedv2
166+
pool:
167+
vmImage: 'ubuntu-20.04'
168+
displayName: "kvmtest-t0 by TestbedV2"
169+
timeoutInMinutes: 1080
170+
condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES'))
171+
continueOnError: false
172+
steps:
173+
- template: .azure-pipelines/run-test-scheduler-template.yml
174+
parameters:
175+
TOPOLOGY: t0
176+
MIN_WORKER: 2
177+
MAX_WORKER: 3
178+
MGMT_BRANCH: 202012
179+
180+
- job: t0_2vlans_testbedv2
181+
pool:
182+
vmImage: 'ubuntu-20.04'
183+
displayName: "kvmtest-t0-2vlans by TestbedV2"
184+
timeoutInMinutes: 1080
185+
condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES'))
186+
continueOnError: false
187+
steps:
188+
- template: .azure-pipelines/run-test-scheduler-template.yml
189+
parameters:
190+
TOPOLOGY: t0
191+
TEST_SET: t0-2vlans
192+
MAX_WORKER: 1
193+
DEPLOY_MG_EXTRA_PARAMS: "-e vlan_config=two_vlan_a"
194+
MGMT_BRANCH: 202012
195+
162196
- job:
163-
pool: sonictest
197+
pool:
198+
vmImage: 'ubuntu-20.04'
164199
displayName: "kvmtest-t0"
165-
timeoutInMinutes: 300
166200
dependsOn:
167201
- t0_part1
168202
- t0_part2
203+
- t0_testbedv2
204+
- t0_2vlans_testbedv2
169205
condition: always()
170206
variables:
171207
resultOfPart1: $[ dependencies.t0_part1.result ]
172208
resultOfPart2: $[ dependencies.t0_part2.result ]
209+
resultOfT0TestbedV2: $[ dependencies.t0_testbedv2.result ]
210+
resultOfT02VlansTestbedV2: $[ dependencies.t0_2vlans_testbedv2.result ]
173211

174212
steps:
175213
- script: |
214+
if [ $(resultOfT0TestbedV2) == "Succeeded" ] && [ $(resultOfT02VlansTestbedV2) == "Succeeded" ]; then
215+
echo "TestbedV2 t0 passed."
216+
exit 0
217+
fi
218+
176219
if [ $(resultOfPart1) == "Succeeded" ] && [ $(resultOfPart2) == "Succeeded" ]; then
177-
echo "Both job kvmtest-t0-part1 and kvmtest-t0-part2 are passed."
220+
echo "Classic t0 jobs(both part1 and part2) passed."
178221
exit 0
179-
else
180-
echo "Either job kvmtest-t0-part1 or job kvmtest-t0-part2 failed! Please check the detailed information."
181-
exit 1
182222
fi
183223
184-
- job:
185-
pool: sonictest-t1-lag
186-
displayName: "kvmtest-t1-lag"
187-
timeoutInMinutes: 240
224+
echo "Both classic and TestbedV2 t0 jobs failed! Please check the detailed information. (Any of them passed, t0 will be considered as passed)"
225+
exit 1
188226
227+
228+
- job: t1_lag_classic
229+
pool: sonictest-t1-lag
230+
displayName: "kvmtest-t1-lag classic"
231+
timeoutInMinutes: 400
232+
condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_CLASSICAL_TEST, 'YES'))
233+
continueOnError: false
189234
steps:
190235
- template: .azure-pipelines/run-test-template.yml
191236
parameters:
192237
dut: vlab-03
193238
tbname: vms-kvm-t1-lag
194239
ptf_name: ptf_vms6-2
195240
tbtype: t1-lag
241+
242+
- job: t1_lag_testbedv2
243+
pool:
244+
vmImage: 'ubuntu-20.04'
245+
displayName: "kvmtest-t1-lag by TestbedV2"
246+
timeoutInMinutes: 600
247+
condition: and(succeeded(), eq(variables.BUILD_IMG_RUN_TESTBEDV2_TEST, 'YES'))
248+
continueOnError: false
249+
steps:
250+
- template: .azure-pipelines/run-test-scheduler-template.yml
251+
parameters:
252+
TOPOLOGY: t1-lag
253+
MIN_WORKER: 2
254+
MAX_WORKER: 3
255+
MGMT_BRANCH: 202012
256+
257+
- job:
258+
pool:
259+
vmImage: 'ubuntu-20.04'
260+
displayName: "kvmtest-t1-lag"
261+
dependsOn:
262+
- t1_lag_classic
263+
- t1_lag_testbedv2
264+
condition: always()
265+
continueOnError: false
266+
variables:
267+
resultOfClassic: $[ dependencies.t1_lag_classic.result ]
268+
resultOfTestbedV2: $[ dependencies.t1_lag_testbedv2.result ]
269+
steps:
270+
- script: |
271+
if [ $(resultOfTestbedV2) == "Succeeded" ]; then
272+
echo "TestbedV2 t1-lag passed."
273+
exit 0
274+
fi
275+
276+
if [ $(resultOfClassic) == "Succeeded" ]; then
277+
echo "Classic t1-lag passed."
278+
exit 0
279+
fi
280+
281+
echo "Both classic and TestbedV2 t1-lag jobs failed! Please check the detailed information. (Any of them passed, t1-lag will be considered as passed)"
282+
exit 1

0 commit comments

Comments
 (0)