Skip to content

Commit 77533e5

Browse files
Sergio Chavezhellt
andauthored
Nokia SR-SIM auto tests (#2700)
* test ci srsim * correct test name * try handling the env var differently * try handling the env var differently take two... test with extra var * try handling the env var differently take three... * try handling the env var differently take four... * try handling the env var differently take five... * try handling the env var differently take six... * adding inherit secrets on cicd because #first time * fix typo * add sr-sim image * adding registry auth * fix image path * fixes robot test * comments review & add srsim distributed test * add /opt/nokia/sros folder to ci * fix test ref * rename file --------- Co-authored-by: Roman Dodin <[email protected]>
1 parent bc60090 commit 77533e5

File tree

6 files changed

+126
-15
lines changed

6 files changed

+126
-15
lines changed

.github/workflows/cicd.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,14 @@ jobs:
374374
# with:
375375
# py_ver: ${{ needs.process-gitref.outputs.py_ver }}
376376

377-
# srsim-tests:
378-
# uses: ./.github/workflows/srsim-tests.yml
379-
# needs:
380-
# - file-changes
381-
# - build-containerlab
382-
# with:
383-
# py_ver: ${{ needs.process-gitref.outputs.py_ver }}
377+
srsim-tests:
378+
uses: ./.github/workflows/srsim-tests.yml
379+
secrets: inherit
380+
needs:
381+
- file-changes
382+
- build-containerlab
383+
with:
384+
py_ver: ${{ needs.process-gitref.outputs.py_ver }}
384385

385386
fortigate-tests:
386387
uses: ./.github/workflows/fortigate-tests.yml
@@ -434,7 +435,7 @@ jobs:
434435
- ixiac-one-basic-tests
435436
- vxlan-tests
436437
- kind-tests
437-
# - sros-tests
438+
- srsim-tests
438439
- fortigate-tests
439440
- cisco_iol-tests
440441
- fdio_vpp-tests
@@ -511,6 +512,7 @@ jobs:
511512
- ext-container-tests
512513
- vxlan-tests
513514
- kind-tests
515+
- srsim-tests
514516
- cisco_iol-tests
515517
- fortigate-tests
516518
- fdio_vpp-tests

.github/workflows/srsim-tests.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ name: srsim-tests
1313
jobs:
1414
srsim-tests:
1515
runs-on: ubuntu-24.04
16+
env:
17+
SRSIM_LICENSE: ${{ secrets.SRSIM_LICENSE }}
1618
strategy:
1719
matrix:
1820
test-suite:
19-
- "13*.robot"
21+
- "01*.robot"
22+
- "03*.robot"
2023
steps:
2124
- name: Checkout
2225
uses: actions/checkout@v4
@@ -30,6 +33,9 @@ jobs:
3033
- name: Move containerlab to usr/bin
3134
run: sudo mv ./containerlab /usr/bin/containerlab && sudo chown root:root /usr/bin/containerlab && sudo chmod 4755 /usr/bin/containerlab
3235

36+
- name: Create license file from env vars
37+
run: sudo mkdir -p /opt/nokia/sros/ && echo $SRSIM_LICENSE > /opt/nokia/sros/license-sros25.txt
38+
3339
- name: Install uv
3440
uses: astral-sh/setup-uv@v6
3541
with:
@@ -57,10 +63,19 @@ jobs:
5763
- name: Sanitize test-suite name
5864
run: echo "TEST_SUITE=$(echo ${{ matrix.test-suite }} | tr -d '*')" >> $GITHUB_ENV
5965

60-
- name: Run sros tests
61-
run: |
62-
bash ./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}
66+
- name: Login to GitHub Container Registry
67+
uses: docker/login-action@v3
68+
with:
69+
registry: ghcr.io
70+
username: ${{ github.actor }}
71+
password: ${{ secrets.GITHUB_TOKEN }}
72+
73+
- name: Pull and re-tag srsim image
74+
run: docker pull ghcr.io/srl-labs/containerlab/nokia_srsim:25.7.R1 && docker tag ghcr.io/srl-labs/containerlab/nokia_srsim:25.7.R1 registry.srlinux.dev/pub/nokia_srsim:25.7.R1
6375

76+
- name: Run sros-srsim tests
77+
run: |
78+
./tests/rf-run.sh ${{ inputs.runtime }} ./tests/13-srsim/${{ matrix.test-suite }}
6479
# upload test reports as a zip file
6580
- name: Upload test logs
6681
uses: actions/upload-artifact@v4

tests/13-srsim/01-sros-to-linux.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Suite Teardown Run Keyword Cleanup
77

88

99
*** Variables ***
10-
${lab-name} 13-01-sros-to-linux
10+
${lab-name} sr02
1111
${lab-file-name} 02-srsim.clab.yml
1212
${runtime} docker
1313
${key-name} clab-test-key
@@ -36,7 +36,7 @@ Ensure sros is reachable over ssh
3636
... password=NokiaSros1!
3737
... try_for=10
3838

39-
Verify links in node srl1
39+
Verify links in node l1
4040
${rc} ${output} = Run And Return Rc And Output
4141
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=l1 --cmd "ip link show eth1"
4242
Log ${output}

tests/13-srsim/02-srsim.clab.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ topology:
1313
ip addr add dev eth1 10.0.0.1/30'
1414
sros:
1515
kind: nokia_srsim
16-
image: nokia_srsim:25.7.R1
16+
image: registry.srlinux.dev/pub/nokia_srsim:25.7.R1
1717
type: sr-1
1818
license: /opt/nokia/sros/license-sros25.txt
1919
startup-config: |
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
*** Settings ***
2+
Library OperatingSystem
3+
Resource ../ssh.robot
4+
Resource ../common.robot
5+
6+
Suite Teardown Run Keyword Cleanup
7+
8+
9+
*** Variables ***
10+
${lab-name} sr03
11+
${lab-file-name} 03-srsim-dist.clab.yml
12+
${runtime} docker
13+
${key-name} clab-test-key
14+
15+
16+
*** Test Cases ***
17+
Set key-path Variable
18+
${key-path} = OperatingSystem.Normalize Path ~/.ssh/${key-name}
19+
Set Suite Variable ${key-path}
20+
21+
Create SSH keypair - RSA
22+
${rc} ${output} = Run And Return Rc And Output
23+
... ssh-keygen -t rsa -N "" -f ${key-path}-rsa
24+
25+
Deploy ${lab-name} lab
26+
Log ${CURDIR}
27+
${rc} ${output} = Run And Return Rc And Output
28+
... ${CLAB_BIN} --runtime ${runtime} deploy -t ${CURDIR}/${lab-file-name}
29+
Log ${output}
30+
Should Be Equal As Integers ${rc} 0
31+
32+
Ensure sros is reachable over ssh
33+
Login via SSH with username and password
34+
... address=clab-${lab-name}-sros-a
35+
... username=admin
36+
... password=NokiaSros1!
37+
... try_for=10
38+
39+
Verify links in node l1
40+
${rc} ${output} = Run And Return Rc And Output
41+
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=l1 --cmd "ip link show eth1"
42+
Log ${output}
43+
Should Be Equal As Integers ${rc} 0
44+
Should Contain ${output} state UP
45+
46+
Ensure l1 can ping sros over 1/1/1 interface
47+
Sleep 30s give some time for linecards to come up
48+
${rc} ${output} = Run And Return Rc And Output
49+
... ${CLAB_BIN} --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=l1 --cmd "ping 10.0.0.2 -c2 -w 3"
50+
Log ${output}
51+
Should Be Equal As Integers ${rc} 0
52+
Should Contain ${output} 0% packet loss
53+
54+
55+
*** Keywords ***
56+
Cleanup
57+
Run ${CLAB_BIN} --runtime ${runtime} destroy -t ${CURDIR}/${lab-file-name} --cleanup
58+
Run rm -f ${key-path}*
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: sr03
2+
3+
topology:
4+
kinds:
5+
nokia_srsim:
6+
license: /opt/nokia/sros/license-sros25.txt
7+
image: registry.srlinux.dev/pub/nokia_srsim:25.7.R1
8+
nodes:
9+
l1:
10+
kind: linux
11+
image: alpine:latest
12+
exec:
13+
- >
14+
ash -c '
15+
apk add iproute2 &&
16+
ip l set dev eth1 up &&
17+
ip addr add dev eth1 10.0.0.1/30'
18+
sros-a:
19+
kind: nokia_srsim
20+
type: ixr-s
21+
env:
22+
NOKIA_SROS_SLOT: A
23+
startup-config: |
24+
/configure port 1/1/1 ethernet mode hybrid
25+
/configure port 1/1/1 admin-state enable
26+
/configure router "Base" interface "to-linux" port 1/1/1:0
27+
/configure router "Base" interface "to-linux" ipv4 primary address 10.0.0.2
28+
/configure router "Base" interface "to-linux" ipv4 primary prefix-length 24
29+
sros-1:
30+
kind: nokia_srsim
31+
type: ixr-s
32+
network-mode: container:sros-a
33+
env:
34+
NOKIA_SROS_SLOT: 1
35+
links:
36+
- endpoints: ["l1:eth1", "sros-1:1/1/1"]

0 commit comments

Comments
 (0)