Skip to content

Commit 6c6d095

Browse files
author
Sergio Chavez
authored
Srsim comps fix #2702 (#2705)
* 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 * attemp to fix #2702 * attempt to fix #2702
1 parent 97c2cae commit 6c6d095

File tree

4 files changed

+96
-6
lines changed

4 files changed

+96
-6
lines changed

.github/workflows/srsim-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
test-suite:
2121
- "01*.robot"
2222
- "03*.robot"
23+
- "05*.robot"
2324
steps:
2425
- name: Checkout
2526
uses: actions/checkout@v4

nodes/sros/sros.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,11 @@ func (n *sros) setupComponentNodes() error {
375375
}
376376

377377
// adjust the config values from the original node
378-
componentConfig.ShortName = fmt.Sprintf("%s-%s", componentConfig.ShortName, c.Slot)
379-
componentConfig.LongName = fmt.Sprintf("%s-%s", componentConfig.LongName, c.Slot)
378+
componentConfig.ShortName = n.calcComponentName(componentConfig.ShortName, c.Slot)
379+
componentConfig.LongName = n.calcComponentName(componentConfig.LongName, c.Slot)
380380
componentConfig.NodeType = n.Cfg.NodeType
381381
componentConfig.Components = nil
382-
fqdnDotIndex := strings.Index(componentConfig.Fqdn, ".")
383-
componentConfig.Fqdn = fmt.Sprintf("%s-%s%s", componentConfig.Fqdn[:fqdnDotIndex],
384-
c.Slot, componentConfig.Fqdn[fqdnDotIndex:])
382+
componentConfig.Fqdn = n.calcComponentFqdn(c.Slot)
385383
if idx != 0 {
386384
componentConfig.DNS = nil
387385
}
@@ -521,7 +519,7 @@ func (n *sros) cpmNode() (nodes.Node, error) {
521519
if err != nil {
522520
return nil, err
523521
}
524-
522+
defaultSlot = strings.ToLower(defaultSlot)
525523
for _, cn := range n.componentNodes {
526524
if cn.GetShortName()[len(cn.GetShortName())-1:] == defaultSlot {
527525
return cn, nil
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} sr05
11+
${lab-file-name} 05-srsim-comp.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/c23/4 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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: sr05
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:
19+
kind: nokia_srsim
20+
type: sr-1-92s
21+
components:
22+
- slot: A
23+
- slot: 1
24+
startup-config: |
25+
/configure port 1/1/c23 connector breakout c4-100g
26+
/configure port 1/1/c23 admin-state enable
27+
/configure port 1/1/c23/4 ethernet mode hybrid
28+
/configure port 1/1/c23/4 admin-state enable
29+
/configure router "Base" interface "to-linux" port 1/1/c23/4:0
30+
/configure router "Base" interface "to-linux" ipv4 primary address 10.0.0.2
31+
/configure router "Base" interface "to-linux" ipv4 primary prefix-length 24
32+
links:
33+
- endpoints: ["l1:eth1", "sros:1/1/c23/4"]

0 commit comments

Comments
 (0)