-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for vJunosEvolved (#1775)
* 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
1 parent
ddc8dc7
commit 7d5c21a
Showing
12 changed files
with
303 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters