You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make '--instance' and '--snapshot' CLI parameters consistent
* Add '--instance' parameter to most netlab commands
* Add 'change to instance directory' processing to the 'load snapshot'
function
* Allow '--snapshot' parameter only in read-only commands that do not
access lab devices
Closes#1784
Copy file name to clipboardExpand all lines: docs/netlab/collect.md
+7-4
Original file line number
Diff line number
Diff line change
@@ -3,22 +3,23 @@
3
3
4
4
**netlab collect** command uses Ansible *device facts* modules (or an equivalent list of Ansible tasks) to collect device configurations and store them in specified output directory.
5
5
6
-
A single configuration file in the output directory is created for most network devices; multiple files stored in host-specific subdirectory are collected from Cumulus VX.
6
+
A single configuration file in the output directory is created for most network devices; multiple files are collected from FRR and Cumulus VX.
7
7
8
8
After collecting the device configurations, you can save them in a tar archive with the `--tar` option and clean up the working directory with `--cleanup` option.
9
9
10
10
```{tip}
11
-
**netlab collect** command does not need a topology file (so you don't have to specify one even if you're using a non-default topology name). It's just a thin wrapper around an Ansible playbook which uses Ansible inventory created by **netlab create** or **netlab up** command.
11
+
* **netlab collect** command is just a thin wrapper around an Ansible playbook which uses Ansible inventory created by **netlab create** or **netlab up** command.
12
+
* When executed with the `-i` option, **netlab collect** switches to the lab directory to execute the Ansible playbook, but stores the results within the directory from which it was executed.
Copy file name to clipboardExpand all lines: docs/netlab/config.md
+13-9
Original file line number
Diff line number
Diff line change
@@ -5,23 +5,23 @@
5
5
6
6
You have to use **netlab config** on a running lab. If you want to try out the configuration templates without starting the lab, add the [**config** attribute](custom-config) to node data and run **netlab create** (to create the Ansible inventory) followed by **[netlab initial -c -o](netlab-initial)** to create the configuration files.
template Configuration template or a directory with templates
16
+
template Configuration template or a directory with templates
19
17
20
18
options:
21
-
-h, --help show this help message and exit
22
-
-r, --reload Reload saved device configurations
23
-
-v, --verbose Verbose logging (add multiple flags for increased verbosity)
24
-
-q, --quiet Report only major errors
19
+
-h, --help show this help message and exit
20
+
-r, --reload Reload saved device configurations
21
+
-v, --verbose Verbose logging (add multiple flags for increased verbosity)
22
+
-q, --quiet Report only major errors
23
+
-i INSTANCE, --instance INSTANCE
24
+
Specify lab instance to configure
25
25
26
26
All other arguments are passed directly to ansible-playbook
27
27
```
@@ -34,6 +34,10 @@ When you specify a directory name, the **netlab config** command tries to find t
34
34
35
35
See [](custom-config), [](netlab-initial-custom) and [](dev-find-custom) for more details.
36
36
37
+
```{tip}
38
+
When executed with the `-i` option, **netlab config** expects the configuration template file or directory to be within the lab directory.
39
+
```
40
+
37
41
## Limiting the Scope of Configuration Deployments
38
42
39
43
All unrecognized parameters are passed to the internal `config.ansible` Ansible playbook. You can use **ansible-playbook** CLI parameters to modify the configuration deployment, for example:
@@ -51,4 +55,4 @@ After that, it treats the saved device configurations as custom templates and us
51
55
52
56
To display device configurations within the Ansible playbook without deploying them, use `-v --tags test` parameters after the template name.
53
57
54
-
The `-v` flag will trigger a debugging printout, and the bogus `test` flag will skip the actual configuration deployment.
58
+
The `-v` flag triggers a debugging printout, and the bogus `test` flag skips the configuration deployment.
usage: netlab down [-h] [-v] [--cleanup] [--dry-run] [--force] [-i INSTANCE]
12
13
13
14
Destroy the virtual lab
14
15
15
16
options:
16
17
-h, --help show this help message and exit
17
18
-v, --verbose Verbose logging (where applicable)
18
19
--cleanup Remove all configuration files created by netlab create
19
-
--dry-run Print the commands that would be executed, but do not execute them
20
+
--dry-run Print the commands that would be executed, but do not execute
21
+
them
22
+
--force Force shutdown or cleanup (use at your own risk)
20
23
-i INSTANCE, --instance INSTANCE
21
24
Specify lab instance to shut down
22
-
--force Force shutdown or cleanup (use at your own risk)
23
25
```
24
26
25
27
Notes:
26
28
27
29
***netlab down** needs transformed topology data to find the virtualization provider and link (bridge) names.
28
-
***netlab down** reads the transformed topology from `netlab.snapshot.yml` file created by **netlab up** or **netlab create**. You can specify a different snapshot file name, but you really should not.
30
+
***netlab down** reads the transformed topology from `netlab.snapshot.yml` file created by **netlab up** or **netlab create**.
29
31
* With the `--instance` flag, you can shut down a lab instance running in a different directory. Use the `netlab status --all` command to display all running instances.
30
32
* Use the `--cleanup` flag to delete all Ansible-, Vagrant- or containerlab-related configuration files.
31
33
* Use the `--force` flag with the `--cleanup` flag if you want to clean up the directory even when the virtualization provider fails during the shutdown process.
-v, --verbose Verbose logging (add multiple flags for increased verbosity)
43
46
-q, --quiet Report only major errors
44
-
-v, --verbose Verbose logging
45
47
-i, --initial Deploy just the initial configuration
46
48
-m [MODULE], --module [MODULE]
47
-
Deploy module-specific configuration (optionally including a
49
+
Deploy module-specific configuration (optionally including a
48
50
list of modules separated by commas)
49
-
-c, --custom Deploy custom configuration templates (specified in "config"
51
+
-c, --custom Deploy custom configuration templates (specified in "config"
50
52
group or node attribute)
51
53
--ready Wait for devices to become ready
52
-
--fast Use "free" strategy in Ansible playbook for faster
53
-
configuration deployment
54
+
--fast Use "free" strategy in Ansible playbook for faster configuration
55
+
deployment
54
56
-o [OUTPUT], --output [OUTPUT]
55
57
Create a directory with initial configurations instead of
56
-
deploying them
58
+
deploying them (default output directory: config)
59
+
--instance INSTANCE Specify lab instance to configure
57
60
58
61
All other arguments are passed directly to ansible-playbook
59
62
```
60
63
64
+
```{tip}
65
+
* While most **netlab** commands accept the `-i` option to specify the lab instance, you have to use the `--instance` option with **netlab initial**.
66
+
* When executed with the `--instance` option, **netlab initial -o** switches to the lab directory to execute the Ansible playbook, but stores the results within the directory from which it was executed.
67
+
```
68
+
61
69
## Wait for Devices to Become Ready
62
70
63
71
Some devices are not ready immediately after they complete the boot process. For example, Cisco Nexus OS or Juniper vPTX need another minute to realize they have data-plane interfaces.
Copy file name to clipboardExpand all lines: docs/netlab/restart.md
+8-7
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,18 @@
2
2
3
3
**netlab restart** executes **[netlab down](down.md)** followed by **[netlab up](up.md)** to restart your lab from the transformed lab topology stored in `netlab.snapshot.yml` snapshot file.
4
4
5
-
You can use **netlab restart** to restart the existing lab (use `--snapshot` keyword), or to recreate the lab configuration files in case you changed the lab topology.
5
+
You can use **netlab restart** to restart the existing lab (use `--snapshot` keyword) or recreate the lab configuration files if you changed the lab topology.
6
6
7
7
```{warning}
8
-
**netlab restart** does not support `-d`, `-p` or `-s` flags used by **netlab create** or **netlab up**. If you want to change lab topology settings with CLI parameters use **netlab down** and **netlab up** commands.
8
+
* **netlab restart** does not support `-d`, `-p` or `-s` flags used by **netlab create** or **netlab up**. If you want to change lab topology settings with CLI parameters, use **netlab down** and **netlab up** commands.
9
+
* You must execute the **netlab restart** command within the lab directory.
0 commit comments