Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added --max-workers flag to generate cmd #282

Merged
merged 2 commits into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions cmd/generate.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cmd

import (
Expand All @@ -30,12 +15,17 @@ import (
)

var interfaceFormat = map[string]string{
"srl": "e1-%d",
"ceos": "eth%d",
"linux": "eth$d",
"bridge": "veth%d",
"srl": "e1-%d",
"ceos": "eth%d",
"crpd": "eth%d",
"sonic-vs": "eth%d",
"linux": "eth%d",
"bridge": "veth%d",
"vr-sros": "eth%d",
"vr-vmx": "eth%d",
"vr-xrv9k": "eth%d",
}
var supportedKinds = []string{"srl", "ceos", "linux", "bridge", "sonic", "crpd"}
var supportedKinds = []string{"srl", "ceos", "linux", "bridge", "sonic-vs", "crpd", "vr-sros", "vr-vmx", "vr-xrv9k"}

const (
defaultSRLType = "ixr6"
Expand Down Expand Up @@ -131,6 +121,7 @@ func init() {
generateCmd.Flags().StringVarP(&groupPrefix, "group-prefix", "", defaultGroupPrefix, "prefix used in group names")
generateCmd.Flags().StringVarP(&file, "file", "", "", "file path to save generated topology")
generateCmd.Flags().BoolVarP(&deploy, "deploy", "", false, "deploy a fabric based on the generated topology file")
generateCmd.Flags().UintVarP(&maxWorkers, "max-workers", "", 0, "limit the maximum number of workers creating nodes and virtual wires")
}

func generateTopologyConfig(name, network, ipv4range, ipv6range string, images map[string]string, licenses map[string]string, nodes ...nodesDef) ([]byte, error) {
Expand Down
5 changes: 5 additions & 0 deletions docs/cmd/generate.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ When `--deploy` flag is present, the lab deployment process starts using the gen

The generated definition file is first saved by the path set with `--file` or, if file path is not set, by the default path of `<lab-name>.yml`. Then the equivalent of the `deploy -t <file> --reconfigure` command is executed.

#### max-workers
With `--max-workers` flag it is possible to limit the amout of concurrent workers that create containers or wire virtual links. By default the number of workers equals the number of nodes/links to create.

If during the deployment of a large scaled lab you see errors about max number of opened files reached, limit the max workers with this flag.

#### file
With `--file` flag its possible to save the generated topology definition in a file by a given path.

Expand Down