From bad598dd070f12a84cea9984ac021def3a8f59e1 Mon Sep 17 00:00:00 2001 From: vista- Date: Thu, 6 Jun 2024 10:46:57 +0200 Subject: [PATCH] Add vJunos-Router kind based on existing vJunos-switch implementation (#2063) * Add vJunos-Router kind based on existing vJunos-switch implementation * Add/fix vJunos kind short names * Fix vJunos shortnames in schema, merge separate vJunosRouter into vJunosSwitch kind, minor doc fixes * Add note about vJunosEvolved being freely downloadable to docs * Re-add accidentally removed trailing whitespace/newlines to docs * Remove deprecated vr-prefixed short names * Change vJunos short names to long names in autocompletion generator --- cmd/generate.go | 4 +- docs/index.md | 3 +- docs/manual/kinds/index.md | 1 + docs/manual/kinds/vr-vjunosevolved.md | 4 +- docs/manual/kinds/vr-vjunosrouter.md | 79 ++++++++++++++++++++++++ docs/manual/kinds/vr-vjunosswitch.md | 4 +- docs/manual/vrnetlab.md | 1 + mkdocs.yml | 1 + nodes/vr_vjunosswitch/vr-vjunosswitch.go | 2 +- schemas/clab.schema.json | 6 +- 10 files changed, 95 insertions(+), 10 deletions(-) create mode 100644 docs/manual/kinds/vr-vjunosrouter.md diff --git a/cmd/generate.go b/cmd/generate.go index 38638cf5d..55191da9b 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -39,8 +39,8 @@ var interfaceFormat = map[string]string{ var supportedKinds = []string{ "srl", "ceos", "linux", "bridge", "sonic-vs", "crpd", "vr-sros", "vr-vmx", "vr-vsrx", - "vr-vqfx", "vr-vjunosswitch", "vr-xrv9k", "vr-veos", "xrd", "rare", "openbsd", "cisco_ftdv", - "freebsd", + "vr-vqfx", "juniper_vjunosevolved", "juniper_vjunosrouter", "juniper_vjunosswitch", "vr-xrv9k", "vr-veos", + "xrd", "rare", "openbsd", "cisco_ftdv", "freebsd", } const ( diff --git a/docs/index.md b/docs/index.md index 539ab12da..ce70b0c11 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,7 +36,8 @@ In addition to native containerized NOSes, containerlab can launch traditional v * [Juniper vMX](manual/kinds/vr-vmx.md) * [Juniper vQFX](manual/kinds/vr-vqfx.md) * [Juniper vSRX](manual/kinds/vr-vsrx.md) -* [Juniper vJunos Switch](manual/kinds/vr-vjunosswitch.md) +* [Juniper vJunos-router](manual/kinds/vr-vjunosrouter.md) +* [Juniper vJunos-switch](manual/kinds/vr-vjunosswitch.md) * [Juniper vJunos Evolved](manual/kinds/vr-vjunosevolved.md) * [Cisco IOS XRv9k](manual/kinds/vr-xrv9k.md) * [Cisco Nexus 9000v](manual/kinds/vr-n9kv.md) diff --git a/docs/manual/kinds/index.md b/docs/manual/kinds/index.md index 9e3a37a3c..495401965 100644 --- a/docs/manual/kinds/index.md +++ b/docs/manual/kinds/index.md @@ -41,6 +41,7 @@ Within each predefined kind, we store the necessary information that is used to | **Juniper vMX** | [`vr-vmx/vr-juniper_vmx`](vr-vmx.md) | supported | VM | | **Juniper vQFX** | [`vr-vqfx/vr-juniper_vqfx`](vr-vqfx.md) | supported | VM | | **Juniper vSRX** | [`vr-vsrx/vr-juniper_vsrx`](vr-vsrx.md) | supported | VM | +| **Juniper vJunos-router** | [`vr-vjunosrouter/juniper_vjunosrouter`](vr-vjunosrouter.md) | supported | VM | | **Juniper vJunos-switch** | [`vr-vjunosswitch/juniper_vjunosswitch`](vr-vjunosswitch.md) | supported | VM | | **Juniper vJunosEvolved** | [`vr-vjunosevolved/juniper_vjunosevolved`](vr-vjunosevolved.md) | supported | VM | | **Cisco XRd** | [`xrd/cisco_xrd'](xrd.md) | supported | container | diff --git a/docs/manual/kinds/vr-vjunosevolved.md b/docs/manual/kinds/vr-vjunosevolved.md index da26fd6fc..9a5fac15b 100644 --- a/docs/manual/kinds/vr-vjunosevolved.md +++ b/docs/manual/kinds/vr-vjunosevolved.md @@ -4,13 +4,13 @@ search: --- # Juniper vJunosEvolved -[Juniper vJunosEvolved](https://support.juniper.net/support/downloads/?p=vjunos-evolved) is a virtualized PTX10001 router identified with `juniper_vjunosevolved` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format. +[Juniper vJunosEvolved](https://www.juniper.net/documentation/product/us/en/vjunosevolved/) is a virtualized PTX10001 router identified with `juniper_vjunosevolved` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format. Juniper vJunosEvolved nodes launched with containerlab come up pre-provisioned with SSH, SNMP, NETCONF and gNMI services enabled. ## How to obtain the image -The qcow2 image can be downloaded from [Juniper website](https://support.juniper.net/support/downloads/?p=vjunos-evolved) and built with [vrnetlab](../vrnetlab.md). +The qcow2 image can be freely downloaded from the [Juniper support portal](https://support.juniper.net/support/downloads/?p=vjunos-evolved) without a Juniper account and built with [vrnetlab](../vrnetlab.md). ## Managing Juniper vJunosEvolved nodes diff --git a/docs/manual/kinds/vr-vjunosrouter.md b/docs/manual/kinds/vr-vjunosrouter.md new file mode 100644 index 000000000..7897589ab --- /dev/null +++ b/docs/manual/kinds/vr-vjunosrouter.md @@ -0,0 +1,79 @@ +--- +search: + boost: 4 +--- +# Juniper vJunos-router + +[Juniper vJunos-router](https://www.juniper.net/documentation/product/us/en/vjunos-router/) is a virtualized MX router, a single-VM version of the vMX that requires no feature licenses and is meant for lab/testing use. It is identified with `juniper_vjunosrouter` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format. + +Juniper vJunos-router nodes launched with containerlab come up pre-provisioned with SSH, SNMP, NETCONF and gNMI services enabled. + +## How to obtain the image + +The qcow2 image can be freely downloaded from the [Juniper support portal](https://support.juniper.net/support/downloads/?p=vjunos-router) without a Juniper account and built with [vrnetlab](../vrnetlab.md). + +## Managing Juniper vJunos-router nodes + +!!!note + Containers with vJunos-router inside can take up to ~5-10min to fully boot. + You can monitor the progress with `docker logs -f `. + +Juniper vJunos-router node launched with containerlab can be managed via the following interfaces: + +=== "bash" + to connect to a `bash` shell of a running Juniper vJunos-router container: + ```bash + docker exec -it bash + ``` +=== "CLI via SSH" + to connect to the vJunos-router CLI + ```bash + ssh admin@ + ``` +=== "NETCONF" + NETCONF server is running over port 830 + ```bash + ssh admin@ -p 830 -s netconf + ``` + +!!!info + Default user credentials: `admin:admin@123` + +## Interfaces mapping + +Juniper vJunos-router container can have up to 11 interfaces and uses the following mapping rules: + +* `eth0` - management interface connected to the containerlab management network +* `eth1` - first data interface, mapped to a first data port of vJunos-router VM +* `eth2+` - second and subsequent data interface + +When containerlab launches Juniper vJunos-router node, it will assign IPv4/6 address to the `eth0` interface. These addresses can be used to reach the management plane of the router. + +Data interfaces `eth1+` need to be configured with IP addressing manually using CLI/management protocols or via a startup-config text file. + +## Features and options + +### Node configuration + +Juniper vJunos-router nodes come up with a basic configuration supplied by a mountable configuration disk to the main VM image. Users, management interfaces, and protocols such as SSH and NETCONF are configured. + +#### Startup configuration + +It is possible to make vJunos-router nodes boot up with a user-defined startup-config instead of a built-in one. With a [`startup-config`](../nodes.md#startup-config) property of the node/kind user sets the path to the config file that will be mounted to a container and used as a startup-config: + +```yaml +topology: + nodes: + node: + kind: juniper_vjunosrouter + startup-config: myconfig.txt +``` + +With this knob containerlab is instructed to take a file `myconfig.txt` from the directory that hosts the topology file, and copy it to the lab directory for that specific node under the `/config/startup-config.cfg` name. Then the directory that hosts the startup-config dir is mounted to the container. This will result in this config being applied at startup by the node. + +Configuration is applied after the node is started, thus it can contain partial configuration snippets that you desire to add on top of the default config that a node boots up with. + +## Known issues and limitations + +* vJunos-router requires Linux kernel 4.17+ +* To check the boot log, use `docker logs -f `. diff --git a/docs/manual/kinds/vr-vjunosswitch.md b/docs/manual/kinds/vr-vjunosswitch.md index 27b7854c6..2a9cc999e 100644 --- a/docs/manual/kinds/vr-vjunosswitch.md +++ b/docs/manual/kinds/vr-vjunosswitch.md @@ -4,13 +4,13 @@ search: --- # Juniper vJunos-switch -[Juniper vJunos-switch](https://support.juniper.net/support/downloads/?p=vjunos) is a virtualized EX9214 switch identified with `juniper_vjunosswitch` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format. +[Juniper vJunos-switch](https://www.juniper.net/documentation/product/us/en/vjunos-switch/) is a virtualized EX9214 switch identified with `juniper_vjunosswitch` kind in the [topology file](../topo-def-file.md). It is built using [vrnetlab](../vrnetlab.md) project and essentially is a Qemu VM packaged in a docker container format. Juniper vJunos-switch nodes launched with containerlab come up pre-provisioned with SSH, SNMP, NETCONF and gNMI services enabled. ## How to obtain the image -The qcow2 image can be downloaded from [Juniper website](https://support.juniper.net/support/downloads/?p=vjunos) and built with [vrnetlab](../vrnetlab.md). +The qcow2 image can be freely downloaded from the [Juniper support portal](https://support.juniper.net/support/downloads/?p=vjunos-switch) without a Juniper account and built with [vrnetlab](../vrnetlab.md). ## Managing Juniper vJunos-switch nodes diff --git a/docs/manual/vrnetlab.md b/docs/manual/vrnetlab.md index d482566d0..f80bbccbc 100644 --- a/docs/manual/vrnetlab.md +++ b/docs/manual/vrnetlab.md @@ -92,6 +92,7 @@ The images that work with containerlab will appear in the supported list as we i | Juniper vMX | [juniper_vmx](kinds/vr-vmx.md) | [SRL & vMX](../lab-examples/vr-vmx.md) | | | Juniper vQFX | [juniper_vqfx](kinds/vr-vqfx.md) | | | | Juniper vSRX | [juniper_vsrx](kinds/vr-vsrx.md) | | | +| Juniper vJunos-Router | [juniper_vjunosrouter](kinds/vr-vjunosrouter.md) | | | | Juniper vJunos-Switch | [juniper_vjunosswitch](kinds/vr-vjunosswitch.md) | | | | Juniper vJunosEvolved | [juniper_vjunosevolved](kinds/vr-vjunosevolved.md) | | | | Cisco XRv | [cisco_xrv](kinds/vr-xrv.md) | [SRL & XRv](../lab-examples/vr-xrv.md) | | diff --git a/mkdocs.yml b/mkdocs.yml index 4fdd21838..f6054cf95 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -17,6 +17,7 @@ nav: - Juniper vMX: manual/kinds/vr-vmx.md - Juniper vQFX: manual/kinds/vr-vqfx.md - Juniper vSRX: manual/kinds/vr-vsrx.md + - Juniper vJunos-router: manual/kinds/vr-vjunosrouter.md - Juniper vJunos-switch: manual/kinds/vr-vjunosswitch.md - Juniper vJunosEvolved: manual/kinds/vr-vjunosevolved.md - Cisco XRd: manual/kinds/xrd.md diff --git a/nodes/vr_vjunosswitch/vr-vjunosswitch.go b/nodes/vr_vjunosswitch/vr-vjunosswitch.go index 4c9435182..ddb556cd2 100644 --- a/nodes/vr_vjunosswitch/vr-vjunosswitch.go +++ b/nodes/vr_vjunosswitch/vr-vjunosswitch.go @@ -17,7 +17,7 @@ import ( ) var ( - kindnames = []string{"juniper_vjunosswitch"} + kindnames = []string{"juniper_vjunosrouter", "juniper_vjunosswitch"} defaultCredentials = nodes.NewCredentials("admin", "admin@123") ) diff --git a/schemas/clab.schema.json b/schemas/clab.schema.json index 762a10814..1d580b159 100644 --- a/schemas/clab.schema.json +++ b/schemas/clab.schema.json @@ -50,8 +50,7 @@ "vr-vsrx", "vr-juniper_vsrx", "juniper_vsrx", - "vr-vjunosswitch", - "vr-juniper_vjunosswitch", + "juniper_vjunosrouter", "juniper_vjunosswitch", "juniper_vjunosevolved", "vr-xrv", @@ -902,6 +901,9 @@ "vr-vsrx": { "$ref": "#/definitions/node-config" }, + "juniper_vjunosrouter": { + "$ref": "#/definitions/node-config" + }, "juniper_vjunosswitch": { "$ref": "#/definitions/node-config" },