Skip to content

Commit

Permalink
Add support for Cisco Catalyst 9000v (#225)
Browse files Browse the repository at this point in the history
* Add minimum nics arg to VM class & add dummy nic generation feature for Cat9kv support.

* Add removal of .xml files from docker/ directory.

* add copy of vswitch.xml file if present (for cat9kv).

* Add initial support for Cisco Cat9kv

* Remove image install process.

* Remove ASIC image tagging

* Correct hostname in bootstrap & startup configurations.

* formatting

* Fix directory creation for when vswitch.xml file is added via binds

* Add supplement qemu PCI args for dummy nics

* format with ruff

add no-install-recommends

---------

Co-authored-by: Roman Dodin <[email protected]>
  • Loading branch information
kaelemc and hellt authored Jul 9, 2024
1 parent 7ee2dbd commit 98492a8
Show file tree
Hide file tree
Showing 6 changed files with 454 additions and 3 deletions.
12 changes: 12 additions & 0 deletions cat9kv/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
VENDOR=Cisco
NAME=cat9kv
IMAGE_FORMAT=qcow2
IMAGE_GLOB=*.qcow2

# match versions like:
# csr1000v-universalk9.16.03.01a.qcow2
# csr1000v-universalk9.16.04.01.qcow2
VERSION=$(shell echo $(IMAGE) | sed -e 's/.\+[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+[a-z]\?\)\([^0-9].*\|$$\)/\1/')

-include ../makefile-sanity.include
-include ../makefile.include
95 changes: 95 additions & 0 deletions cat9kv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Cisco Catalyst 9000V

This is the vrnetlab image for the Cisco Catalyst 9000v (cat9kv, c9000v).

The Cat9kv emulates two types of ASICs that are found in the common Catalyst 9000 hardware platforms, either:

- UADP (Cisco Unified Access Data Plane)
- Cisco Silicon One Q200 (referred to as Q200 for short)

The Q200 is a newer ASIC, however doen't support as many features as the UADP ASIC emulation.

> Insufficient RAM will not allow the node to boot correctly.
Eight interfaces will always appear regardless if you have defined any links in the `*.clab.yaml` topology file. The Cat9kv requires 8 interfaces at minimum to boot, so dummy interfaces are created if there are an insufficient amount of interfaces (links) defined.

## Building the image

Copy the Cat9kv .qcow2 file in this directory and you can perform `make docker-image`. On average the image takes approxmiately ~4 minutes to build as an initial install process occurs.

The UADP and Q200 use the same .qcow2 image. The default image created is the UADP image.

To configure the Q200 image or enable a higher throughput dataplane for UADP; you must supply the relevant `vswitch.xml` file. You can place that file in this directory and build the image.

> You can obtain a `vswitch.xml` file from the relevant CML node definiton file.
Known working versions:

- cat9kv-prd-17.12.01prd9.qcow2 (UADP & Q200)

## Usage

You can define the image easily and use it in a topolgy. As mentioned earlier no links are requried to be defined.

```yaml
# topology.clab.yaml
name: mylab
topology:
nodes:
cat9kv:
kind: cisco_cat9kv
image: vrnetlab/vr-cat9kv:<tag>
```
You can also supply a vswitch.xml file using `binds`. Below is an example topology file.

```yaml
# topology.clab.yaml
name: mylab
topology:
nodes:
cat9kv:
kind: cisco_cat9kv
image: vrnetlab/vr-cat9kv:<tag>
binds:
- /path/to/vswitch.xml:/vswitch.xml
```

### Interface naming

Currently a maximum of 8 data-plane interfaces are supported. 9 interfaces total if including the management interface.

- `eth0` - Node management interface
- `eth1` - First dataplane interface (GigabitEthernet1/0/1).
- `ethX` - Subsequent dataplane interfaces will count onwards from 1. For example, the third dataplane interface will be `eth3`

You can also use interface aliases of `GigabitEthernet1/0/x` or `Gi1/0/x`

### Environment Variables

| Environment Variable | Default |
| --------------------- | ------------- |
| VCPU | 4 |
| RAM | 18432 |

### Example

```yaml
name: my-example-lab
topology:
nodes:
my-cat9kv:
kind: cisco_cat9kv
image: vrnetlab/vr-cat9kv:17.12.01
env:
VCPU: 6
RAM: 12288
```

## System requirements

| | UADP (Default)| Q200 |
| --------- | ------------- | ----- |
| vCPU | 4 | 4 |
| RAM (MB) | 18432 | 12288 |
| Disk (GB) | 4 | 4 |
31 changes: 31 additions & 0 deletions cat9kv/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM public.ecr.aws/docker/library/debian:bookworm-slim

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qy \
&& apt-get install -y --no-install-recommends \
bridge-utils \
iproute2 \
socat \
qemu-kvm \
qemu-utils \
python3 \
tcpdump \
inetutils-ping \
ssh \
telnet \
procps \
genisoimage \
&& rm -rf /var/lib/apt/lists/*

ARG VERSION
ENV VERSION=${VERSION}
ARG IMAGE
COPY $IMAGE* /
COPY *.py /
# for vSwitch.xml file (specifies ASIC emulation parameters), won't throw error if vswitch.xml isn't present
COPY vswitch.xm[l] /img_dir/conf/

EXPOSE 22 161/udp 830 5000 10000-10099
HEALTHCHECK CMD ["/healthcheck.py"]
ENTRYPOINT ["/launch.py"]
Loading

0 comments on commit 98492a8

Please sign in to comment.