Skip to content

Commit

Permalink
added save for srl
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Jun 28, 2021
1 parent 0be0302 commit 09af65d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions nodes/srl/srl.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ var (

//go:embed topology/*
topologies embed.FS

saveCmd []string = []string{"sr_cli", "-d", "tools", "system", "configuration", "generate-checkpoint"}
)

func init() {
Expand Down Expand Up @@ -173,6 +175,19 @@ func (s *srl) Destroy(ctx context.Context, r runtime.ContainerRuntime) error {
func (s *srl) WithMgmtNet(*types.MgmtNet) {}

func (s *srl) SaveConfig(ctx context.Context, r runtime.ContainerRuntime) error {

stdout, stderr, err := r.Exec(ctx, s.cfg.LongName, saveCmd)
if err != nil {
return fmt.Errorf("%s: failed to execute cmd: %v", s.cfg.ShortName, err)
}

if len(stderr) > 0 {
return fmt.Errorf("%s errors: %s", s.cfg.ShortName, string(stderr))
}

confPath := s.cfg.LabDir + "/config/checkpoint/checkpoint-0.json"
log.Infof("saved SR Linux configuration from %s node to %s\noutput:\n%s", s.cfg.ShortName, confPath, string(stdout))

return nil
}

Expand Down
1 change: 1 addition & 0 deletions runtime/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ func (c *DockerRuntime) CreateContainer(ctx context.Context, node *types.NodeCon
if err != nil {
return err
}

return utils.LinkContainerNS(node.NSPath, node.LongName)

}
Expand Down

0 comments on commit 09af65d

Please sign in to comment.