Skip to content

Commit

Permalink
Merge pull request #431 from srl-labs/fix-mgmt-net-reg
Browse files Browse the repository at this point in the history
fix mgmt-net feature regression
  • Loading branch information
hellt authored May 27, 2021
2 parents 4e4df29 + 5eaffd7 commit 710457f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion clab/clab.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ func WithGracefulShutdown(gracefulShutdown bool) ClabOption {
// NewContainerLab function defines a new container lab
func NewContainerLab(opts ...ClabOption) *CLab {
c := &CLab{
Config: new(Config),
Config: &Config{
Mgmt: new(types.MgmtNet),
},
TopoFile: new(TopoFile),
m: new(sync.RWMutex),
Nodes: make(map[string]*types.Node),
Expand Down
2 changes: 1 addition & 1 deletion clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var srlTypes = map[string]string{
// Config defines lab configuration as it is provided in the YAML file
type Config struct {
Name string `json:"name,omitempty"`
Mgmt types.MgmtNet `json:"mgmt,omitempty"`
Mgmt *types.MgmtNet `json:"mgmt,omitempty"`
Topology Topology `json:"topology,omitempty"`
ConfigPath string `yaml:"config_path,omitempty"`
}
Expand Down
5 changes: 3 additions & 2 deletions runtime/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const sysctlBase = "/proc/sys"
type DockerRuntime struct {
Client *dockerC.Client
timeout time.Duration
Mgmt types.MgmtNet
Mgmt *types.MgmtNet
debug bool
gracefulShutdown bool
}
Expand All @@ -41,14 +41,15 @@ func NewDockerRuntime(d bool, dur time.Duration, gracefulShutdown bool) *DockerR

return &DockerRuntime{
Client: c,
Mgmt: new(types.MgmtNet),
// TODO: undo this hard-coding
timeout: dur,
debug: d,
gracefulShutdown: gracefulShutdown,
}
}

func (c *DockerRuntime) SetMgmtNet(n types.MgmtNet) {
func (c *DockerRuntime) SetMgmtNet(n *types.MgmtNet) {
c.Mgmt = n
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (

type ContainerRuntime interface {
// Set the network management details (generated by the config.go)
SetMgmtNet(types.MgmtNet)
SetMgmtNet(*types.MgmtNet)
// Create container (bridge) network
CreateNet(context.Context) error
// Delete container (bridge) network
Expand Down

0 comments on commit 710457f

Please sign in to comment.