Skip to content

Commit

Permalink
added admin-enable for srl interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Dec 2, 2021
1 parent dc5e193 commit 54ab020
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
14 changes: 13 additions & 1 deletion nodes/srl/srl.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"time"

"github.com/google/shlex"
"github.com/hairyhenderson/gomplate/v3"
"github.com/hairyhenderson/gomplate/v3/data"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"

Expand Down Expand Up @@ -48,6 +50,14 @@ set / system json-rpc-server admin-state enable network-instance mgmt http admin
set / system json-rpc-server admin-state enable network-instance mgmt https admin-state enable tls-profile clab-profile
set / system lldp admin-state enable
set / system aaa authentication idle-timeout 7200
{{/* enabling interfaces referenced as endpoints for a node (both e1-2 and e1-3-1 notations) */}}
{{ range $ep := .Endpoints }}
{{- $parts := ($ep.EndpointName | strings.ReplaceAll "e" "" | strings.Split "-") -}}
set / interface ethernet-{{index $parts 0}}/{{index $parts 1}} admin-state enable
{{- if eq (len $parts) 3 }}
set / interface ethernet-{{index $parts 0}}/{{index $parts 1}}/{{index $parts 2}} admin-state enable
{{- end }}
{{- end }}
commit save`
)

Expand Down Expand Up @@ -80,7 +90,9 @@ var (
mgmtServerRdyCmd, _ = shlex.Split("sr_cli -d info from state system app-management application mgmt_server state | grep running")
commitCompleteCmd, _ = shlex.Split("sr_cli -d info from state system configuration commit 1 status | grep complete")

srlCfgTpl, _ = template.New("srl-tls-profile").Parse(srlConfigCmdsTpl)
srlCfgTpl, _ = template.New("srl-tls-profile").
Funcs(gomplate.CreateFuncs(context.Background(), new(data.Data))).
Parse(srlConfigCmdsTpl)
)

func init() {
Expand Down
10 changes: 10 additions & 0 deletions tests/02-basic-srl/01-two-srls.robot
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ Verify links in node srl2
Should Be Equal As Integers ${rc} 0
Should Contain ${output} state UP

Verify e1-1 interface have been admin enabled on srl1
[Documentation]
... This test cases ensures that e1-1 interface referenced in links section
... has been automatically admin enabled
${rc} ${output} = Run And Return Rc And Output
... sudo containerlab --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=srl1 --cmd "sr_cli 'show interface ethernet-1/1'"
Log ${output}
Should Be Equal As Integers ${rc} 0
Should Contain ${output} ethernet-1/1 is up

Verify srl2 accepted user-provided CLI config
${rc} ${output} = Run And Return Rc And Output
... sudo containerlab --runtime ${runtime} exec -t ${CURDIR}/${lab-file-name} --label clab-node-name\=srl2 --cmd "sr_cli 'info /system information location'"
Expand Down

0 comments on commit 54ab020

Please sign in to comment.