Cisco Model Labs

Breakout Tool

  • Download: Tools > Breakout tools

  • Change permission: chmod u+x breakout-linux-amd64

  • Run: ./breakout-linux-amd64 -listen 127.0.0.1 ui

    • Access the tool: http://127.0.0.1:8080

  • Some commands:

    • config: Creates a default configuration file.

    • init: Retrieves lab information from the Cisco Modeling Labs server. When a lab ID or unique lab name is provided as a second argument, the Breakout Tool will only retrieve the information for the specified lab and enable it by default.

    • run: Runs the tool, reading all configuration information from config files, CLI flags, and environment variables.

    • ui: Runs the tool with a web interface for both configuring the tool and enabling connections.

Manage Lab using RestAPI

  • Tools > API Documentation

Create Lab using Python

from virl2_client import ClientLibrary

client = ClientLibrary ("https://10.1.1.1", "user", "password", ssl_verify=False)
# create a blank lab
lab = client.create_lab('Created with Python')

# add two nodes
r1 = lab.create_node("Router1", "csr1000v", 100, 100)
r1.config = "hostname Router1"
r2 = lab.create_node("Router2", "csr1000v", 200, 100) 
r2.config = "hostname Router2"

CMLUtils

  • Installation: pip install cmlutils

  • Configure, creat .virlrc file

Some commands

  • cml ls: list

  • cml up -f lab.yaml: spin up lab using file lab.yaml

  • cml nodes: view nodes

  • cml console R1: access console of R1

    • Escape from console session: ^] (Ctrl+6+])

  • cml id: check id of selected lab

  • cml use --lab-name "My lab": change selected lab

  • cml generate pyats -o testbed.yaml: generate pyats testbed file for the lab

  • cml generate ansible: generate ansible inventory file

  • cml command "R1" "show ip int brief": run show ip int brief on R1

Reference

  • Sample Lab: https://github.com/CiscoDevNet/cml-community

Last updated