Skip to content

Commit

Permalink
Merge pull request #235 from srl-wim/vr-sros
Browse files Browse the repository at this point in the history
added vr-sros kind
  • Loading branch information
hellt committed Jan 20, 2021
2 parents e9b85c9 + 0391751 commit 6ceb5f3
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 0 deletions.
36 changes: 36 additions & 0 deletions clab/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
dockerNetIPv6Addr = "2001:172:20:20::/80"
dockerNetMTU = "1450"
srlDefaultType = "ixr6"
vrsrosDefaultType = "sr-1"
)

// supported kinds
Expand Down Expand Up @@ -255,6 +256,9 @@ func (c *CLab) typeInit(nodeCfg *NodeConfig, kind string) string {
switch kind {
case "srl":
return srlDefaultType

case "vr-sros":
return vrsrosDefaultType
}
return ""
}
Expand Down Expand Up @@ -499,6 +503,38 @@ func (c *CLab) NewNode(nodeName string, nodeCfg NodeConfig, idx int) error {
// mount sshd_config
node.Binds = append(node.Binds, fmt.Sprint(path.Join(node.LabDir, "config/sshd_config"), ":/etc/ssh/sshd_config"))

case "vr-sros":
node.Config = c.configInitialization(&nodeCfg, node.Kind)
node.Image = c.imageInitialization(&nodeCfg, node.Kind)
node.Group = c.groupInitialization(&nodeCfg, node.Kind)
node.Position = c.positionInitialization(&nodeCfg, node.Kind)
node.User = user

// vr-sros types set the vrnetlab/sros variant (https://github.com/hellt/vrnetlab/sros)
node.NodeType = c.typeInit(&nodeCfg, node.Kind)

// initialize license file
lp, err := c.licenseInit(&nodeCfg, node)
if err != nil {
return err
}
lp, err = resolvePath(lp)
if err != nil {
return err
}
node.License = lp

// env vars are used to set launch.py arguments in vrnetlab container
defEnv := map[string]string{
"NUM_NICS": "5",
"CONNECTION_MODE": "bridge"}
node.Env = mergeStringMaps(defEnv, envs)

// mount tftpboot dir
node.Binds = append(node.Binds, fmt.Sprint(path.Join(node.LabDir, "tftpboot"), ":/tftpboot"))

node.Cmd = fmt.Sprintf("--num-nics %s --connection-mode %s --hostname %s --variant %s", node.Env["NUM_NICS"], node.Env["CONNECTION_MODE"], node.ShortName, node.NodeType)

case "alpine", "linux":
node.Config = c.configInitialization(&nodeCfg, node.Kind)
node.Image = c.imageInitialization(&nodeCfg, node.Kind)
Expand Down
12 changes: 12 additions & 0 deletions clab/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,19 @@ func (c *CLab) CreateNodeDirStructure(node *Node) (err error) {
}
log.Debugf("CopyFile src %s -> dst %s succeeded", src, dst)
}
case "vr-sros":
// create config directory that will be bind mounted to vrnetlab container at / path
CreateDirectory(path.Join(node.LabDir, "tftpboot"), 0777)

if node.License != "" {
// copy license file to node specific lab directory
src := node.License
dst := path.Join(node.LabDir, "/tftpboot/license.txt")
if err = copyFile(src, dst); err != nil {
return fmt.Errorf("file copy [src %s -> dst %s] failed %v", src, dst, err)
}
log.Debugf("CopyFile src %s -> dst %s succeeded", src, dst)
}
case "bridge":
default:
}
Expand Down
29 changes: 29 additions & 0 deletions docs/lab-examples/vr-sros.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
| | |
| ----------------------------- | ------------------------------------------------------------------------------------ |
| **Description** | A Nokia SR Linux connected back-to-back with Nokia SR OS |
| **Components** | [Nokia SR Linux][srl], [Nokia SR OS][sros] |
| **Resource requirements**[^1] | :fontawesome-solid-microchip: 2 <br/>:fontawesome-solid-memory: 5 GB |
| **Topology file** | [vr01.yml][topofile] |
| **Name** | vr01 |
| **Version information**[^2] | `containerlab:0.9.0`, `srlinux:20.6.3-145`, `vr-sros:20.10.R1`, `docker-ce:19.03.13` |

## Description
A lab consists of an SR Linux node connected with Nokia SR OS via a point-to-point ethernet link. Both nodes are also connected with their management interfaces to the `clab` docker network.

Nokia SR OS VM is launched as a container, using [vrnetlab integration](../manual/vrnetlab.md).

<div class="mxgraph" style="max-width:100%;border:1px solid transparent;margin:0 auto; display:block;" data-mxgraph="{&quot;page&quot;:0,&quot;zoom&quot;:1.5,&quot;highlight&quot;:&quot;#0000ff&quot;,&quot;nav&quot;:true,&quot;check-visible-state&quot;:true,&quot;resize&quot;:true,&quot;url&quot;:&quot;https://raw.githubusercontent.com/srl-wim/container-lab/diagrams/vr01.drawio&quot;}"></div>

## Use cases
This lab allows users to launch basic interoperability scenarios between Nokia SR Linux and Nokia SR OS network operating systems.

The lab directory [contains](https://github.com/srl-wim/container-lab/tree/master/lab-examples/vr01) files with essential configurations which can be used to jumpstart the interop demonstration.

[srl]: https://www.nokia.com/networks/products/service-router-linux-NOS/
[sros]: https://www.nokia.com/networks/products/service-router-operating-system/
[topofile]: https://github.com/srl-wim/container-lab/tree/master/lab-examples/vr01/vr01.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://cdn.jsdelivr.net/gh/hellt/drawio-js@main/embed2.js" async></script>
66 changes: 66 additions & 0 deletions docs/manual/kinds/vr-sros.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Nokia SR OS

[Nokia SR OS](https://www.juniper.net/documentation/us/en/software/vr-sros/vr-sros-deployment/topics/concept/understanding-vr-sros.html) virtualized router is identified with `vr-sros` 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.

vr-sros nodes launched with containerlab comes up pre-provisioned with SSH, SNMP, NETCONF and gNMI services enabled.

## Managing vr-sros nodes

!!!note
Containers with SR OS inside will take ~3min to fully boot.
You can monitor the progress with `watch docker ps` waiting till the status will change to `healthy`.

Nokia SR OS node launched with containerlab can be managed via the following interfaces:

=== "bash"
to connect to a `bash` shell of a running vr-sros container:
```bash
docker exec -it <container-name/id> bash
```
=== "CLI via SSH"
to connect to the SR OS CLI
```bash
ssh admin@<container-name/id>
```
=== "NETCONF"
NETCONF server is running over port 830
```bash
ssh root@<container-name> -p 830 -s netconf
```
=== "gNMI"
using the best in class [gnmic](https://gnmic.kmrd.dev) gNMI client as an example:
```bash
gnmic -a <container-name/node-mgmt-address> --insecure \
-u admin -p admin \
capabilities
```

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

## Interfaces mapping
vr-sros container uses the following mapping for its interfaces:

* `eth0` - management interface connected to the containerlab management network
* `eth1` - first data interface, mapped to first data port of SR OS line card
* `eth2+` - second and subsequent data interface

When containerlab launches vr-sros node, it will assign IPv4/6 address to the `eth0` interface. These addresses can be used to reach management plane of the router.

Data interfaces `eth1+` needs to be configured with IP addressing manually using CLI/management protocols.


## Features and options
### Node configuration
vr-sros nodes come up with a basic "blank" configuration where only the card/mda are provisioned, as well as the management interfaces such as Netconf, SNMP, gNMI.

### License
Path to a valid license must be provided for all vr-sros nodes with a [`license`](../nodes.md#license) directive.

### File mounts
When a user starts a lab, containerlab creates a node directory for storing [configuration artifacts](../conf-artifacts.md). For `vr-sros` kind containerlab creates `tftpboot` directory where the license file will be copied.

## Lab examples
The following labs feature vr-sros node:

- [SR Linux and vr-sros](../../lab-examples/vr-sros.md)
31 changes: 31 additions & 0 deletions docs/manual/vrnetlab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Containerlab focuses on containers, but there are way more routing products which are only shipped in a virtual machine packaging. Leaving containerlab users without ability to create topologies with both containerized and VM-based routing systems would have been a shame.

Keeping this requirement in mind from the very beginning, we added a kind [`bridge`](../lab-examples/ext-bridge.md), that allows to, ehm, bridge your containerized topology with other resources available via a bridged network. For example a VM based router.

<div class="mxgraph" style="max-width:100%;border:1px solid transparent;margin:0 auto; display:block;" data-mxgraph="{&quot;page&quot;:0,&quot;zoom&quot;:1.5,&quot;highlight&quot;:&quot;#0000ff&quot;,&quot;nav&quot;:true,&quot;check-visible-state&quot;:true,&quot;resize&quot;:true,&quot;url&quot;:&quot;https://raw.githubusercontent.com/srl-wim/container-lab/diagrams/vrnetlab.drawio&quot;}"></div>

<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/hellt/drawio-js@main/embed2.js" async></script>

Although this approach has many pros, it doesn't allow users to define the VM based nodes in the same topology file. But not anymore, with [`vrnetlab`](https://github.com/plajjan/vrnetlab) integration containerlab became capable of launching topologies with VM-based routers.

## Vrnetlab
Vrnetlab essentially allows to package a regular VM inside a container and makes it runnable and accessible as if it was a container image all way long.

To make this work, vrnetlab provides a set of scripts that will build the container image taking a user provided qcow file as an input.

<div class="mxgraph" style="max-width:100%;border:1px solid transparent;margin:0 auto; display:block;" data-mxgraph="{&quot;page&quot;:1,&quot;zoom&quot;:1.5,&quot;highlight&quot;:&quot;#0000ff&quot;,&quot;nav&quot;:true,&quot;check-visible-state&quot;:true,&quot;resize&quot;:true,&quot;url&quot;:&quot;https://raw.githubusercontent.com/srl-wim/container-lab/diagrams/vrnetlab.drawio&quot;}"></div>

!!!info
Although multiple vendors are supported in vrnetlab, to make these images work with container-based networking, we needed to fork the project and provide the necessary improvements.
Thus, the VM based products will appear in the supported list gradually.

### Supported VM products


#### Nokia SR OS
Nokia's virtualized SR OS, aka VSR/VSim has been added to containerlab supported kinds under the [vr-sros](kinds/vr-sros.md) kind. A [demo lab](../lab-examples/vr-sros.md) explains the way this kind can be used.

To build a container image with SR OS inside users should follow [the instructions](https://github.com/hellt/vrnetlab/tree/master/sros#building-the-docker-image) provided and using the code of the forked version of a vrnetlab project.

### Limitations
* LACP and BPDU packets can not be delivered to/from VM's running inside the containers when launched with containerlab.
9 changes: 9 additions & 0 deletions lab-examples/vr01/srl.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
enter candidate
set / interface ethernet-1/1
set / interface ethernet-1/1 admin-state enable
set / interface ethernet-1/1 subinterface 0
set / interface ethernet-1/1 subinterface 0 ipv4
set / interface ethernet-1/1 subinterface 0 ipv4 address 192.168.1.1/24
set / network-instance default
set / network-instance default interface ethernet-1/1.0
commit now
26 changes: 26 additions & 0 deletions lab-examples/vr01/sros.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
edit-config private
/configure port 1/1/c1 admin-state enable
/configure port 1/1/c1 connector breakout c1-100g
/configure port 1/1/c1/1 admin-state enable
/configure port 1/1/c1/1 description "port 1/1/c1/1"
/configure port 1/1/c1/1 ethernet mode hybrid
/configure port 1/1/c1/1 { ethernet lldp }
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge notification true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge port-id-subtype tx-if-name
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge receive true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge transmit true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge tx-tlvs port-desc true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge tx-tlvs sys-name true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge tx-tlvs sys-desc true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge tx-tlvs sys-cap true
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge tx-mgmt-address oob admin-state enable
/configure port 1/1/c1/1 ethernet lldp dest-mac nearest-bridge tx-mgmt-address system admin-state enable

/configure router "Base" interface "toSRL" { }
/configure router "Base" interface "toSRL" { admin-state enable }
/configure router "Base" interface "toSRL" { port 1/1/c1/1:0 }
/configure router "Base" interface "toSRL" { ipv4 }
/configure router "Base" interface "toSRL" { ipv4 primary }
/configure router "Base" interface "toSRL" { ipv4 primary address 192.168.1.2 }
/configure router "Base" interface "toSRL" { ipv4 primary prefix-length 24 }
commit
16 changes: 16 additions & 0 deletions lab-examples/vr01/vr01.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: vr01

topology:
nodes:
srl:
kind: srl
image: srlinux:20.6.3-145
license: license.key
sros:
kind: vr-sros
image: vr-sros:20.10.R1
type: sr-1
license: license-sros20.txt

links:
- endpoints: ["srl:e1-1", "sros:eth1"]
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ nav:
- srl - Nokia SR Linux: manual/kinds/srl.md
- crpd - Juniper cRPD: manual/kinds/crpd.md
- ceos - Arista cEOS: manual/kinds/ceos.md
- vr-sros - Nokia SR OS: manual/kinds/vr-sros.md
- Configuration artifacts: manual/conf-artifacts.md
- Network wiring concepts: manual/network.md
- Packet capture & Wireshark: manual/wireshark.md
- VM based routers integration: manual/vrnetlab.md
- Command reference:
- deploy: cmd/deploy.md
- destroy: cmd/destroy.md
Expand All @@ -31,6 +33,7 @@ nav:
- Nokia SR Linux and Juniper cRPD: lab-examples/srl-crpd.md
- External bridge capability: lab-examples/ext-bridge.md
- WAN topology: lab-examples/wan.md
- SR Linux and Nokia SR OS: lab-examples/vr-sros.md

site_author: Roman Dodin
site_description: >-
Expand Down

0 comments on commit 6ceb5f3

Please sign in to comment.