Skip to content

Commit

Permalink
Add support for vJunosEvolved (#1775)
Browse files Browse the repository at this point in the history
* adding support for vJunosEvolved

* removing vim files

* Update vr-vjunosevolved.md

* update link README.md

* adding vJunosEvolved lab example doc, mkdocs.yml, and link in README

* removing vr- prefixed instances of vJunos-switch and Evo. updating lab-example to reference upcoming release of clab

* removing vr- prefix in `vr-vjunosswitch.go`
  • Loading branch information
akielaries authored Dec 13, 2023
1 parent ddc8dc7 commit 7d5c21a
Show file tree
Hide file tree
Showing 12 changed files with 303 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ In addition to native containerized NOSes, containerlab can launch traditional v
* [Juniper vMX](https://containerlab.dev/manual/kinds/vr-vmx/)
* [Juniper vQFX](https://containerlab.dev/manual/kinds/vr-vqfx/)
* [Juniper vSRX](https://containerlab.dev/manual/kinds/vr-vsrx/)
* [Juniper vJunos-switch](https://containerlab.dev/manual/kinds/vr-vjunosswitch/)
* [Juniper vJunosEvolved](https://containerlab.dev/manual/kinds/vr-vjunosevolved/)
* [Cisco IOS XRv9k](https://containerlab.dev/manual/kinds/vr-xrv9k/)
* [Cisco Nexus 9000v](https://containerlab.dev/manual/kinds/vr-n9kv)
* [Cisco CSR 1000v](https://containerlab.dev/manual/kinds/vr-csr)
Expand Down
2 changes: 2 additions & 0 deletions clab/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
vr_sros "github.com/srl-labs/containerlab/nodes/vr_sros"
vr_veos "github.com/srl-labs/containerlab/nodes/vr_veos"
vr_vjunosswitch "github.com/srl-labs/containerlab/nodes/vr_vjunosswitch"
vr_vjunosevolved "github.com/srl-labs/containerlab/nodes/vr_vjunosevolved"
vr_vmx "github.com/srl-labs/containerlab/nodes/vr_vmx"
vr_vqfx "github.com/srl-labs/containerlab/nodes/vr_vqfx"
vr_vsrx "github.com/srl-labs/containerlab/nodes/vr_vsrx"
Expand Down Expand Up @@ -67,6 +68,7 @@ func (c *CLab) RegisterNodes() {
vr_vsrx.Register(c.Reg)
vr_vqfx.Register(c.Reg)
vr_vjunosswitch.Register(c.Reg)
vr_vjunosevolved.Register(c.Reg)
vr_xrv.Register(c.Reg)
vr_xrv9k.Register(c.Reg)
xrd.Register(c.Reg)
Expand Down
25 changes: 25 additions & 0 deletions docs/lab-examples/srl-vjunosevolved.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
| | |
| ----------------------------- | ---------------------------------------------------------------------------------------- |
| **Description** | A Nokia SR Linux connected back-to-back with Juniper vJunosEvolved |
| **Components** | [Nokia SR Linux][srl], [Juniper vJunosEvolved][vjunos] |
| **Resource requirements**[^1] | :fontawesome-solid-microchip: 6 <br/>:fontawesome-solid-memory: 12 GB |
| **Topology file** | [srlvjunos02.clab.yml][topofile] |
| **Name** | srlvjunos02 |
| **Version information**[^2] | `containerlab:0.49.0`, `srlinux:23.7.1`, `vJunosEvolved-23.2R1-S1.8`, `docker-ce:24.0.7,` |

## Description

A lab consists of an SR Linux node connected with Juniper vJunosEvolved via three point-to-point ethernet links. Both nodes are also connected with their management interfaces to the `clab` docker network.

## Use cases

The nodes are provisioned with a basic interface configuration for three interfaces they are connected with. Pings between the nodes should work out of the box using all three interfaces.

[srl]: ../manual/kinds/srl.md
[vjunos]: ../manual/kinds/vr-vjunosevolved.md
[topofile]: https://github.com/srl-labs/containerlab/tree/main/lab-examples/srlvjunos02/srlvjunos02.clab.yml

[^1]: Resource requirements are provisional. Consult with the installation guides for additional information.
[^2]: The lab has been validated using these versions of the required tools/components. Using versions other than stated might lead to a non-operational setup process.

<script type="text/javascript" src="https://viewer.diagrams.net/js/viewer-static.min.js" async></script>
83 changes: 83 additions & 0 deletions docs/manual/kinds/vr-vjunosevolved.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
search:
boost: 4
---
# 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 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).

## Managing Juniper vJunosEvolved nodes

!!!note
Containers with vJunosEvolved inside will take ~15min to fully boot.
You can monitor the progress with `docker logs -f <container-name>`.

Juniper vJunosEvolved node launched with containerlab can be managed via the following interfaces:

=== "bash"
to connect to a `bash` shell of a running Juniper vJunosEvolved container:
```bash
docker exec -it <container-name/id> bash
```
=== "CLI via SSH"
to connect to the vJunosEvolved CLI
```bash
ssh admin@<container-name/id>
```
=== "NETCONF"
NETCONF server is running over port 830
```bash
ssh admin@<container-name> -p 830 -s netconf
```

!!!info
Default user credentials: `admin:admin@123`

## Interfaces mapping

Juniper vJunosEvolved container can have up to 17 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 vJunosEvolved VM
* `eth2+` - second and subsequent data interface

When containerlab launches Juniper vJunosEvolved 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 vJunosEvolved 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 vJunosEvolved 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_vjunosevolved
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.

## Lab examples

The following labs feature the Juniper vJunosEvolved node:

* [SR Linux and Juniper vJunosEvolved](../../../lab-examples/srlvjunos02/srlvjunos02.yml

## Known issues and limitations
* To check the boot log, use `docker logs -f <node-name>`.
1 change: 1 addition & 0 deletions docs/manual/vrnetlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ The images that work with containerlab will appear in the supported list as we i
| Juniper vQFX | [juniper_vqfx](kinds/vr-vqfx.md) | | |
| Juniper vSRX | [juniper_vsrx](kinds/vr-vsrx.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) | |
| Cisco XRv9k | [cisco_xrv9k](kinds/vr-xrv9k.md) | [SRL & XRv9k](../lab-examples/vr-xrv9k.md) | |
| Cisco CSR1000v | [cisco_csr](kinds/vr-csr.md) | | |
Expand Down
39 changes: 39 additions & 0 deletions lab-examples/srlvjunos02/srl.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
interface ethernet-1/1 {
admin-state enable
subinterface 0 {
ipv4 {
admin-state enable
address 192.168.0.2/24 {
}
}
}
}
interface ethernet-1/2 {
admin-state enable
subinterface 0 {
ipv4 {
admin-state enable
address 192.168.1.2/24 {
}
}
}
}
interface ethernet-1/3 {
admin-state enable
subinterface 0 {
ipv4 {
admin-state enable
address 192.168.2.2/24 {
}
}
}
}

network-instance default {
interface ethernet-1/1.0 {
}
interface ethernet-1/2.0 {
}
interface ethernet-1/3.0 {
}
}
18 changes: 18 additions & 0 deletions lab-examples/srlvjunos02/srlvjunos02.clab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: srlvjunos02

topology:
nodes:
srl:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux:23.7.1
startup-config: srl.cli

vevo:
kind: juniper_vjunosevolved
image: vrnetlab/vr-vjunosevolved:23.2R1-S1.8-EVO
startup-config: vjunos.cfg

links:
- endpoints: ["srl:e1-1", "vevo:eth1"]
- endpoints: ["srl:e1-2", "vevo:eth2"]
- endpoints: ["srl:e1-3", "vevo:eth3"]
23 changes: 23 additions & 0 deletions lab-examples/srlvjunos02/vjunos.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
interfaces {
et-0/0/0 {
unit 0 {
family inet {
address 192.168.0.1/24;
}
}
}
et-0/0/1 {
unit 0 {
family inet {
address 192.168.1.1/24;
}
}
}
et-0/0/2 {
unit 0 {
family inet {
address 192.168.2.1/24;
}
}
}
}
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ nav:
- Juniper vQFX: manual/kinds/vr-vqfx.md
- Juniper vSRX: manual/kinds/vr-vsrx.md
- Juniper vJunos-switch: manual/kinds/vr-vjunosswitch.md
- Juniper vJunosEvolved: manual/kinds/vr-vjunosevolved.md
- Cisco XRd: manual/kinds/xrd.md
- Cisco XRv9k: manual/kinds/vr-xrv9k.md
- Cisco XRv: manual/kinds/vr-xrv.md
Expand Down Expand Up @@ -97,6 +98,7 @@ nav:
- Nokia SR Linux and Cisco XRv: lab-examples/vr-xrv.md
- Nokia SR Linux and FRR: lab-examples/srl-frr.md
- Nokia SR Linux and Juniper vJunos-switch: lab-examples/srl-vjunos-switch.md
- Nokia SR Linux and Juniper vJunosEvolved: lab-examples/srl-vjunosevolved.md
- FRR: lab-examples/frr01.md
- Cumulus Linux and FRR: lab-examples/cvx01.md
- Cumulus Linux (docker runtime) and Host: lab-examples/cvx02.md
Expand Down
103 changes: 103 additions & 0 deletions nodes/vr_vjunosevolved/vr-vjunosevolved.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Copyright 2020 Nokia
// Licensed under the BSD 3-Clause License.
// SPDX-License-Identifier: BSD-3-Clause

package vr_vjunosevolved

import (
"context"
"fmt"
"path"

log "github.com/sirupsen/logrus"
"github.com/srl-labs/containerlab/netconf"
"github.com/srl-labs/containerlab/nodes"
"github.com/srl-labs/containerlab/types"
"github.com/srl-labs/containerlab/utils"
)

var (
kindnames = []string{"juniper_vjunosevolved"}
defaultCredentials = nodes.NewCredentials("admin", "admin@123")
)

const (
scrapliPlatformName = "juniper_junos"

configDirName = "config"
startupCfgFName = "startup-config.cfg"
)

// Register registers the node in the NodeRegistry.
func Register(r *nodes.NodeRegistry) {
r.Register(kindnames, func() nodes.Node {
return new(vrVJUNOSEVOLVED)
}, defaultCredentials)
}

type vrVJUNOSEVOLVED struct {
nodes.DefaultNode
}

func (n *vrVJUNOSEVOLVED) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
// Init DefaultNode
n.DefaultNode = *nodes.NewDefaultNode(n)
// set virtualization requirement
n.HostRequirements.VirtRequired = true

n.Cfg = cfg
for _, o := range opts {
o(n)
}
// env vars are used to set launch.py arguments in vrnetlab container
defEnv := map[string]string{
"USERNAME": defaultCredentials.GetUsername(),
"PASSWORD": defaultCredentials.GetPassword(),
"CONNECTION_MODE": nodes.VrDefConnMode,
"DOCKER_NET_V4_ADDR": n.Mgmt.IPv4Subnet,
"DOCKER_NET_V6_ADDR": n.Mgmt.IPv6Subnet,
}
n.Cfg.Env = utils.MergeStringMaps(defEnv, n.Cfg.Env)

// mount config dir to support startup-config functionality
n.Cfg.Binds = append(n.Cfg.Binds, fmt.Sprint(path.Join(n.Cfg.LabDir, configDirName), ":/config"))

if n.Cfg.Env["CONNECTION_MODE"] == "macvtap" {
// mount dev dir to enable macvtap
n.Cfg.Binds = append(n.Cfg.Binds, "/dev:/dev")
}

n.Cfg.Cmd = fmt.Sprintf("--username %s --password %s --hostname %s --connection-mode %s --trace",
defaultCredentials.GetUsername(), defaultCredentials.GetPassword(), n.Cfg.ShortName, n.Cfg.Env["CONNECTION_MODE"])

return nil
}

func (n *vrVJUNOSEVOLVED) PreDeploy(_ context.Context, params *nodes.PreDeployParams) error {
utils.CreateDirectory(n.Cfg.LabDir, 0777)
_, err := n.LoadOrGenerateCertificate(params.Cert, params.TopologyName)
if err != nil {
return nil
}
return nodes.LoadStartupConfigFileVr(n, configDirName, startupCfgFName)
}

func (n *vrVJUNOSEVOLVED) SaveConfig(_ context.Context) error {
err := netconf.SaveConfig(n.Cfg.LongName,
defaultCredentials.GetUsername(),
defaultCredentials.GetPassword(),
scrapliPlatformName,
)
if err != nil {
return err
}

log.Infof("saved %s running configuration to startup configuration file\n", n.Cfg.ShortName)
return nil
}

// CheckInterfaceName checks if a name of the interface referenced in the topology file correct.
func (n *vrVJUNOSEVOLVED) CheckInterfaceName() error {
return nodes.GenericVMInterfaceCheck(n.Cfg.ShortName, n.Endpoints)
}

2 changes: 1 addition & 1 deletion nodes/vr_vjunosswitch/vr-vjunosswitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

var (
kindnames = []string{"juniper_vjunosswitch", "vr-vjunosswitch", "vr-juniper_vjunosswitch"}
kindnames = []string{"juniper_vjunosswitch"}
defaultCredentials = nodes.NewCredentials("admin", "admin@123")
)

Expand Down
7 changes: 4 additions & 3 deletions schemas/clab.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"vr-vjunosswitch",
"vr-juniper_vjunosswitch",
"juniper_vjunosswitch",
"juniper_vjunosevolved",
"vr-xrv",
"vr-cisco_xrv",
"cisco_xrv",
Expand Down Expand Up @@ -728,10 +729,10 @@
"vr-vsrx": {
"$ref": "#/definitions/node-config"
},
"vr-juniper_vjunosswitch": {
"juniper_vjunosswitch": {
"$ref": "#/definitions/node-config"
},
"vr-vjunosswitch": {
"juniper_vjunosevolved": {
"$ref": "#/definitions/node-config"
},
"vr-aruba_aoscx": {
Expand Down Expand Up @@ -844,4 +845,4 @@
"name",
"topology"
]
}
}

0 comments on commit 7d5c21a

Please sign in to comment.