{"id":13797109,"url":"https://github.com/ciscodevnet/virlutils","last_synced_at":"2025-05-15T17:03:57.616Z","repository":{"id":41435488,"uuid":"114168527","full_name":"CiscoDevNet/virlutils","owner":"CiscoDevNet","description":"A collection of utilities for interacting with Cisco Modeling Labs (CML)","archived":false,"fork":false,"pushed_at":"2025-03-03T19:17:40.000Z","size":5213,"stargazers_count":159,"open_issues_count":4,"forks_count":52,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-21T10:02:14.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CiscoDevNet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-13T21:02:26.000Z","updated_at":"2025-04-16T01:53:08.000Z","dependencies_parsed_at":"2023-10-11T16:27:55.830Z","dependency_job_id":"c4d792ee-df32-4ca7-a5a1-ed57aa49805e","html_url":"https://github.com/CiscoDevNet/virlutils","commit_stats":{"total_commits":540,"total_committers":18,"mean_commits":30.0,"dds":"0.37962962962962965","last_synced_commit":"84afb01a6366d54febb9481c364a378f891327f4"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fvirlutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fvirlutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fvirlutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fvirlutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CiscoDevNet","download_url":"https://codeload.github.com/CiscoDevNet/virlutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384983,"owners_count":22062422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T23:01:22.554Z","updated_at":"2025-05-15T17:03:57.576Z","avatar_url":"https://github.com/CiscoDevNet.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"8c5a692b5d26527ef346687e047c5c21\"\u003e\u003c/a\u003e收集"],"sub_categories":[],"readme":"# virlutils\n\n[![Build Status](https://travis-ci.org/CiscoDevNet/virlutils.svg?branch=master)](https://travis-ci.org/CiscoDevNet/virlutils)\n[![Coverage Status](https://coveralls.io/repos/github/CiscoDevNet/virlutils/badge.svg?branch=master)](https://coveralls.io/github/CiscoDevNet/virlutils?branch=master)\n[![PyPI version](https://badge.fury.io/py/virlutils.svg)](https://badge.fury.io/py/virlutils)\n\nA collection of utilities for interacting with [Cisco Modeling Labs (CML)](https://developer.cisco.com/modeling-labs) v2.6+.\n\n## virl up / cml up\n\n`virl` (or `cml`) is a devops style cli which supports the most common VIRL/CML operations. Adding new ones is easy...\n\n```sh\nUsage: cml [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --debug / --no-debug  Print any debugging output.\n  --help                Show this message and exit.\n\nCommands:\n  clear        clear the current lab ID\n  cluster      display and manage CML cluster details\n  cockpit      opens the Cockpit UI\n  command      send a command or config to a node (requires pyATS)\n  console      console for node\n  definitions  manage image and node definitions\n  down         stop a lab\n  extract      extract configurations from all nodes in a lab\n  generate     generate inv file for various tools\n  groups       manage groups\n  id           get the current lab title and ID\n  license      work with product licensing\n  ls           lists running labs and optionally those in the cache\n  nodes        get node list for the current lab\n  pull         pull topology.yaml from repo\n  rm           remove a lab\n  save         save lab to a local yaml file\n  search       list topologies available via github\n  ssh          ssh to a node\n  start        start a node\n  stop         stop a node\n  telnet       telnet to a node\n  tmux         console to all nodes using tmux\n  ui           opens the Workbench for the current lab\n  up           start a lab\n  use          use lab launched elsewhere\n  users        manage users\n  version      version information\n  wipe         wipe a lab or nodes within a lab\n```\n\n\u003c!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --\u003e\n\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage / Workflows](#usage--workflows)\n- [Contributing](#contributing)\n\n\u003c!-- /TOC --\u003e\n\n## Prerequisites\n\n- Python 3.8+ (tested with Python 3.8, 3.9, 3.10, 3.11 and 3.12)\n\n## Installation\n\n1.Clone this repo\n\n```sh\ngit clone https://github.com/CiscoDevNet/virlutils\ncd virlutils\n```\n\n2.Either (2a) use pip, or (2b) use setup.py\n\n2a. Use pip\n\n```sh\npip install cmlutils\n```\n\nOr\n\n```sh\npip install virlutils\n```\n\n2b. Use setup.py\n\n```sh\npython3 -m venv venv\nsource venv/bin/activate\npython setup.py install\n```\n\n## Configuration\n\nThere really isn't much to configure, just set your CML credentials. There are a few different ways to accomplish this, pick whichever one works best for you. The options listed below are in the `preferred` order.\n\n### .virlrc in working directory\n\nAdd a .virlrc to the working directory, this will always be checked first and\nis useful when you want to override one or more parameters for a particular project\ndirectory.\n\nThe contents would look something like this.\n\n```sh\nVIRL_HOST=specialvirlserver.foo.com\n```\n\n### environment variables\n\nYou can also add them as environment variables. This is useful if you want to override\nthe global VIRL settings.\n\n```sh\nexport VIRL_HOST=192.0.2.100\nexport VIRL_USERNAME=admin\nexport VIRL_PASSWORD=admin123\n```\n\n### .virlrc in your home directory\n\nConfigure VIRL credentials globally by putting them in ~/.virlrc the formatting\n\n```sh\nVIRL_USERNAME=netadmins\nVIRL_PASSWORD=cancodetoo!\n```\n\n### Other configuration options\n\nIn addition to basic credentials, the following configuration options are supported\nusing any of the methods mentioned previously\n\n- `VIRL_TELNET_COMMAND` - allows the user to customize the telnet command that is called.\n  This command will be passed the host/ip information from the running simulation\n\n  Example:\n\n  ```sh\n  export VIRL_TELNET_COMMAND=\"mytelnet {host}\"\n  ```\n\n- `VIRL_SSH_COMMAND` - allows the user to customize the ssh command that is called.\n  This command will be passed the host/ip as well as the username from the running simulation\n\n  Example:\n\n  ```sh\n  export VIRL_SSH_COMMAND=\"myssh {username}@{host}\"\n  ```\n\n- `CML_VERIFY_CERT` - The path to a PEM-encoded certificate file to use to verify the CML controller VM's SSL certificate. If you do not wish to verify the certificate, set this to \"False\"\n\n  Example:\n\n  ```sh\n  export CML_VERIFY_CERT=/etc/certs/ca_bundle.pem\n  ```\n\n- `CML_CONSOLE_COMMAND` - allows the user to customize the SSH command that is called.\n\n  This command will be passed the CML controller VM IP, the console path of the node, and the CML controller username (**note:** you may have to force a TTY allocation in your SSH command)\n\n  Example:\n\n  ```sh\n  export CML_CONSOLE_COMMAND=\"myssh {user}@{host} {console}\"\n  ```\n\n- `CML_PLUGIN_PATH` - A delimiter-separated list of directories in which to find cmlutils plugins. See the [plugin documentation](examples/plugins/README.md) for more details. By default, the `plugins` directory in the current `.virl` directory will be searched.\n\n  Example:\n\n  ```sh\n  export CML_PLUGIN_PATH=\"~/cmlutils/plugins:/opt/cmlutils/plugins\"\n  ```\n\n### Why so many choices??!?\n\nUnderstanding the precedence allows you to do some pretty cool things.\n\nAssume the following directory structure...\n\n```plain\n.\n├── dev\n│   ├── .virlrc\n│   └── topology.yaml\n├── prod\n│   ├── .virlrc\n│   └── topology.yaml\n└── test\n    ├── .virlrc\n    └── topology.yaml\n\n```\n\nThis allows three major benefits.\n\n1. you can easily use different credentials/servers for various environments\n2. you can customize your lab .yaml files to include different tags, different node configurations, etc.\n3. you have a badass workflow.\n\n```sh\n$ cml ls\nLabs on Server\n╒═══════════════╤════════════════════════╤═══════════════╤══════════╤══════════╤═════════╤═════════╤══════════════╕\n│ ID            │ Title                  │ Description   │ Owner    │ Status   │   Nodes │   Links │   Interfaces │\n╞═══════════════╪════════════════════════╪═══════════════╪══════════╪══════════╪═════════╪═════════╪══════════════╡\n│               │                        │               │          │          │         │         │              │\n╘═══════════════╧════════════════════════╧═══════════════╧══════════╧══════════╧═════════╧═════════╧══════════════╛\n$ cd ../test\n$ cml ls\nLabs on Server\n╒══════════════════════════════════════╤════════════════════════════════╤═════════════════════════════════════════╤══════════╤═════════════════╤═════════╤═════════╤══════════════╕\n│ ID                                   │ Title                          │ Description                             │ Owner    │ Status          │   Nodes │   Links │   Interfaces │\n╞══════════════════════════════════════╪════════════════════════════════╪═════════════════════════════════════════╪══════════╪═════════════════╪═════════╪═════════╪══════════════╡\n│ f25b3881-0d19-4a6d-816f-36d1c663f930 │ Multi Platform Network         │ A sample network built with IOS XE, NX- │ labuser  │ STOPPED         │      14 │      32 │          101 │\n│                                      │                                │ OS, IOS XR, and ASA devices.  Includes  │          │                 │         │         │              │\n│                                      │                                │ Linux hosts.                            │          │                 │         │         │              │\n╘══════════════════════════════════════╧════════════════════════════════╧═════════════════════════════════════════╧══════════╧═════════════════╧═════════╧═════════╧══════════════╛\n$ cd ../prod\n$ cml ls\nLabs on Server\n╒══════════════════════════════════════╤════════════════════════════════╤═════════════════════════════════════════╤══════════╤═════════════════╤═════════╤═════════╤══════════════╕\n│ ID                                   │ Title                          │ Description                             │ Owner    │ Status          │   Nodes │   Links │   Interfaces │\n╞══════════════════════════════════════╪════════════════════════════════╪═════════════════════════════════════════╪══════════╪═════════════════╪═════════╪═════════╪══════════════╡\n│ 0fdea012-83b4-4545-8747-c7b8037e5a96 │ Multi Platform Network         │ A sample network built with IOS XE, NX- │ labuser  │ STARTED         │      14 │      32 │          101 │\n│                                      │                                │ OS, IOS XR, and ASA devices.  Includes  │          │                 │         │         │              │\n│                                      │                                │ Linux hosts.                            │          │                 │         │         │              │\n╘══════════════════════════════════════╧════════════════════════════════╧═════════════════════════════════════════╧══════════╧═════════════════╧═════════╧═════════╧══════════════╛\n```\n\n## Usage / Workflows\n\n### Basic Workflow\n\nin the absence of better documentation, here's a sample workflow\n\n```sh\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml ls\nLabs on Server\n╒══════════════════════════════════════╤════════════════════════════════╤═════════════════════════════════════════╤══════════╤═════════════════╤═════════╤═════════╤══════════════╕\n│ ID                                   │ Title                          │ Description                             │ Owner    │ Status          │   Nodes │   Links │   Interfaces │\n╞══════════════════════════════════════╪════════════════════════════════╪═════════════════════════════════════════╪══════════╪═════════════════╪═════════╪═════════╪══════════════╡\n│ 35c5393b-6037-4c96-86d4-33f96e53a615 │ CCIE Enterprise Infrastructure │                                         │ labuser  │ DEFINED_ON_CORE │      54 │      67 │           216│\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ a5fa67e3-44b9-4b26-8a50-58d471766280 │ Branch Test                    │                                         │ labuser  │ STOPPED         │       6 │       5 │           17 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 931b20a1-f0be-4c9f-b7ef-4db96ee77135 │ Small Branch                   │ A small branch network built with CSR1kv│ labuser  │ STOPPED         │      14 │      32 │          101 │\n│                                      │                                │ IOSv, IOSvL2. The devices are managed by│          │                 │         │         │              │\n│                                      │                                │ NSO.                                    │          │                 │         │         │              │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 8e8047b6-faf8-4b0a-86ea-c05a0549e4fe │ Dynamic Split Tunnel           │                                         │ labuser  │ STOPPED         │       7 │       9 │           37 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 86ef940d-58e8-49d9-b154-22ec714add62 │ Lab at Tue 14:45 PM            │                                         │ labuser  │ STOPPED         │       3 │       2 │           14 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ ba9a1282-048f-4914-a419-59c8027afa6a │ DFN                            │ German Research Network                 │ labuser  │ STARTED         │      51 │      80 │          211 │\n╘══════════════════════════════════════╧════════════════════════════════╧═════════════════════════════════════════╧══════════╧═════════════════╧═════════╧═════════╧══════════════╛\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml use --lab-name \"Small Branch\"\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml id\nSmall Branch (ID: 931b20a1-f0be-4c9f-b7ef-4db96ee77135)\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml up\nLab Small Branch (ID: 931b20a1-f0be-4c9f-b7ef-4db96ee77135) is already set as the current lab\nStarting lab Small Branch (ID: 931b20a1-f0be-4c9f-b7ef-4db96ee77135)\n\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml ls\nLabs on Server\n╒══════════════════════════════════════╤════════════════════════════════╤═════════════════════════════════════════╤══════════╤═════════════════╤═════════╤═════════╤══════════════╕\n│ ID                                   │ Title                          │ Description                             │ Owner    │ Status          │   Nodes │   Links │   Interfaces │\n╞══════════════════════════════════════╪════════════════════════════════╪═════════════════════════════════════════╪══════════╪═════════════════╪═════════╪═════════╪══════════════╡\n│ 35c5393b-6037-4c96-86d4-33f96e53a615 │ CCIE Enterprise Infrastructure │                                         │ labuser  │ DEFINED_ON_CORE │      54 │      67 │           216│\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ a5fa67e3-44b9-4b26-8a50-58d471766280 │ Branch Test                    │                                         │ labuser  │ STOPPED         │       6 │       5 │           17 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 931b20a1-f0be-4c9f-b7ef-4db96ee77135 │ Small Branch                   │ A small branch network built with CSR1kv│ labuser  │ STARTED         │      14 │      32 │          101 │\n│                                      │                                │ IOSv, IOSvL2. The devices are managed by│          │                 │         │         │              │\n│                                      │                                │ NSO.                                    │          │                 │         │         │              │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 8e8047b6-faf8-4b0a-86ea-c05a0549e4fe │ Dynamic Split Tunnel           │                                         │ labuser  │ STOPPED         │       7 │       9 │           37 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 86ef940d-58e8-49d9-b154-22ec714add62 │ Lab at Tue 14:45 PM            │                                         │ labuser  │ STOPPED         │       3 │       2 │           14 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ ba9a1282-048f-4914-a419-59c8027afa6a │ DFN                            │ German Research Network                 │ labuser  │ STARTED         │      51 │      80 │          211 │\n╘══════════════════════════════════════╧════════════════════════════════╧═════════════════════════════════════════╧══════════╧═════════════════╧═════════╧═════════╧══════════════╛\n\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml nodes\nHere is a list of nodes in this lab\n╒══════════════════════════════════════╤════════════════════╤════════════════════╤════════════════╤═════════════════╤══════════╤══════════════════════════════════════╕\n│ ID                                   │ Label              │ Type               │ Compute Node   │ State           │ Wiped?   │ L3 Address(es)                       │\n╞══════════════════════════════════════╪════════════════════╪════════════════════╪════════════════╪═════════════════╪══════════╪══════════════════════════════════════╡\n│ 32135ea1-d6f4-4ae5-94cb-8dfa14c0b758 │ Internet           │ external_connector │ compute-01     │ BOOTED          │ False    │                                      │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ e6ed74ef-62bf-4f4c-8fe8-a44fb3bc74c4 │ branch-rtr         │ csr1000v           │ compute-01     │ BOOTED          │ False    │ 192.168.10.129                       │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ a01784b1-d11f-4c52-907b-b6ac92d3b8f1 │ branch-sw          │ iosvl2             │ compute-01     │ BOOTED          │ False    │ 192.168.10.143                       │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ 84625ab4-53dd-4ff4-8cd1-2a2ef94edc02 │ nso-0              │ nso_ubuntu         │ compute-01     │ BOOTED          │ False    │ 2001:db8:dead:beef:5054:ff:fe11:a168 │\n│                                      │                    │                    │                │                 │          │ fe80::5054:ff:fe11:a168              │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ 579a9e46-3433-4645-9bad-c84106d9cd54 │ remote-rtr         │ iosv               │ compute-01     │ BOOTED          │ False    │ 192.168.10.137                       │\n╘══════════════════════════════════════╧════════════════════╧════════════════════╧════════════════╧═════════════════╧══════════╧══════════════════════════════════════╛\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml console branch-rtr\nadmin@192.168.10.214's password:\nConnecting to console for\nConnected to terminalserver.\nEscape character is '^]'.\n\nbranch-rtr#\nbranch-rtr#\nbranch-rtr#\nbranch-rtr#\n\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml down\nShutting down lab Small Branch (ID: 931b20a1-f0be-4c9f-b7ef-4db96ee77135).....\nSUCCESS\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml ls\nLabs on Server\n╒══════════════════════════════════════╤════════════════════════════════╤═════════════════════════════════════════╤══════════╤═════════════════╤═════════╤═════════╤══════════════╕\n│ ID                                   │ Title                          │ Description                             │ Owner    │ Status          │   Nodes │   Links │   Interfaces │\n╞══════════════════════════════════════╪════════════════════════════════╪═════════════════════════════════════════╪══════════╪═════════════════╪═════════╪═════════╪══════════════╡\n│ 35c5393b-6037-4c96-86d4-33f96e53a615 │ CCIE Enterprise Infrastructure │                                         │ labuser  │ DEFINED_ON_CORE │      54 │      67 │           216│\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ a5fa67e3-44b9-4b26-8a50-58d471766280 │ Branch Test                    │                                         │ labuser  │ STOPPED         │       6 │       5 │           17 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 931b20a1-f0be-4c9f-b7ef-4db96ee77135 │ Small Branch                   │ A small branch network built with CSR1kv│ labuser  │ STOPPED         │      14 │      32 │          101 │\n│                                      │                                │ IOSv, IOSvL2. The devices are managed by│          │                 │         │         │              │\n│                                      │                                │ NSO.                                    │          │                 │         │         │              │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 8e8047b6-faf8-4b0a-86ea-c05a0549e4fe │ Dynamic Split Tunnel           │                                         │ labuser  │ STOPPED         │       7 │       9 │           37 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ 86ef940d-58e8-49d9-b154-22ec714add62 │ Lab at Tue 14:45 PM            │                                         │ labuser  │ STOPPED         │       3 │       2 │           14 │\n├──────────────────────────────────────┼────────────────────────────────┼─────────────────────────────────────────┼──────────┼─────────────────┼─────────┼─────────┼──────────────┤\n│ ba9a1282-048f-4914-a419-59c8027afa6a │ DFN                            │ German Research Network                 │ labuser  │ STARTED         │      51 │      80 │          211 │\n╘══════════════════════════════════════╧════════════════════════════════╧═════════════════════════════════════════╧══════════╧═════════════════╧═════════╧═════════╧══════════════╛\n\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml nodes\nHere is a list of nodes in this lab\n╒══════════════════════════════════════╤════════════════════╤════════════════════╤════════════════╤═════════════════╤══════════╤══════════════════════════════════════╕\n│ ID                                   │ Label              │ Type               │ Compute Node   │ State           │ Wiped?   │ L3 Address(es)                       │\n╞══════════════════════════════════════╪════════════════════╪════════════════════╪════════════════╪═════════════════╪══════════╪══════════════════════════════════════╡\n│ 32135ea1-d6f4-4ae5-94cb-8dfa14c0b758 │ Internet           │ external_connector │ compute-01     │ STOPPED         │ False    │                                      │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ e6ed74ef-62bf-4f4c-8fe8-a44fb3bc74c4 │ branch-rtr         │ csr1000v           │ compute-01     │ STOPPED         │ False    │                                      │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ a01784b1-d11f-4c52-907b-b6ac92d3b8f1 │ branch-sw          │ iosvl2             │ compute-01     │ STOPPED         │ False    │                                      │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ 84625ab4-53dd-4ff4-8cd1-2a2ef94edc02 │ nso-0              │ nso_ubuntu         │ compute-01     │ STOPPED         │ False    │                                      │\n│                                      │                    │                    │                │                 │          │                                      │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────────────┼──────────┼──────────────────────────────────────┤\n│ 579a9e46-3433-4645-9bad-c84106d9cd54 │ remote-rtr         │ iosv               │ compute-01     │ STOPPED         │ False    │                                      │\n╘══════════════════════════════════════╧════════════════════╧════════════════════╧════════════════╧═════════════════╧══════════╧══════════════════════════════════════╛\n```\n\n### Console to All Nodes with tmux\n\nIf you are a `tmux` user you can console to all nodes with the following command:\n\n```sh\n❯ cml tmux --help\nUsage: cml tmux [OPTIONS]\n\n  console to all nodes using tmux\n\nOptions:\n  --group [panes|windows]  'panes': group all nodes in one window, 'windows':\n                           one node per window  [default: panes]\n  --help                   Show this message and exit.\n\n❯ cml nodes\nHere is a list of nodes in this lab\n╒══════════════════════════════════════╤════════════════════╤════════════════════╤════════════════╤═════════╤══════════╤══════════════════╕\n│ ID                                   │ Label              │ Type               │ Compute Node   │ State   │ Wiped?   │ L3 Address(es)   │\n╞══════════════════════════════════════╪════════════════════╪════════════════════╪════════════════╪═════════╪══════════╪══════════════════╡\n│ 5fdb38b6-7ff7-4792-b685-5eeaa41d8865 │ c8v-2              │ cat8000v           │ cml-01         │ BOOTED  │ False    │                  │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────┼──────────┼──────────────────┤\n│ 7bdedc4a-a196-4ad0-b1f3-888cf77eee8b │ c8v-1              │ cat8000v           │ cml-01         │ BOOTED  │ False    │                  │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────┼──────────┼──────────────────┤\n│ ab3ee63d-109d-424e-a2c0-7581a61b1d1d │ unmanaged-switch-0 │ unmanaged_switch   │ cml-01         │ BOOTED  │ False    │                  │\n├──────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼─────────┼──────────┼──────────────────┤\n│ 9a068ec0-0565-44a0-bf16-8e4690108ac9 │ ext-conn-0         │ external_connector │ cml-01         │ BOOTED  │ False    │                  │\n╘══════════════════════════════════════╧════════════════════╧════════════════════╧════════════════╧═════════╧══════════╧══════════════════╛\n```\n\nThis will create a new tmux session with title \"lab name + first 4 lab id chars\" (e.g. `PPK-c93a`).\nBy default, the nodes will be grouped into one window (`cml tmux --group panes`),\n\n```sh\n❯  printf '\\033]2;%s\\033\\\\' 'c8v-2'\n❯  ssh -t admin@cml-01 open /PPK/c8v-2/0\nadmin@cml-01's password:\nConnecting to console for c8v-2\nConnected to CML terminalserver.\nEscape character is '^]'.\n\nc8v2#\n─────────────────────────────────────────────────────────────────────────\n❯  printf '\\033]2;%s\\033\\\\' 'c8v-1'\n❯  ssh -t admin@cml-01 open /PPK/c8v-1/0\nadmin@cml-01's password:\nConnecting to console for c8v-1\nConnected to CML terminalserver.\nEscape character is '^]'.\n\nc8v1#\n PPK-c93a \u003e\u003e 1 \u003e ssh \u003e                                     \u003c 20:20\n```\n\n\u003e Note: the command `printf '\\033]2;%s\\033\\\\' 'c8v-2'` is used to set the pane's title see: [tmux man](https://man7.org/linux/man-pages/man1/tmux.1.html#NAMES_AND_TITLES)\n\nif you prefer having one connection per window, use: `cml tmux --group windows`.\n\n```sh\n❯  ssh -t admin@cml-01 open /PPK/c8v-2/0\nadmin@cml-01's password:\nConnecting to console for c8v-2\nConnected to CML terminalserver.\nEscape character is '^]'.\n\nc8v2#\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n PPK-c93a \u003e\u003e 1 \u003e c8v-2 \u003e\u003e 2 \u003e c8v-1 \u003e                      \u003c 20:32\n```\n\n### Inventory Generation\n\nvirlutils will generate inventories for various management systems\n\n#### pyATS Testbed Generation\n\nquickly turn your simulations into a testbed file that can be used for pyATS/Genie\n\n```sh\ncml generate pyats\n```\n\n#### Command and Config Execution\n\nUsing the same pyATS framework, `virlutils` can execute CLI EXEC-level (e.g., \"show\") commands as well as configuration commands on nodes within a lab. These nodes do not have to be externally reachable or have any IP connectivity. This is a great way to test operational aspects of a completely isolated topology. Before using the `command` command you must install pyATS. You can install pyATS by running `pip install pyats`.\n\n```sh\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒ cml command \"branch-rtr\" \"show version\"\nCisco IOS XE Software, Version 16.11.01b\nCisco IOS Software [Gibraltar], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.11.1b, RELEASE SOFTWARE (fc2)\nTechnical Support: http://www.cisco.com/techsupport\n...\n```\n\n```sh\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒ cml command --config \"branch-rtr\" \"snmp-server community notpublic\"\n\n```\n\n#### EVE-NG Lab Support\n\nThe `cml up` command can convert EVE-NG labs to CML labs on the fly (\".unl\" to \".yaml\" conversion) if you install the\n[eve2cml](https://pypi.org/project/eve2cml/) Python package.  With that library package, a command such as\n`cml up -f my-lab.unl` will convert `my-lab.unl` to `my-lab.yaml` in the same directory and import it into CML.\n\n#### Ansible Inventory Generation\n\nquickly turn your simulations into an inventory file that can be used to run your playbooks\nagainst. Both INI and YAML(default) formats are supported by the tool.\n\n```sh\nUsage: cml generate ansible [OPTIONS]\n\n  generate ansible inventory\n\nOptions:\n  -o, --output TEXT   output File name\n  --style [ini|yaml]  output format (default is yaml)\n  --help              Show this message and exit.\n```\n\nThe ansible group membership can be controlled by adding the \"ansible_group\" tag to nodes in your CML labs. Multiple \"ansible_group\" tags can be assigned to a single node, and that node will be placed into each Ansible inventory group.\n\n```yaml\nnodes:\n  - id: n0\n    label: branch-rtr\n    node_definition: csr1000v\n    tags:\n      - ansible_group=mygroup\n```\n\nwould result in the following inventory entry\n\n```yaml\nall:\n  children:\n    mygroup:\n      hosts:\n        branch-router:\n          ansible_host: 192.0.2.1\n```\n\n**NOTE:** if the ansible_group tag is not specified for a node, that node will not be included during inventory generation. Additionally, CML needs to know each node's management IP address before it will be placed into the inventory file\n\n#### Cisco Network Services Orchestrator\n\nYou can add/update Network Services Orchestrator with your VIRL simulation.\n\nUsage\n\n```sh\nUsage: cml generate nso [OPTIONS]\n\n  generate nso inventory\n\nOptions:\n  -o, --output TEXT           just dump the payload to file without sending\n  --syncfrom / --no-syncfrom  Perform sync-from after updating devices\n  --help                      Show this message and exit.\n```\n\noutput\n\n```sh\nUpdating NSO....\nEnter NSO IP/Hostname: localhost\nEnter NSO username: admin\nEnter NSO password:\nSuccessfully added CML devices to NSO\n\n```\n\n**NOTE**: NSO environment is also attempted to be determined using the following environment\nvariables\n\n- NSO_HOST\n- NSO_USERNAME\n- NSO_PASSWORD\n\nNSO Configuration Example\n\n```sh\nexport NSO_HOST=localhost\nexport NSO_USERNAME=admin\nexport NSO_PASSWORD=admin\n```\n\n### User and Group Management\n\nYou can manage users and groups too!\n\n#### Users\n\nTo manage users you can use the `cml users` command\n\n``` sh\n❯ cml users\nUsage: cml users [OPTIONS] COMMAND [ARGS]...\n\n  manage users\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  create  Create one or more users (e.g., user1 user2)\n  delete  Delete one or more users (e.g., user1 user2)\n  ls      List all users on the server.\n  update  Update one or more users (e.g., user1 user2)\n```\n\nTo list users\n\n```sh\n❯ cml users ls\n╒════════════╤═════════════════╤═════════════╤═════════╤════════════╤════════════════════════╕\n│ Username   │ Administrator   │ Full Name   │ Email   │ Groups     │ Labs                   │\n╞════════════╪═════════════════╪═════════════╪═════════╪════════════╪════════════════════════╡\n│ admin      │ True            │             │         │ users      │ BGP                    │\n│            │                 │             │         │ superusers │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ john       │ False           │ Uncle John  │         │ users      │ OSPF                   │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ chuck      │ False           │ Uncle Chuck │         │            │                        │\n╘════════════╧═════════════════╧═════════════╧═════════╧════════════╧════════════════════════╛\n```\n\nBy default, user IDs are not shown, to display them use the `--verbose` or `-v` flag:\n\n```sh\n❯ cml users ls --verbose\nUsers on Server\n╒══════════════════════════════════════╤════════════╤═════════════════╤═════════════╤═════════╤════════════╤════════════════════════╕\n│ ID                                   │ Username   │ Administrator   │ Full Name   │ Email   │ Groups     │ Labs                   │\n╞══════════════════════════════════════╪════════════╪═════════════════╪═════════════╪═════════╪════════════╪════════════════════════╡\n│ 00000000-0000-4000-a000-000000000000 │ admin      │ True            │             │         │ users      │ BGP                    │\n│                                      │            │                 │             │         │ superusers │                        │\n├──────────────────────────────────────┼────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ 9e4e75b4-aaab-47af-9edb-9364460a81ae │ john       │ False           │ Uncle John  │         │ users      │ OSPF                   │\n├──────────────────────────────────────┼────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ dcc96fe1-8cba-4227-9aa6-b41d5ff91e3a │ chuck      │ True            │ Uncle Chuck │         │            │                        │\n╘══════════════════════════════════════╧════════════╧═════════════════╧═════════════╧═════════╧════════════╧════════════════════════╛\n```\n\nYou can create one or multiple users. For each user, you will be prompted for the password and confirmation.\nOptionally, you can grant admin privileges and add the users to one or more groups.\n\n``` sh\n❯ cml users create alice bob --admin --group users --superusers\nEnter alice's password:\nRe-Enter alice's password:\nUser alice successfully created\nEnter bob's password:\nRe-Enter bob's password:\nUser bob successfully created\n\n\n❯ cml users ls\n╒════════════╤═════════════════╤═════════════╤═════════╤════════════╤════════════════════════╕\n│ Username   │ Administrator   │ Full Name   │ Email   │ Groups     │ Labs                   │\n╞════════════╪═════════════════╪═════════════╪═════════╪════════════╪════════════════════════╡\n│ admin      │ True            │             │         │ users      │ BGP                    │\n│            │                 │             │         │ superusers │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ john       │ False           │ Uncle John  │         │ users      │ OSPF                   │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ chuck      │ False           │ Uncle Chuck │         │            │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ alice      │ True            │             │         │ users      │                        │\n│            │                 │             │         │ superusers │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ bob        │ True            │             │         │ users      │                        │\n│            │                 │             │         │ superusers │                        │\n╘════════════╧═════════════════╧═════════════╧═════════╧════════════╧════════════════════════╛\n```\n\nYou can also update one or more existing users (e.g. removing admin privileges)\n\n``` sh\n❯ cml users update alice bob --no-admin --remove-from-all-groups\nUser alice successfully updated\nUser bob successfully updated\n\n❯ cml users ls\n╒════════════╤═════════════════╤═════════════╤═════════╤════════════╤════════════════════════╕\n│ Username   │ Administrator   │ Full Name   │ Email   │ Groups     │ Labs                   │\n╞════════════╪═════════════════╪═════════════╪═════════╪════════════╪════════════════════════╡\n│ admin      │ True            │             │         │ users      │ BGP                    │\n│            │                 │             │         │ superusers │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ john       │ False           │ Uncle John  │         │ users      │ OSPF                   │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ chuck      │ False           │ Uncle Chuck │         │            │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ alice      │ False           │             │         │            │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ bob        │ False           │             │         │            │                        │\n╘════════════╧═════════════════╧═════════════╧═════════╧════════════╧════════════════════════╛\n```\n\nCheck the cli help for more options.\n\nTo delete one or multiple users.\n\n``` sh\n❯ cml users delete alice bob\nUser alice successfully deleted\nUser bob successfully deleted\n\n❯ cml users ls\n╒════════════╤═════════════════╤═════════════╤═════════╤════════════╤════════════════════════╕\n│ Username   │ Administrator   │ Full Name   │ Email   │ Groups     │ Labs                   │\n╞════════════╪═════════════════╪═════════════╪═════════╪════════════╪════════════════════════╡\n│ admin      │ True            │             │         │ users      │ BGP                    │\n│            │                 │             │         │ superusers │                        │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ john       │ False           │ Uncle John  │         │ users      │ OSPF                   │\n├────────────┼─────────────────┼─────────────┼─────────┼────────────┼────────────────────────┤\n│ chuck      │ False           │ Uncle Chuck │         │            │                        │\n╘════════════╧═════════════════╧═════════════╧═════════╧════════════╧════════════════════════╛\n```\n\n#### Groups\n\nTo manage groups you can use the `cml groups` command\n\n``` sh\n❯ cml groups --help\nUsage: cml groups [OPTIONS] COMMAND [ARGS]...\n\n  manage groups\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  create  Create one or more groups (e.g., group1 group2)\n  delete  Delete one or more groups (e.g., group1 group2)\n  ls      List all groups on the server\n  update  Update one or more groups (e.g., group1 group2)\n```\n\nTo list groups\n\n``` sh\n❯ cml groups ls\nGroups on Server\n╒════════════╤═══════════════╤═════════╤════════════════════════════════════╕\n│ Name       │ Description   │ Users   │ Labs                               │\n╞════════════╪═══════════════╪═════════╪════════════════════════════════════╡\n│ users      │ All Users     │ admin   │ netbox (read_only)                 │\n│            │               │ john    │ Multi Platform Network (read_only) │\n│            │               │         │ BFD (read_only)                    │\n├────────────┼───────────────┼─────────┼────────────────────────────────────┤\n│ superusers │ Superusers    │ admin   │                                    │\n╘════════════╧═══════════════╧═════════╧════════════════════════════════════╛\n```\n\nYou can create one or more groups and assign them to multiple labs or members.\n\n``` sh\n❯ cml ls\nLabs on Server\n╒══════════════════════════════════════╤════════════════════════╤═════════════════════════════════════════╤══════════╤══════════╤═════════╤═════════╤══════════════╕\n│ ID                                   │ Title                  │ Description                             │ Owner    │ Status   │   Nodes │   Links │   Interfaces │\n╞══════════════════════════════════════╪════════════════════════╪═════════════════════════════════════════╪══════════╪══════════╪═════════╪═════════╪══════════════╡\n│ ba9a1282-048f-4914-a419-59c8027afa6a │ Quantum IPsec          │                                         │ admin    │ STOPPED  │       5 │       4 │           20 │\n├──────────────────────────────────────┼────────────────────────┼─────────────────────────────────────────┼──────────┼──────────┼─────────┼─────────┼──────────────┤\n│ 0786b045-aa39-4e98-af01-575b22566cf2 │ Multi-SA HSRP          │                                         │ admin    │ STARTED  │      10 │      13 │           47 │\n╘══════════════════════════════════════╧════════════════════════╧═════════════════════════════════════════╧══════════╧══════════╧═════════╧═════════╧══════════════╛\n\n❯ cml groups create --member alice --member bob --member mike --lab ba9a1282-048f-4914-a419-59c8027afa6a read_only --lab 0786b045-aa39-4e98-af01-575b22566cf2 read_write cryptopals\nGroup cryptopals successfully created\n\n❯ cml groups ls\nGroups on Server\n╒════════════╤═══════════════╤═════════╤════════════════════════════════════╕\n│ Name       │ Description   │ Users   │ Labs                               │\n╞════════════╪═══════════════╪═════════╪════════════════════════════════════╡\n│ users      │ All Users     │ admin   │ netbox (read_only)                 │\n│            │               │ john    │ Multi Platform Network (read_only) │\n│            │               │         │ BFD (read_only)                    │\n├────────────┼───────────────┼─────────┼────────────────────────────────────┤\n│ superusers │ Superusers    │ admin   │                                    │\n├────────────┼───────────────┼─────────┼────────────────────────────────────┤\n│ cryptopals │               │ alice   │ Quantum IPsec (read_only)          │\n│            │               │ bob     │ Multi-SA HSRP (read_write)         │\n│            │               │ mike    │                                    │\n╘════════════╧═══════════════╧═════════╧════════════════════════════════════╛\n```\n\nSimilarly, you can update one or more groups and assign them to multiple labs or members.\nAlso, for both `cml groups create` and `cml groups update` you can assign all labs and/or all users to the groups.\n\n``` sh\n❯ cml groups update --add-all-users --add-all-labs read_only users\nGroup users successfully updated\n\n❯ cml groups ls\nGroups on Server\n╒════════════╤═══════════════╤══════════╤════════════════════════════════════╕\n│ Name       │ Description   │ Users    │ Labs                               │\n╞════════════╪═══════════════╪══════════╪════════════════════════════════════╡\n│ users      │ All Users     │ admin    │ netbox (read_only)                 │\n│            │               │ john     │ Multi Platform Network (read_only) │\n│            │               │ alice    │ BFD (read_only)                    │\n│            │               │ bob      │ Quantum IPsec (read_only)          │\n│            │               │ mike     │ Multi-SA HSRP (read_only)          │\n├────────────┼───────────────┼──────────┼────────────────────────────────────┤\n│ superusers │ Superusers    │ admin    │                                    │\n├────────────┼───────────────┼──────────┼────────────────────────────────────┤\n│ cryptopals │               │ alice    │ Quantum IPsec (read_only)          │\n│            │               │ bob      │ Multi-SA HSRP (read_write)         │\n│            │               │ mike     │                                    │\n╘════════════╧═══════════════╧══════════╧════════════════════════════════════╛\n```\n\nTo delete one ore multiple groups\n\n``` sh\n❯ cml groups delete superusers cryptopals\nGroup superusers successfully deleted\nGroup cryptopals successfully deleted\n\n❯ cml groups ls\nGroups on Server\n╒════════╤═══════════════╤══════════╤════════════════════════════════════╕\n│ Name   │ Description   │ Users    │ Labs                               │\n╞════════╪═══════════════╪══════════╪════════════════════════════════════╡\n│ users  │ All Users     │ admin    │ nso-ha (read_only)                 │\n│        │               │ john     │ netbox (read_only)                 │\n│        │               │ bob      │ Multi Platform Network (read_only) │\n│        │               │          │ BFD (read_only)                    │\n│        │               │          │ Vodafone-PT (read_only)            │\n│        │               │          │ fastapi-ubuntu (read_only)         │\n│        │               │          │ upm-quick-test (read_only)         │\n│        │               │          │ Quantum IPsec (read_only)          │\n│        │               │          │ Multi-SA HSRP (read_only)          │\n╘════════╧═══════════════╧══════════╧════════════════════════════════════╛\n```\n\n### Tab Completions\n\n```sh\n[venv]jclarke@jamahal:~/src/git/virlutils|cmlutils\n⇒  cml l\u003ctab\u003e\nlicense  ls\n```\n\nYou can activate VIRL autocompletions by executing the following command\n\n```sh\neval \"$(_VIRL_COMPLETE=bash_source virl)\"\n```\n\nTo do the same for the `cml` command, do the following\n\n```sh\neval \"$(_CML_COMPLETE=bash_source cml)\"\n```\n\nzsh users may need to run the following prior\n\n```sh\nautoload bashcompinit\nbashcompinit\n```\n\nAnd then the following to properly enable completions for zsh\n\n```sh\neval \"$(_VIRL_COMPLETE=zsh_source virl)\"\neval \"$(_CML_COMPLETE=zsh_source cml)\"\n```\n\n## Contributing\n\nIf you have an idea for a feature you would like to see, we gladly accept pull requests. To get started please review the [Contributing Guide](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fvirlutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscodevnet%2Fvirlutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fvirlutils/lists"}