From f25605297ccde5e88f4a64c730fb15ef0456d1bc Mon Sep 17 00:00:00 2001 From: hellt Date: Tue, 19 Jan 2021 23:58:45 +0200 Subject: [PATCH 1/2] added vr-sros kind --- clab/config.go | 36 +++++++++++++++++++++ clab/file.go | 12 +++++++ docs/lab-examples/vr-sros.md | 29 +++++++++++++++++ docs/manual/kinds/vr-sros.md | 61 ++++++++++++++++++++++++++++++++++++ docs/manual/vrnetlab.md | 31 ++++++++++++++++++ lab-examples/vr01/srl.cfg | 9 ++++++ lab-examples/vr01/sros.cfg | 26 +++++++++++++++ lab-examples/vr01/vr01.yml | 16 ++++++++++ mkdocs.yml | 3 ++ 9 files changed, 223 insertions(+) create mode 100644 docs/lab-examples/vr-sros.md create mode 100644 docs/manual/kinds/vr-sros.md create mode 100644 docs/manual/vrnetlab.md create mode 100644 lab-examples/vr01/srl.cfg create mode 100644 lab-examples/vr01/sros.cfg create mode 100644 lab-examples/vr01/vr01.yml diff --git a/clab/config.go b/clab/config.go index 868feddfe..32f6038bb 100644 --- a/clab/config.go +++ b/clab/config.go @@ -23,6 +23,7 @@ const ( dockerNetIPv6Addr = "2001:172:20:20::/80" dockerNetMTU = "1450" srlDefaultType = "ixr6" + vrsrosDefaultType = "sr-1" ) // supported kinds @@ -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 "" } @@ -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) diff --git a/clab/file.go b/clab/file.go index a94870a1f..987fc09e9 100644 --- a/clab/file.go +++ b/clab/file.go @@ -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: } diff --git a/docs/lab-examples/vr-sros.md b/docs/lab-examples/vr-sros.md new file mode 100644 index 000000000..ad39f73e1 --- /dev/null +++ b/docs/lab-examples/vr-sros.md @@ -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
: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). + +
+ +## 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. + + \ No newline at end of file diff --git a/docs/manual/kinds/vr-sros.md b/docs/manual/kinds/vr-sros.md new file mode 100644 index 000000000..f5937ceb2 --- /dev/null +++ b/docs/manual/kinds/vr-sros.md @@ -0,0 +1,61 @@ +# 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 +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 bash + ``` +=== "CLI via SSH" + to connect to the SR OS CLI + ```bash + ssh admin@ + ``` +=== "NETCONF" + NETCONF server is running over port 830 + ```bash + ssh root@ -p 830 -s netconf + ``` +=== "gNMI" + using the best in class [gnmic](https://gnmic.kmrd.dev) gNMI client as an example: + ```bash + gnmic -a --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) \ No newline at end of file diff --git a/docs/manual/vrnetlab.md b/docs/manual/vrnetlab.md new file mode 100644 index 000000000..b5cf4e97c --- /dev/null +++ b/docs/manual/vrnetlab.md @@ -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. + +
+ + + +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. + +
+ +!!!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. diff --git a/lab-examples/vr01/srl.cfg b/lab-examples/vr01/srl.cfg new file mode 100644 index 000000000..427d224e2 --- /dev/null +++ b/lab-examples/vr01/srl.cfg @@ -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 \ No newline at end of file diff --git a/lab-examples/vr01/sros.cfg b/lab-examples/vr01/sros.cfg new file mode 100644 index 000000000..b320de730 --- /dev/null +++ b/lab-examples/vr01/sros.cfg @@ -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 \ No newline at end of file diff --git a/lab-examples/vr01/vr01.yml b/lab-examples/vr01/vr01.yml new file mode 100644 index 000000000..5b6214879 --- /dev/null +++ b/lab-examples/vr01/vr01.yml @@ -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"] diff --git a/mkdocs.yml b/mkdocs.yml index 7bb4bd377..b6439e2f5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 @@ -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: >- From 03917518b820a2c2f86a6a33900cb6743b66ba52 Mon Sep 17 00:00:00 2001 From: hellt Date: Wed, 20 Jan 2021 14:20:39 +0200 Subject: [PATCH 2/2] added note about boot time --- docs/manual/kinds/vr-sros.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/manual/kinds/vr-sros.md b/docs/manual/kinds/vr-sros.md index f5937ceb2..043a342b6 100644 --- a/docs/manual/kinds/vr-sros.md +++ b/docs/manual/kinds/vr-sros.md @@ -5,6 +5,11 @@ 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"