10 Commits

Author SHA1 Message Date
Hank Preston
80db952042 Initial Code Server Custom Commit 2025-08-01 13:03:00 -04:00
Hank Preston
675e7d491c Merge pull request #65 from jcpmunizie/fix-missing-libnsl-dev
Add libnsl-dev to the aaa-tacacs-exploration lab topologies
2025-07-21 08:54:38 -04:00
Joe Clarke
ef9821a504 Synchronize to get re-runs to work on the latest repo. 2025-07-20 04:52:06 -04:00
Joe Clarke
cc711f220e Add ext4 as a provision disk type. 2025-07-20 04:37:59 -04:00
branoTaran
2d3049f918 SIMPLE-7648: Added configuration to the ISE node definition (#62)
* SIMPLE-7648: Added configuration to the ISE node definition

* Added Windows 11 node-definition from simple.

* Fixed typo

* Update ise.yaml

Updated some of the parameters of the config content; Commented all parameters which are not required to run ISE; For some parameters kept the <...> description but added a sample input to help fill them in;
2025-07-20 04:36:10 -04:00
branoTaran
c30265c1ee Simple win11 node definition (#64)
* SIMPLE-7648: Added configuration to the ISE node definition

* Added Windows 11 node-definition from simple.

* Fixed typo

* Reverted ise.yaml to upstream state
2025-07-20 04:35:46 -04:00
Joe Clarke
a0f1f4b6aa Pet markdown lint. 2025-07-12 17:24:05 -04:00
Joe Clarke
91def995a0 Add the CML Sizing Calculator. 2025-07-12 15:47:59 -04:00
Joe Clarke
f9801dddfc Remove submodules in favor of READMEs.
Also, add a new script, the cml-exporter.
2025-07-12 15:41:21 -04:00
Joao Muniz
e0045ff571 Add libnsl-dev as it's a required dependency to compile tac_plus package used in aaa-tacacs-exploration lab topology 2025-07-07 02:01:26 +01:00
27 changed files with 849 additions and 66 deletions

View File

@@ -2,9 +2,11 @@ name: Node definition schema check
on:
push:
types: [synchronize]
paths:
- 'node-definitions/**/*.yaml'
pull_request:
types: [synchronize]
paths:
- 'node-definitions/**/*.yaml'

27
.gitmodules vendored
View File

@@ -1,27 +0,0 @@
[submodule "use-cases/cml-class-automation"]
path = use-cases/cml-class-automation
url = https://github.com/CiscoDevNet/cml-class-automation
[submodule "use-cases/cml-cicd"]
path = use-cases/cml-cicd
url = https://github.com/CiscoDevNet/cml-cicd
[submodule "use-cases/dst-automation"]
path = use-cases/dst-automation
url = https://github.com/CiscoDevNet/dst-automation
[submodule "use-cases/virlutils"]
path = use-cases/virlutils
url = https://github.com/CiscoDevNet/virlutils
[submodule "use-cases/ansible-cml"]
path = use-cases/ansible-cml
url = https://github.com/CiscoDevNet/ansible-cml
[submodule "use-cases/sdwan-devops"]
path = use-cases/sdwan-devops
url = https://github.com/CiscoDevNet/sdwan-devops
[submodule "lab-topologies/ciscolive-brkcrt-2059"]
path = lab-topologies/ciscolive-brkcrt-2059
url = https://github.com/CiscoLearning/ciscolive-brkcrt-2059.git
[submodule "use-cases/cloud-cml"]
path = use-cases/cloud-cml
url = https://github.com/CiscoDevNet/cloud-cml.git
[submodule "scripts/eve2cml"]
path = scripts/eve2cml
url = https://github.com/CiscoDevNet/eve2cml.git

View File

@@ -4,8 +4,8 @@
Community Contributed Content and Resources for Cisco Modeling Labs
![](readme_images/cml-lab.png)
![CML Screenshot](readme_images/cml-lab.png)
## Repository Description
[Cisco Modeling Labs](http://developer.cisco.com/modeling-labs) (CML) is a network simulation platform from Cisco that allows for the creation of robust network topologies made up of nearly anything you can imagine. It supports virtual machine based devices using QCOW or KVM format, and can be tied into physical components by "bridging" the simulation to the real world.
@@ -14,34 +14,39 @@ CML is officially supported on bare-metal x86\_64 servers and in VMware ESXi and
Unofficially, CML can be installed onto [HyperV](documentation/cml_on_hyperv.md), [Proxmox](documentation/cml_on_proxmox.md),
and [Nutanix AHV](documentation/cml_on_nutanix.md).
This repository is intended to be a place for the CML community to find and share content that builds on top of the standard CML installation. Examples of this content include:
This repository is intended to be a place for the CML community to find and share content that builds on top of the standard CML installation. Examples of this content include:
### Node and Image Definition Files
Included with CML is a library of ["reference platforms"](https://developer.cisco.com/docs/modeling-labs/#!reference-platforms-and-images) for a variety of Cisco network devices as well as images for Linux servers, traffic generators, unmanaged devices, etc. However, CML allows a "bring your own image" model for any KVM supported image. While we **cannot** share the actual QCOW image files for nodes that require proper licensing and rights from individual platform owners, we can post the CML YAML file definitions that have been created to support different platforms from Cisco as well as third party vendors.
The folder structure of this repository reflect the folder structure and naming conventions used on the CML server itself for storing the definitions.
Included with CML is a library of ["reference platforms"](https://developer.cisco.com/docs/modeling-labs/#!reference-platforms-and-images) for a variety of Cisco network devices as well as images for Linux servers, traffic generators, unmanaged devices, etc. However, CML allows a "bring your own image" model for any KVM supported image. While we **cannot** share the actual QCOW image files for nodes that require proper licensing and rights from individual platform owners, we can post the CML YAML file definitions that have been created to support different platforms from Cisco as well as third party vendors.
The folder structure of this repository reflect the folder structure and naming conventions used on the CML server itself for storing the definitions.
* [node-definitions](node-definitions) - Folder containing YAML file definitions for a CML node. The YAML file includes details on how the VM would be configured (ie CPU, RAM, Network Adapters, etc).
* [virl-base-images](virl-base-images) - Folder containing a folder for each added platform disk image. Within each platform folder you will find a YAML file that references a specific `disk_image` file for a platform. A base image definition will reference a node definition.
* *Note: You will need to download the disk images from the vendors yourself.*
* **Note: You will need to download the disk images from the vendors yourself.**
When deciding how many total resources you need to use CML, consult the [CML Sizing Calculator](documentation/cml_sizing_calculator.xlsx).
### Sample Lab Topologies
### Sample Lab Topologies
CML includes a series of Sample Labs that are available from the Tools menu in Lab Manager, however these are just a start of the possible network simulations that can be created. Within this repository users of CML can find, or share, network topologies that have been created to highlight a specific type of simulation challenge.
> Note: Sample Lab Topologies from this repository may leverage nodes that are **NOT** included with the standard reference platform for CML. Be sure to look at the requirements for any given lab topology.
> Note: Sample Lab Topologies from this repository may leverage nodes that are **NOT** included with the standard reference platform for CML. Be sure to look at the requirements for any given lab topology.
## DevNet Sandbox
A great way to make your repo easy for others to use is to provide a link to a [DevNet Sandbox](https://developer.cisco.com/site/sandbox/) that provides a network or other resources required to use this code. In addition to identifying an appropriate sandbox, be sure to provide instructions and any configuration necessary to run your code with the sandbox.
If you are new to Cisco Modeling Labs, you can explore and test drive CML within [DevNet Sandbox](https://developer.cisco.com/site/sandbox/). Just search for "Cisco Modeling" from the Sandbox Catalog.
If you are new to Cisco Modeling Labs, you can explore and test drive CML within [DevNet Sandbox](https://developer.cisco.com/site/sandbox/). Just search for "Cisco Modeling" from the Sandbox Catalog.
![](readme_images/sandbox-catalog-cml.png)
![DevNet Sandbox Screenshot](readme_images/sandbox-catalog-cml.png)
## Getting help
Instruct users how to get help with this code; this might include links to an issues list, wiki, mailing list, etc.
**Example**
### Example
If you have questions, concerns, bug reports, etc., please create an issue against this repository.

Binary file not shown.

View File

@@ -223,6 +223,7 @@ nodes:
- flex
- bison
- libwrap0-dev
- libnsl-dev
write_files:
# Create the tac_plus configuration file

View File

@@ -499,6 +499,7 @@ nodes:
- bison
- libwrap0-dev
- python3.10-venv
- libnsl-dev
write_files:
# Create the tac_plus configuration file

View File

@@ -32,7 +32,7 @@ sim:
memory: 1
efi_boot: false
boot:
timeout: 1200
timeout: 3600
uses_regex: false
inherited:
image:
@@ -50,4 +50,51 @@ inherited:
configuration:
generator:
driver: null
provisioning:
files:
- editable: true
name: ise-ztp.conf
content: |-
hostname=inserthostname-here
ipv4_addr=<IPv4 address>
ipv4_mask=<IPv4 subnet>
ipv4_default_gw=<IPv4 gateway address>
# IPv6 is optional
#ipv6_addr=<IPv6 address>
#ipv6_default_gw=<IPv6 gateway address>
domain=cisco.com
primary_nameserver=<IPv4 address> <--example-8.8.8.8
# secondary and tertiary are optional
#secondary_nameserver=<IPv4 address>
#tertiary_nameserver=<IPv4 address>
primary_ntpserver=<IPv4 address or FQDN of the NTP server> <--example-time.google.com
#secondary and tertiary are optional
#secondary_ntpserver=<IPv4 address or FQDN of the NTP server>
#tertiary_ntpserver=<IPv4 address or FQDN of the NTP server>
#timezone=<timezone>
#ssh=<true/false>
username=admin
password=Cisc@123
# Public Key Authentication configuration is optional
#public_key=<Public Key>
# Repository Configuration are optional
#repository_name=<repository name>
#repository_protocol=<repository protocol>
#repository_server_name=<IPv4 address>
#repository_path=<repository path>
# Patch Information - optional
#patch=<patch filename>
# HotPatches Information - optional
#hotpatches=<hotpatch filename,comma separated list>
# services - optional
#ers=<true/false>
#openapi=<true/false>
#pxgrid=<true/false>
#pxGrid_Cloud=<true/false>
# Skipping specific checks
#SkipIcmpChecks=<true/false>
#SkipDnsChecks=<true/false>
#SkipNtpChecks=<true/false>
media_type: ext4
volume_name: ISE-ZTP
schema_version: 0.0.1

View File

@@ -6,7 +6,7 @@ This directory contains the following node definition:
### Image Availability
VHD images can be downloaded from microsoft on a trial basis here: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-10-enterprise Then the VHD image will have to be converted to a .qcow2 format. Linux qumu-img makes it easy. Documentation: https://docs.openstack.org/image-guide/convert-images.html
VHD images can be downloaded from microsoft on a trial basis here: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-10-enterprise Then the VHD image will have to be converted to a .qcow2 format. Linux `qemu-img` makes it easy. Documentation: https://docs.openstack.org/image-guide/convert-images.html
### Notes

View File

@@ -0,0 +1,13 @@
# Microsoft Windows 11
This directory contains the following node definition:
* `win11.yaml` - Microsoft Windows 11 node definition
### Image Availability
VHD images can be downloaded from Microsoft on a trial basis here: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-11-enterprise. Then the VHD image will have to be converted to a .qcow2 format. Linux `qemu-img` makes it easy. Documentation: https://docs.openstack.org/image-guide/convert-images.html
### Notes
This node definition uses 2 VCPUS and 6 GB RAM.

View File

@@ -0,0 +1,71 @@
id: win11
general:
nature: server
read_only: false
description: Windows 11
device:
interfaces:
has_loopback_zero: false
physical:
- eth0
- eth1
- eth2
- eth3
- eth4
- eth5
- eth6
- eth7
serial_ports: 1
default_count: 2
ui:
visible: true
label_prefix: win11-
icon: host
label: Windows 11
description: |-
2 vCPUs 6 GB RAM
Username/Password:
IEUser/Passw0rd! (or whichever is set on installation)
##### Note
**EXPERIMENTAL**
The -waitpkg flag is required for boot with hyperv compatibility,
which speeds up the node; the model setting then required disabling
the other features (hle,rtm,mpx) on the machine used to test this.
sim:
linux_native:
libvirt_domain_driver: kvm
driver: server
disk_driver: sata
ram: 6144
cpus: 2
nic_driver: e1000
video:
model: cirrus
memory: 16
cpu_limit: 20
cpu_model: 'Skylake-Server,-waitpkg,-hle,-rtm,-mpx'
machine_type: q35
enable_tpm: true
efi_boot: true
boot:
timeout: 300
inherited:
image:
ram: true
cpus: true
data_volume: true
boot_disk_size: true
cpu_limit: true
node:
ram: true
cpus: true
data_volume: true
boot_disk_size: true
cpu_limit: true
configuration:
generator:
driver: server
schema_version: 0.0.1

View File

@@ -0,0 +1,429 @@
annotations:
- border_color: '#00000000'
border_style: ''
color: '#050505'
rotation: 0
text_bold: false
text_content: |-
Code Server Addresses:
- From Chrome Node: http://10.0.0.11:8443
- PATty Configured: http://{CML IP}:7001
(requires PATty enabled on CML server)
text_font: monospace
text_italic: false
text_size: 10
text_unit: pt
thickness: 1
type: text
x1: 40.0
y1: -280.0
z_index: 0
- border_color: '#00000000'
border_style: ''
color: '#050505'
rotation: 0
text_bold: false
text_content: |-
Code Server Addresses:
- From Chrome Node: http://10.0.0.11:8443
- PATty Configured: http://{CML IP}:7001
(requires PATty enabled on CML server)
text_font: monospace
text_italic: false
text_size: 10
text_unit: pt
thickness: 1
type: text
x1: -240.0
y1: 0.0
z_index: 0
- border_color: '#00000000'
border_style: ''
color: '#050505'
rotation: 0
text_bold: false
text_content: |-
Code Server Addresses:
- From Chrome Node: http://10.0.0.11:8443
- PATty Configured: http://{CML IP}:7001
(requires PATty enabled on CML server)
text_font: monospace
text_italic: false
text_size: 10
text_unit: pt
thickness: 1
type: text
x1: -240.0
y1: 0.0
z_index: 0
- border_color: '#00000000'
border_style: ''
color: '#050505'
rotation: 0
text_bold: false
text_content: 'ip: 10.0.0.1'
text_font: monospace
text_italic: false
text_size: 10
text_unit: pt
thickness: 1
type: text
x1: -120.0
y1: -320.0
z_index: 0
- border_color: '#00000000'
border_style: ''
color: '#000000'
rotation: 0
text_bold: true
text_content: 'Example: Using Code Server For Network Automation Testing'
text_font: monospace
text_italic: false
text_size: 12
text_unit: pt
thickness: 1
type: text
x1: -280.0
y1: -400.0
z_index: 1
smart_annotations:
- tag: pat:tcp:7001:8443
is_on: true
padding: 35
label: pat:tcp:7001:8443
tag_offset_x: 0
tag_offset_y: 0
tag_size: 14
group_distance: 400
thickness: 1
border_style: ''
fill_color: '#005C9980'
border_color: '#00000080'
z_index: 1
nodes:
- boot_disk_size: null
configuration: []
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n0
image_definition: null
label: internet
node_definition: external_connector
parameters: {}
ram: null
tags: []
x: -240
y: -280
interfaces:
- id: i0
label: port
mac_address: null
type: physical
slot: 0
- boot_disk_size: null
configuration:
- name: boot.sh
content: |-
# The following commands will run at boot.
# Note: Suggested that eth0 be connected to ext-conn for
# internet access to reach locations such as GitHub
# and PyPi. Leave eth0 gaining IP from DHCP. Add
# second interface (eth1) for reachability to
# "lab networks"
# Examples :
# - Static IP address, routes, and DNS server
ip address add dev eth1 10.0.0.11/24
ip route add 10.0.0.0/16 via 10.0.0.1
ip link set dev eth1 up
# echo "nameserver 192.168.10.11" >> /etc/resolv.conf
# - Clone something from Source Control
# If the container is getting its IP via DHCP, uncomment
# this sleep to ensure the DHCP process completes before
# attempting to clone the repo
sleep 10
# Recommend placing code in the /app/code directory for default workspace
cd /app/code
# Do the clone as the user "abc", which is the code-server user
sudo -u abc git clone https://github.com/hpreston/net-hello-world.git
# Install Python requirements file into the container virtual environment
sudo -u abc /app/code/.venv/bin/python -m pip install -r net-hello-world/requirements.txt
# End the script cleanly
exit 0
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n1
image_definition: null
label: codeserver-0
node_definition: code-server-custom-4.102
parameters: {}
ram: null
tags:
- pat:tcp:7001:8443
x: -240
y: -120
interfaces:
- id: i0
label: eth0
mac_address: null
type: physical
slot: 0
- id: i1
label: eth1
mac_address: null
type: physical
slot: 1
- boot_disk_size: null
configuration:
- name: ios_config.txt
content: |-
hostname router01
ip domain name net.internal
ip domain list net.internal
!
! EEM Applet to add SSH Key Automatically
event manager applet do-ssh authorization bypass
event timer cron cron-entry "@reboot" maxrun 130
action 01 wait 10
action 02 cli command "enable"
action 11 cli command "crypto key generate rsa modulus 2048"
action 20 cli command "config t"
action 21 cli command "no event manager applet do-ssh"
action 22 cli command "end"
action 23 cli command "write mem"
!
enable secret cisco
username cisco privilege 15 secret cisco
!
line vty 0 4
transport input ssh
login local
exit
!
!
! In order to avoid entering a configuration dialog on boot, please
! ensure that all interfaces have some IP configuration present here
! such as the example below:
!
interface range Ethernet0/0-3
no ip address
shutdown
!
interface Serial1/0
no ip address
shutdown
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Ethernet0/0
no shut
ip address 10.0.0.1 255.255.255.0
!
end
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n2
image_definition: null
label: router01
node_definition: iol-xe-serial-4eth
parameters: {}
ram: null
tags: []
x: -80
y: -280
interfaces:
- id: i0
label: Loopback0
mac_address: null
type: loopback
- id: i1
label: Ethernet0/0
mac_address: null
type: physical
slot: 0
- id: i2
label: Ethernet0/1
mac_address: null
type: physical
slot: 1
- id: i3
label: Ethernet0/2
mac_address: null
type: physical
slot: 2
- id: i4
label: Ethernet0/3
mac_address: null
type: physical
slot: 3
- id: i5
label: Serial1/0
mac_address: null
type: physical
slot: 4
- id: i6
label: Serial1/1
mac_address: null
type: physical
slot: 5
- id: i7
label: Serial1/2
mac_address: null
type: physical
slot: 6
- id: i8
label: Serial1/3
mac_address: null
type: physical
slot: 7
- boot_disk_size: null
configuration:
- name: boot.sh
content: |-
# insert commands here, e.g. a static IP address
ip address add dev eth0 10.0.0.12/24
ip link set dev eth0 up
exit 0
- name: environment
content: |-
# NOTE 2025-08-01:
# The current (CML 2.9.0) Chrome and Firefox containers
# do NOT support setting the HOME_URL for code-server due
# to code-server returning a 405 error to HEAD requests
# A future CML node update will enable more flexible checks
# to enable using HOME_URL for code-server
# -- These are understood by the start script
# -- Homepage to open at start (needs network!)
# HOME_URL=https://www.cisco.com/go/cml
# -- Wait additional time for network before starting Chrome
# WAIT=2
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n3
image_definition: null
label: chrome-0
node_definition: chrome
parameters: {}
ram: null
tags: []
x: 80
y: -120
interfaces:
- id: i0
label: eth0
mac_address: null
type: physical
slot: 0
- boot_disk_size: null
configuration: []
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n4
image_definition: null
label: switch
node_definition: unmanaged_switch
parameters: {}
ram: null
tags: []
x: -80
y: -120
interfaces:
- id: i0
label: port0
mac_address: null
type: physical
slot: 0
- id: i1
label: port1
mac_address: null
type: physical
slot: 1
- id: i2
label: port2
mac_address: null
type: physical
slot: 2
- id: i3
label: port3
mac_address: null
type: physical
slot: 3
- id: i4
label: port4
mac_address: null
type: physical
slot: 4
- id: i5
label: port5
mac_address: null
type: physical
slot: 5
- id: i6
label: port6
mac_address: null
type: physical
slot: 6
- id: i7
label: port7
mac_address: null
type: physical
slot: 7
links:
- id: l0
n1: n1
n2: n0
i1: i0
i2: i0
conditioning: {}
label: codeserver-0-eth0<->internet-port
- id: l1
n1: n1
n2: n4
i1: i1
i2: i0
conditioning: {}
label: codeserver-0-eth1<->unmanaged-switch-0-port0
- id: l2
n1: n4
n2: n2
i1: i1
i2: i1
conditioning: {}
label: unmanaged-switch-0-port1<->router01-Ethernet0/0
- id: l3
n1: n3
n2: n4
i1: i0
i2: i2
conditioning: {}
label: chrome-0-eth0<->unmanaged-switch-0-port2
lab:
description: 'This is an example topology that shows how the Code Server Custom
Node can be used in a topology to provide a developer experience for Network Automation
use cases. '
notes: ''
title: Example - Code Server Custom
version: 0.3.0

View File

@@ -0,0 +1,77 @@
# Code Server Custom
Looking to easily add a network automation workspace to your CML topologies? Well this node definition is for you.
![](cml-code-server-01.png)
Built from the [Linux Servers Container Image for "Code Server"](https://hub.docker.com/r/linuxserver/code-server), this node provides a web based VS Code interface that can be added into your CML topologies like any other node.
You can then use a Chrome/Firefox container within the topology to begin your automation work. Or setup a PATty connection, and directly access the Code Server from your local workstation.
## Node Details
* Requires CML version 2.9+
* Code Server Version 4.102.2 used
* Automation Tools Included:
* Python 3.12.3
* Terraform v1.12.2
* Default Workspace Configured:
* Path: `/app/code`
* Python VENV: `/app/code/.venv` (No Packages Installed)
* Requires matching image definition and container image
* Image Definition File: [`code-server.custom.01.4.102.yaml`](../../../virl-base-images/opensource/code-server.custom.01.4.102/code-server.custom.01.4.102.yaml).
* Container Image: [`code-server-custom.01.4.102.tar`](https://cml-images.nerdops.io/code-server-custom.01.4.102.tar.gz)
> Note: CML container node definition, image definition, and container image file are tightly coupled. The image "name" (ex: `code-server-custom:01_04.102.2`), and the SHA Hash (ex: `6525a3a31...`) must match exactly. Changing to a different container image with your own customizations, will require updating the node and image definitions.
* Container SHA value: `6525a3a31b1b18cf01f64425e96b080aeac86f87c0f02fc041792358bc599dd1` (Required for Image Definition Creation)
## Adding the node to your CML instance
> Container support was added in CML 2.9.0.
> Adding a container image to CML is slightly different than adding a typical VM based node. As with many things in the world, there are multiple ways to accomplish the same task. These instructions present one method, but feel free to adjust for your own environment and preferences as you see fit.
1. Import the node definition file to CML from the CML GUI.
2. Download the container image file to your local workstation.
```
# Example:
wget https://cml-images.nerdops.io/code-server-custom.01.4.102.tar.gz
Saving to: code-server-custom.01.4.102.tar.gz
code-server-custom.01.4.102.tar.gz 100%[=======>] 666.61M 47.1MB/s in 14s
2025-08-01 16:17:27 (47.9 MB/s) - code-server-custom.01.4.102.tar.gz saved [698992808/698992808]
```
1. Upload the container image to the CML server. Here I use SCP to do the upload.
```
scp code-server-custom.01.4.102.tar.gz admin@{CML_SERVER_ADDRESS}:
code-server-custom.01.4.102.tar.gz 100% 667MB 315.1MB/s 00:02
```
1. If the container image is compressed into a `.tar.gz` file like this example, you'll need to uncompress it into just a `.tar` file to continue. You can do this before you upload it to CML, but you can also do it on the CML server after the upload as the `sysadmin` account.
```
sudo -u virl2 gunzip /var/local/virl2/dropfolder/code-server-custom.01.4.102.tar.gz
```
* Access the `sysadmin` terminal through the Cockpit interface, or by SSHing to the CML server (if enabled) on port 1122
* Use `sudo -u virl2` to run the unzip as the CML service account
1. Create the Image Definition using the CML GUI. Be sure to select the correct Node and Disk Image. You'll need to provide ID, Label, Description, and Disk Hash (SHA value).
> There isn't an "Import" ability for Image Definitions, but you can use the details from the [image definition file here](../../../virl-base-images/opensource/code-server.custom.01.4.102/code-server.custom.01.4.102.yaml) in the CML Community to fill in the blanks.
## Testing the Node Definition
If you'd like to test the new node definition, a simple CML topology file is included in this repo: [Example - Code Server Custom](Example_-_Code_Server_Custom.yaml)
![](example-cml-topology-01.png)
This example includes the Code Server node with a configuraiton that automatically will clone down [https://github.com/hpreston/net-hello-world](https://github.com/hpreston/net-hello-world#) and install the Python requirements from the project automatically. There is also an IOL router, that the [`hello_world.py`](https://github.com/hpreston/net-hello-world/blob/main/hello_world.py) will use pyATS to query and print the device version.
You can access the Code-Server using the Chrome node in the topology by navigating to the code-server address of `http://10.0.0.11:8443`. If your CML server is configured for PATty, you can also access the code-server at `http://{CML_IP}:7001`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

View File

@@ -0,0 +1,125 @@
id: code-server-custom-4.102
boot:
timeout: 30
completed:
- READY
uses_regex: false
sim:
linux_native:
libvirt_domain_driver: docker
driver: ubuntu
ram: 4096
cpus: 1
cpu_limit: 100
video:
memory: 1
general:
nature: host
description: Code-Server Customized 4.102.2 (Docker)
read_only: false
configuration:
generator:
driver: null
provisioning:
files:
- editable: false
name: config.json
content: |-
{
"docker": {
"image": "code-server-custom:01_04.102.2",
"mounts": [
"type=bind,source=cfg/boot.sh,target=/boot.sh"
],
"misc_args": [
"--security-opt","seccomp=unconfined"
],
"env": [
"DOCKER_MODS=code-server-python3|linuxserver/mods:code-server-terraform",
"TZ=Etc/UTC",
"DEFAULT_WORKSPACE=/app/code/code.code-workspace"
]
},
"shell": "/bin/sh",
"day0cmd": [ "/bin/sh", "/boot.sh" ],
"busybox": true
}
- editable: true
name: boot.sh
content: |-
# The following commands will run at boot.
# Note: Suggested that eth0 be connected to ext-conn for
# internet access to reach locations such as GitHub
# and PyPi. Leave eth0 gaining IP from DHCP. Add
# second interface (eth1) for reachability to
# "lab networks"
# Examples :
# - Static IP address, routes, and DNS server
# ip address add dev eth1 192.168.10.11/24
# ip route add 192.168.11.0/24 via 192.168.10.1
# ip link set dev eth1 up
# echo "nameserver 192.168.10.11" >> /etc/resolv.conf
# - Clone something from Source Control
# If the container is getting its IP via DHCP, uncomment
# this sleep to ensure the DHCP process completes before
# attempting to clone the repo
# sleep 10
# Recommend placing code in the /app/code directory for default workspace
# cd /app/code
# Do the clone as the user "abc", which is the code-server user
# sudo -u abc git clone {REPO_ADDRESS}
# Install Python requirements file into the container virtual environment
# Note: Depending on internet speed and number of requirements, the
# installation can take significant time to complete.
# sudo -u abc /app/code/.venv/bin/python -m pip install -r {PROJECT_FOLDER}/requirements.txt
# End the script cleanly
exit 0
- editable: true
name: environment
content: |-
# Create any additional Environment Variables for the Server
# Example:
# ROUTER_ADDRESS=10.0.0.1
media_type: raw
volume_name: cfg
device:
interfaces:
serial_ports: 2
physical:
- eth0
- eth1
- eth2
- eth3
has_loopback_zero: false
default_count: 1
ui:
label_prefix: codeserver-
icon: host
label: Code-Server (Python/Terraform)
visible: true
group: Others
description: |-
Code Server 4.102.2 (Docker) Based on linuxserver/code-server
* Python and Terraform Installed
* Code workspace created at `/app/code`
* Workspace Python venv: `/app/code/.venv`
* Access Code Server at: http://{CONTAINER_IP}:8443
* PATty support: `pat:tcp:{PATty Port}:8443`
inherited:
image:
ram: true
cpus: false
data_volume: false
boot_disk_size: false
cpu_limit: false
node:
ram: true
cpus: false
data_volume: false
boot_disk_size: false
cpu_limit: false
schema_version: 0.0.1

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

14
scripts/README.md Normal file
View File

@@ -0,0 +1,14 @@
# Cisco Modeling Labs (CML) Scripts
This directory contains various scripts designed to assist with using Cisco Modeling Labs (CML). These scripts can help automate tasks, manage labs, and streamline your workflow with CML.
Feel free to explore the scripts and refer to their individual documentation or comments for usage instructions.
## Other Useful Scripts Hosted Elsewhere
In addition to the scripts in this directory, you may find the following external resources helpful:
- [eve2cml](https://github.com/CiscoDevNet/eve2cml) - An EVE-NG to CML lab topology conversion tool written in Python
- [cml-exporter](https://github.com/xorrkaz/cml-exporter) - A Prometheus exporter for CML written in Python
These repositories contain additional scripts and examples for automating and managing CML environments.

Submodule scripts/eve2cml deleted from a1402eeddb

View File

@@ -1,26 +1,27 @@
# CML Use Cases
# Cisco Modeling Labs (CML) Use Cases
This directory consists of Git submodules for other repositories that contain uses cases for CML and build off of
CML's powerful REST API (and Python Client Library).
This directory contains curated use cases for Cisco Modeling Labs (CML). Each use case demonstrates practical scenarios, workflows, or solutions that can be implemented using CML.
## Using
## Use Cases in This Repository
By default, git doesn't pull down the submodules content. You can cause it to clone all of the submodules by doing the
following:
- Explore the subdirectories for available use cases hosted here.
```sh
git submodule init
git submodule update
```
## External Use Cases
If you haven't yet cloned the `cml-community` repo, you can use the following command to clone it and pull down all the
submodules:
The following use cases are not hosted in this repository but may be useful:
```sh
git clone --recuse-submodules https://github.com/CiscoDevNet/cml-community
```
- [cml-class-automation](https://github.com/CiscoDevNet/cml-class-automation) - Proof of concept on how one can automate Cisco Modeling Labs in order to deliver networking courses using virtual labs.
- [cml-cicd](https://github.com/CiscoDevNet/cml-cicd) - Example on using CML within a CI/CD pipeline.
- [dst-automation](https://github.com/CiscoDevNet/dst-automation) - Automate the deployment and testing of Dynamic Split Tunneling on a Cisco ASA firewall within CML.
- [cmlutils](https://github.com/CiscoDevNet/virlutils) - A collection of utilities for interacting with Cisco Modeling Labs (CML).
- [ansible-cml](https://github.com/CiscoDevNet/ansible-cml) - Ansible Modules for CML.
- [sdwan-devops](https://github.com/CiscoDevNet/sdwan-devops) - SD-WAN DevOps Tools built around CML.
- [ciscolive-brkcrt-2059](https://github.com/CiscoLearning/ciscolive-brkcrt-2059) - Lab Up For Success With Cisco Modeling Labs.
- [cloud-cml](https://github.com/CiscoDevNet/cloud-cml) - Run Cisco Modeling Labs on cloud infrastructure.
## Contributing
If you have a Git repo (doesn't even have to be on GitHub) that contains a use case for CML, submit a pull request or
issue to get it added. We'd love to see how you're using CML.
If you wish to submit a use case, you can either create a pull request to host it here in this repository, or you can submit a pull request
for this `README.md` alone that points to your CML use cases hosted elsewhere.
Feel free to contribute new use cases or suggest additional resources!

View File

@@ -182,7 +182,8 @@
"description": "The type of the configuration media.",
"enum": [
"iso",
"fat"
"fat",
"ext4"
]
},
"volume_name": {

View File

@@ -0,0 +1,31 @@
id: code-server.custom.01.4.102
node_definition_id: code-server-custom-4.102
description: |-
Code Server (4.102) from https://hub.docker.com/r/linuxserver/code-server
Reachable at: http://{IP_ADDRESS}:8443
Customizations:
* DOCKER_MODS=linuxserver/mods:code-server-python3|linuxserver/mods:code-server-terraform"
* VS Code Extensions
```
code-server --install-extension dotjoshjohnson.xml
code-server --install-extension ms-python.black-formatter
code-server --install-extension ms-python.debugpy
code-server --install-extension ms-python.flake8
code-server --install-extension ms-python.python
code-server --install-extension redhat.ansible
code-server --install-extension redhat.vscode-yaml
code-server --install-extension samuelcolvin.jinjahtml
code-server --install-extension hashicorp.terraform
code-server --install-extension ms-toolsai.jupyter
```
* Workspace for /app/code created
label: Code Server Custom
disk_image: code-server-custom.01.4.102.tar
read_only: false
schema_version: 0.0.1
sha256: 6525a3a31b1b18cf01f64425e96b080aeac86f87c0f02fc041792358bc599dd1